@vio-live/web-sdk 0.4.0 → 0.4.1
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 +37 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,6 +97,43 @@ function Shop() {
|
|
|
97
97
|
|
|
98
98
|
Wrappers: `VioProduct`, `VioProductCarousel`, `VioProductDetail`, `VioCart`, `VioCheckout`.
|
|
99
99
|
|
|
100
|
+
## Theming
|
|
101
|
+
|
|
102
|
+
Every component reads its colors and fonts from `--vio-*` CSS custom properties
|
|
103
|
+
(shadow DOM inherits these from the light DOM, so this reaches every component,
|
|
104
|
+
including the Apple Pay/Klarna/Vipps panels). `applyVioTheme` is the one
|
|
105
|
+
supported way to override them — don't set `--vio-*` properties by hand, and
|
|
106
|
+
don't rely on the internal variable names staying stable across versions:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
import { applyVioTheme } from '@vio-live/web-sdk/ui' // or '/react'
|
|
110
|
+
|
|
111
|
+
applyVioTheme({
|
|
112
|
+
colorAccent: '#0044ff',
|
|
113
|
+
colorText: '#111111',
|
|
114
|
+
fontSerif: '"Playfair Display", Georgia, serif',
|
|
115
|
+
fontSans: '"Inter", sans-serif',
|
|
116
|
+
})
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
A curated set on purpose — colors + fonts, not the full internal token list
|
|
120
|
+
(spacing/radius/sizes stay implementation detail). Call it again any time
|
|
121
|
+
(e.g. after a user picks a different brand color in a settings UI) — pass
|
|
122
|
+
`null`/`undefined` for a key to revert it to the SDK default instead of
|
|
123
|
+
leaving a stale override behind:
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
applyVioTheme({ colorAccent: null }) // back to the default #c14a3b
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
By default it sets the override on `document.documentElement` (`:root`, the
|
|
130
|
+
whole page). Pass a second argument to scope it to one element instead —
|
|
131
|
+
useful if you show multiple differently-branded sponsors on the same page:
|
|
132
|
+
|
|
133
|
+
```ts
|
|
134
|
+
applyVioTheme({ colorAccent: '#ff6600' }, document.getElementById('sponsor-2'))
|
|
135
|
+
```
|
|
136
|
+
|
|
100
137
|
## Headless / SSR
|
|
101
138
|
|
|
102
139
|
The root and `/core` entries export the framework-agnostic core with **no DOM side-effects** — SSR-safe and **tree-shakeable** (importing one helper pulls only that helper, ~0.5 kB):
|