@justai/cuts 0.105.0 → 0.106.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/package.json +1 -1
- package/src/Catalogue.astro +19 -2
package/package.json
CHANGED
package/src/Catalogue.astro
CHANGED
|
@@ -210,6 +210,17 @@ const isNew = (added: string): boolean => { const t0 = Date.parse(added || "");
|
|
|
210
210
|
<section class="grid" id="grid" data-kind={kind} data-apex={apexHost} data-new-label={strings.new} data-cat-map={JSON.stringify(catLabels)} data-order={JSON.stringify(order)} data-taglines={JSON.stringify(taglines)}>
|
|
211
211
|
{seed.map((app) => <CatalogueCard app={app} name={appName(app)} desc={appDesc(app)} isNew={isNew(app.added)} newLabel={strings.new} />)}
|
|
212
212
|
</section>
|
|
213
|
+
{/* queries: runtime cards are unstyled · the card has no CSS · an apex with no seed · scope cid ·
|
|
214
|
+
data-astro-cid · pin.games cards render as blue links
|
|
215
|
+
THE SCOPE, CARRIED IN AN INERT CARD. Cards appended at runtime are built as plain strings, so
|
|
216
|
+
they sit outside CatalogueCard's scoped CSS and have to be stamped with its `data-astro-cid-*`
|
|
217
|
+
by hand. That attribute was read off a SEEDED card — which works on any apex that ships a seed,
|
|
218
|
+
and fails completely on one that does not: pin.games opened with its only game rendered as bare
|
|
219
|
+
blue underlined links, because there was no card to read the scope from.
|
|
220
|
+
A <template> is the right home for it. Its content is parsed but never rendered, never matched
|
|
221
|
+
by a document query and never painted, while Astro still stamps the cid on it at build. So the
|
|
222
|
+
scope is available from the first paint whether or not this apex has ever seeded a card. */}
|
|
223
|
+
<template id="cardscope"><CatalogueCard app={{ id: "scope", url: "https://example.invalid", category: "", added: "" } as any} name="" desc="" isNew={false} newLabel="" /></template>
|
|
213
224
|
{/* Both sentences ride data-attributes because the loader below is a BUNDLED script and
|
|
214
225
|
cannot see props — the same seam Posts uses. */}
|
|
215
226
|
<p class="empty" id="empty" hidden
|
|
@@ -421,8 +432,14 @@ const isNew = (added: string): boolean => { const t0 = Date.parse(added || "");
|
|
|
421
432
|
try { return new URL(a.href).host; } catch { return ""; }
|
|
422
433
|
}),
|
|
423
434
|
);
|
|
424
|
-
//
|
|
425
|
-
|
|
435
|
+
// The appended cards must inherit CatalogueCard's scoped styles → copy the cid off a real card, and
|
|
436
|
+
// fall back to the inert one in #cardscope when this apex ships no seed. Without that fallback an
|
|
437
|
+
// empty-seed storefront renders every runtime card as unstyled markup — measured on pin.games' first
|
|
438
|
+
// night, where the shelf's only game arrived as blue underlined links.
|
|
439
|
+
const scopeTpl = document.getElementById("cardscope") as HTMLTemplateElement | null;
|
|
440
|
+
const sample = grid.querySelector<HTMLElement>("a.card")
|
|
441
|
+
?? scopeTpl?.content.querySelector<HTMLElement>("a.card")
|
|
442
|
+
?? null;
|
|
426
443
|
const scopeAttr = sample ? sample.getAttributeNames().find((n) => n.startsWith("data-astro-cid-")) || null : null;
|
|
427
444
|
|
|
428
445
|
const esc = (s: unknown): string =>
|