@opentf/afw 0.36.0 → 0.37.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/index.js +4 -2
- package/package.json +1 -1
- package/runtime/code-block.js +4 -3
- package/runtime/hydrate.js +5 -3
package/index.js
CHANGED
|
@@ -7,7 +7,9 @@ export * from "./runtime/index.js";
|
|
|
7
7
|
// `Link` is shipped as JSX source and compiled by the consuming app's pipeline
|
|
8
8
|
// (the `.jsx` lands in the module graph and afwc transforms it). Its compiled
|
|
9
9
|
// module self-registers `afw-link` (CSR `customElements.define` / SSG `defineSSG`).
|
|
10
|
-
// The bare import forces that registration to be retained — `<Link>`
|
|
11
|
-
//
|
|
10
|
+
// The bare import forces that registration to be retained — call sites address `<Link>`
|
|
11
|
+
// by its literal `afw-link` tag (a framework built-in), not `Link.tag`, so the binding
|
|
12
|
+
// alone would be tree-shaken. (Other compiled components register on first `.tag` read
|
|
13
|
+
// and need no bare import.)
|
|
12
14
|
import "./components/Link.jsx";
|
|
13
15
|
export { default as Link } from "./components/Link.jsx";
|
package/package.json
CHANGED
package/runtime/code-block.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
//! Code block — a built-in that renders a (
|
|
1
|
+
//! Code block — a built-in that renders a code block (plain, or highlighted at build time)
|
|
2
2
|
//! and **owns its copy behavior**.
|
|
3
3
|
//
|
|
4
4
|
// <CodeFence html={"<div class='afw-code'>…<button class='afw-copy'>…</button><pre>…</pre></div>"} />
|
|
5
5
|
//
|
|
6
6
|
// The MDX front-end emits this for fenced code (compiles to `afw-internal-code-block`,
|
|
7
|
-
// like `<RawHtml>` → `afw-internal-raw-html`). The
|
|
8
|
-
// string from the
|
|
7
|
+
// like `<RawHtml>` → `afw-internal-raw-html`). The markup — escaped code, which
|
|
8
|
+
// afw-docs' build plugin highlights — is a trusted string from the build, so it's
|
|
9
|
+
// assigned to `innerHTML`; the difference from
|
|
9
10
|
// `RawHtml` is that on connect this element wires its own `.afw-copy` button to copy
|
|
10
11
|
// the `<pre>` text. That keeps copy working wherever a code block is rendered (docs,
|
|
11
12
|
// blog, anywhere) — no delegated listener in a layout. SSG renders the string inline
|
package/runtime/hydrate.js
CHANGED
|
@@ -76,9 +76,11 @@ export class HydrationMismatch extends Error {
|
|
|
76
76
|
//
|
|
77
77
|
// Why it initializes from the DOM sentinel, not `false`: a custom element upgrades — and
|
|
78
78
|
// its `connectedCallback` runs the build-vs-adopt switch — the instant its class is
|
|
79
|
-
// `customElements.define`d.
|
|
80
|
-
// (
|
|
81
|
-
//
|
|
79
|
+
// `customElements.define`d. Compiled components register on first use (the adopt walk's
|
|
80
|
+
// `claimElement(cur, X.tag)`), but framework built-ins register when their module loads
|
|
81
|
+
// (`<Link>` from `@opentf/afw`, the `afw-internal-*` elements), so they are defined and
|
|
82
|
+
// upgraded during the entry bundle's evaluation, **before** `mountApp` runs
|
|
83
|
+
// `beginHydration()`. If the flag were
|
|
82
84
|
// still `false` then, every server-rendered `<afw-link>` would take the *build* arm —
|
|
83
85
|
// re-wrapping the server subtree it should have adopted (a silent `<a><a>` double-build)
|
|
84
86
|
// — long before the router ever starts hydrating. So the flag is seeded synchronously
|