yukey

adopt-into-root: the header's contract moves onto adoptIntoRoot

commit f791bafcc98c57e0ecb9f6f327bbf9213571b1d7 · parent 2b3489bba1 · browse this tree
Ximianth, 2026-10-18 10:47:06 UTC

The module is one function; its header was that function's contract and now
lives on it as a /** */ block, reaching dist/adopt-into-root.d.ts.  The
header keeps the one-line purpose.  Wording is unchanged apart from
lowercasing emphasis and backticks on `<style>`; lines break at clauses.
diff --git a/packages/yukey/src/adopt-into-root.ts b/packages/yukey/src/adopt-into-root.ts
index 9955dfb..f8ebaf3 100644
--- a/packages/yukey/src/adopt-into-root.ts
+++ b/packages/yukey/src/adopt-into-root.ts
@@ -1,17 +1,18 @@
-// Stylesheet adoption for components that render into their OWNER's tree.
-// Megacolumn-composed components (yk-live-list mega mode, yk-list) render light-DOM
-// rows -- the megacolumn scan and aria-activedescendant cannot cross shadow
-// boundaries -- so their styles must reach the owner's root, not a shadow root of
-// their own.  This appends a sheet to the root's adopted stylesheets, once per root.
-//
-// By hand, because lit's adoptStyles() REPLACES a root's sheets and the root here
-// belongs to the owner.  Where constructed stylesheets are unsupported (jsdom),
-// fall back to one marked <style> tag -- the same fallback shape lit itself uses;
-// `marker` is the attribute name that makes the fallback idempotent (one per
-// adopter class, e.g. "data-yk-live-list").
+// Stylesheet adoption for components that render into their owner's tree.
 
 import type { CSSResult } from "lit";
 
+/**
+ * adoptIntoRoot appends a sheet to the root's adopted stylesheets, once per root.
+ * Megacolumn-composed components (yk-live-list mega mode, yk-list) render light-DOM rows --
+ * the megacolumn scan and aria-activedescendant cannot cross shadow boundaries --
+ * so their styles must reach the owner's root, not a shadow root of their own.
+ *
+ * By hand, because lit's adoptStyles() replaces a root's sheets and the root here belongs to the owner.
+ * Where constructed stylesheets are unsupported (jsdom), fall back to one marked `<style>` tag --
+ * the same fallback shape lit itself uses;
+ * `marker` is the attribute name that makes the fallback idempotent (one per adopter class, e.g. "data-yk-live-list").
+ */
 export function adoptIntoRoot(root: Node, styles: CSSResult, marker: string): void {
 	if (!(root instanceof ShadowRoot || root instanceof Document)) {
 		throw new Error(`adopt-into-root (${marker}): not inside any document or shadow root`);