@nersh/render 0.3.0 → 0.4.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/LICENSE +21 -0
- package/README.md +16 -0
- package/dist/index.cjs +19040 -4182
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +36 -7
- package/dist/index.d.ts +36 -7
- package/dist/index.mjs +19208 -4350
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Scott Campbell
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -106,6 +106,21 @@ A node in `site.json` may carry `styles`: CSS per breakpoint, keyed `desktop`, `
|
|
|
106
106
|
|------|------|-------------|
|
|
107
107
|
| `site` | `CompositionSite` | The parsed `site.json` |
|
|
108
108
|
| `registry` | `Record<string, ComponentType>` | Maps section IDs to components |
|
|
109
|
+
| `codeEmbed` | `'run' \| 'off'` | Whether Code Embed blocks run their code; default `'off'` |
|
|
110
|
+
|
|
111
|
+
### Code Embed
|
|
112
|
+
|
|
113
|
+
With `codeEmbed="run"`, Code Embed blocks run the site author's HTML, CSS and JavaScript in a sealed frame: a sandboxed iframe with no access to the page or its cookies, whose own policy blocks requests (WebRTC aside, as "What it still can" in the [Code Embed guide](https://nertia.ai/docs/guides/code-embed) says). The default is off, and an off block shows its reserved box and fallback picture. `renderSiteToHtml` never runs it: static markup holds the box and the fallback, never the frame or the code.
|
|
114
|
+
|
|
115
|
+
A sealed frame can send itself to another address. Send a `frame-src` rule that names the hosts your embeds use, and the browser lets it go only to those:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
Content-Security-Policy: frame-src https://www.youtube.com https://player.vimeo.com
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
List the hosts your own embeds use; nertia's list is in `packages/create-nersh/templates/next/next.config.ts`, and projects created with `create-nersh` send it for you. Without this rule, a frame's code can send the frame to any site. That site's page then shows in the block's box, has the network, and can stay there. Whatever a frame loads, it still cannot read your page, its cookies or its storage, and cannot navigate the top window, open popups or submit forms.
|
|
122
|
+
|
|
123
|
+
A sealed frame inherits the page's policy, so a page-level `script-src` without `'unsafe-inline'`, or one that moves to nonces, stops Code Embed frames: their code never runs.
|
|
109
124
|
|
|
110
125
|
---
|
|
111
126
|
|
|
@@ -132,5 +147,6 @@ A skin's dark values ship under a `.dark` class selector, the shadcn convention:
|
|
|
132
147
|
|
|
133
148
|
## Changelog
|
|
134
149
|
|
|
150
|
+
- 0.4.0: `SiteRenderer` takes `codeEmbed?: 'run' | 'off'` (default `'off'`); with `'run'`, Code Embed blocks run the author's code in a sealed frame. `create-nersh` 0.4.0 passes `'run'` and sends the `frame-src` header
|
|
135
151
|
- 0.3.0: renders node `styles` (per-breakpoint CSS on any node) as one scoped stylesheet; unstyled sites render as before, the surface stylesheet less the unused `data-text-color` and `data-text-align` rules; a node's legacy `overrides` bag is not read (0.2.5 never read it either); importing an older `.nertia.json` into nertia.ai converts each bag to `styles`, so export it again from there to keep that look
|
|
136
152
|
- 0.2.5: declares `tailwind-merge`, `clsx`, and `embla-carousel-react`; 0.2.4 required installing them by hand
|