@se-studio/skills 1.6.2 → 1.6.4
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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @se-studio/skills
|
|
2
2
|
|
|
3
|
+
## 1.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2c479e7: Wrap HtmlComponent customJs in an IIFE so `hcRoot` is per-instance. Two HtmlComponents with scripts on the same page no longer throw `Identifier 'hcRoot' has already been declared`.
|
|
8
|
+
|
|
9
|
+
## 1.6.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- DotLottie player for CMS animations (JSON and `.lottie`), with classic lottie-player fallback if DotLottie is not installed. Lazy load by default; honour loading/fetchPriority for eager (heroes). Server enrich reads dimensions and poster for CLS. WASM self-host helper (`/dotlottie/dotlottie-player.wasm`). Extension-first animation detection; hosted staged upload allows JSON/zip for animation packages. INavigation surfaces optional backgroundColour/textColour for footer chrome.
|
|
14
|
+
|
|
3
15
|
## 1.6.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -228,7 +228,7 @@ Never redeclare colours or typography in `customCss` — those already exist as
|
|
|
228
228
|
|
|
229
229
|
## Custom JavaScript (`customJs`)
|
|
230
230
|
|
|
231
|
-
The renderer
|
|
231
|
+
The renderer injects `hcRoot` (this component's `[data-hc-id]` root) inside an IIFE so each instance has its own binding. Multiple HtmlComponents with `customJs` on one page are safe. **Always use `hcRoot` as the root for DOM queries** — never `document.querySelector('[data-hc-id]')`, which matches the first component on the page, not this one.
|
|
232
232
|
|
|
233
233
|
```js
|
|
234
234
|
// ✓ Correct — hcRoot is scoped to this component automatically
|
|
@@ -246,6 +246,7 @@ var section = document.querySelector('[data-hc-id]');
|
|
|
246
246
|
**Rules:**
|
|
247
247
|
- Use `hcRoot.querySelector` / `hcRoot.querySelectorAll` for all DOM lookups.
|
|
248
248
|
- Keep scripts small and self-contained — no module imports, no global state.
|
|
249
|
+
- Top-level `function` / `var` / `const` stay inside the IIFE. Do not call them from `rawHtml` (`onclick="setup()"`). Bind listeners on `hcRoot`. Assign `window.foo` only if another script must see the name.
|
|
249
250
|
- Avoid `document.getElementById` unless the ID is guaranteed unique across the whole page.
|
|
250
251
|
- Default `scriptStrategy` is `afterInteractive` — runs after page hydration. Use `lazyOnload` for non-critical third-party widgets.
|
|
251
252
|
|
|
@@ -166,7 +166,12 @@ The `IResponsiveVisual` type (from `@se-studio/core-data-types`) supports:
|
|
|
166
166
|
|
|
167
167
|
1. **Image**: Standard Contentful image asset.
|
|
168
168
|
2. **Video**: Hosted video file (mp4/webm). The component handles `<video>` tag rendering with autoplay/loop/muted attributes suitable for background videos.
|
|
169
|
-
3. **Animation**: Lottie
|
|
169
|
+
3. **Animation**: Lottie motion file. Player is chosen by **file extension**:
|
|
170
|
+
* **`.json`** (or `application/json`) → `@lottiefiles/lottie-player` (classic Lottie).
|
|
171
|
+
* **`.lottie`** → `@lottiefiles/dotlottie-react` (ThorVG / WASM). Wrong extension ⇒ wrong player.
|
|
172
|
+
* Lazy-loaded near the viewport by default; pass `loading="eager"` / `fetchPriority="high"` (e.g. `calculateImagePriority(0)` on heroes) to load immediately and preload WASM for DotLottie.
|
|
173
|
+
* Server enrich reads dimensions (and a poster when possible) so layout does not jump.
|
|
174
|
+
* Sites using `.lottie` must install `@lottiefiles/dotlottie-react` and copy WASM to `public/dotlottie/dotlottie-player.wasm` (see `ensureDotLottieWasm` / `NEXT_PUBLIC_DOTLOTTIE_WASM_URL`).
|
|
170
175
|
|
|
171
176
|
The component automatically detects the type and renders the appropriate element.
|
|
172
177
|
|