@parhelia/head 1.0.13049 → 1.0.13193

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parhelia/head",
3
- "version": "1.0.13049",
3
+ "version": "1.0.13193",
4
4
  "description": "Make a rendering head editable in Parhelia, on any framework and without one: the editing bridge, slot markers, the in-place refresh (with a DOM-patching one for heads without a client framework), the rendered-content identity capture reads, the editor signal a head's server checks (/server), rich-text sanitising (/rich-text), per-CMS marker helpers (/contentful, /umbraco), a SitecoreAI editing host's canvas render (/sitecore), the build values and the Vite build adapter (/vite). No React: React heads add @parhelia/react, Next.js heads @parhelia/next, Astro heads @parhelia/astro.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "publishConfig": {
@@ -140,10 +140,10 @@
140
140
  },
141
141
  "devDependencies": {
142
142
  "@types/node": "*",
143
- "@types/react": "19.2.18",
144
- "jsdom": "^30.0.1",
143
+ "@types/react": "19.3.0",
144
+ "jsdom": "^30.1.3",
145
145
  "typescript": "npm:@typescript/typescript6@6.0.2",
146
- "vitest": "^4.1.11",
146
+ "vitest": "^4.1.12",
147
147
  "vite": "*"
148
148
  }
149
149
  }
@@ -1,6 +1,7 @@
1
1
  export declare const REFRESH_ROOT_ATTRIBUTE: "data-parhelia-refresh-root";
2
2
  export declare const REFRESH_SIGNATURE_ATTRIBUTE: "data-parhelia-refresh-signature";
3
3
  export declare const REFRESH_DEADLINE_ATTRIBUTE: "data-parhelia-refresh-deadline";
4
+ export declare const REFRESH_READ_CLASS: "parhelia-refresh-read";
4
5
 
5
6
  /** Patches `live` from the render it showed (`before`) to the new render (`after`), touching only what differs. */
6
7
  export declare function patchRendered(live: Node, before: Node, after: Node): Node;
@@ -11,6 +11,8 @@ import { installParheliaRefresh } from "./refresh.js";
11
11
  export const REFRESH_ROOT_ATTRIBUTE = "data-parhelia-refresh-root";
12
12
  export const REFRESH_SIGNATURE_ATTRIBUTE = "data-parhelia-refresh-signature";
13
13
  export const REFRESH_DEADLINE_ATTRIBUTE = "data-parhelia-refresh-deadline";
14
+ /** The class a finished read toggles on the refresh root (no style of its own): the mutation the editing bridge sees. */
15
+ export const REFRESH_READ_CLASS = "parhelia-refresh-read";
14
16
 
15
17
  const ELEMENT = 1;
16
18
  const TEXT = 3;
@@ -87,6 +89,10 @@ export function installParheliaDomRefresh({ deadlineMs } = {}) {
87
89
  if (rendered) patchRendered(live, rendered, next);
88
90
  else live.replaceWith(document.importNode(next, true));
89
91
  rendered = next;
92
+ // A read that changed nothing touches no node, and the editing bridge reports a refresh's render by the document's
93
+ // mutations: the editor would wait for this render until its own deadline. Each read marks the root (an attribute the
94
+ // renders never carry, so the next patch leaves it alone), as a framework's re-render touches the document.
95
+ root()?.classList.toggle(REFRESH_READ_CLASS);
90
96
  },
91
97
  });
92
98
  }