@sigil-dev/types 0.9.12 → 0.9.13

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.
Files changed (2) hide show
  1. package/index.d.ts +29 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -74,6 +74,35 @@ type SigilIntrinsicElements = {
74
74
  LowercaseHandlers<React.JSX.IntrinsicElements[K]>;
75
75
  };
76
76
 
77
+
78
+ /**
79
+ * The hydration state the server embeds in the document, and the shape a
80
+ * streamed value takes in it.
81
+ *
82
+ * Declared here because every app that reads a streamed value has been
83
+ * re-declaring this by hand — the same three fields, with the `nodeType`
84
+ * guard that the runtime really needs and nobody remembers to write.
85
+ */
86
+ interface GrimoireState {
87
+ /** The route pattern this document was rendered for. */
88
+ pattern: string;
89
+ /** Rendered load data. A value still in flight is absent until it settles. */
90
+ data?: Record<string, unknown>;
91
+ }
92
+
93
+ interface Window {
94
+ /**
95
+ * Mirrors `__grimoire_state__`. The element carries the authoritative
96
+ * copy, but a late patch script can arrive before the element is parsed,
97
+ * so the runtime falls back to this object. `nodeType` is how the
98
+ * difference is told apart: the element has one, the plain object does
99
+ * not.
100
+ */
101
+ __grimoire_state__?: GrimoireState | HTMLElement;
102
+ /** Public environment values, as the server saw them. */
103
+ __grimoire_env__?: Record<string, string>;
104
+ }
105
+
77
106
  declare namespace JSX {
78
107
  type Element = React.JSX.Element;
79
108
  interface ElementClass extends React.JSX.ElementClass {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sigil-dev/types",
3
3
  "description": "JSX/runtime sigil types",
4
- "version": "0.9.12",
4
+ "version": "0.9.13",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": "./index.d.ts"