@grimoire-rs/indexer 0.4.4 → 0.5.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/CHANGELOG.md +190 -0
- package/NOTICE +30 -0
- package/README.md +76 -331
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +35 -4
- package/dist/cli/init.js.map +1 -1
- package/dist/config.d.ts +107 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +181 -36
- package/dist/config.js.map +1 -1
- package/dist/renderer/astro/components/CardLogo.d.ts +5 -0
- package/dist/renderer/astro/components/CardLogo.js +58 -0
- package/dist/renderer/astro/components/CardLogo.tsx +96 -0
- package/dist/renderer/astro/components/Catalog.d.ts +14 -1
- package/dist/renderer/astro/components/Catalog.js +467 -108
- package/dist/renderer/astro/components/Catalog.tsx +756 -349
- package/dist/renderer/astro/components/CommandBar.astro +66 -0
- package/dist/renderer/astro/components/CopyButton.d.ts +7 -0
- package/dist/renderer/astro/components/CopyButton.js +28 -0
- package/dist/renderer/astro/components/CopyButton.tsx +56 -0
- package/dist/renderer/astro/components/KindMark.d.ts +69 -0
- package/dist/renderer/astro/components/KindMark.js +66 -0
- package/dist/renderer/astro/components/KindMark.tsx +141 -0
- package/dist/renderer/astro/components/PackageCard.d.ts +18 -0
- package/dist/renderer/astro/components/PackageCard.js +50 -0
- package/dist/renderer/astro/components/PackageCard.tsx +273 -0
- package/dist/renderer/astro/components/PackageRow.d.ts +10 -0
- package/dist/renderer/astro/components/PackageRow.js +32 -0
- package/dist/renderer/astro/components/PackageRow.tsx +126 -0
- package/dist/renderer/astro/components/PickerMenu.astro +5 -14
- package/dist/renderer/astro/components/SiteFooter.astro +64 -0
- package/dist/renderer/astro/components/SiteHeader.astro +74 -0
- package/dist/renderer/astro/components/VersionMenu.astro +2 -2
- package/dist/renderer/astro/layouts/Base.astro +860 -206
- package/dist/renderer/astro/lib/base.d.ts +25 -0
- package/dist/renderer/astro/lib/base.js +23 -0
- package/dist/renderer/astro/lib/base.ts +27 -0
- package/dist/renderer/astro/lib/catalog.d.ts +24 -0
- package/dist/renderer/astro/lib/catalog.js +36 -0
- package/dist/renderer/astro/lib/catalog.ts +37 -0
- package/dist/renderer/astro/lib/commands.d.ts +58 -0
- package/dist/renderer/astro/lib/commands.js +86 -0
- package/dist/renderer/astro/lib/commands.ts +117 -0
- package/dist/renderer/astro/lib/keywordRail.d.ts +44 -0
- package/dist/renderer/astro/lib/keywordRail.js +99 -0
- package/dist/renderer/astro/lib/keywordRail.ts +110 -0
- package/dist/renderer/astro/pages/index.astro +40 -87
- package/dist/renderer/astro/pages/p/[...slug].astro +340 -195
- package/dist/renderer/astro/styles/tokens.css +40 -5
- package/dist/renderer/index.d.ts +58 -0
- package/dist/renderer/index.d.ts.map +1 -1
- package/dist/renderer/index.js +547 -5
- package/dist/renderer/index.js.map +1 -1
- package/dist/renderer/types.d.ts +9 -0
- package/dist/renderer/types.d.ts.map +1 -1
- package/package.json +9 -4
- package/templates/README.md +6 -0
- package/templates/gitignore +4 -1
- package/templates/theme/README.md +38 -0
- package/templates/tsconfig.json +47 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
// One copyable command, optionally with a picker that swaps which command it
|
|
3
|
+
// shows and a trailing action segment — the "install grim" and "add registry"
|
|
4
|
+
// boxes on the landing page, and the "add this package" box on every detail
|
|
5
|
+
// page. All three were the same twenty lines of markup written out three
|
|
6
|
+
// times; this is that markup, once.
|
|
7
|
+
//
|
|
8
|
+
// It is also the component an index's own page most wants: a setup guide that
|
|
9
|
+
// has to show `grim config registry add …` should draw the same bar the rest
|
|
10
|
+
// of the site draws, not a code block that looks like one.
|
|
11
|
+
//
|
|
12
|
+
// ---
|
|
13
|
+
// import CommandBar from "@grim/components/CommandBar.astro";
|
|
14
|
+
// import { installChoices } from "@grim/lib/commands";
|
|
15
|
+
// import { data } from "@grim/lib/data";
|
|
16
|
+
// ---
|
|
17
|
+
// <CommandBar choices={installChoices(data.config)} noun="install command"
|
|
18
|
+
// copyLabel="Copy the install command" pickerTitle="Platform"
|
|
19
|
+
// pickerLabel="Choose your platform" detect />
|
|
20
|
+
//
|
|
21
|
+
// The picker's behaviour — which glyph shows, what the field copies, what the
|
|
22
|
+
// toast calls it — is the generic `[data-os-switch]` handler in `Base.astro`.
|
|
23
|
+
// Nothing here ships a script.
|
|
24
|
+
import PickerMenu from "./PickerMenu.astro";
|
|
25
|
+
import CommandField from "./CommandField.astro";
|
|
26
|
+
import type { Choice } from "../lib/commands";
|
|
27
|
+
|
|
28
|
+
interface Props {
|
|
29
|
+
/**
|
|
30
|
+
* The commands this bar offers. One renders as a bare field; more than one
|
|
31
|
+
* adds the picker. **Empty is legal** — a bar can be nothing but its action
|
|
32
|
+
* segment, which is what the landing page shows when an index publishes a
|
|
33
|
+
* VS Code deep link but no copyable registry command.
|
|
34
|
+
*/
|
|
35
|
+
choices: Choice[];
|
|
36
|
+
/**
|
|
37
|
+
* What the copy toast calls this, minus the choice's own name: `"install
|
|
38
|
+
* command"` becomes `"Linux install command"`. The picker rewrites it per
|
|
39
|
+
* pick, so it has to read as a noun phrase after any choice name.
|
|
40
|
+
*/
|
|
41
|
+
noun: string;
|
|
42
|
+
/** Accessible name for the field, e.g. `"Copy the install command"`. */
|
|
43
|
+
copyLabel: string;
|
|
44
|
+
/** Picker tooltip, e.g. `"Platform"`. Unused with fewer than two choices. */
|
|
45
|
+
pickerTitle?: string;
|
|
46
|
+
/** Picker accessible name, e.g. `"Choose your platform"`. */
|
|
47
|
+
pickerLabel?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Preselect the visitor's own platform before first paint. Only meaningful
|
|
50
|
+
* where the choices ARE platforms — see the inline script in `index.astro`,
|
|
51
|
+
* which is what reads this.
|
|
52
|
+
*/
|
|
53
|
+
detect?: boolean;
|
|
54
|
+
}
|
|
55
|
+
const { choices, noun, copyLabel, pickerTitle = "", pickerLabel = "", detect = false } = Astro.props;
|
|
56
|
+
const first = choices[0];
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
<div class="cmd-bar" data-os-switch data-os-detect={detect ? "" : undefined} data-os-noun={noun}>
|
|
60
|
+
{choices.length > 1 && <PickerMenu choices={choices} title={pickerTitle} label={pickerLabel} />}
|
|
61
|
+
{first && <CommandField value={first.command} name={`${first.name} ${noun}`} label={copyLabel} />}
|
|
62
|
+
{/* The trailing segment: a VS Code deep link on all three shipped bars, and
|
|
63
|
+
whatever an index's own page puts there. A slot rather than props, so
|
|
64
|
+
adding a second kind of action needs no change here. */}
|
|
65
|
+
<slot name="action" />
|
|
66
|
+
</div>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function CopyButton({ command, variant, name, }: {
|
|
2
|
+
command: string;
|
|
3
|
+
variant?: "default" | "global";
|
|
4
|
+
/** What the copy toast calls this, e.g. `"global install command"`. */
|
|
5
|
+
name?: string;
|
|
6
|
+
}): import("preact").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=CopyButton.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// Copyright 2026 The Grimoire Authors
|
|
4
|
+
// The copy-to-clipboard button a card wears under its install commands.
|
|
5
|
+
// Split out of `Catalog.tsx` with the card itself, so an index replacing
|
|
6
|
+
// `PackageCard.tsx` still gets the toast behaviour rather than reimplementing
|
|
7
|
+
// the custom event `Base.astro` listens for.
|
|
8
|
+
import { useState } from "preact/hooks";
|
|
9
|
+
import { Check, FolderRoot, Globe } from "lucide-preact";
|
|
10
|
+
export function CopyButton({ command, variant = "default", name, }) {
|
|
11
|
+
const [copied, setCopied] = useState(false);
|
|
12
|
+
const copy = () => {
|
|
13
|
+
navigator.clipboard.writeText(command).then(() => {
|
|
14
|
+
setCopied(true);
|
|
15
|
+
// The toast lives in Base.astro's inline script, outside this island —
|
|
16
|
+
// an event is how a hydrated component reaches it without either side
|
|
17
|
+
// importing the other.
|
|
18
|
+
document.dispatchEvent(new CustomEvent("grimoire:copied", {
|
|
19
|
+
detail: { name, value: command },
|
|
20
|
+
}));
|
|
21
|
+
setTimeout(() => setCopied(false), 1500);
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
return (_jsx("button", { type: "button", class: copied ? "copy copied" : "copy", title: command, "aria-label": `Copy: ${command}`,
|
|
25
|
+
// Out of the Tab sequence: the card is the stop, and the same command
|
|
26
|
+
// is copyable from the detail page Enter opens.
|
|
27
|
+
tabIndex: -1, onClick: copy, children: copied ? (_jsx(Check, { size: 14 })) : variant === "global" ? (_jsx(Globe, { size: 14 })) : (_jsx(FolderRoot, { size: 14 })) }));
|
|
28
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright 2026 The Grimoire Authors
|
|
3
|
+
|
|
4
|
+
// The copy-to-clipboard button a card wears under its install commands.
|
|
5
|
+
// Split out of `Catalog.tsx` with the card itself, so an index replacing
|
|
6
|
+
// `PackageCard.tsx` still gets the toast behaviour rather than reimplementing
|
|
7
|
+
// the custom event `Base.astro` listens for.
|
|
8
|
+
import { useState } from "preact/hooks";
|
|
9
|
+
import { Check, FolderRoot, Globe } from "lucide-preact";
|
|
10
|
+
|
|
11
|
+
export function CopyButton({
|
|
12
|
+
command,
|
|
13
|
+
variant = "default",
|
|
14
|
+
name,
|
|
15
|
+
}: {
|
|
16
|
+
command: string;
|
|
17
|
+
variant?: "default" | "global";
|
|
18
|
+
/** What the copy toast calls this, e.g. `"global install command"`. */
|
|
19
|
+
name?: string;
|
|
20
|
+
}) {
|
|
21
|
+
const [copied, setCopied] = useState(false);
|
|
22
|
+
const copy = () => {
|
|
23
|
+
navigator.clipboard.writeText(command).then(() => {
|
|
24
|
+
setCopied(true);
|
|
25
|
+
// The toast lives in Base.astro's inline script, outside this island —
|
|
26
|
+
// an event is how a hydrated component reaches it without either side
|
|
27
|
+
// importing the other.
|
|
28
|
+
document.dispatchEvent(
|
|
29
|
+
new CustomEvent("grimoire:copied", {
|
|
30
|
+
detail: { name, value: command },
|
|
31
|
+
}),
|
|
32
|
+
);
|
|
33
|
+
setTimeout(() => setCopied(false), 1500);
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
return (
|
|
37
|
+
<button
|
|
38
|
+
type="button"
|
|
39
|
+
class={copied ? "copy copied" : "copy"}
|
|
40
|
+
title={command}
|
|
41
|
+
aria-label={`Copy: ${command}`}
|
|
42
|
+
// Out of the Tab sequence: the card is the stop, and the same command
|
|
43
|
+
// is copyable from the detail page Enter opens.
|
|
44
|
+
tabIndex={-1}
|
|
45
|
+
onClick={copy}
|
|
46
|
+
>
|
|
47
|
+
{copied ? (
|
|
48
|
+
<Check size={14} />
|
|
49
|
+
) : variant === "global" ? (
|
|
50
|
+
<Globe size={14} />
|
|
51
|
+
) : (
|
|
52
|
+
<FolderRoot size={14} />
|
|
53
|
+
)}
|
|
54
|
+
</button>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Artifact-kind marks, drawn from Microsoft's codicons.
|
|
3
|
+
*
|
|
4
|
+
* These are the *same glyphs* the Grimoire VS Code extension puts on its own
|
|
5
|
+
* cards — its `KIND_ICONS` maps skill/rule/agent/mcp/bundle to
|
|
6
|
+
* sparkle/law/agent/mcp/package. The two surfaces show one catalogue, so an
|
|
7
|
+
* artifact wearing a different mark in each was the thing to fix; a Lucide
|
|
8
|
+
* look-alike per kind is close, not the same.
|
|
9
|
+
*
|
|
10
|
+
* The extension consumes codicons as a webfont. This site ships no icon font
|
|
11
|
+
* and never will — a 120 KB TTF for five glyphs — so the path data is inlined
|
|
12
|
+
* here, exactly as `BrandMark` inlines `@mdi/js` paths. `@vscode/codicons` is
|
|
13
|
+
* a devDependency purely for provenance: it pins the version these came from,
|
|
14
|
+
* so re-extracting them later is reproducible rather than archaeology.
|
|
15
|
+
*
|
|
16
|
+
* ---------------------------------------------------------------------------
|
|
17
|
+
* Path data below is from @vscode/codicons 0.0.45, © Microsoft Corporation,
|
|
18
|
+
* licensed CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/).
|
|
19
|
+
* Source: https://github.com/microsoft/vscode-codicons
|
|
20
|
+
* Unmodified apart from extraction from the per-icon SVG files.
|
|
21
|
+
* ---------------------------------------------------------------------------
|
|
22
|
+
*/
|
|
23
|
+
interface GlyphPath {
|
|
24
|
+
d: string;
|
|
25
|
+
/** codicons draw a few marks as one path with holes. */
|
|
26
|
+
evenOdd?: boolean;
|
|
27
|
+
}
|
|
28
|
+
interface Glyph {
|
|
29
|
+
/**
|
|
30
|
+
* The glyph's own square box — `[x, y, side]` — used as the viewBox in
|
|
31
|
+
* place of the shared `0 0 16 16`.
|
|
32
|
+
*
|
|
33
|
+
* Codicons are drawn to sit correctly at 16px in a row of text, not to
|
|
34
|
+
* fill their grid, and how much of it each uses varies a lot: `sparkle`
|
|
35
|
+
* spans 12 units, `mcp` spans 16.3. Rendered at one `size` on the shared
|
|
36
|
+
* box that is a third again in apparent size between the smallest mark and
|
|
37
|
+
* the largest — which is exactly what a wall of cards looked like.
|
|
38
|
+
* Framing each glyph on its own bounding box makes them all render to the
|
|
39
|
+
* same square.
|
|
40
|
+
*
|
|
41
|
+
* Measured from the path coordinates, so a curve's control points can push
|
|
42
|
+
* the box slightly wider than the ink actually goes. That errs toward a
|
|
43
|
+
* hair of extra margin rather than a clipped glyph, which is the safe
|
|
44
|
+
* direction to be wrong in.
|
|
45
|
+
*/
|
|
46
|
+
box: [number, number, number];
|
|
47
|
+
paths: GlyphPath[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Which mark each artifact kind wears. An unknown kind gets none rather than
|
|
51
|
+
* a stand-in: a wrong glyph on a future kind reads as a claim, and no glyph
|
|
52
|
+
* reads as what it is.
|
|
53
|
+
*/
|
|
54
|
+
export declare const KIND_MARKS: Record<string, Glyph>;
|
|
55
|
+
/** What a retired artifact wears instead of its kind. */
|
|
56
|
+
export declare const DEPRECATED_MARK: Glyph;
|
|
57
|
+
/**
|
|
58
|
+
* One codicon, filled with `currentColor`, framed on its own box.
|
|
59
|
+
*
|
|
60
|
+
* Filled rather than stroked, which is what makes it usable at watermark
|
|
61
|
+
* scale: a stroked glyph's overlapping paths composite twice wherever they
|
|
62
|
+
* cross, so a translucent one comes out blotchy along its own joins.
|
|
63
|
+
*/
|
|
64
|
+
export declare function KindMark({ glyph, size, ...rest }: {
|
|
65
|
+
glyph: Glyph;
|
|
66
|
+
size?: number;
|
|
67
|
+
} & Record<string, unknown>): import("preact").JSX.Element;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=KindMark.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
const CODICONS = {
|
|
3
|
+
sparkle: {
|
|
4
|
+
box: [1.64, 1.64, 12.73],
|
|
5
|
+
paths: [
|
|
6
|
+
{ d: "M5.46524 9.82962C5.62134 9.94037 5.80806 9.99974 5.99946 9.99948C6.19151 10.0003 6.37897 9.94082 6.53546 9.82948C6.69223 9.71378 6.81095 9.55398 6.87646 9.37048L7.22346 8.30348C7.3077 8.05191 7.44906 7.82327 7.63646 7.63548C7.82305 7.44851 8.05078 7.30776 8.30146 7.22448L9.38746 6.87148C9.56665 6.80759 9.72173 6.68989 9.83146 6.53448C9.94145 6.37908 10.0005 6.19337 10.0005 6.00298C10.0005 5.81259 9.94145 5.62689 9.83146 5.47148C9.71293 5.30613 9.54426 5.18339 9.35046 5.12148L8.28146 4.77548C8.02989 4.69238 7.80123 4.55163 7.61371 4.36447C7.4262 4.1773 7.28503 3.9489 7.20146 3.69748L6.84846 2.61348C6.78519 2.43423 6.66777 2.27908 6.51246 2.16948C6.35557 2.06133 6.16951 2.00342 5.97896 2.00342C5.78841 2.00342 5.60235 2.06133 5.44546 2.16948C5.28572 2.28196 5.16594 2.44237 5.10346 2.62748L4.74846 3.71748C4.66476 3.96155 4.52691 4.18351 4.34524 4.36673C4.16358 4.54996 3.9428 4.6897 3.69946 4.77548L2.61546 5.12648C2.43437 5.19048 2.27775 5.30937 2.16743 5.4666C2.05712 5.62383 1.99859 5.81155 2.00003 6.00361C2.00146 6.19568 2.06277 6.38251 2.17541 6.53808C2.28806 6.69364 2.44643 6.81019 2.62846 6.87148L3.69546 7.21848C3.94767 7.30297 4.17673 7.44506 4.36446 7.63348C4.41519 7.6837 4.46262 7.73715 4.50646 7.79348C4.62481 7.94615 4.71614 8.11797 4.77646 8.30148L5.12846 9.38148C5.19143 9.56222 5.30914 9.71886 5.46524 9.82962ZM4.00746 6.26448L3.15246 5.99948L4.01646 5.71848C4.41071 5.58184 4.76826 5.35637 5.06146 5.05948C5.35281 4.76039 5.57294 4.39943 5.70546 4.00348L5.97046 3.14448L6.25046 4.00648C6.38349 4.40638 6.60809 4.76969 6.90636 5.06744C7.20463 5.36519 7.56833 5.58915 7.96846 5.72148L8.84846 5.99048L7.98746 6.27048C7.58707 6.40272 7.22321 6.62691 6.92505 6.92507C6.62689 7.22324 6.4027 7.58709 6.27046 7.98748L6.00546 8.84448L5.72646 7.98548C5.63026 7.69329 5.48483 7.41968 5.29646 7.17648C5.22699 7.08766 5.15254 7.00286 5.07346 6.92248C4.7738 6.62366 4.4089 6.39842 4.00746 6.26448ZM10.5344 13.8515C10.6703 13.9477 10.8328 13.9994 10.9994 13.9995C11.1642 13.998 11.3245 13.9456 11.4584 13.8495C11.5979 13.751 11.7029 13.611 11.7584 13.4495L12.0064 12.6875C12.0595 12.529 12.1485 12.385 12.2664 12.2665C12.3837 12.148 12.5277 12.0592 12.6864 12.0075L13.4584 11.7555C13.6161 11.701 13.7528 11.5985 13.8494 11.4625C13.9227 11.3595 13.9706 11.2405 13.9891 11.1154C14.0076 10.9903 13.9962 10.8626 13.9558 10.7428C13.9154 10.623 13.8472 10.5144 13.7567 10.4261C13.6662 10.3377 13.5561 10.272 13.4354 10.2345L12.6714 9.98548C12.5132 9.93291 12.3695 9.8443 12.2514 9.72663C12.1334 9.60896 12.0444 9.46547 11.9914 9.30748L11.7394 8.53348C11.685 8.37623 11.5825 8.24011 11.4464 8.14448C11.3443 8.07153 11.2266 8.02359 11.1026 8.00453C10.9787 7.98547 10.8519 7.99582 10.7327 8.03475C10.6135 8.07369 10.5051 8.1401 10.4163 8.22865C10.3274 8.31719 10.2607 8.42538 10.2214 8.54448L9.97435 9.30648C9.92207 9.46413 9.83452 9.60777 9.71835 9.72648C9.60382 9.84272 9.46428 9.9313 9.31035 9.98548L8.53435 10.2385C8.41689 10.2793 8.31057 10.347 8.22382 10.4361C8.13708 10.5252 8.0723 10.6333 8.03464 10.7518C7.99698 10.8704 7.98746 10.996 8.00686 11.1189C8.02625 11.2417 8.07401 11.3583 8.14635 11.4595C8.24456 11.5993 8.38462 11.7044 8.54635 11.7595L9.30935 12.0065C9.46821 12.0599 9.61262 12.1492 9.73135 12.2675C9.84958 12.3857 9.93801 12.5304 9.98935 12.6895L10.2424 13.4635C10.2971 13.6199 10.3992 13.7555 10.5344 13.8515ZM9.62035 11.0585L9.44235 10.9995L9.62635 10.9355C9.92811 10.8305 10.2018 10.6578 10.4264 10.4305C10.6528 10.2015 10.8238 9.92374 10.9264 9.61848L10.9844 9.44048L11.0434 9.62148C11.1453 9.92819 11.3175 10.2069 11.5461 10.4353C11.7748 10.6638 12.0536 10.8357 12.3604 10.9375L12.5554 11.0005L12.3754 11.0595C12.068 11.1617 11.7888 11.3344 11.5601 11.5637C11.3314 11.7931 11.1596 12.0728 11.0584 12.3805L10.9994 12.5615L10.9414 12.3805C10.84 12.0721 10.6676 11.7919 10.4382 11.5623C10.2088 11.3326 9.92863 11.1601 9.62035 11.0585Z" },
|
|
7
|
+
],
|
|
8
|
+
},
|
|
9
|
+
law: {
|
|
10
|
+
box: [1.61, 1.36, 13.78],
|
|
11
|
+
paths: [
|
|
12
|
+
{ d: "M10.039 7.30702L10.036 7.31402C10.036 7.31402 10.033 7.32202 10.032 7.32602C10.028 7.33602 10.024 7.34702 10.021 7.35702C10.02 7.36102 10.019 7.36502 10.018 7.36902C10.015 7.38002 10.012 7.39202 10.01 7.40402C10.009 7.40902 10.008 7.41502 10.007 7.42102C10.005 7.43102 10.004 7.44102 10.003 7.45102C10.001 7.46702 10.001 7.48302 10.001 7.50002C10.001 8.87802 11.123 10 12.501 10C13.879 10 15.001 8.87802 15.001 7.50002C15.001 7.48402 15.001 7.46702 14.999 7.45102C14.998 7.44102 14.996 7.43102 14.995 7.42102C14.995 7.41502 14.994 7.41002 14.992 7.40402C14.99 7.39202 14.987 7.38102 14.984 7.36902C14.983 7.36502 14.982 7.36102 14.981 7.35702C14.978 7.34602 14.974 7.33602 14.97 7.32602C14.969 7.32202 14.967 7.31802 14.966 7.31402L14.963 7.30702C14.963 7.30702 14.963 7.30502 14.963 7.30402L13.241 2.99902H14.002C14.278 2.99902 14.502 2.77502 14.502 2.49902C14.502 2.22302 14.278 1.99902 14.002 1.99902H2.99998C2.72398 1.99902 2.49998 2.22302 2.49998 2.49902C2.49998 2.77502 2.72398 2.99902 2.99998 2.99902H3.76098L2.03898 7.30402C2.03898 7.30402 2.03898 7.30602 2.03898 7.30702L2.03598 7.31402C2.03598 7.31402 2.03298 7.32202 2.03198 7.32602C2.02798 7.33602 2.02398 7.34702 2.02098 7.35702C2.01998 7.36102 2.01898 7.36502 2.01798 7.36902C2.01498 7.38002 2.01198 7.39202 2.00998 7.40402C2.00898 7.40902 2.00798 7.41502 2.00698 7.42102C2.00498 7.43102 2.00398 7.44102 2.00298 7.45102C2.00098 7.46702 2.00098 7.48302 2.00098 7.50002C2.00098 8.87802 3.12298 10 4.50098 10C5.87898 10 7.00098 8.87802 7.00098 7.50002C7.00098 7.48402 7.00098 7.46702 6.99898 7.45102C6.99798 7.44102 6.99598 7.43102 6.99498 7.42102C6.99498 7.41502 6.99398 7.41002 6.99198 7.40402C6.98998 7.39202 6.98698 7.38102 6.98398 7.36902C6.98298 7.36502 6.98198 7.36102 6.98098 7.35702C6.97798 7.34602 6.97398 7.33602 6.96998 7.32602C6.96898 7.32202 6.96698 7.31802 6.96598 7.31402L6.96298 7.30702C6.96298 7.30702 6.96298 7.30502 6.96298 7.30402L5.24098 2.99902H8.00198V10.999H5.50198C4.67498 10.999 4.00198 11.672 4.00198 12.499C4.00198 13.326 4.67498 13.999 5.50198 13.999H11.502C12.329 13.999 13.002 13.326 13.002 12.499C13.002 11.672 12.329 10.999 11.502 10.999H9.00198V3.00002H11.763L10.041 7.30502C10.041 7.30502 10.041 7.30702 10.041 7.30802L10.039 7.30702ZM4.49998 3.84602L5.76198 7.00002H3.23898L4.49998 3.84602ZM4.49998 9.00002C3.84798 9.00002 3.29198 8.58202 3.08598 8.00002H5.91398C5.70698 8.58202 5.15198 9.00002 4.49998 9.00002ZM12 12.5C12 12.775 11.776 13 11.5 13H5.49998C5.22398 13 4.99998 12.775 4.99998 12.5C4.99998 12.225 5.22398 12 5.49998 12H11.5C11.776 12 12 12.225 12 12.5ZM12.5 9.00002C11.848 9.00002 11.292 8.58202 11.086 8.00002H13.914C13.707 8.58202 13.152 9.00002 12.5 9.00002ZM11.238 7.00002L12.5 3.84602L13.762 7.00002H11.239H11.238Z" },
|
|
13
|
+
],
|
|
14
|
+
},
|
|
15
|
+
agent: {
|
|
16
|
+
box: [-0.33, -0.33, 16.67],
|
|
17
|
+
paths: [
|
|
18
|
+
{ d: "M10.887 15H8.49998C8.22398 15 7.99998 14.776 7.99998 14.5C7.99998 14.224 8.22398 14 8.49998 14H10.887C11.243 14 11.575 13.809 11.752 13.5L14.64 8.5C14.819 8.191 14.819 7.809 14.64 7.5L11.705 2.416C11.557 2.16 11.28 2 10.983 2C10.616 2 10.296 2.236 10.188 2.587L6.76598 13.707C6.52898 14.48 5.82498 15 5.01598 15C4.36398 15 3.75498 14.649 3.42898 14.084L0.494984 9C0.137984 8.383 0.137984 7.617 0.494984 7L3.38198 2C3.73698 1.383 4.40098 1 5.11298 1H7.49998C7.77598 1 7.99998 1.224 7.99998 1.5C7.99998 1.776 7.77598 2 7.49998 2H5.11298C4.75698 2 4.42498 2.191 4.24798 2.5L1.35998 7.5C1.18098 7.809 1.18098 8.191 1.35998 8.5L4.29498 13.584C4.44298 13.841 4.71998 14 5.01698 14C5.38398 14 5.70398 13.764 5.81198 13.412L9.23398 2.293C9.47098 1.52 10.174 1 10.984 1C11.636 1 12.245 1.351 12.571 1.916L15.506 7C15.863 7.617 15.863 8.383 15.506 9.001L12.619 14C12.264 14.617 11.599 15 10.887 15Z" },
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
mcp: {
|
|
22
|
+
box: [-0.54, -0.76, 17.31],
|
|
23
|
+
paths: [
|
|
24
|
+
{ d: "M14.5565 7.87462C14.5385 7.89312 14.5205 7.91112 14.5025 7.92862L8.69849 13.6201C8.62599 13.6906 8.62449 13.8061 8.69499 13.8786C8.69599 13.8801 8.69749 13.8811 8.69849 13.8821L9.89049 15.0516C10.1075 15.2626 10.1125 15.6101 9.90149 15.8276C9.89799 15.8311 9.89449 15.8351 9.89049 15.8386C9.66699 16.0556 9.31199 16.0556 9.08849 15.8386L7.89649 14.6701C7.38949 14.1776 7.37799 13.3671 7.87049 12.8601C7.87899 12.8511 7.88749 12.8426 7.89649 12.8341L13.7005 7.14212C14.352 6.50762 14.3665 5.46512 13.732 4.81362C13.7215 4.80312 13.711 4.79262 13.7005 4.78212L13.667 4.74962C12.998 4.09862 11.9325 4.09762 11.2625 4.74762L6.48099 9.43712L6.47949 9.43862L6.41399 9.50312C6.19049 9.72062 5.83449 9.72062 5.61149 9.50312C5.39449 9.29162 5.38949 8.94462 5.60049 8.72712C5.60399 8.72362 5.60749 8.71962 5.61149 8.71612L10.46 3.96062C11.1105 3.32512 11.123 2.28262 10.4875 1.63212C10.478 1.62212 10.468 1.61262 10.458 1.60262C9.78799 0.950619 8.72099 0.950619 8.05149 1.60262L1.63499 7.89512C1.41149 8.11212 1.05649 8.11212 0.832987 7.89512C0.615987 7.68412 0.610987 7.33662 0.821987 7.11912C0.825487 7.11562 0.828987 7.11162 0.832987 7.10812L7.24999 0.815119C8.36599 -0.271381 10.1445 -0.271381 11.2605 0.815119C11.8905 1.42762 12.189 2.30512 12.063 3.17512C12.9435 3.05012 13.8325 3.34062 14.469 3.96162L14.5025 3.99512C15.5885 5.05162 15.613 6.78812 14.5565 7.87412V7.87462ZM12.8655 6.32212C13.083 6.11062 13.0875 5.76362 12.8765 5.54612C12.873 5.54262 12.8695 5.53862 12.8655 5.53512C12.642 5.31762 12.286 5.31762 12.063 5.53512L7.31699 10.1896C6.64699 10.8416 5.57999 10.8416 4.91049 10.1896C4.25899 9.55512 4.24449 8.51262 4.87899 7.86112C4.88949 7.85062 4.89999 7.84012 4.91049 7.82962L9.65699 3.17512C9.87399 2.96362 9.87899 2.61662 9.66799 2.39912C9.66449 2.39562 9.66099 2.39162 9.65699 2.38812C9.43349 2.17062 9.07749 2.17062 8.85449 2.38812L4.10849 7.04262C3.02249 8.09912 2.99799 9.83562 4.05449 10.9216C4.07249 10.9401 4.09049 10.9581 4.10849 10.9756C5.22499 12.0616 7.00299 12.0616 8.11899 10.9756L12.8655 6.32112V6.32212Z", evenOdd: true },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
package: {
|
|
28
|
+
box: [0.58, 0.58, 14.84],
|
|
29
|
+
paths: [
|
|
30
|
+
{ d: "M6 8.63998C5.934 8.63998 5.867 8.62698 5.803 8.59898L3.303 7.52898C3.049 7.42098 2.931 7.12698 3.04 6.87298C3.149 6.61998 3.444 6.50098 3.696 6.60998L6.196 7.67998C6.45 7.78798 6.568 8.08198 6.459 8.33598C6.378 8.52498 6.193 8.63898 6 8.63898V8.63998Z" },
|
|
31
|
+
{ d: "M4.80397 10.17C4.86797 10.197 4.93397 10.21 4.99997 10.21C5.19397 10.21 5.37897 10.096 5.45997 9.90599C5.56797 9.65199 5.44997 9.35799 5.19597 9.24999L3.69597 8.60999C3.44397 8.50199 3.14797 8.61999 3.03997 8.87399C2.93197 9.12799 3.04997 9.42199 3.30397 9.52999L4.80397 10.17Z" },
|
|
32
|
+
{ d: "M14.039 3.28598L9.077 1.37798C8.384 1.11098 7.616 1.11098 6.923 1.37798L1.962 3.28598C1.383 3.50898 1 4.06498 1 4.68598V11.312C1 11.933 1.382 12.489 1.962 12.712L6.923 14.62C7.616 14.887 8.384 14.887 9.077 14.62L14.039 12.712C14.618 12.489 15 11.933 15 11.312V4.68598C15 4.06498 14.618 3.50898 14.039 3.28598ZM7.5 13.757C7.426 13.738 7.354 13.715 7.282 13.687L2.32 11.779C2.127 11.705 2 11.519 2 11.312V4.97098L7.5 7.32798V13.757ZM2.564 4.12598L7.282 2.31098C7.744 2.13298 8.256 2.13298 8.718 2.31098L13.436 4.12598L8 6.45598L2.564 4.12598ZM14 11.313C14 11.52 13.873 11.705 13.68 11.78L8.718 13.688C8.646 13.716 8.574 13.739 8.5 13.758V7.32998L14 4.97298V11.313Z", evenOdd: true },
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
warning: {
|
|
36
|
+
box: [0.5, 0.58, 14.84],
|
|
37
|
+
paths: [
|
|
38
|
+
{ d: "M14.831 11.965L9.206 1.714C8.965 1.274 8.503 1 8 1C7.497 1 7.035 1.274 6.794 1.714L1.169 11.965C1.059 12.167 1 12.395 1 12.625C1 13.383 1.617 14 2.375 14H13.625C14.383 14 15 13.383 15 12.625C15 12.395 14.941 12.167 14.831 11.965ZM13.625 13H2.375C2.168 13 2 12.832 2 12.625C2 12.561 2.016 12.5 2.046 12.445L7.671 2.195C7.736 2.075 7.863 2 8 2C8.137 2 8.264 2.075 8.329 2.195L13.954 12.445C13.984 12.501 14 12.561 14 12.625C14 12.832 13.832 13 13.625 13ZM8.75 11.25C8.75 11.664 8.414 12 8 12C7.586 12 7.25 11.664 7.25 11.25C7.25 10.836 7.586 10.5 8 10.5C8.414 10.5 8.75 10.836 8.75 11.25ZM7.5 9V5.5C7.5 5.224 7.724 5 8 5C8.276 5 8.5 5.224 8.5 5.5V9C8.5 9.276 8.276 9.5 8 9.5C7.724 9.5 7.5 9.276 7.5 9Z" },
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Which mark each artifact kind wears. An unknown kind gets none rather than
|
|
44
|
+
* a stand-in: a wrong glyph on a future kind reads as a claim, and no glyph
|
|
45
|
+
* reads as what it is.
|
|
46
|
+
*/
|
|
47
|
+
export const KIND_MARKS = {
|
|
48
|
+
skill: CODICONS.sparkle,
|
|
49
|
+
rule: CODICONS.law,
|
|
50
|
+
agent: CODICONS.agent,
|
|
51
|
+
mcp: CODICONS.mcp,
|
|
52
|
+
bundle: CODICONS.package,
|
|
53
|
+
};
|
|
54
|
+
/** What a retired artifact wears instead of its kind. */
|
|
55
|
+
export const DEPRECATED_MARK = CODICONS.warning;
|
|
56
|
+
/**
|
|
57
|
+
* One codicon, filled with `currentColor`, framed on its own box.
|
|
58
|
+
*
|
|
59
|
+
* Filled rather than stroked, which is what makes it usable at watermark
|
|
60
|
+
* scale: a stroked glyph's overlapping paths composite twice wherever they
|
|
61
|
+
* cross, so a translucent one comes out blotchy along its own joins.
|
|
62
|
+
*/
|
|
63
|
+
export function KindMark({ glyph, size = 16, ...rest }) {
|
|
64
|
+
const [x, y, side] = glyph.box;
|
|
65
|
+
return (_jsx("svg", { viewBox: `${x} ${y} ${side} ${side}`, width: size, height: size, ...rest, children: glyph.paths.map((p) => (_jsx("path", { d: p.d, fill: "currentColor", "fill-rule": p.evenOdd ? "evenodd" : undefined, "clip-rule": p.evenOdd ? "evenodd" : undefined }, p.d))) }));
|
|
66
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright 2026 The Grimoire Authors
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Artifact-kind marks, drawn from Microsoft's codicons.
|
|
6
|
+
*
|
|
7
|
+
* These are the *same glyphs* the Grimoire VS Code extension puts on its own
|
|
8
|
+
* cards — its `KIND_ICONS` maps skill/rule/agent/mcp/bundle to
|
|
9
|
+
* sparkle/law/agent/mcp/package. The two surfaces show one catalogue, so an
|
|
10
|
+
* artifact wearing a different mark in each was the thing to fix; a Lucide
|
|
11
|
+
* look-alike per kind is close, not the same.
|
|
12
|
+
*
|
|
13
|
+
* The extension consumes codicons as a webfont. This site ships no icon font
|
|
14
|
+
* and never will — a 120 KB TTF for five glyphs — so the path data is inlined
|
|
15
|
+
* here, exactly as `BrandMark` inlines `@mdi/js` paths. `@vscode/codicons` is
|
|
16
|
+
* a devDependency purely for provenance: it pins the version these came from,
|
|
17
|
+
* so re-extracting them later is reproducible rather than archaeology.
|
|
18
|
+
*
|
|
19
|
+
* ---------------------------------------------------------------------------
|
|
20
|
+
* Path data below is from @vscode/codicons 0.0.45, © Microsoft Corporation,
|
|
21
|
+
* licensed CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/).
|
|
22
|
+
* Source: https://github.com/microsoft/vscode-codicons
|
|
23
|
+
* Unmodified apart from extraction from the per-icon SVG files.
|
|
24
|
+
* ---------------------------------------------------------------------------
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
interface GlyphPath {
|
|
28
|
+
d: string;
|
|
29
|
+
/** codicons draw a few marks as one path with holes. */
|
|
30
|
+
evenOdd?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
interface Glyph {
|
|
34
|
+
/**
|
|
35
|
+
* The glyph's own square box — `[x, y, side]` — used as the viewBox in
|
|
36
|
+
* place of the shared `0 0 16 16`.
|
|
37
|
+
*
|
|
38
|
+
* Codicons are drawn to sit correctly at 16px in a row of text, not to
|
|
39
|
+
* fill their grid, and how much of it each uses varies a lot: `sparkle`
|
|
40
|
+
* spans 12 units, `mcp` spans 16.3. Rendered at one `size` on the shared
|
|
41
|
+
* box that is a third again in apparent size between the smallest mark and
|
|
42
|
+
* the largest — which is exactly what a wall of cards looked like.
|
|
43
|
+
* Framing each glyph on its own bounding box makes them all render to the
|
|
44
|
+
* same square.
|
|
45
|
+
*
|
|
46
|
+
* Measured from the path coordinates, so a curve's control points can push
|
|
47
|
+
* the box slightly wider than the ink actually goes. That errs toward a
|
|
48
|
+
* hair of extra margin rather than a clipped glyph, which is the safe
|
|
49
|
+
* direction to be wrong in.
|
|
50
|
+
*/
|
|
51
|
+
box: [number, number, number];
|
|
52
|
+
paths: GlyphPath[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const CODICONS: Record<string, Glyph> = {
|
|
56
|
+
sparkle: {
|
|
57
|
+
box: [1.64, 1.64, 12.73],
|
|
58
|
+
paths: [
|
|
59
|
+
{ d: "M5.46524 9.82962C5.62134 9.94037 5.80806 9.99974 5.99946 9.99948C6.19151 10.0003 6.37897 9.94082 6.53546 9.82948C6.69223 9.71378 6.81095 9.55398 6.87646 9.37048L7.22346 8.30348C7.3077 8.05191 7.44906 7.82327 7.63646 7.63548C7.82305 7.44851 8.05078 7.30776 8.30146 7.22448L9.38746 6.87148C9.56665 6.80759 9.72173 6.68989 9.83146 6.53448C9.94145 6.37908 10.0005 6.19337 10.0005 6.00298C10.0005 5.81259 9.94145 5.62689 9.83146 5.47148C9.71293 5.30613 9.54426 5.18339 9.35046 5.12148L8.28146 4.77548C8.02989 4.69238 7.80123 4.55163 7.61371 4.36447C7.4262 4.1773 7.28503 3.9489 7.20146 3.69748L6.84846 2.61348C6.78519 2.43423 6.66777 2.27908 6.51246 2.16948C6.35557 2.06133 6.16951 2.00342 5.97896 2.00342C5.78841 2.00342 5.60235 2.06133 5.44546 2.16948C5.28572 2.28196 5.16594 2.44237 5.10346 2.62748L4.74846 3.71748C4.66476 3.96155 4.52691 4.18351 4.34524 4.36673C4.16358 4.54996 3.9428 4.6897 3.69946 4.77548L2.61546 5.12648C2.43437 5.19048 2.27775 5.30937 2.16743 5.4666C2.05712 5.62383 1.99859 5.81155 2.00003 6.00361C2.00146 6.19568 2.06277 6.38251 2.17541 6.53808C2.28806 6.69364 2.44643 6.81019 2.62846 6.87148L3.69546 7.21848C3.94767 7.30297 4.17673 7.44506 4.36446 7.63348C4.41519 7.6837 4.46262 7.73715 4.50646 7.79348C4.62481 7.94615 4.71614 8.11797 4.77646 8.30148L5.12846 9.38148C5.19143 9.56222 5.30914 9.71886 5.46524 9.82962ZM4.00746 6.26448L3.15246 5.99948L4.01646 5.71848C4.41071 5.58184 4.76826 5.35637 5.06146 5.05948C5.35281 4.76039 5.57294 4.39943 5.70546 4.00348L5.97046 3.14448L6.25046 4.00648C6.38349 4.40638 6.60809 4.76969 6.90636 5.06744C7.20463 5.36519 7.56833 5.58915 7.96846 5.72148L8.84846 5.99048L7.98746 6.27048C7.58707 6.40272 7.22321 6.62691 6.92505 6.92507C6.62689 7.22324 6.4027 7.58709 6.27046 7.98748L6.00546 8.84448L5.72646 7.98548C5.63026 7.69329 5.48483 7.41968 5.29646 7.17648C5.22699 7.08766 5.15254 7.00286 5.07346 6.92248C4.7738 6.62366 4.4089 6.39842 4.00746 6.26448ZM10.5344 13.8515C10.6703 13.9477 10.8328 13.9994 10.9994 13.9995C11.1642 13.998 11.3245 13.9456 11.4584 13.8495C11.5979 13.751 11.7029 13.611 11.7584 13.4495L12.0064 12.6875C12.0595 12.529 12.1485 12.385 12.2664 12.2665C12.3837 12.148 12.5277 12.0592 12.6864 12.0075L13.4584 11.7555C13.6161 11.701 13.7528 11.5985 13.8494 11.4625C13.9227 11.3595 13.9706 11.2405 13.9891 11.1154C14.0076 10.9903 13.9962 10.8626 13.9558 10.7428C13.9154 10.623 13.8472 10.5144 13.7567 10.4261C13.6662 10.3377 13.5561 10.272 13.4354 10.2345L12.6714 9.98548C12.5132 9.93291 12.3695 9.8443 12.2514 9.72663C12.1334 9.60896 12.0444 9.46547 11.9914 9.30748L11.7394 8.53348C11.685 8.37623 11.5825 8.24011 11.4464 8.14448C11.3443 8.07153 11.2266 8.02359 11.1026 8.00453C10.9787 7.98547 10.8519 7.99582 10.7327 8.03475C10.6135 8.07369 10.5051 8.1401 10.4163 8.22865C10.3274 8.31719 10.2607 8.42538 10.2214 8.54448L9.97435 9.30648C9.92207 9.46413 9.83452 9.60777 9.71835 9.72648C9.60382 9.84272 9.46428 9.9313 9.31035 9.98548L8.53435 10.2385C8.41689 10.2793 8.31057 10.347 8.22382 10.4361C8.13708 10.5252 8.0723 10.6333 8.03464 10.7518C7.99698 10.8704 7.98746 10.996 8.00686 11.1189C8.02625 11.2417 8.07401 11.3583 8.14635 11.4595C8.24456 11.5993 8.38462 11.7044 8.54635 11.7595L9.30935 12.0065C9.46821 12.0599 9.61262 12.1492 9.73135 12.2675C9.84958 12.3857 9.93801 12.5304 9.98935 12.6895L10.2424 13.4635C10.2971 13.6199 10.3992 13.7555 10.5344 13.8515ZM9.62035 11.0585L9.44235 10.9995L9.62635 10.9355C9.92811 10.8305 10.2018 10.6578 10.4264 10.4305C10.6528 10.2015 10.8238 9.92374 10.9264 9.61848L10.9844 9.44048L11.0434 9.62148C11.1453 9.92819 11.3175 10.2069 11.5461 10.4353C11.7748 10.6638 12.0536 10.8357 12.3604 10.9375L12.5554 11.0005L12.3754 11.0595C12.068 11.1617 11.7888 11.3344 11.5601 11.5637C11.3314 11.7931 11.1596 12.0728 11.0584 12.3805L10.9994 12.5615L10.9414 12.3805C10.84 12.0721 10.6676 11.7919 10.4382 11.5623C10.2088 11.3326 9.92863 11.1601 9.62035 11.0585Z" },
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
law: {
|
|
63
|
+
box: [1.61, 1.36, 13.78],
|
|
64
|
+
paths: [
|
|
65
|
+
{ d: "M10.039 7.30702L10.036 7.31402C10.036 7.31402 10.033 7.32202 10.032 7.32602C10.028 7.33602 10.024 7.34702 10.021 7.35702C10.02 7.36102 10.019 7.36502 10.018 7.36902C10.015 7.38002 10.012 7.39202 10.01 7.40402C10.009 7.40902 10.008 7.41502 10.007 7.42102C10.005 7.43102 10.004 7.44102 10.003 7.45102C10.001 7.46702 10.001 7.48302 10.001 7.50002C10.001 8.87802 11.123 10 12.501 10C13.879 10 15.001 8.87802 15.001 7.50002C15.001 7.48402 15.001 7.46702 14.999 7.45102C14.998 7.44102 14.996 7.43102 14.995 7.42102C14.995 7.41502 14.994 7.41002 14.992 7.40402C14.99 7.39202 14.987 7.38102 14.984 7.36902C14.983 7.36502 14.982 7.36102 14.981 7.35702C14.978 7.34602 14.974 7.33602 14.97 7.32602C14.969 7.32202 14.967 7.31802 14.966 7.31402L14.963 7.30702C14.963 7.30702 14.963 7.30502 14.963 7.30402L13.241 2.99902H14.002C14.278 2.99902 14.502 2.77502 14.502 2.49902C14.502 2.22302 14.278 1.99902 14.002 1.99902H2.99998C2.72398 1.99902 2.49998 2.22302 2.49998 2.49902C2.49998 2.77502 2.72398 2.99902 2.99998 2.99902H3.76098L2.03898 7.30402C2.03898 7.30402 2.03898 7.30602 2.03898 7.30702L2.03598 7.31402C2.03598 7.31402 2.03298 7.32202 2.03198 7.32602C2.02798 7.33602 2.02398 7.34702 2.02098 7.35702C2.01998 7.36102 2.01898 7.36502 2.01798 7.36902C2.01498 7.38002 2.01198 7.39202 2.00998 7.40402C2.00898 7.40902 2.00798 7.41502 2.00698 7.42102C2.00498 7.43102 2.00398 7.44102 2.00298 7.45102C2.00098 7.46702 2.00098 7.48302 2.00098 7.50002C2.00098 8.87802 3.12298 10 4.50098 10C5.87898 10 7.00098 8.87802 7.00098 7.50002C7.00098 7.48402 7.00098 7.46702 6.99898 7.45102C6.99798 7.44102 6.99598 7.43102 6.99498 7.42102C6.99498 7.41502 6.99398 7.41002 6.99198 7.40402C6.98998 7.39202 6.98698 7.38102 6.98398 7.36902C6.98298 7.36502 6.98198 7.36102 6.98098 7.35702C6.97798 7.34602 6.97398 7.33602 6.96998 7.32602C6.96898 7.32202 6.96698 7.31802 6.96598 7.31402L6.96298 7.30702C6.96298 7.30702 6.96298 7.30502 6.96298 7.30402L5.24098 2.99902H8.00198V10.999H5.50198C4.67498 10.999 4.00198 11.672 4.00198 12.499C4.00198 13.326 4.67498 13.999 5.50198 13.999H11.502C12.329 13.999 13.002 13.326 13.002 12.499C13.002 11.672 12.329 10.999 11.502 10.999H9.00198V3.00002H11.763L10.041 7.30502C10.041 7.30502 10.041 7.30702 10.041 7.30802L10.039 7.30702ZM4.49998 3.84602L5.76198 7.00002H3.23898L4.49998 3.84602ZM4.49998 9.00002C3.84798 9.00002 3.29198 8.58202 3.08598 8.00002H5.91398C5.70698 8.58202 5.15198 9.00002 4.49998 9.00002ZM12 12.5C12 12.775 11.776 13 11.5 13H5.49998C5.22398 13 4.99998 12.775 4.99998 12.5C4.99998 12.225 5.22398 12 5.49998 12H11.5C11.776 12 12 12.225 12 12.5ZM12.5 9.00002C11.848 9.00002 11.292 8.58202 11.086 8.00002H13.914C13.707 8.58202 13.152 9.00002 12.5 9.00002ZM11.238 7.00002L12.5 3.84602L13.762 7.00002H11.239H11.238Z" },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
agent: {
|
|
69
|
+
box: [-0.33, -0.33, 16.67],
|
|
70
|
+
paths: [
|
|
71
|
+
{ d: "M10.887 15H8.49998C8.22398 15 7.99998 14.776 7.99998 14.5C7.99998 14.224 8.22398 14 8.49998 14H10.887C11.243 14 11.575 13.809 11.752 13.5L14.64 8.5C14.819 8.191 14.819 7.809 14.64 7.5L11.705 2.416C11.557 2.16 11.28 2 10.983 2C10.616 2 10.296 2.236 10.188 2.587L6.76598 13.707C6.52898 14.48 5.82498 15 5.01598 15C4.36398 15 3.75498 14.649 3.42898 14.084L0.494984 9C0.137984 8.383 0.137984 7.617 0.494984 7L3.38198 2C3.73698 1.383 4.40098 1 5.11298 1H7.49998C7.77598 1 7.99998 1.224 7.99998 1.5C7.99998 1.776 7.77598 2 7.49998 2H5.11298C4.75698 2 4.42498 2.191 4.24798 2.5L1.35998 7.5C1.18098 7.809 1.18098 8.191 1.35998 8.5L4.29498 13.584C4.44298 13.841 4.71998 14 5.01698 14C5.38398 14 5.70398 13.764 5.81198 13.412L9.23398 2.293C9.47098 1.52 10.174 1 10.984 1C11.636 1 12.245 1.351 12.571 1.916L15.506 7C15.863 7.617 15.863 8.383 15.506 9.001L12.619 14C12.264 14.617 11.599 15 10.887 15Z" },
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
mcp: {
|
|
75
|
+
box: [-0.54, -0.76, 17.31],
|
|
76
|
+
paths: [
|
|
77
|
+
{ d: "M14.5565 7.87462C14.5385 7.89312 14.5205 7.91112 14.5025 7.92862L8.69849 13.6201C8.62599 13.6906 8.62449 13.8061 8.69499 13.8786C8.69599 13.8801 8.69749 13.8811 8.69849 13.8821L9.89049 15.0516C10.1075 15.2626 10.1125 15.6101 9.90149 15.8276C9.89799 15.8311 9.89449 15.8351 9.89049 15.8386C9.66699 16.0556 9.31199 16.0556 9.08849 15.8386L7.89649 14.6701C7.38949 14.1776 7.37799 13.3671 7.87049 12.8601C7.87899 12.8511 7.88749 12.8426 7.89649 12.8341L13.7005 7.14212C14.352 6.50762 14.3665 5.46512 13.732 4.81362C13.7215 4.80312 13.711 4.79262 13.7005 4.78212L13.667 4.74962C12.998 4.09862 11.9325 4.09762 11.2625 4.74762L6.48099 9.43712L6.47949 9.43862L6.41399 9.50312C6.19049 9.72062 5.83449 9.72062 5.61149 9.50312C5.39449 9.29162 5.38949 8.94462 5.60049 8.72712C5.60399 8.72362 5.60749 8.71962 5.61149 8.71612L10.46 3.96062C11.1105 3.32512 11.123 2.28262 10.4875 1.63212C10.478 1.62212 10.468 1.61262 10.458 1.60262C9.78799 0.950619 8.72099 0.950619 8.05149 1.60262L1.63499 7.89512C1.41149 8.11212 1.05649 8.11212 0.832987 7.89512C0.615987 7.68412 0.610987 7.33662 0.821987 7.11912C0.825487 7.11562 0.828987 7.11162 0.832987 7.10812L7.24999 0.815119C8.36599 -0.271381 10.1445 -0.271381 11.2605 0.815119C11.8905 1.42762 12.189 2.30512 12.063 3.17512C12.9435 3.05012 13.8325 3.34062 14.469 3.96162L14.5025 3.99512C15.5885 5.05162 15.613 6.78812 14.5565 7.87412V7.87462ZM12.8655 6.32212C13.083 6.11062 13.0875 5.76362 12.8765 5.54612C12.873 5.54262 12.8695 5.53862 12.8655 5.53512C12.642 5.31762 12.286 5.31762 12.063 5.53512L7.31699 10.1896C6.64699 10.8416 5.57999 10.8416 4.91049 10.1896C4.25899 9.55512 4.24449 8.51262 4.87899 7.86112C4.88949 7.85062 4.89999 7.84012 4.91049 7.82962L9.65699 3.17512C9.87399 2.96362 9.87899 2.61662 9.66799 2.39912C9.66449 2.39562 9.66099 2.39162 9.65699 2.38812C9.43349 2.17062 9.07749 2.17062 8.85449 2.38812L4.10849 7.04262C3.02249 8.09912 2.99799 9.83562 4.05449 10.9216C4.07249 10.9401 4.09049 10.9581 4.10849 10.9756C5.22499 12.0616 7.00299 12.0616 8.11899 10.9756L12.8655 6.32112V6.32212Z", evenOdd: true },
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
|
+
package: {
|
|
81
|
+
box: [0.58, 0.58, 14.84],
|
|
82
|
+
paths: [
|
|
83
|
+
{ d: "M6 8.63998C5.934 8.63998 5.867 8.62698 5.803 8.59898L3.303 7.52898C3.049 7.42098 2.931 7.12698 3.04 6.87298C3.149 6.61998 3.444 6.50098 3.696 6.60998L6.196 7.67998C6.45 7.78798 6.568 8.08198 6.459 8.33598C6.378 8.52498 6.193 8.63898 6 8.63898V8.63998Z" },
|
|
84
|
+
{ d: "M4.80397 10.17C4.86797 10.197 4.93397 10.21 4.99997 10.21C5.19397 10.21 5.37897 10.096 5.45997 9.90599C5.56797 9.65199 5.44997 9.35799 5.19597 9.24999L3.69597 8.60999C3.44397 8.50199 3.14797 8.61999 3.03997 8.87399C2.93197 9.12799 3.04997 9.42199 3.30397 9.52999L4.80397 10.17Z" },
|
|
85
|
+
{ d: "M14.039 3.28598L9.077 1.37798C8.384 1.11098 7.616 1.11098 6.923 1.37798L1.962 3.28598C1.383 3.50898 1 4.06498 1 4.68598V11.312C1 11.933 1.382 12.489 1.962 12.712L6.923 14.62C7.616 14.887 8.384 14.887 9.077 14.62L14.039 12.712C14.618 12.489 15 11.933 15 11.312V4.68598C15 4.06498 14.618 3.50898 14.039 3.28598ZM7.5 13.757C7.426 13.738 7.354 13.715 7.282 13.687L2.32 11.779C2.127 11.705 2 11.519 2 11.312V4.97098L7.5 7.32798V13.757ZM2.564 4.12598L7.282 2.31098C7.744 2.13298 8.256 2.13298 8.718 2.31098L13.436 4.12598L8 6.45598L2.564 4.12598ZM14 11.313C14 11.52 13.873 11.705 13.68 11.78L8.718 13.688C8.646 13.716 8.574 13.739 8.5 13.758V7.32998L14 4.97298V11.313Z", evenOdd: true },
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
warning: {
|
|
89
|
+
box: [0.5, 0.58, 14.84],
|
|
90
|
+
paths: [
|
|
91
|
+
{ d: "M14.831 11.965L9.206 1.714C8.965 1.274 8.503 1 8 1C7.497 1 7.035 1.274 6.794 1.714L1.169 11.965C1.059 12.167 1 12.395 1 12.625C1 13.383 1.617 14 2.375 14H13.625C14.383 14 15 13.383 15 12.625C15 12.395 14.941 12.167 14.831 11.965ZM13.625 13H2.375C2.168 13 2 12.832 2 12.625C2 12.561 2.016 12.5 2.046 12.445L7.671 2.195C7.736 2.075 7.863 2 8 2C8.137 2 8.264 2.075 8.329 2.195L13.954 12.445C13.984 12.501 14 12.561 14 12.625C14 12.832 13.832 13 13.625 13ZM8.75 11.25C8.75 11.664 8.414 12 8 12C7.586 12 7.25 11.664 7.25 11.25C7.25 10.836 7.586 10.5 8 10.5C8.414 10.5 8.75 10.836 8.75 11.25ZM7.5 9V5.5C7.5 5.224 7.724 5 8 5C8.276 5 8.5 5.224 8.5 5.5V9C8.5 9.276 8.276 9.5 8 9.5C7.724 9.5 7.5 9.276 7.5 9Z" },
|
|
92
|
+
],
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Which mark each artifact kind wears. An unknown kind gets none rather than
|
|
98
|
+
* a stand-in: a wrong glyph on a future kind reads as a claim, and no glyph
|
|
99
|
+
* reads as what it is.
|
|
100
|
+
*/
|
|
101
|
+
export const KIND_MARKS: Record<string, Glyph> = {
|
|
102
|
+
skill: CODICONS.sparkle!,
|
|
103
|
+
rule: CODICONS.law!,
|
|
104
|
+
agent: CODICONS.agent!,
|
|
105
|
+
mcp: CODICONS.mcp!,
|
|
106
|
+
bundle: CODICONS.package!,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/** What a retired artifact wears instead of its kind. */
|
|
110
|
+
export const DEPRECATED_MARK = CODICONS.warning!;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* One codicon, filled with `currentColor`, framed on its own box.
|
|
114
|
+
*
|
|
115
|
+
* Filled rather than stroked, which is what makes it usable at watermark
|
|
116
|
+
* scale: a stroked glyph's overlapping paths composite twice wherever they
|
|
117
|
+
* cross, so a translucent one comes out blotchy along its own joins.
|
|
118
|
+
*/
|
|
119
|
+
export function KindMark({
|
|
120
|
+
glyph,
|
|
121
|
+
size = 16,
|
|
122
|
+
...rest
|
|
123
|
+
}: {
|
|
124
|
+
glyph: Glyph;
|
|
125
|
+
size?: number;
|
|
126
|
+
} & Record<string, unknown>) {
|
|
127
|
+
const [x, y, side] = glyph.box;
|
|
128
|
+
return (
|
|
129
|
+
<svg viewBox={`${x} ${y} ${side} ${side}`} width={size} height={size} {...rest}>
|
|
130
|
+
{glyph.paths.map((p) => (
|
|
131
|
+
<path
|
|
132
|
+
key={p.d}
|
|
133
|
+
d={p.d}
|
|
134
|
+
fill="currentColor"
|
|
135
|
+
fill-rule={p.evenOdd ? "evenodd" : undefined}
|
|
136
|
+
clip-rule={p.evenOdd ? "evenodd" : undefined}
|
|
137
|
+
/>
|
|
138
|
+
))}
|
|
139
|
+
</svg>
|
|
140
|
+
);
|
|
141
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type CatalogPackage } from "../lib/catalog.js";
|
|
2
|
+
export interface PackageCardProps {
|
|
3
|
+
pkg: CatalogPackage;
|
|
4
|
+
/**
|
|
5
|
+
* `publisher.extension` id behind the deep links, or `null`. A prop rather
|
|
6
|
+
* than a `lib/data` read: this island hydrates in the browser, and importing
|
|
7
|
+
* the build-time payload here would ship the whole catalog twice.
|
|
8
|
+
*/
|
|
9
|
+
vscodeExtension: string | null;
|
|
10
|
+
/** Keyword facets currently applied, so a chip can render itself pressed. */
|
|
11
|
+
activeKeywords: string[];
|
|
12
|
+
/** Apply or clear one keyword facet. */
|
|
13
|
+
onToggleKeyword: (keyword: string) => void;
|
|
14
|
+
/** The catalog's own arrow-key navigation. */
|
|
15
|
+
onKeyDown: (event: KeyboardEvent) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function PackageCard({ pkg: p, vscodeExtension, activeKeywords, onToggleKeyword, onKeyDown, }: PackageCardProps): import("preact").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=PackageCard.d.ts.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// Copyright 2026 The Grimoire Authors
|
|
4
|
+
// One card of the grid view.
|
|
5
|
+
//
|
|
6
|
+
// Its own file so an index can replace the card without owning `Catalog.tsx`
|
|
7
|
+
// and its sorting, filtering, keyboard and URL-state machinery. Unlike the
|
|
8
|
+
// `.astro` components, this one takes props — a Preact component in a
|
|
9
|
+
// hydrated island cannot read the build-time payload — so its props ARE a
|
|
10
|
+
// contract, and they are the reason component overrides are documented as
|
|
11
|
+
// unstable for now.
|
|
12
|
+
import { ArrowBigUp } from "lucide-preact";
|
|
13
|
+
import { mdiMicrosoftVisualStudioCode } from "@mdi/js";
|
|
14
|
+
import { BrandMark } from "./BrandMark.js";
|
|
15
|
+
import { CardLogo } from "./CardLogo.js";
|
|
16
|
+
import { CopyButton } from "./CopyButton.js";
|
|
17
|
+
import { DEPRECATED_MARK, KIND_MARKS, KindMark } from "./KindMark.js";
|
|
18
|
+
import { withBase } from "../lib/base.js";
|
|
19
|
+
import { externalUrl, lastUpdated, timeAgo, vscodeUrl, vscodeVoteUrl, } from "../lib/catalog.js";
|
|
20
|
+
export function PackageCard({ pkg: p, vscodeExtension, activeKeywords, onToggleKeyword, onKeyDown, }) {
|
|
21
|
+
return (_jsxs("li", { class: "card", "data-slot": "package-card", tabIndex: 0, onKeyDown: onKeyDown, children: [(() => {
|
|
22
|
+
const mark = p.deprecated
|
|
23
|
+
? DEPRECATED_MARK
|
|
24
|
+
: KIND_MARKS[p.kind];
|
|
25
|
+
if (!mark)
|
|
26
|
+
return null;
|
|
27
|
+
return (_jsx(KindMark, { glyph: mark, class: "card-watermark", size: 112, role: p.deprecated ? "img" : undefined, "aria-label": p.deprecated ? "deprecated" : undefined, "aria-hidden": p.deprecated ? undefined : "true", style: {
|
|
28
|
+
color: p.deprecated
|
|
29
|
+
? "var(--grim-color-deprecated)"
|
|
30
|
+
: `var(--grim-color-kind-${p.kind}, var(--grim-color-muted))`,
|
|
31
|
+
} }));
|
|
32
|
+
})(), _jsxs("div", { class: "card-head", children: [_jsx(CardLogo, { pkg: p }), _jsx("h2", { "data-slot": "package-name", children: _jsx("a", { href: withBase(`/p/${p.namespace}/${p.name}/`), tabIndex: -1, children: p.name }) }), p.rating &&
|
|
33
|
+
(() => {
|
|
34
|
+
const votes = `${p.rating.up} upvote${p.rating.up === 1 ? "" : "s"}`;
|
|
35
|
+
// Registry-supplied, like every other outbound string
|
|
36
|
+
// here: through the scheme allowlist before it is an
|
|
37
|
+
// href, whatever the sidecar spelled.
|
|
38
|
+
const thread = externalUrl(p.rating.url);
|
|
39
|
+
const vote = vscodeVoteUrl(vscodeExtension, p.ref);
|
|
40
|
+
return (_jsxs("span", { class: "rating-group", children: [thread ? (_jsxs("a", { class: "rating-count", href: thread, target: "_blank", rel: "noopener noreferrer", tabIndex: -1, title: `${votes} — open the thread to vote`, "aria-label": `${p.name}: ${votes}. Open the voting thread`, children: [_jsx(ArrowBigUp, { size: 13, "aria-hidden": "true" }), p.rating.up] })) : (_jsxs("span", { class: "rating-count", title: votes, children: [_jsx(ArrowBigUp, { size: 13, "aria-hidden": "true" }), p.rating.up] })), vote && (_jsx("a", { class: "rating-vote", href: vote, tabIndex: -1, title: "Upvote in VS Code", "aria-label": `Upvote ${p.name} in VS Code`, children: _jsx(BrandMark, { path: mdiMicrosoftVisualStudioCode, size: 12 }) }))] }));
|
|
41
|
+
})(), _jsxs("p", { class: "namespace", children: [_jsx("span", { class: "kind", "data-slot": "package-kind", children: p.kind }), _jsx("span", { "aria-hidden": "true", children: " \u00B7 " }), p.namespace] })] }), p.keywords && p.keywords.length > 0 && (_jsx("div", { class: "keywords", "data-slot": "package-keywords", children: p.keywords.slice(0, 5).map((kw) => (_jsx("button", { type: "button", class: activeKeywords.includes(kw)
|
|
42
|
+
? "chip keyword active"
|
|
43
|
+
: "chip keyword", "aria-pressed": activeKeywords.includes(kw), tabIndex: -1, onClick: () => onToggleKeyword(kw), children: kw }, kw))) })), p.description && _jsx("p", { class: "description", children: p.description }), _jsxs("div", { class: "card-foot", children: [_jsxs("div", { class: "copy-group", children: [_jsx(CopyButton, { command: `grim add --global ${p.ref}`, variant: "global", name: `global add for ${p.name}` }), _jsx(CopyButton, { command: `grim add ${p.ref}`, name: `project add for ${p.name}` }), vscodeUrl(vscodeExtension, p.ref) && (_jsx("a", { class: "copy vscode", href: vscodeUrl(vscodeExtension, p.ref), title: "Open in VS Code", "aria-label": `Open ${p.name} in VS Code`, tabIndex: -1, children: _jsx(BrandMark, { path: mdiMicrosoftVisualStudioCode }) }))] }), (() => {
|
|
44
|
+
const at = lastUpdated(p);
|
|
45
|
+
const ago = at && timeAgo(at) ? timeAgo(at) : null;
|
|
46
|
+
if (!p.version && !ago)
|
|
47
|
+
return null;
|
|
48
|
+
return (_jsxs("p", { class: "card-meta", "data-slot": "package-meta", children: [p.version && (_jsxs("span", { class: "card-version", children: ["v", p.version] })), p.version && ago && _jsx("span", { "aria-hidden": "true", children: " \u00B7 " }), ago && at && (_jsxs("time", { datetime: at, title: at, children: ["updated ", ago] }))] }));
|
|
49
|
+
})()] })] }));
|
|
50
|
+
}
|