@sprucelabs/spruce-heartwood-utils 38.17.1 → 38.17.2
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 +28 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -576,26 +576,43 @@ import {
|
|
|
576
576
|
|
|
577
577
|
### Required CSS
|
|
578
578
|
|
|
579
|
+
> **⚠ Silent failure warning:** If CSS transitions are missing, animations will not play and no error will be thrown. Elements will simply snap instantly between states with no visual feedback. Every class listed below requires its own `transition` declaration — the system provides none.
|
|
580
|
+
|
|
579
581
|
**Inside a Heartwood skill view:** all required CSS is already provided by Heartwood's stylesheet. No extra setup needed.
|
|
580
582
|
|
|
581
|
-
**Outside Heartwood (standalone use):** supply
|
|
583
|
+
**Outside Heartwood (standalone use):** supply every rule below yourself. Missing any one of them causes that animation to silently skip.
|
|
584
|
+
|
|
585
|
+
---
|
|
586
|
+
|
|
587
|
+
#### `queueShow` / `queueHide` — fade + slide transitions
|
|
582
588
|
|
|
583
|
-
|
|
589
|
+
`queueShow` removes the `hidden` class; `queueHide` adds it back. The `hidden` class sets the hidden state (opacity, position offset, pointer-events). **The transition must be declared on the element itself, not on `.hidden`** — if the transition is on `.hidden` it is removed at the same moment the class is removed and the browser never interpolates.
|
|
584
590
|
|
|
585
591
|
```css
|
|
592
|
+
/* Hidden state — sets opacity, nudge, and pointer-events */
|
|
586
593
|
.hidden {
|
|
587
594
|
opacity: 0;
|
|
588
595
|
transform: translateY(4px);
|
|
589
596
|
pointer-events: none;
|
|
590
597
|
}
|
|
591
598
|
|
|
592
|
-
/* Transition
|
|
599
|
+
/* Transition on the element — this is what the browser animates */
|
|
593
600
|
.your-element {
|
|
594
601
|
transition: opacity 200ms ease, transform 200ms ease;
|
|
595
602
|
}
|
|
596
603
|
```
|
|
597
604
|
|
|
598
|
-
`
|
|
605
|
+
Elements must also start with `hidden` in their `className` so they are invisible until `queueShow` fires:
|
|
606
|
+
|
|
607
|
+
```tsx
|
|
608
|
+
<div className="your-element hidden" ref={(ref) => { ref && queueShow(ref) }} />
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
#### `Sizer` — animated height
|
|
614
|
+
|
|
615
|
+
`Sizer` measures its content and writes `style.height` directly. The CSS `transition` on `.sizer` is what makes the height change animate smoothly. Without it the height jumps instantly.
|
|
599
616
|
|
|
600
617
|
```css
|
|
601
618
|
.sizer {
|
|
@@ -604,7 +621,11 @@ The `queueShow` system toggles a `hidden` CSS class. Elements must start with `h
|
|
|
604
621
|
}
|
|
605
622
|
```
|
|
606
623
|
|
|
607
|
-
|
|
624
|
+
---
|
|
625
|
+
|
|
626
|
+
#### `DelayedPlacer` — absolute positioning
|
|
627
|
+
|
|
628
|
+
`DelayedPlacer` writes `style.left` / `style.top` on the child. The `.placer` wrapper must be `position: relative` so the child's absolute coordinates are relative to it.
|
|
608
629
|
|
|
609
630
|
```css
|
|
610
631
|
.placer {
|
|
@@ -615,6 +636,8 @@ The `queueShow` system toggles a `hidden` CSS class. Elements must start with `h
|
|
|
615
636
|
}
|
|
616
637
|
```
|
|
617
638
|
|
|
639
|
+
No transition is needed on `.placer` itself — placement jumps immediately to the measured position.
|
|
640
|
+
|
|
618
641
|
---
|
|
619
642
|
|
|
620
643
|
### System Architecture
|