@streamoid/ui 0.6.56 → 0.6.58

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.
@@ -230,10 +230,14 @@ routes work, don't pass both.
230
230
  DOM class list literally contains `undefined`. Harmless in the browser, but it
231
231
  shows up in snapshot tests — don't assert on the exact class string.
232
232
 
233
- **9. jsdom tests need a stub.** Importing from the `@streamoid/ui` barrel pulls
234
- `ScButton`, which touches `CSS.registerProperty` at module load. Both host repos
235
- `vi.mock("@streamoid/ui")` with a div that surfaces `state` and forwards `onClick`
236
- (see `catalogix/dashboard app/tests/formControls.test.jsx`).
233
+ **9. jsdom tests no longer need a stub (0.6.58+).** Importing from the
234
+ `@streamoid/ui` barrel pulls `ScButton`, which touches `CSS.registerProperty` at
235
+ module load. Its guard used to reach for `CSS` as soon as `window` existed —
236
+ and jsdom defines `window` but NOT `CSS`, so the whole barrel threw on import.
237
+ Hosts worked around it with `vi.mock("@streamoid/ui")` and a hand-written stub
238
+ (see `catalogix/dashboard app/tests/formControls.test.jsx`). The guard now
239
+ checks `typeof CSS` first, so the real component renders in jsdom and those
240
+ mocks can go as each host gets to them.
237
241
 
238
242
  ---
239
243
 
@@ -193,10 +193,12 @@ handler even though the switch ignores it.
193
193
  **9. No transition.** ON and OFF are two different SVG trees, so React swaps them —
194
194
  the knob teleports. Don't promise a sliding animation in a spec.
195
195
 
196
- **10. jsdom tests need a stub.** Host repos mock `@streamoid/ui` (see
197
- `catalogix/dashboard app/tests/formControls.test.jsx`, which stubs
198
- `ScToggleSwitch` with a div exposing `data-checked`) because the barrel import
199
- touches `CSS.registerProperty`.
196
+ **10. jsdom tests no longer need a stub (0.6.58+).** Host repos mocked
197
+ `@streamoid/ui` (see `catalogix/dashboard app/tests/formControls.test.jsx`,
198
+ which stubs `ScToggleSwitch` with a div exposing `data-checked`) because the
199
+ barrel import touched `CSS.registerProperty` where jsdom provides `window` but
200
+ no `CSS`. The guard now checks `typeof CSS` first, so the real component
201
+ renders and those mocks can go as each host gets to them.
200
202
 
201
203
  ---
202
204
 
package/dist/index.d.mts CHANGED
@@ -1067,6 +1067,10 @@ interface StreamoidSearchShortcutEvent {
1067
1067
  metaKey: boolean;
1068
1068
  ctrlKey: boolean;
1069
1069
  altKey: boolean;
1070
+ /** `true` on the `keydown`s the OS synthesises while the chord is HELD.
1071
+ * Optional so a caller hand-building an event object does not have to know
1072
+ * about it; absent reads as a first press. */
1073
+ repeat?: boolean;
1070
1074
  }
1071
1075
  /**
1072
1076
  * Is this keydown the search chord?
@@ -1080,6 +1084,11 @@ interface StreamoidSearchShortcutEvent {
1080
1084
  * resolved through the keyboard layout. `code` is physical, so on AZERTY or
1081
1085
  * Dvorak the key labelled K is not `KeyK` and the shortcut would land under
1082
1086
  * a different letter than the `⌘ K` hint promises.
1087
+ * - A REPEAT IS NOT A SECOND PRESS. Auto-repeat fires `keydown` every few
1088
+ * tens of ms once the OS delay passes, and the hook drives a TOGGLE — so
1089
+ * without this, holding the chord flickers the dialog open and shut for as
1090
+ * long as the key is down. Found by review on cxo-dashboard, where the
1091
+ * hand-rolled listener this replaces had exactly that bug.
1083
1092
  */
1084
1093
  declare function matchesStreamoidSearchShortcut(event: StreamoidSearchShortcutEvent, letter?: string): boolean;
1085
1094
  interface StreamoidSearchShortcutOptions {
package/dist/index.d.ts CHANGED
@@ -1067,6 +1067,10 @@ interface StreamoidSearchShortcutEvent {
1067
1067
  metaKey: boolean;
1068
1068
  ctrlKey: boolean;
1069
1069
  altKey: boolean;
1070
+ /** `true` on the `keydown`s the OS synthesises while the chord is HELD.
1071
+ * Optional so a caller hand-building an event object does not have to know
1072
+ * about it; absent reads as a first press. */
1073
+ repeat?: boolean;
1070
1074
  }
1071
1075
  /**
1072
1076
  * Is this keydown the search chord?
@@ -1080,6 +1084,11 @@ interface StreamoidSearchShortcutEvent {
1080
1084
  * resolved through the keyboard layout. `code` is physical, so on AZERTY or
1081
1085
  * Dvorak the key labelled K is not `KeyK` and the shortcut would land under
1082
1086
  * a different letter than the `⌘ K` hint promises.
1087
+ * - A REPEAT IS NOT A SECOND PRESS. Auto-repeat fires `keydown` every few
1088
+ * tens of ms once the OS delay passes, and the hook drives a TOGGLE — so
1089
+ * without this, holding the chord flickers the dialog open and shut for as
1090
+ * long as the key is down. Found by review on cxo-dashboard, where the
1091
+ * hand-rolled listener this replaces had exactly that bug.
1083
1092
  */
1084
1093
  declare function matchesStreamoidSearchShortcut(event: StreamoidSearchShortcutEvent, letter?: string): boolean;
1085
1094
  interface StreamoidSearchShortcutOptions {
package/dist/index.js CHANGED
@@ -1752,7 +1752,7 @@ var ScButton_default = {
1752
1752
  var import_icons7 = require("@streamoid/icons");
1753
1753
  var import_react6 = require("react");
1754
1754
  var import_jsx_runtime16 = require("react/jsx-runtime");
1755
- if (typeof window !== "undefined" && CSS.registerProperty) {
1755
+ if (typeof window !== "undefined" && typeof CSS !== "undefined" && typeof CSS.registerProperty === "function") {
1756
1756
  const props = [
1757
1757
  { name: "--x-0", val: "72%" },
1758
1758
  { name: "--y-0", val: "90%" },
@@ -6185,6 +6185,7 @@ function ScWorkspaceAccountMenu({
6185
6185
  var import_react19 = require("react");
6186
6186
  function matchesStreamoidSearchShortcut(event, letter = "k") {
6187
6187
  if (event.altKey) return false;
6188
+ if (event.repeat) return false;
6188
6189
  if (!event.metaKey && !event.ctrlKey) return false;
6189
6190
  return event.key.toLowerCase() === letter.toLowerCase();
6190
6191
  }
package/dist/index.mjs CHANGED
@@ -1553,7 +1553,7 @@ var ScButton_default = {
1553
1553
  import { SiconHome as SiconHome2 } from "@streamoid/icons";
1554
1554
  import { useState as useState4, useEffect as useEffect2, isValidElement, cloneElement } from "react";
1555
1555
  import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
1556
- if (typeof window !== "undefined" && CSS.registerProperty) {
1556
+ if (typeof window !== "undefined" && typeof CSS !== "undefined" && typeof CSS.registerProperty === "function") {
1557
1557
  const props = [
1558
1558
  { name: "--x-0", val: "72%" },
1559
1559
  { name: "--y-0", val: "90%" },
@@ -5995,6 +5995,7 @@ function ScWorkspaceAccountMenu({
5995
5995
  import { useEffect as useEffect5, useRef as useRef6 } from "react";
5996
5996
  function matchesStreamoidSearchShortcut(event, letter = "k") {
5997
5997
  if (event.altKey) return false;
5998
+ if (event.repeat) return false;
5998
5999
  if (!event.metaKey && !event.ctrlKey) return false;
5999
6000
  return event.key.toLowerCase() === letter.toLowerCase();
6000
6001
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoid/ui",
3
- "version": "0.6.56",
3
+ "version": "0.6.58",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -22,7 +22,8 @@
22
22
  "dev": "sh -c 'npm run watch:js & npm run watch:dts & wait'",
23
23
  "lint": "eslint src/",
24
24
  "test:panel-resize": "npm run build:js && node --test tests/panel-resize.test.mjs",
25
- "test:search-shortcut": "npm run build:js && node --test tests/search-shortcut.test.mjs"
25
+ "test:search-shortcut": "npm run build:js && node --test tests/search-shortcut.test.mjs",
26
+ "test:barrel-import": "npm run build:js && node --test tests/barrel-import-in-jsdom.test.mjs"
26
27
  },
27
28
  "peerDependencies": {
28
29
  "react": "^18.0.0 || ^19.0.0",