@standardbeagle/edit-db 0.4.454 → 0.4.455

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.
@@ -7,6 +7,12 @@ interface RowData {
7
7
  id?: number | string;
8
8
  [key: string]: unknown;
9
9
  }
10
+ /**
11
+ * Clamp a page index into the valid [0, pageCount-1] range. Guards against a
12
+ * stale/out-of-range page (e.g. "page 2 of 1" after switching to a smaller
13
+ * table or when the row count shrinks).
14
+ */
15
+ export declare function clampPageIndex(pageIndex: number, pageCount: number): number;
10
16
  export declare function getMultiJoinRows(row: RowData, join: Join): RowData[];
11
17
  /**
12
18
  * Return type for the useDataTable hook.
@@ -7,6 +7,12 @@ interface NavContext {
7
7
  interface RouteParams {
8
8
  [key: string]: string | undefined;
9
9
  }
10
+ interface PathData {
11
+ path: string;
12
+ data: RouteParams;
13
+ hash: string;
14
+ query: string;
15
+ }
10
16
  interface NavigationState extends NavContext {
11
17
  navigate: (path: string) => void;
12
18
  back: (count?: number) => void;
@@ -25,6 +31,10 @@ interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
25
31
  to: string;
26
32
  children?: ReactNode;
27
33
  }
34
+ interface PathMatch extends PathData {
35
+ isMatch: boolean;
36
+ remainer: string;
37
+ }
28
38
  export declare function usePath(): string;
29
39
  export declare function useHistory(): string[];
30
40
  export declare function useNavigate(): (url: string) => void;
@@ -40,6 +50,20 @@ export declare const Link: React.ForwardRefExoticComponent<LinkProps & React.Ref
40
50
  export declare function Routes({ children }: {
41
51
  children: ReactNode;
42
52
  }): React.JSX.Element;
53
+ /** Higher = more specific: literal segments rank above `:param`, which ranks above `*`. */
54
+ export declare function routeSpecificity(route: string): number;
55
+ /**
56
+ * Picks the single most-specific matching route for a path. When several
57
+ * same-length routes match (a literal segment vs a `:param` at the same
58
+ * position, e.g. `/:table/edit` vs `/:table/:id` for "/users/edit"), the
59
+ * literal route wins so a route keyword like "edit" is never captured as an
60
+ * `:id` and fired off as a bogus get-by-id ($id="edit"). Ties keep declaration
61
+ * order.
62
+ */
63
+ export declare function selectRoute(routePaths: string[], path: string): {
64
+ route: string;
65
+ match: PathMatch;
66
+ } | null;
43
67
  export declare function Route({ path, element }: {
44
68
  path: string;
45
69
  element: ReactElement;
@@ -2,6 +2,8 @@
2
2
  export type ContentKind = 'json' | 'xml' | 'php-serialized' | 'binary' | 'longtext' | 'text';
3
3
  /** Check if a dbType is a binary/blob type */
4
4
  export declare function isBinaryDbType(dbType: string): boolean;
5
+ /** Check if a dbType is a native JSON type (json, jsonb). */
6
+ export declare function isJsonDbType(dbType: string): boolean;
5
7
  /** Check if a dbType is a long text type (text, ntext, varchar(max), xml) */
6
8
  export declare function isLongTextDbType(dbType: string): boolean;
7
9
  /** Detect content kind from a string value and optional dbType hint */
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@standardbeagle/edit-db",
3
3
  "private": false,
4
- "version": "0.4.454",
4
+ "version": "0.4.455",
5
5
  "type": "module",
6
6
  "dependencies": {
7
7
  "@radix-ui/react-slot": "^1.2.4",