@openelement/protocol 1.0.0-alpha.13 → 1.0.0-alpha.15

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.
@@ -1 +1,47 @@
1
- export {};
1
+ //#region src/style-sheet.ts
2
+ /**
3
+ * The one key under which a sheet carries its readiness promise: the generated
4
+ * client style adapter records it on the sheet it exports, and the element
5
+ * runtime reads the same key to hand styles to roots that are already
6
+ * connected. Build-time and runtime cannot drift because the adapter generator
7
+ * interpolates this exact name.
8
+ *
9
+ * The promise settles once. Fulfillment means the rules were installed through
10
+ * `replace()`; rejection carries the load or replacement failure and keeps its
11
+ * rejected state — an observer may attach its own catch, it must never convert
12
+ * the promise into a fulfilled one.
13
+ */
14
+ const STYLE_SHEET_READY = "__openElementStyleReady";
15
+ /**
16
+ * The one key under which a sheet carries the URL of the external CSS resource
17
+ * that delivers its rules: the generated client style adapter records the
18
+ * emitted asset URL on the sheet it exports, and the element runtime compares
19
+ * it against the declarative `<link rel="stylesheet" data-oe-static-styles>`
20
+ * nodes an SSR/DSD template already carries (alpha15 S lane). A root whose
21
+ * serialized markup already references the sheet's URL keeps that link as the
22
+ * delivery and does NOT adopt a second constructable copy — one stylesheet
23
+ * resource, one delivery, no duplicate application. Build-time and runtime
24
+ * cannot drift because the adapter generator interpolates this exact name.
25
+ */
26
+ const STYLE_SHEET_URL = "__openElementStyleSheetUrl";
27
+ /**
28
+ * The one key marking a sheet whose bytes are a LIVE resource rather than an
29
+ * immutable one (alpha15 S lane, S-C1.3).
30
+ *
31
+ * The dev server serves an authored sheet from a mutable endpoint that
32
+ * hot-updates: the sheet object is the copy the live resource re-fills through
33
+ * `replace()`, so every root that adopted it re-renders on an edit. A root
34
+ * whose serialized markup declares the same URL therefore still ADOPTS this
35
+ * sheet — the declarative `<link>` stays the first-paint / no-JavaScript
36
+ * delivery, and the adopted object is the one an edit reaches. Without that,
37
+ * a CSS-only edit could only be delivered by re-fetching the link, which is a
38
+ * DOM write this protocol does not perform.
39
+ *
40
+ * Production sheets never carry this key: their URL is content-addressed, so
41
+ * the link and the sheet can never disagree and one delivery is the whole
42
+ * story. Build-time and runtime cannot drift because the dev adapter generator
43
+ * interpolates this exact name.
44
+ */
45
+ const STYLE_SHEET_LIVE = "__openElementStyleSheetLive";
46
+ //#endregion
47
+ export { STYLE_SHEET_LIVE, STYLE_SHEET_READY, STYLE_SHEET_URL };