@lucrex/storefront-blocks 0.0.0-stage → 0.1.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/README.md CHANGED
@@ -1,3 +1,45 @@
1
- # Temporary Holding Version
1
+ # @lucrex/storefront-blocks
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The page format, blocks and built-in templates behind Lucrex storefront pages. The page builder, the AI and the backend renderer all use this package, so a page looks the same in the editor and once published.
4
+
5
+ ## The page format
6
+
7
+ A page is JSON:
8
+
9
+ ```json
10
+ {
11
+ "root": { "props": { "fonts": [{ "family": "Cairo", "weights": [400, 700] }], "css": "" } },
12
+ "content": [
13
+ {
14
+ "type": "Section",
15
+ "props": {
16
+ "id": "hero",
17
+ "style": { "padding": "48px 16px", "mobile": { "padding": "24px 12px" } },
18
+ "css": "& h1 { letter-spacing: -0.02em; }",
19
+ "content": [{ "type": "ProductTitle", "props": { "id": "title", "level": "h1" } }]
20
+ }
21
+ }
22
+ ]
23
+ }
24
+ ```
25
+
26
+ - Every block has a unique `id`. Its root element gets `data-block="<id>"`.
27
+ - `style` takes CSS properties in camelCase, with `tablet` and `mobile` overrides.
28
+ - `css` is scoped to the block. Nesting is allowed and `&` is the block itself.
29
+ - Slot props (`content`, `column1`…) hold more blocks.
30
+ - Product and checkout blocks read live data (product, offers, form fields, wilayas) at render time. The page never stores prices.
31
+
32
+ `pageJsonSchema()` describes every block for an AI agent. `parsePageDocument()` validates a page and reports each problem with its path.
33
+
34
+ ## Entry points
35
+
36
+ - `@lucrex/storefront-blocks`: browser safe. Blocks, `PageContent`, page CSS, validation, JSON Schema and templates.
37
+ - `@lucrex/storefront-blocks/server`: everything above plus `renderPage(document, data)`, which returns `{ html, css, fontStylesheets, preloadImages }` with the CSS checked, scoped and lowered for older browsers.
38
+
39
+ ## Checkout hooks
40
+
41
+ Product and checkout blocks output the `data-funnel`, `data-field`, `data-offer-*`, `data-total` and `.cs-submit` hooks that the storefront SDK binds to. Keep them when changing a block.
42
+
43
+ ## Releasing
44
+
45
+ Bump `version`, then push a `storefront-blocks-v<version>` tag. CI tests, builds and publishes to npm.