fynixui 1.0.11 → 1.0.13
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/LICENSE +21 -21
- package/README.md +396 -0
- package/dist/README.md +396 -0
- package/dist/custom/DataTable.js +359 -0
- package/dist/custom/button.js +241 -1
- package/dist/custom/index.js +2 -1
- package/dist/error/errorOverlay.js +1 -1
- package/dist/hooks/nixFor.js +15 -17
- package/dist/package.json +2 -3
- package/dist/plugins/vite-plugin-res.js +26 -4
- package/dist/router/router.js +108 -217
- package/dist/runtime.js +1261 -1026
- package/dist-types/context/context.d.ts +1 -1
- package/dist-types/custom/DataTable.d.ts +54 -0
- package/dist-types/custom/button.d.ts +35 -1
- package/dist-types/custom/index.d.ts +2 -1
- package/dist-types/hooks/nixFor.d.ts +1 -1
- package/dist-types/router/router.d.ts +14 -10
- package/dist-types/runtime.d.ts +118 -40
- package/package.json +256 -254
- package/types/fnx.d.ts +34 -34
- package/types/global.d.ts +277 -279
- package/types/jsx.d.ts +1046 -993
- package/types/vite-env.d.ts +545 -545
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
type TableVariant = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark";
|
|
2
|
+
type ActionHandler<T = any> = (row: T, index: number) => void;
|
|
3
|
+
export interface ColumnDef<T = any> {
|
|
4
|
+
key: keyof T | string;
|
|
5
|
+
label: string;
|
|
6
|
+
style?: Record<string, string>;
|
|
7
|
+
class?: string;
|
|
8
|
+
render?: (value: any, row: T, index: number) => any;
|
|
9
|
+
}
|
|
10
|
+
export interface ActionsDef<T = any> {
|
|
11
|
+
view?: ActionHandler<T> | false;
|
|
12
|
+
edit?: ActionHandler<T> | false;
|
|
13
|
+
delete?: ActionHandler<T> | false;
|
|
14
|
+
extra?: Array<{
|
|
15
|
+
label: string;
|
|
16
|
+
handler: ActionHandler<T>;
|
|
17
|
+
style?: Record<string, string>;
|
|
18
|
+
class?: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
export interface DataTableProps<T = any> {
|
|
22
|
+
columns: ColumnDef<T>[];
|
|
23
|
+
data: T[];
|
|
24
|
+
actions?: ActionsDef<T>;
|
|
25
|
+
variant?: TableVariant;
|
|
26
|
+
outline?: boolean;
|
|
27
|
+
striped?: boolean;
|
|
28
|
+
hoverable?: boolean;
|
|
29
|
+
bordered?: boolean;
|
|
30
|
+
style?: Record<string, string>;
|
|
31
|
+
class?: string;
|
|
32
|
+
tableStyle?: Record<string, string>;
|
|
33
|
+
tableClass?: string;
|
|
34
|
+
rc?: string;
|
|
35
|
+
[key: string]: any;
|
|
36
|
+
}
|
|
37
|
+
export declare function DataTable<T = any>({ columns, data, actions, style: wrapStyle, class: wrapClass, tableStyle, tableClass, rc, ...rest }: DataTableProps<T>): any;
|
|
38
|
+
export declare const PrimaryDataTable: <T>(p: DataTableProps<T>) => any;
|
|
39
|
+
export declare const SecondaryDataTable: <T>(p: DataTableProps<T>) => any;
|
|
40
|
+
export declare const SuccessDataTable: <T>(p: DataTableProps<T>) => any;
|
|
41
|
+
export declare const DangerDataTable: <T>(p: DataTableProps<T>) => any;
|
|
42
|
+
export declare const WarningDataTable: <T>(p: DataTableProps<T>) => any;
|
|
43
|
+
export declare const InfoDataTable: <T>(p: DataTableProps<T>) => any;
|
|
44
|
+
export declare const LightDataTable: <T>(p: DataTableProps<T>) => any;
|
|
45
|
+
export declare const DarkDataTable: <T>(p: DataTableProps<T>) => any;
|
|
46
|
+
export declare const OutlinePrimaryDataTable: <T>(p: DataTableProps<T>) => any;
|
|
47
|
+
export declare const OutlineSecondaryDataTable: <T>(p: DataTableProps<T>) => any;
|
|
48
|
+
export declare const OutlineSuccessDataTable: <T>(p: DataTableProps<T>) => any;
|
|
49
|
+
export declare const OutlineDangerDataTable: <T>(p: DataTableProps<T>) => any;
|
|
50
|
+
export declare const OutlineWarningDataTable: <T>(p: DataTableProps<T>) => any;
|
|
51
|
+
export declare const OutlineInfoDataTable: <T>(p: DataTableProps<T>) => any;
|
|
52
|
+
export declare const OutlineLightDataTable: <T>(p: DataTableProps<T>) => any;
|
|
53
|
+
export declare const OutlineDarkDataTable: <T>(p: DataTableProps<T>) => any;
|
|
54
|
+
export {};
|
|
@@ -1 +1,35 @@
|
|
|
1
|
-
|
|
1
|
+
type ButtonVariant = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark" | "link";
|
|
2
|
+
type ButtonSize = "sm" | "md" | "lg";
|
|
3
|
+
interface ButtonProps {
|
|
4
|
+
value?: string;
|
|
5
|
+
type?: "button" | "submit" | "reset";
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
variant?: ButtonVariant;
|
|
8
|
+
size?: ButtonSize;
|
|
9
|
+
outline?: boolean;
|
|
10
|
+
style?: Record<string, string>;
|
|
11
|
+
class?: string;
|
|
12
|
+
rc?: string;
|
|
13
|
+
"r-click"?: (this: HTMLElement, event: MouseEvent) => void;
|
|
14
|
+
[key: string]: any;
|
|
15
|
+
}
|
|
16
|
+
export declare function Button({ value, ...props }: ButtonProps): any;
|
|
17
|
+
export declare const PrimaryButton: (p: ButtonProps) => any;
|
|
18
|
+
export declare const SecondaryButton: (p: ButtonProps) => any;
|
|
19
|
+
export declare const SuccessButton: (p: ButtonProps) => any;
|
|
20
|
+
export declare const DangerButton: (p: ButtonProps) => any;
|
|
21
|
+
export declare const WarningButton: (p: ButtonProps) => any;
|
|
22
|
+
export declare const InfoButton: (p: ButtonProps) => any;
|
|
23
|
+
export declare const LightButton: (p: ButtonProps) => any;
|
|
24
|
+
export declare const DarkButton: (p: ButtonProps) => any;
|
|
25
|
+
export declare const LinkButton: (p: ButtonProps) => any;
|
|
26
|
+
export declare const OutlinePrimaryButton: (p: ButtonProps) => any;
|
|
27
|
+
export declare const OutlineSecondaryButton: (p: ButtonProps) => any;
|
|
28
|
+
export declare const OutlineSuccessButton: (p: ButtonProps) => any;
|
|
29
|
+
export declare const OutlineDangerButton: (p: ButtonProps) => any;
|
|
30
|
+
export declare const OutlineWarningButton: (p: ButtonProps) => any;
|
|
31
|
+
export declare const OutlineInfoButton: (p: ButtonProps) => any;
|
|
32
|
+
export declare const OutlineLightButton: (p: ButtonProps) => any;
|
|
33
|
+
export declare const OutlineDarkButton: (p: ButtonProps) => any;
|
|
34
|
+
export declare const OutlineLinkButton: (p: ButtonProps) => any;
|
|
35
|
+
export {};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { Button } from "./button";
|
|
1
|
+
export { Button, PrimaryButton, SecondaryButton, SuccessButton, DangerButton, WarningButton, InfoButton, LightButton, DarkButton, LinkButton, } from "./button";
|
|
2
|
+
export { DataTable, PrimaryDataTable, SecondaryDataTable, SuccessDataTable, DangerDataTable, WarningDataTable, InfoDataTable, LightDataTable, DarkDataTable, OutlinePrimaryDataTable, OutlineSecondaryDataTable, OutlineSuccessDataTable, OutlineDangerDataTable, OutlineWarningDataTable, OutlineInfoDataTable, OutlineLightDataTable, OutlineDarkDataTable, } from "./DataTable";
|
|
2
3
|
export { Path } from "./path";
|
|
@@ -2,7 +2,7 @@ import { VNode } from "../types/fnx";
|
|
|
2
2
|
interface ReactiveState<T> {
|
|
3
3
|
value: T;
|
|
4
4
|
_isNixState: boolean;
|
|
5
|
-
subscribe(callback: (
|
|
5
|
+
subscribe(callback: () => void): () => void;
|
|
6
6
|
}
|
|
7
7
|
interface ForProps<T> {
|
|
8
8
|
each: T[] | ReactiveState<T[]>;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
interface
|
|
1
|
+
interface LocationSignal {
|
|
2
2
|
path: string;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
layout?: ComponentFunction;
|
|
6
|
-
keepAlive?: boolean;
|
|
3
|
+
params: Record<string, string>;
|
|
4
|
+
search: string;
|
|
7
5
|
}
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
declare class LocationManager {
|
|
7
|
+
private current;
|
|
8
|
+
private subscribers;
|
|
9
|
+
get value(): LocationSignal;
|
|
10
|
+
set value(newLocation: LocationSignal);
|
|
11
|
+
subscribe(callback: (location: LocationSignal) => void): () => void;
|
|
10
12
|
}
|
|
13
|
+
export declare const location: LocationManager;
|
|
11
14
|
interface RouteComponent {
|
|
12
15
|
(props: any): any;
|
|
13
16
|
props?: Record<string, any> | (() => Record<string, any>);
|
|
@@ -28,6 +31,9 @@ interface DynamicRoute {
|
|
|
28
31
|
component: RouteComponent;
|
|
29
32
|
params: string[];
|
|
30
33
|
}
|
|
34
|
+
interface FynixRouterOptions {
|
|
35
|
+
lazy?: boolean;
|
|
36
|
+
}
|
|
31
37
|
interface FynixRouter {
|
|
32
38
|
mountRouter(selector?: string): void;
|
|
33
39
|
navigate(path: string, props?: Record<string, any>): void;
|
|
@@ -36,11 +42,9 @@ interface FynixRouter {
|
|
|
36
42
|
cleanup(): void;
|
|
37
43
|
routes: Record<string, RouteComponent>;
|
|
38
44
|
dynamicRoutes: DynamicRoute[];
|
|
39
|
-
preloadRoute?(path: string): Promise<void>;
|
|
40
45
|
clearCache?(): void;
|
|
41
|
-
enableNestedRouting?(routes: NestedRoute[]): void;
|
|
42
46
|
}
|
|
43
|
-
declare function createFynix(): FynixRouter;
|
|
47
|
+
declare function createFynix(options?: FynixRouterOptions): FynixRouter;
|
|
44
48
|
export { createFynix };
|
|
45
49
|
export default createFynix;
|
|
46
50
|
export declare function setLinkProps(key: string, props: Record<string, any>): void;
|
package/dist-types/runtime.d.ts
CHANGED
|
@@ -1,37 +1,40 @@
|
|
|
1
1
|
type Priority = "immediate" | "high" | "normal" | "low" | "idle";
|
|
2
|
+
type EffectTag = "PLACEMENT" | "UPDATE" | "DELETION" | null;
|
|
2
3
|
interface FynixFiber {
|
|
3
4
|
type: string | symbol | ComponentFunction;
|
|
4
|
-
props:
|
|
5
|
+
props: VNodeProps;
|
|
5
6
|
key: string | number | null;
|
|
6
7
|
child: FynixFiber | null;
|
|
7
8
|
sibling: FynixFiber | null;
|
|
8
9
|
parent: FynixFiber | null;
|
|
9
10
|
alternate: FynixFiber | null;
|
|
10
|
-
effectTag:
|
|
11
|
+
effectTag: EffectTag;
|
|
11
12
|
updatePriority: Priority;
|
|
12
|
-
_domNode
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
context?: ComponentContext;
|
|
13
|
+
_domNode: Node | null;
|
|
14
|
+
ctx: ComponentContext | null;
|
|
15
|
+
_vnode: VNode | null;
|
|
16
16
|
}
|
|
17
|
-
type VNodeType = string | symbol | ComponentFunction;
|
|
18
|
-
type VNodeChild = VNode | string | number | boolean | null | undefined;
|
|
19
|
-
type VNodeChildren = VNodeChild | VNodeChild[];
|
|
20
|
-
interface VNodeProps {
|
|
17
|
+
export type VNodeType = string | symbol | ComponentFunction;
|
|
18
|
+
export type VNodeChild = VNode | string | number | boolean | null | undefined;
|
|
19
|
+
export type VNodeChildren = VNodeChild | VNodeChild[];
|
|
20
|
+
export interface VNodeProps {
|
|
21
21
|
children?: VNode[];
|
|
22
22
|
key?: string | number | null;
|
|
23
23
|
[key: string]: any;
|
|
24
24
|
}
|
|
25
|
-
interface VNode {
|
|
25
|
+
export interface VNode {
|
|
26
26
|
type: VNodeType;
|
|
27
27
|
props: VNodeProps;
|
|
28
28
|
key: string | number | null;
|
|
29
29
|
_domNode?: Node | null;
|
|
30
|
+
_fiber?: FynixFiber | null;
|
|
30
31
|
_rendered?: VNode | null;
|
|
32
|
+
_fragmentStart?: Node | null;
|
|
33
|
+
_fragmentEnd?: Node | null;
|
|
31
34
|
_state?: ReactiveState<any> | null;
|
|
32
35
|
_cleanup?: (() => void) | null;
|
|
33
36
|
}
|
|
34
|
-
interface ComponentFunction {
|
|
37
|
+
export interface ComponentFunction {
|
|
35
38
|
(props: any): VNode | Promise<VNode>;
|
|
36
39
|
}
|
|
37
40
|
interface ReactiveState<T> {
|
|
@@ -44,7 +47,8 @@ interface ComponentContext {
|
|
|
44
47
|
hookIndex: number;
|
|
45
48
|
effects: Array<() => void | (() => void)>;
|
|
46
49
|
cleanups: Array<() => void>;
|
|
47
|
-
_vnode: VNode;
|
|
50
|
+
_vnode: VNode | null;
|
|
51
|
+
_fiber: FynixFiber | null;
|
|
48
52
|
_accessedStates: Set<ReactiveState<any>>;
|
|
49
53
|
_subscriptions: Set<ReactiveState<any>>;
|
|
50
54
|
_subscriptionCleanups: Array<() => void>;
|
|
@@ -53,6 +57,7 @@ interface ComponentContext {
|
|
|
53
57
|
Component: ComponentFunction;
|
|
54
58
|
_isMounted: boolean;
|
|
55
59
|
_isRerendering: boolean;
|
|
60
|
+
_rerenderTimeout: ReturnType<typeof setTimeout> | null;
|
|
56
61
|
}
|
|
57
62
|
import { Button, Path } from "./custom/index";
|
|
58
63
|
import { nixAsync } from "./hooks/nixAsync";
|
|
@@ -76,48 +81,121 @@ import { nixRef } from "./hooks/nixRef";
|
|
|
76
81
|
import { nixState } from "./hooks/nixState";
|
|
77
82
|
import { nixStore } from "./hooks/nixStore";
|
|
78
83
|
import createFynix from "./router/router";
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
type AsyncBatchingStore = {
|
|
85
|
+
isBatching: boolean;
|
|
86
|
+
callbacks: Array<() => void>;
|
|
87
|
+
};
|
|
88
|
+
export declare function batchUpdates(fn: () => void): void;
|
|
89
|
+
export declare function isCurrentlyBatching(): boolean;
|
|
90
|
+
export interface ErrorHandlerConfig {
|
|
91
|
+
onRenderError?: (error: Error, component?: ComponentFunction) => boolean;
|
|
92
|
+
onAsyncError?: (error: Error) => boolean;
|
|
93
|
+
onCommitError?: (error: Error, fiber?: FynixFiber) => boolean;
|
|
94
|
+
logToConsole?: boolean;
|
|
95
|
+
showOverlay?: boolean;
|
|
96
|
+
}
|
|
97
|
+
export declare function configureErrorHandling(config: Partial<ErrorHandlerConfig>): void;
|
|
98
|
+
export declare function getErrorConfig(): ErrorHandlerConfig;
|
|
99
|
+
export interface PerformanceProfileConfig {
|
|
100
|
+
enabled?: boolean;
|
|
101
|
+
logMeasurements?: boolean;
|
|
102
|
+
slowRenderThreshold?: number;
|
|
103
|
+
onMetrics?: (metrics: PerformanceMetrics) => void;
|
|
104
|
+
}
|
|
105
|
+
export interface PerformanceMetrics {
|
|
106
|
+
renderTime: number;
|
|
107
|
+
commitTime: number;
|
|
108
|
+
totalTime: number;
|
|
109
|
+
updateCount: number;
|
|
110
|
+
fiberCount: number;
|
|
111
|
+
componentName?: string;
|
|
112
|
+
timestamp: number;
|
|
113
|
+
}
|
|
114
|
+
export declare function enablePerformanceProfiling(config: PerformanceProfileConfig): void;
|
|
115
|
+
export declare function getPerfConfig(): PerformanceProfileConfig;
|
|
116
|
+
export declare const TEXT: unique symbol;
|
|
117
|
+
export declare const Fragment: unique symbol;
|
|
118
|
+
export declare const BOOLEAN_ATTRS: Set<string>;
|
|
119
|
+
export declare const DOM_PROPERTIES: Set<string>;
|
|
120
|
+
export declare const DANGEROUS_HTML_PROPS: Set<string>;
|
|
121
|
+
export declare const DANGEROUS_PROTOCOLS: Set<string>;
|
|
122
|
+
export declare const SAFE_PROTOCOLS: Set<string>;
|
|
123
|
+
export declare function createTextVNode(text: any): VNode;
|
|
124
|
+
export declare function h(type: VNodeType, props?: VNodeProps | null, ...children: VNodeChildren[]): VNode;
|
|
125
|
+
export declare namespace h {
|
|
126
|
+
var Fragment: ({ children }: {
|
|
127
|
+
children?: VNode[];
|
|
128
|
+
}) => VNode[];
|
|
129
|
+
}
|
|
130
|
+
export declare const Fynix: typeof h;
|
|
131
|
+
declare class FiberReconciler {
|
|
132
|
+
private wipRoot;
|
|
133
|
+
private wipEntry;
|
|
134
|
+
private nextWork;
|
|
83
135
|
private deletions;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
136
|
+
mountRoot(vnode: VNode, container: Element): void;
|
|
137
|
+
scheduleUpdate(fiber: FynixFiber, priority?: Priority): void;
|
|
138
|
+
private scheduleRender;
|
|
139
|
+
private workLoop;
|
|
140
|
+
private performWork;
|
|
141
|
+
private updateComponentFiber;
|
|
142
|
+
private updateHostFiber;
|
|
87
143
|
private reconcileChildren;
|
|
88
144
|
private commitRoot;
|
|
89
145
|
private commitWork;
|
|
90
146
|
private commitDeletion;
|
|
91
|
-
private
|
|
147
|
+
private unmountFiber;
|
|
148
|
+
private runEffects;
|
|
149
|
+
private vnodeToFiber;
|
|
150
|
+
private cloneFiber;
|
|
151
|
+
private findDomParent;
|
|
152
|
+
private findNearestDom;
|
|
153
|
+
private findNextDomSibling;
|
|
92
154
|
}
|
|
93
|
-
|
|
155
|
+
declare const fiberReconciler: FiberReconciler;
|
|
156
|
+
export declare const __debug__: {
|
|
157
|
+
getSchedulerState: () => {
|
|
158
|
+
isScheduled: boolean;
|
|
159
|
+
isWorking: boolean;
|
|
160
|
+
currentPriority: Priority;
|
|
161
|
+
queueSize: number;
|
|
162
|
+
batchedUpdatesSize: number;
|
|
163
|
+
idCounter: number;
|
|
164
|
+
};
|
|
165
|
+
getQueueMetrics: () => {
|
|
166
|
+
pending: number;
|
|
167
|
+
batched: number;
|
|
168
|
+
isActive: boolean;
|
|
169
|
+
currentPriority: Priority;
|
|
170
|
+
};
|
|
171
|
+
getFiberReconciler: () => FiberReconciler;
|
|
172
|
+
getErrorConfig: () => ErrorHandlerConfig;
|
|
173
|
+
getPerfConfig: () => PerformanceProfileConfig;
|
|
174
|
+
collectGarbage: () => void;
|
|
175
|
+
clearSchedulerQueue: () => void;
|
|
176
|
+
getAsyncContext: () => {
|
|
177
|
+
currentBatchStore: AsyncBatchingStore | null;
|
|
178
|
+
batchingStorageAvailable: boolean;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
94
181
|
declare class HierarchicalStore {
|
|
95
182
|
private root;
|
|
96
183
|
private selectorCache;
|
|
97
184
|
private stateSnapshot;
|
|
98
185
|
select<T>(selector: (state: any) => T): T;
|
|
99
|
-
optimisticUpdate<T>(path: string, update: T,
|
|
186
|
+
optimisticUpdate<T>(path: string, update: T, onRollback?: () => void): {
|
|
100
187
|
commit: () => void;
|
|
101
188
|
rollback: () => void;
|
|
102
189
|
};
|
|
103
|
-
private getState;
|
|
104
|
-
private get;
|
|
105
190
|
private set;
|
|
106
|
-
private clearRollback;
|
|
107
|
-
private invalidateSelectors;
|
|
108
191
|
}
|
|
109
192
|
export declare function useHierarchicalStore(): HierarchicalStore;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
export declare function
|
|
113
|
-
export declare function h(type: VNodeType, props?: VNodeProps | null, ...children: VNodeChildren[]): VNode;
|
|
114
|
-
export declare namespace h {
|
|
115
|
-
var Fragment: ({ children }: {
|
|
116
|
-
children?: VNode[];
|
|
117
|
-
}) => VNode[];
|
|
118
|
-
}
|
|
119
|
-
export declare const Fynix: typeof h;
|
|
193
|
+
declare function mount(AppComponent: ComponentFunction, root: string | Element, props?: any): void;
|
|
194
|
+
declare function hydrate(AppComponent: ComponentFunction, root: string | Element, props?: any): void;
|
|
195
|
+
export declare function memo(Component: ComponentFunction, propsAreEqual?: (oldProps: any, newProps: any) => boolean): ComponentFunction;
|
|
120
196
|
export declare function renderComponent(Component: ComponentFunction, props?: any): VNode;
|
|
121
|
-
export declare function
|
|
122
|
-
|
|
123
|
-
|
|
197
|
+
export declare function ErrorBoundary({ fallback, children, }: {
|
|
198
|
+
fallback: (error: Error) => VNode;
|
|
199
|
+
children?: VNode[];
|
|
200
|
+
}): VNode;
|
|
201
|
+
export { Button, createFynix, nixAsync, nixAsyncCached, nixAsyncDebounce, nixAsyncQuery, nixCallback, nixComputed, nixDebounce, nixEffect, nixEffectAlways, nixEffectOnce, nixForm, nixFormAsync, nixInterval, nixLazy, nixLazyAsync, nixLazyFormAsync, nixLocalStorage, nixMemo, nixPrevious, nixRef, nixState, nixStore, Path, Suspense, mount, hydrate, fiberReconciler, };
|