rockin 0.0.30 → 0.0.32
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/dist/hooks/index.d.ts +8 -1
- package/dist/hooks/index.js +49 -1
- package/dist/styles.css +4 -0
- package/dist/ui/index.js +3 -15
- package/package.json +1 -1
package/dist/hooks/index.d.ts
CHANGED
|
@@ -57,6 +57,13 @@ declare function useSearchParams(): {
|
|
|
57
57
|
transactionPage: number;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
type SideRail = "left" | "right" | null;
|
|
61
|
+
/**
|
|
62
|
+
* Which screen edge has a wide, empty safe-area strip that can hold a vertical
|
|
63
|
+
* nav rail, such as the sensor column on the iPhone Duo. `null` everywhere else.
|
|
64
|
+
*/
|
|
65
|
+
declare function useSideRail(): SideRail;
|
|
66
|
+
|
|
60
67
|
declare function useDataTablePagination(): {
|
|
61
68
|
pageIndex: number;
|
|
62
69
|
pageSize: number;
|
|
@@ -115,4 +122,4 @@ declare function useGridChanges<TData extends Record<string, unknown>>(grid: Dat
|
|
|
115
122
|
reconcile: (succeededIds: string[], failedIds?: string[]) => void;
|
|
116
123
|
};
|
|
117
124
|
|
|
118
|
-
export { searchFocus, useDataGridClipboard, useDataGridFillHandle, useDataGridMove, useDataTablePagination, useDataTableRows, useDataTableSearch, useFullscreen, useGridChanges, useMediaQuery, useMounted, useNative, useSearchParams };
|
|
125
|
+
export { type SideRail, searchFocus, useDataGridClipboard, useDataGridFillHandle, useDataGridMove, useDataTablePagination, useDataTableRows, useDataTableSearch, useFullscreen, useGridChanges, useMediaQuery, useMounted, useNative, useSearchParams, useSideRail };
|
package/dist/hooks/index.js
CHANGED
|
@@ -260,6 +260,53 @@ function useSearchParams() {
|
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
|
|
263
|
+
// src/hooks/useSideRail.ts
|
|
264
|
+
import { useSyncExternalStore } from "react";
|
|
265
|
+
var RAIL_MIN_INSET = 64;
|
|
266
|
+
var RAIL_MAX_OPPOSITE = 16;
|
|
267
|
+
var probe = null;
|
|
268
|
+
function readInsets() {
|
|
269
|
+
if (!probe) {
|
|
270
|
+
probe = document.createElement("div");
|
|
271
|
+
probe.setAttribute("aria-hidden", "true");
|
|
272
|
+
probe.style.cssText = "position:fixed;top:0;left:0;width:0;height:0;visibility:hidden;pointer-events:none;padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px)";
|
|
273
|
+
document.body.appendChild(probe);
|
|
274
|
+
}
|
|
275
|
+
const style = getComputedStyle(probe);
|
|
276
|
+
return {
|
|
277
|
+
left: Number.parseFloat(style.paddingLeft) || 0,
|
|
278
|
+
right: Number.parseFloat(style.paddingRight) || 0
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function getSnapshot() {
|
|
282
|
+
const { left, right } = readInsets();
|
|
283
|
+
if (right >= RAIL_MIN_INSET && left <= RAIL_MAX_OPPOSITE) return "right";
|
|
284
|
+
if (left >= RAIL_MIN_INSET && right <= RAIL_MAX_OPPOSITE) return "left";
|
|
285
|
+
return null;
|
|
286
|
+
}
|
|
287
|
+
function subscribe(onChange) {
|
|
288
|
+
readInsets();
|
|
289
|
+
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(onChange);
|
|
290
|
+
if (probe) observer?.observe(probe, { box: "border-box" });
|
|
291
|
+
let frame = 0;
|
|
292
|
+
const onViewportChange = () => {
|
|
293
|
+
onChange();
|
|
294
|
+
cancelAnimationFrame(frame);
|
|
295
|
+
frame = requestAnimationFrame(onChange);
|
|
296
|
+
};
|
|
297
|
+
window.addEventListener("resize", onViewportChange);
|
|
298
|
+
window.addEventListener("orientationchange", onViewportChange);
|
|
299
|
+
return () => {
|
|
300
|
+
observer?.disconnect();
|
|
301
|
+
cancelAnimationFrame(frame);
|
|
302
|
+
window.removeEventListener("resize", onViewportChange);
|
|
303
|
+
window.removeEventListener("orientationchange", onViewportChange);
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
function useSideRail() {
|
|
307
|
+
return useSyncExternalStore(subscribe, getSnapshot, () => null);
|
|
308
|
+
}
|
|
309
|
+
|
|
263
310
|
// src/ui/data-table/hooks/use-data-grid-clipboard.ts
|
|
264
311
|
function useDataGridClipboard() {
|
|
265
312
|
return {
|
|
@@ -382,5 +429,6 @@ export {
|
|
|
382
429
|
useMediaQuery,
|
|
383
430
|
useMounted,
|
|
384
431
|
useNative,
|
|
385
|
-
useSearchParams
|
|
432
|
+
useSearchParams,
|
|
433
|
+
useSideRail
|
|
386
434
|
};
|
package/dist/styles.css
CHANGED
|
@@ -372,6 +372,10 @@ html[data-native-app="true"][data-native-device="mac"] {
|
|
|
372
372
|
font-synthesis-weight: none;
|
|
373
373
|
text-rendering: optimizeLegibility;
|
|
374
374
|
-webkit-tap-highlight-color: transparent;
|
|
375
|
+
/* Keep content clear of side safe areas: landscape notches and the
|
|
376
|
+
* iPhone Duo sensor strip, which iOS reports as a side inset. */
|
|
377
|
+
padding-left: env(safe-area-inset-left, 0px);
|
|
378
|
+
padding-right: env(safe-area-inset-right, 0px);
|
|
375
379
|
@apply bg-background text-foreground;
|
|
376
380
|
}
|
|
377
381
|
[data-slot="layout"] {
|
package/dist/ui/index.js
CHANGED
|
@@ -5578,7 +5578,7 @@ function Image({
|
|
|
5578
5578
|
onLoad,
|
|
5579
5579
|
onError,
|
|
5580
5580
|
children,
|
|
5581
|
-
fallback = /* @__PURE__ */ jsx36(JellyMini, { mood: "curious", className: "size-full p-
|
|
5581
|
+
fallback = /* @__PURE__ */ jsx36(JellyMini, { mood: "curious", className: "size-full p-[12%]" }),
|
|
5582
5582
|
...props
|
|
5583
5583
|
}) {
|
|
5584
5584
|
const currentSrc = srcValue(src);
|
|
@@ -6281,6 +6281,7 @@ function MessageScrollerButton({
|
|
|
6281
6281
|
}
|
|
6282
6282
|
|
|
6283
6283
|
// src/ui/numberstepper.tsx
|
|
6284
|
+
import { TrashBin } from "@gravity-ui/icons";
|
|
6284
6285
|
import { cn as cn39 } from "cn";
|
|
6285
6286
|
import { AnimatePresence as AnimatePresence2, motion as motion6, useReducedMotion } from "motion/react";
|
|
6286
6287
|
import {
|
|
@@ -6585,20 +6586,7 @@ var NumberStepper = forwardRef4(
|
|
|
6585
6586
|
look.button,
|
|
6586
6587
|
"enabled:hover:bg-destructive/10 enabled:hover:text-destructive"
|
|
6587
6588
|
),
|
|
6588
|
-
children: /* @__PURE__ */ jsx42(
|
|
6589
|
-
"svg",
|
|
6590
|
-
{
|
|
6591
|
-
viewBox: "0 0 16 16",
|
|
6592
|
-
"aria-hidden": true,
|
|
6593
|
-
className: styles.icon,
|
|
6594
|
-
fill: "none",
|
|
6595
|
-
stroke: "currentColor",
|
|
6596
|
-
strokeWidth: 1.5,
|
|
6597
|
-
strokeLinecap: "round",
|
|
6598
|
-
strokeLinejoin: "round",
|
|
6599
|
-
children: /* @__PURE__ */ jsx42("path", { d: "M2.75 4.5h10.5M6.25 4.5V3h3.5v1.5M4.25 4.5l.6 8.5h6.3l.6-8.5M6.75 7v3.5M9.25 7v3.5" })
|
|
6600
|
-
}
|
|
6601
|
-
)
|
|
6589
|
+
children: /* @__PURE__ */ jsx42(TrashBin, { "aria-hidden": true, className: cn39("size-3!", styles.icon) })
|
|
6602
6590
|
},
|
|
6603
6591
|
"remove"
|
|
6604
6592
|
);
|