@rokkit/actions 1.4.1 → 1.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/actions",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "Contains generic actions that can be used in various components.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,8 @@
16
16
  "prepublishOnly": "cp ../../LICENSE . && tsc --project tsconfig.build.json",
17
17
  "postpublish": "rm -f LICENSE",
18
18
  "clean": "rm -rf dist",
19
- "build": "bun clean && bun prepublishOnly"
19
+ "build": "bun clean && bun prepublishOnly",
20
+ "check:build": "bun run clean && tsc --project tsconfig.build.json"
20
21
  },
21
22
  "files": [
22
23
  "src/**/*.js",
package/src/navigator.js CHANGED
@@ -85,7 +85,11 @@ const INTERACTIVE_SELECTOR = [
85
85
  */
86
86
  function isNestedInteractive(target, root) {
87
87
  const el = /** @type {HTMLElement|null} */ (target)
88
+ /* v8 ignore start -- a dispatched DOM event always carries a target; the null
89
+ branch exists for the EventTarget|null type, not for a reachable state.
90
+ `ignore next` does not fire on a single-line `if (...) return`. */
88
91
  if (!el) return false
92
+ /* v8 ignore stop */
89
93
  const interactive = /** @type {HTMLElement|null} */ (el.closest(INTERACTIVE_SELECTOR))
90
94
  if (!interactive || !root.contains(interactive)) return false
91
95
  // A nested element explicitly declared as an accordion trigger is a
@@ -122,7 +126,9 @@ function isStrictlyInsideItem(el, interactive) {
122
126
  */
123
127
  function isDisabledItem(target, root) {
124
128
  const el = /** @type {HTMLElement|null} */ (target)
129
+ /* v8 ignore start -- see isNestedInteractive: event.target is never null */
125
130
  if (!el) return false
131
+ /* v8 ignore stop */
126
132
  const dataPathEl = /** @type {HTMLElement|null} */ (el.closest('[data-path]'))
127
133
  if (!dataPathEl || !root.contains(dataPathEl)) return false
128
134
  if (dataPathEl.hasAttribute('data-disabled')) return true
@@ -37,7 +37,13 @@ function syncWithStorage(theme, storageKey) {
37
37
  }
38
38
  }
39
39
 
40
- $effect.root(() => {
40
+ // A plain $effect, not $effect.root. `$effect.root` creates a root detached
41
+ // from the surrounding lifecycle and hands the caller its disposer — which this
42
+ // code discarded, so the listener was never removed and every re-application of
43
+ // the action added another one. The sibling $effect above establishes that we
44
+ // are in an effect context, so a plain $effect ties the listener to the action's
45
+ // lifetime and its teardown actually runs.
46
+ $effect(() => {
41
47
  window.addEventListener('storage', handleStorage)
42
48
  return () => window.removeEventListener('storage', handleStorage)
43
49
  })
package/src/utils.js CHANGED
@@ -75,7 +75,10 @@ function findClosestWithAttribute(element, attribute) {
75
75
  * @returns {boolean}
76
76
  */
77
77
  function isAccordionTrigger(target) {
78
+ /* v8 ignore start -- unreachable: the only caller is isToggleTarget, which
79
+ dereferences target.parentElement first and would throw on null. */
78
80
  if (!target) return false
81
+ /* v8 ignore stop */
79
82
  const trigger = findClosestWithAttribute(target, 'data-accordion-trigger')
80
83
  return trigger !== null
81
84
  }