@rokkit/actions 1.1.14 → 1.1.16

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.
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Applies theme variables to an element
3
- * @param {HTMLElement} node - Element to apply variables to
4
- * @param {Object.<string, string>} variables - CSS variables and their values
2
+ * Apply named-token CSS custom properties to an element as inline styles.
3
+ * A per-instance / runtime color applicator — complementary to the `data-skin`
4
+ * cascade (use `vibe.skin` + `themable` for app-wide named skins; use this to
5
+ * apply a colorset that isn't pre-baked, e.g. a dynamic or server-configured skin).
6
+ *
7
+ * @param {HTMLElement} node
8
+ * @param {Record<string, string>} variables - CSS var name → value, e.g. { '--primary': 'oklch(...)' }
5
9
  */
6
- export function skinnable(node: HTMLElement, variables: {
7
- [x: string]: string;
8
- }): void;
10
+ export function skinnable(node: HTMLElement, variables: Record<string, string>): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/actions",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "Contains generic actions that can be used in various components.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,7 +1,11 @@
1
1
  /**
2
- * Applies theme variables to an element
3
- * @param {HTMLElement} node - Element to apply variables to
4
- * @param {Object.<string, string>} variables - CSS variables and their values
2
+ * Apply named-token CSS custom properties to an element as inline styles.
3
+ * A per-instance / runtime color applicator — complementary to the `data-skin`
4
+ * cascade (use `vibe.skin` + `themable` for app-wide named skins; use this to
5
+ * apply a colorset that isn't pre-baked, e.g. a dynamic or server-configured skin).
6
+ *
7
+ * @param {HTMLElement} node
8
+ * @param {Record<string, string>} variables - CSS var name → value, e.g. { '--primary': 'oklch(...)' }
5
9
  */
6
10
  export function skinnable(node, variables) {
7
11
  $effect(() => {
@@ -1,4 +1,4 @@
1
- const DEFAULT_THEME = { style: 'rokkit', mode: 'dark', density: 'comfortable' }
1
+ const DEFAULT_THEME = { style: 'rokkit', mode: 'dark', density: 'comfortable', skin: 'default' }
2
2
 
3
3
  /**
4
4
  * Update the theme attributes when the state changes.
@@ -26,7 +26,7 @@ export function themable(root, options) {
26
26
  theme.update(newTheme)
27
27
  } catch (e) {
28
28
  // eslint-disable-next-line no-console
29
- console.warn(`Failed to parse theme from storage event for key "${storageKey}"`, e)
29
+ console.warn('Failed to parse theme from storage event for key "%s"', storageKey, e)
30
30
  }
31
31
  }
32
32
  }
@@ -40,6 +40,7 @@ export function themable(root, options) {
40
40
  root.dataset.style = theme.style
41
41
  root.dataset.mode = theme.mode
42
42
  root.dataset.density = theme.density
43
+ root.dataset.skin = theme.skin
43
44
 
44
45
  // Mirror onto documentElement too. The flash-prevention init script
45
46
  // sets `html.dataset.*` before body parses; without this mirror,
@@ -53,6 +54,7 @@ export function themable(root, options) {
53
54
  el.dataset.style = theme.style
54
55
  el.dataset.mode = theme.mode
55
56
  el.dataset.density = theme.density
57
+ el.dataset.skin = theme.skin
56
58
  }
57
59
 
58
60
  // if (storageKey) theme.save(storageKey)