You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.2 KiB
31 lines
1.2 KiB
<script lang="ts">
|
|
/**
|
|
* The count on the `Tokens` tab, READ FROM THE CONTRACT.
|
|
*
|
|
* It used to be a hand-written number next to the tab label, and it drifted
|
|
* exactly as a second source of truth always does: audited 2026-08-24 across
|
|
* the 105 demos that mount `TokensPanel`, three were already wrong —
|
|
* `carousel` claimed 30 against 27, `drag-drop` 10 against 9, `link-preview`
|
|
* 33 against 35 — because the contract moved and nobody edits a badge.
|
|
*
|
|
* The panel below it never had that problem: it asks
|
|
* `ActiveEidos.getRecipeTokens(name)`. This is the same question, so a key
|
|
* added, renamed or dropped shows up in the badge without anyone remembering.
|
|
*/
|
|
import { ActiveEidos } from '$uix/eidos';
|
|
|
|
let { component }: { /** Recipe key in `lib/recipes/base.ts` (the kebab). */ component: string } =
|
|
$props();
|
|
|
|
const eidos = ActiveEidos.require();
|
|
|
|
/** Public surface only — the `_`-prefixed forwards are not theme surface. */
|
|
const count = $derived.by(() => {
|
|
const tokens = eidos.getRecipeTokens(component);
|
|
if (!tokens) return 0;
|
|
return Object.keys(tokens).filter((key) => !key.startsWith('_')).length;
|
|
});
|
|
</script>
|
|
|
|
<span data-uix-tab-count>{count}</span>
|