@platform-blocks/ui 0.4.0 → 0.6.0
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/lib/cjs/index.js +684 -1211
- package/lib/cjs/index.js.map +1 -1
- package/lib/components/Avatar/Avatar.d.ts +1 -1
- package/lib/components/Avatar/types.d.ts +3 -3
- package/lib/components/Carousel/types.d.ts +32 -0
- package/lib/components/DataTable/DataTable.d.ts +1 -1
- package/lib/components/DataTable/types.d.ts +2 -0
- package/lib/components/HoverCard/types.d.ts +4 -2
- package/lib/components/Popover/types.d.ts +2 -0
- package/lib/components/Slider/types.d.ts +29 -1
- package/lib/components/Switch/styles.d.ts +1 -1
- package/lib/components/TextArea/styles.d.ts +1 -1
- package/lib/components/index.d.ts +0 -2
- package/lib/core/providers/OverlayProvider.d.ts +1 -1
- package/lib/core/theme/PlatformBlocksProvider.d.ts +1 -5
- package/lib/esm/index.js +685 -1193
- package/lib/esm/index.js.map +1 -1
- package/lib/index.d.ts +0 -7
- package/package.json +1 -1
- package/lib/components/Can/Can.d.ts +0 -30
- package/lib/components/Can/PermissionDemo.d.ts +0 -2
- package/lib/components/Can/ability.d.ts +0 -89
- package/lib/components/Can/builder.d.ts +0 -113
- package/lib/components/Can/context.d.ts +0 -25
- package/lib/components/Can/index.d.ts +0 -6
- package/lib/components/Can/types.d.ts +0 -230
- package/lib/components/HoverCard/index.d.ts +0 -2
- package/lib/components/NavigationProgress/NavigationProgress.d.ts +0 -4
- package/lib/components/NavigationProgress/defaults.d.ts +0 -8
- package/lib/components/NavigationProgress/hooks/useNavigationProgressState.d.ts +0 -1
- package/lib/components/NavigationProgress/index.d.ts +0 -2
- package/lib/components/NavigationProgress/styles/resolver.d.ts +0 -1
- package/lib/components/NavigationProgress/tokens.d.ts +0 -4
- package/lib/components/NavigationProgress/types.d.ts +0 -30
package/lib/index.d.ts
CHANGED
|
@@ -95,20 +95,15 @@ export { Skeleton } from './components/Skeleton';
|
|
|
95
95
|
export { Loader } from './components/Loader';
|
|
96
96
|
export { Gauge } from './components/Gauge';
|
|
97
97
|
export { Ring } from './components/Ring';
|
|
98
|
-
export { NavigationProgress, navigationProgress } from './components/NavigationProgress';
|
|
99
98
|
export { Toast, ToastProvider, useToast, useToastApi, onToastsRequested } from './components/Toast';
|
|
100
99
|
export { Dialog, DialogProvider, DialogRenderer, useDialog, useDialogApi, useDialogs, useSimpleDialog, onDialogsRequested } from './components/Dialog';
|
|
101
100
|
export { Tooltip } from './components/Tooltip';
|
|
102
101
|
export { Overlay } from './components/Overlay';
|
|
103
102
|
export { LoadingOverlay } from './components/LoadingOverlay';
|
|
104
|
-
export { HoverCard } from './components/HoverCard';
|
|
105
103
|
export { ContextMenu } from './components/ContextMenu';
|
|
106
104
|
export { Popover } from './components/Popover';
|
|
107
105
|
export { Spotlight, SpotlightProvider, useSpotlightStore, spotlight, createSpotlightStore, useSpotlightStoreInstance, useDirectSpotlightState, directSpotlight, onSpotlightRequested } from './components/Spotlight';
|
|
108
106
|
export { FloatingActions } from './components/FloatingActions';
|
|
109
|
-
export { Can, CanWithConditions, Cannot, PermissionGate, withCan, withCannot } from './components/Can';
|
|
110
|
-
export { PermissionProvider, usePermissions, useAbility } from './components/Can';
|
|
111
|
-
export { AbilityCore, PermissionBuilder, RoleBuilder, PermissionPatterns, permissions, defineAbility, defineRoleAbility } from './components/Can';
|
|
112
107
|
export { Icon } from './components';
|
|
113
108
|
export { IconButton } from './components/IconButton';
|
|
114
109
|
export { Image } from './components/Image';
|
|
@@ -206,11 +201,9 @@ export type { RingProps, RingColorStop, RingRenderContext } from './components/R
|
|
|
206
201
|
export type { ToastProps } from './components/Toast';
|
|
207
202
|
export type { DialogProps, DialogConfig, UseSimpleDialogOptions } from './components/Dialog';
|
|
208
203
|
export type { TooltipProps } from './components/Tooltip';
|
|
209
|
-
export type { HoverCardProps } from './components/HoverCard';
|
|
210
204
|
export type { ContextMenuProps } from './components/ContextMenu';
|
|
211
205
|
export type { PopoverProps, PopoverTargetProps, PopoverDropdownProps } from './components/Popover';
|
|
212
206
|
export type { SpotlightProps } from './components/Spotlight';
|
|
213
|
-
export type { Action, Subject, Field, Conditions, PermissionRule, PermissionCheck, Ability, CanProps, CanWithConditionsProps, CannotProps, PermissionGateProps, PermissionContextValue, PermissionProviderProps, UsePermissionsOptions } from './components/Can';
|
|
214
207
|
export type { BrandIconProps, BrandName } from './components/BrandIcon';
|
|
215
208
|
export type { CollapseProps } from './components/Collapse';
|
|
216
209
|
export type { IconButtonProps } from './components/IconButton';
|
package/package.json
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { CanProps, CanWithConditionsProps, CannotProps, PermissionGateProps } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Can Component - Renders children if permission is granted
|
|
5
|
-
*/
|
|
6
|
-
export declare const Can: React.FC<CanProps>;
|
|
7
|
-
/**
|
|
8
|
-
* Can Component with conditions - For object-level permissions
|
|
9
|
-
*/
|
|
10
|
-
export declare const CanWithConditions: React.FC<CanWithConditionsProps>;
|
|
11
|
-
/**
|
|
12
|
-
* Cannot Component - Renders children if permission is NOT granted
|
|
13
|
-
*/
|
|
14
|
-
export declare const Cannot: React.FC<CannotProps>;
|
|
15
|
-
/**
|
|
16
|
-
* Permission Gate - Requires ALL permissions to pass
|
|
17
|
-
*/
|
|
18
|
-
export declare const PermissionGate: React.FC<PermissionGateProps>;
|
|
19
|
-
/**
|
|
20
|
-
* Higher-Order Component for permission checking
|
|
21
|
-
*/
|
|
22
|
-
export declare function withCan<P extends object>(action: string, subject?: any, field?: string): (Component: React.ComponentType<P>) => React.FC<P & {
|
|
23
|
-
fallback?: React.ReactNode;
|
|
24
|
-
}>;
|
|
25
|
-
/**
|
|
26
|
-
* Higher-Order Component for permission denial checking
|
|
27
|
-
*/
|
|
28
|
-
export declare function withCannot<P extends object>(action: string, subject?: any, field?: string): (Component: React.ComponentType<P>) => React.FC<P & {
|
|
29
|
-
fallback?: React.ReactNode;
|
|
30
|
-
}>;
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Action, Subject, Field, PermissionRule, PermissionCheck, Ability } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Core Ability class for managing permissions
|
|
4
|
-
*/
|
|
5
|
-
export declare class AbilityCore implements Ability {
|
|
6
|
-
private rules;
|
|
7
|
-
private cache;
|
|
8
|
-
constructor(rules?: PermissionRule[]);
|
|
9
|
-
/**
|
|
10
|
-
* Check if action is allowed on subject
|
|
11
|
-
*/
|
|
12
|
-
can(action: Action, subject: Subject, field?: Field): boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Check if action is forbidden on subject
|
|
15
|
-
*/
|
|
16
|
-
cannot(action: Action, subject: Subject, field?: Field): boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Get detailed permission check result
|
|
19
|
-
*/
|
|
20
|
-
check(action: Action, subject: Subject, field?: Field): PermissionCheck;
|
|
21
|
-
/**
|
|
22
|
-
* Update ability rules and clear cache
|
|
23
|
-
*/
|
|
24
|
-
update(rules: PermissionRule[]): void;
|
|
25
|
-
/**
|
|
26
|
-
* Get all current rules
|
|
27
|
-
*/
|
|
28
|
-
getRules(): PermissionRule[];
|
|
29
|
-
/**
|
|
30
|
-
* Clear all rules and cache
|
|
31
|
-
*/
|
|
32
|
-
clear(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Perform the actual permission check
|
|
35
|
-
*/
|
|
36
|
-
private performCheck;
|
|
37
|
-
/**
|
|
38
|
-
* Check if a rule matches the current permission check
|
|
39
|
-
*/
|
|
40
|
-
private ruleMatches;
|
|
41
|
-
/**
|
|
42
|
-
* Check if subject matches any of the rule subjects
|
|
43
|
-
*/
|
|
44
|
-
private subjectMatches;
|
|
45
|
-
/**
|
|
46
|
-
* Check if conditions match the subject object
|
|
47
|
-
*/
|
|
48
|
-
private conditionsMatch;
|
|
49
|
-
/**
|
|
50
|
-
* Check if two values match (handles various comparison types)
|
|
51
|
-
*/
|
|
52
|
-
private valuesMatch;
|
|
53
|
-
/**
|
|
54
|
-
* Generate cache key for permission check
|
|
55
|
-
*/
|
|
56
|
-
private getCacheKey;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Create a new Ability instance
|
|
60
|
-
*/
|
|
61
|
-
export declare function createAbility(rules?: PermissionRule[]): Ability;
|
|
62
|
-
/**
|
|
63
|
-
* Helper to create permission rules
|
|
64
|
-
*/
|
|
65
|
-
export declare const definePermissions: (rules: PermissionRule[]) => PermissionRule[];
|
|
66
|
-
/**
|
|
67
|
-
* Common permission actions
|
|
68
|
-
*/
|
|
69
|
-
export declare const Actions: {
|
|
70
|
-
readonly CREATE: "create";
|
|
71
|
-
readonly READ: "read";
|
|
72
|
-
readonly UPDATE: "update";
|
|
73
|
-
readonly DELETE: "delete";
|
|
74
|
-
readonly MANAGE: "manage";
|
|
75
|
-
readonly VIEW: "view";
|
|
76
|
-
readonly EDIT: "edit";
|
|
77
|
-
readonly PUBLISH: "publish";
|
|
78
|
-
readonly ARCHIVE: "archive";
|
|
79
|
-
readonly APPROVE: "approve";
|
|
80
|
-
readonly REJECT: "reject";
|
|
81
|
-
};
|
|
82
|
-
/**
|
|
83
|
-
* Helper to create subject types
|
|
84
|
-
*/
|
|
85
|
-
export declare const subject: (type: string, data?: object) => object;
|
|
86
|
-
/**
|
|
87
|
-
* Check if subject is of specific type
|
|
88
|
-
*/
|
|
89
|
-
export declare const subjectType: (subject: any) => string;
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { AbilityCore } from './ability';
|
|
2
|
-
import { PermissionRule } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Fluent API for building permissions
|
|
5
|
-
*/
|
|
6
|
-
export declare class PermissionBuilder {
|
|
7
|
-
private rules;
|
|
8
|
-
/**
|
|
9
|
-
* Grant permission
|
|
10
|
-
*/
|
|
11
|
-
allow(action: string, subject?: any, field?: string): this;
|
|
12
|
-
/**
|
|
13
|
-
* Deny permission
|
|
14
|
-
*/
|
|
15
|
-
forbid(action: string, subject?: any, field?: string): this;
|
|
16
|
-
/**
|
|
17
|
-
* Conditional permission
|
|
18
|
-
*/
|
|
19
|
-
allowIf(action: string, subject?: any, conditions?: Record<string, any>, field?: string): this;
|
|
20
|
-
/**
|
|
21
|
-
* Conditional denial
|
|
22
|
-
*/
|
|
23
|
-
forbidIf(action: string, subject?: any, conditions?: Record<string, any>, field?: string): this;
|
|
24
|
-
/**
|
|
25
|
-
* Grant all actions on a subject
|
|
26
|
-
*/
|
|
27
|
-
manage(subject: any): this;
|
|
28
|
-
/**
|
|
29
|
-
* Forbid all actions on a subject
|
|
30
|
-
*/
|
|
31
|
-
forbidAll(subject: any): this;
|
|
32
|
-
/**
|
|
33
|
-
* Role-based permissions
|
|
34
|
-
*/
|
|
35
|
-
role(roleName: string, callback: (role: RoleBuilder) => void): this;
|
|
36
|
-
/**
|
|
37
|
-
* Build the ability with all rules
|
|
38
|
-
*/
|
|
39
|
-
build(): AbilityCore;
|
|
40
|
-
/**
|
|
41
|
-
* Get all rules
|
|
42
|
-
*/
|
|
43
|
-
getRules(): PermissionRule[];
|
|
44
|
-
/**
|
|
45
|
-
* Clear all rules
|
|
46
|
-
*/
|
|
47
|
-
clear(): this;
|
|
48
|
-
/**
|
|
49
|
-
* Merge rules from another builder
|
|
50
|
-
*/
|
|
51
|
-
merge(other: PermissionBuilder): this;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Role-specific permission builder
|
|
55
|
-
*/
|
|
56
|
-
export declare class RoleBuilder {
|
|
57
|
-
private roleName;
|
|
58
|
-
private rules;
|
|
59
|
-
constructor(roleName: string);
|
|
60
|
-
/**
|
|
61
|
-
* Grant permission for this role
|
|
62
|
-
*/
|
|
63
|
-
can(action: string, subject?: any, field?: string): this;
|
|
64
|
-
/**
|
|
65
|
-
* Deny permission for this role
|
|
66
|
-
*/
|
|
67
|
-
cannot(action: string, subject?: any, field?: string): this;
|
|
68
|
-
/**
|
|
69
|
-
* Manage all actions on subject for this role
|
|
70
|
-
*/
|
|
71
|
-
manage(subject: any): this;
|
|
72
|
-
/**
|
|
73
|
-
* Get all rules for this role
|
|
74
|
-
*/
|
|
75
|
-
getRules(): PermissionRule[];
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Common permission patterns
|
|
79
|
-
*/
|
|
80
|
-
export declare class PermissionPatterns {
|
|
81
|
-
/**
|
|
82
|
-
* Admin permissions - can do everything
|
|
83
|
-
*/
|
|
84
|
-
static admin(): PermissionBuilder;
|
|
85
|
-
/**
|
|
86
|
-
* User permissions - basic CRUD on own resources
|
|
87
|
-
*/
|
|
88
|
-
static user(userId: string): PermissionBuilder;
|
|
89
|
-
/**
|
|
90
|
-
* Guest permissions - read-only public content
|
|
91
|
-
*/
|
|
92
|
-
static guest(): PermissionBuilder;
|
|
93
|
-
/**
|
|
94
|
-
* Moderator permissions - manage content but not users
|
|
95
|
-
*/
|
|
96
|
-
static moderator(): PermissionBuilder;
|
|
97
|
-
/**
|
|
98
|
-
* Owner permissions - full control over owned resources
|
|
99
|
-
*/
|
|
100
|
-
static owner(ownerId: string): PermissionBuilder;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Helper function to create a new permission builder
|
|
104
|
-
*/
|
|
105
|
-
export declare function permissions(): PermissionBuilder;
|
|
106
|
-
/**
|
|
107
|
-
* Helper function to create ability from rules array
|
|
108
|
-
*/
|
|
109
|
-
export declare function defineAbility(callback: (builder: PermissionBuilder) => void): AbilityCore;
|
|
110
|
-
/**
|
|
111
|
-
* Helper function to create common role-based abilities
|
|
112
|
-
*/
|
|
113
|
-
export declare function defineRoleAbility(role: string, callback: (role: RoleBuilder) => void): AbilityCore;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { PermissionProviderProps, PermissionContextValue } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Permission Provider Component
|
|
5
|
-
*/
|
|
6
|
-
export declare const PermissionProvider: React.FC<PermissionProviderProps>;
|
|
7
|
-
/**
|
|
8
|
-
* Hook to access permission context
|
|
9
|
-
*/
|
|
10
|
-
export declare const usePermissions: (options?: {
|
|
11
|
-
required?: boolean;
|
|
12
|
-
debug?: boolean;
|
|
13
|
-
}) => PermissionContextValue;
|
|
14
|
-
/**
|
|
15
|
-
* Hook to check a specific permission
|
|
16
|
-
*/
|
|
17
|
-
export declare const useCan: (action: string, subject: any, field?: string) => boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Hook to check if permission is denied
|
|
20
|
-
*/
|
|
21
|
-
export declare const useCannot: (action: string, subject: any, field?: string) => boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Hook to get the current ability instance
|
|
24
|
-
*/
|
|
25
|
-
export declare const useAbility: () => import("./types").Ability;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { Can, CanWithConditions, Cannot, PermissionGate, withCan, withCannot } from './Can';
|
|
2
|
-
export { PermissionProvider, usePermissions, useAbility } from './context';
|
|
3
|
-
export { AbilityCore } from './ability';
|
|
4
|
-
export { PermissionBuilder, RoleBuilder, PermissionPatterns, permissions, defineAbility, defineRoleAbility } from './builder';
|
|
5
|
-
export type { Action, Subject, Field, Conditions, PermissionRule, PermissionCheck, Ability, CanProps, CanWithConditionsProps, CannotProps, PermissionGateProps, PermissionContextValue, PermissionProviderProps, UsePermissionsOptions } from './types';
|
|
6
|
-
export { AbilityCore as PermissionAbility } from './ability';
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ViewStyle } from 'react-native';
|
|
3
|
-
/**
|
|
4
|
-
* Possible permission actions
|
|
5
|
-
*/
|
|
6
|
-
export type Action = string;
|
|
7
|
-
/**
|
|
8
|
-
* Subject type - can be string, class, or object
|
|
9
|
-
*/
|
|
10
|
-
type SubjectClass = abstract new (...args: any[]) => unknown;
|
|
11
|
-
type SubjectObject = Record<string, unknown> | object;
|
|
12
|
-
export type Subject = string | SubjectClass | SubjectObject;
|
|
13
|
-
/**
|
|
14
|
-
* Field within a subject
|
|
15
|
-
*/
|
|
16
|
-
export type Field = string;
|
|
17
|
-
/**
|
|
18
|
-
* Conditions for permissions (for object-level permissions)
|
|
19
|
-
*/
|
|
20
|
-
export type Conditions = Record<string, any>;
|
|
21
|
-
/**
|
|
22
|
-
* Permission rule definition
|
|
23
|
-
*/
|
|
24
|
-
export interface PermissionRule {
|
|
25
|
-
/** Action being performed */
|
|
26
|
-
action: Action | Action[];
|
|
27
|
-
/** Subject being acted upon */
|
|
28
|
-
subject: Subject | Subject[];
|
|
29
|
-
/** Fields within the subject (optional) */
|
|
30
|
-
fields?: Field[];
|
|
31
|
-
/** Conditions that must be met (optional) */
|
|
32
|
-
conditions?: Conditions;
|
|
33
|
-
/** Whether this rule grants or denies permission */
|
|
34
|
-
inverted?: boolean;
|
|
35
|
-
/** Human-readable reason for the rule */
|
|
36
|
-
reason?: string;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Permission check result
|
|
40
|
-
*/
|
|
41
|
-
export interface PermissionCheck {
|
|
42
|
-
/** Whether permission is granted */
|
|
43
|
-
allowed: boolean;
|
|
44
|
-
/** Reason for the decision */
|
|
45
|
-
reason?: string;
|
|
46
|
-
/** Matched rule */
|
|
47
|
-
rule?: PermissionRule;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Ability interface for checking permissions
|
|
51
|
-
*/
|
|
52
|
-
export interface Ability {
|
|
53
|
-
/** Check if action is allowed on subject */
|
|
54
|
-
can(action: Action, subject: Subject, field?: Field): boolean;
|
|
55
|
-
/** Check if action is forbidden on subject */
|
|
56
|
-
cannot(action: Action, subject: Subject, field?: Field): boolean;
|
|
57
|
-
/** Get detailed permission check result */
|
|
58
|
-
check(action: Action, subject: Subject, field?: Field): PermissionCheck;
|
|
59
|
-
/** Update ability rules */
|
|
60
|
-
update(rules: PermissionRule[]): void;
|
|
61
|
-
/** Get all current rules */
|
|
62
|
-
getRules(): PermissionRule[];
|
|
63
|
-
/** Clear all rules */
|
|
64
|
-
clear(): void;
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Can component props for basic usage
|
|
68
|
-
*/
|
|
69
|
-
export interface CanProps {
|
|
70
|
-
/** Action to check */
|
|
71
|
-
I: Action;
|
|
72
|
-
/** Subject to check against */
|
|
73
|
-
a?: Subject;
|
|
74
|
-
/** Specific field to check (optional) */
|
|
75
|
-
field?: Field;
|
|
76
|
-
/** Children to render when permission is granted */
|
|
77
|
-
children?: React.ReactNode;
|
|
78
|
-
/** Alternative content when permission is denied */
|
|
79
|
-
fallback?: React.ReactNode;
|
|
80
|
-
/** Custom ability instance (optional) */
|
|
81
|
-
ability?: Ability;
|
|
82
|
-
/** Additional styles */
|
|
83
|
-
style?: ViewStyle;
|
|
84
|
-
/** Test ID for testing */
|
|
85
|
-
testID?: string;
|
|
86
|
-
/** Whether to passthrough (render children regardless) for development */
|
|
87
|
-
passthrough?: boolean;
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Enhanced Can component props with conditions
|
|
91
|
-
*/
|
|
92
|
-
export interface CanWithConditionsProps extends Omit<CanProps, 'a'> {
|
|
93
|
-
/** Subject instance with data for condition checking */
|
|
94
|
-
this: Subject;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Cannot component props (inverse of Can)
|
|
98
|
-
*/
|
|
99
|
-
export type CannotProps = CanProps;
|
|
100
|
-
/**
|
|
101
|
-
* Permission gate props for route-level protection
|
|
102
|
-
*/
|
|
103
|
-
export interface PermissionGateProps {
|
|
104
|
-
/** Required permissions (all must pass) */
|
|
105
|
-
permissions: Array<{
|
|
106
|
-
action: Action;
|
|
107
|
-
subject: Subject;
|
|
108
|
-
field?: Field;
|
|
109
|
-
}>;
|
|
110
|
-
/** Children to render when all permissions pass */
|
|
111
|
-
children: React.ReactNode;
|
|
112
|
-
/** Fallback when permissions fail */
|
|
113
|
-
fallback?: React.ReactNode;
|
|
114
|
-
/** Custom ability instance */
|
|
115
|
-
ability?: Ability;
|
|
116
|
-
/** Redirect function for navigation-based fallbacks */
|
|
117
|
-
onUnauthorized?: () => void;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Permission context value
|
|
121
|
-
*/
|
|
122
|
-
export interface PermissionContextValue {
|
|
123
|
-
/** Current ability instance */
|
|
124
|
-
ability: Ability;
|
|
125
|
-
/** Update ability rules */
|
|
126
|
-
updateAbility: (rules: PermissionRule[]) => void;
|
|
127
|
-
/** Check if user can perform action */
|
|
128
|
-
can: (action: Action, subject: Subject, field?: Field) => boolean;
|
|
129
|
-
/** Check if user cannot perform action */
|
|
130
|
-
cannot: (action: Action, subject: Subject, field?: Field) => boolean;
|
|
131
|
-
/** Get current user context */
|
|
132
|
-
user?: any;
|
|
133
|
-
/** Update user context */
|
|
134
|
-
setUser?: (user: any) => void;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Permission provider props
|
|
138
|
-
*/
|
|
139
|
-
export interface PermissionProviderProps {
|
|
140
|
-
/** Initial permission rules */
|
|
141
|
-
rules?: PermissionRule[];
|
|
142
|
-
/** Initial user context */
|
|
143
|
-
user?: any;
|
|
144
|
-
/** Children components */
|
|
145
|
-
children: React.ReactNode;
|
|
146
|
-
/** Development mode settings */
|
|
147
|
-
dev?: {
|
|
148
|
-
/** Log permission checks */
|
|
149
|
-
logChecks?: boolean;
|
|
150
|
-
/** Warn about missing permissions */
|
|
151
|
-
warnMissing?: boolean;
|
|
152
|
-
/** Allow passthrough in development */
|
|
153
|
-
allowPassthrough?: boolean;
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Hook options for usePermissions
|
|
158
|
-
*/
|
|
159
|
-
export interface UsePermissionsOptions {
|
|
160
|
-
/** Whether to log permission checks */
|
|
161
|
-
debug?: boolean;
|
|
162
|
-
/** Throw error if no ability found */
|
|
163
|
-
required?: boolean;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Permission definition for bulk operations
|
|
167
|
-
*/
|
|
168
|
-
export interface PermissionDefinition {
|
|
169
|
-
/** Actions for this resource */
|
|
170
|
-
actions: Action[];
|
|
171
|
-
/** Subject type */
|
|
172
|
-
subject: Subject;
|
|
173
|
-
/** Default conditions */
|
|
174
|
-
conditions?: Conditions;
|
|
175
|
-
/** Description */
|
|
176
|
-
description?: string;
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Role-based permission set
|
|
180
|
-
*/
|
|
181
|
-
export interface RolePermissions {
|
|
182
|
-
/** Role name */
|
|
183
|
-
role: string;
|
|
184
|
-
/** Permission rules for this role */
|
|
185
|
-
rules: PermissionRule[];
|
|
186
|
-
/** Description of the role */
|
|
187
|
-
description?: string;
|
|
188
|
-
/** Whether role is active */
|
|
189
|
-
active?: boolean;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Permission builder for fluent API
|
|
193
|
-
*/
|
|
194
|
-
export interface PermissionBuilder {
|
|
195
|
-
/** Add a permission rule */
|
|
196
|
-
allow(action: Action | Action[]): PermissionSubjectBuilder;
|
|
197
|
-
/** Add a denial rule */
|
|
198
|
-
deny(action: Action | Action[]): PermissionSubjectBuilder;
|
|
199
|
-
/** Build the rules array */
|
|
200
|
-
build(): PermissionRule[];
|
|
201
|
-
}
|
|
202
|
-
export interface PermissionSubjectBuilder {
|
|
203
|
-
/** Specify the subject */
|
|
204
|
-
on(subject: Subject | Subject[]): PermissionFieldBuilder;
|
|
205
|
-
}
|
|
206
|
-
export interface PermissionFieldBuilder {
|
|
207
|
-
/** Specify fields (optional) */
|
|
208
|
-
fields(fields: Field[]): PermissionConditionBuilder;
|
|
209
|
-
/** Specify conditions */
|
|
210
|
-
when(conditions: Conditions): PermissionRuleBuilder;
|
|
211
|
-
/** Add reason */
|
|
212
|
-
because(reason: string): PermissionRuleBuilder;
|
|
213
|
-
/** Finish building this rule */
|
|
214
|
-
build(): PermissionRule;
|
|
215
|
-
}
|
|
216
|
-
export interface PermissionConditionBuilder {
|
|
217
|
-
/** Specify conditions */
|
|
218
|
-
when(conditions: Conditions): PermissionRuleBuilder;
|
|
219
|
-
/** Add reason */
|
|
220
|
-
because(reason: string): PermissionRuleBuilder;
|
|
221
|
-
/** Finish building this rule */
|
|
222
|
-
build(): PermissionRule;
|
|
223
|
-
}
|
|
224
|
-
export interface PermissionRuleBuilder {
|
|
225
|
-
/** Add reason */
|
|
226
|
-
because(reason: string): PermissionRuleBuilder;
|
|
227
|
-
/** Finish building this rule */
|
|
228
|
-
build(): PermissionRule;
|
|
229
|
-
}
|
|
230
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useNavigationProgressState(): {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function getNavigationProgressStyles(): {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export interface NavigationProgressProps {
|
|
2
|
-
/** Controlled progress value (0-100). If omitted, internal controller progress is used */
|
|
3
|
-
value?: number;
|
|
4
|
-
/** Height (px) */
|
|
5
|
-
size?: number;
|
|
6
|
-
/** Color token key or raw color */
|
|
7
|
-
color?: string;
|
|
8
|
-
/** Whether bar is active/visible when value is controlled */
|
|
9
|
-
active?: boolean;
|
|
10
|
-
/** z-index layering */
|
|
11
|
-
zIndex?: number;
|
|
12
|
-
/** If true position absolute at top full width */
|
|
13
|
-
overlay?: boolean;
|
|
14
|
-
/** Step interval in ms for internal progression animation */
|
|
15
|
-
stepInterval?: number;
|
|
16
|
-
/** Border radius */
|
|
17
|
-
radius?: number;
|
|
18
|
-
/** Custom styles */
|
|
19
|
-
style?: any;
|
|
20
|
-
}
|
|
21
|
-
export interface NavigationProgressController {
|
|
22
|
-
start: () => void;
|
|
23
|
-
stop: () => void;
|
|
24
|
-
complete: () => void;
|
|
25
|
-
reset: () => void;
|
|
26
|
-
set: (v: number) => void;
|
|
27
|
-
increment: (delta?: number) => void;
|
|
28
|
-
decrement: (delta?: number) => void;
|
|
29
|
-
isActive: () => boolean;
|
|
30
|
-
}
|