@rokkit/core 1.3.0 → 1.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/core",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Contains core utility functions and classes that can be used in various components.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,6 +46,6 @@
46
46
  "ramda": "^0.32.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@rokkit/icons": "1.3.0"
49
+ "@rokkit/icons": "1.3.1"
50
50
  }
51
51
  }
package/src/theme.ts CHANGED
@@ -270,6 +270,7 @@ export class Theme {
270
270
  if (name === 'on-primary') {
271
271
  return this.#adapter.wrap(this.#onColorHex('primary', colors))
272
272
  }
273
+ /* v8 ignore next -- on-primary is the only 'derived' token, so this default is unreachable */
273
274
  return undefined
274
275
  }
275
276
 
package/src/utils.js CHANGED
@@ -172,12 +172,13 @@ export function getSnippet(obj, key, defaultSnippet = null) {
172
172
  /**
173
173
  * Resolve which snippet to render for a proxy item.
174
174
  *
175
- * Checks proxy.snippet for a per-item named override first (e.g. item.snippet = 'highlighted').
175
+ * Reads the proxy's `snippet` field (via proxy.get('snippet'), honoring fields.snippet)
176
+ * for a per-item named override first (e.g. item.snippet = 'highlighted').
176
177
  * Falls back to the component-level fallback snippet name (e.g. 'itemContent' / 'groupContent').
177
178
  * Returns null if neither is found.
178
179
  *
179
180
  * @param {Record<string, unknown>} snippets - snippets passed to the component
180
- * @param {{ snippet?: string | null }} proxy - any object with an optional .snippet property
181
+ * @param {{ get: (key: string) => unknown }} proxy - a ProxyItem; its snippet field is read via proxy.get('snippet')
181
182
  * @param {string} [fallback] - fallback snippet name; defaults to ITEM_SNIPPET ('itemContent')
182
183
  * @returns {Function | null}
183
184
  */
@@ -190,7 +191,9 @@ function asSnippet(value) {
190
191
  }
191
192
 
192
193
  export function resolveSnippet(snippets, proxy, fallback = ITEM_SNIPPET) {
193
- const name = proxy && proxy.snippet
194
+ // `snippet` is a field-mapped prop like icon/href — read it via the proxy's
195
+ // field accessor (honors fields.snippet), not as a direct property.
196
+ const name = proxy?.get('snippet')
194
197
  return asSnippet(name && snippets[name]) || asSnippet(snippets[fallback])
195
198
  }
196
199