fynixui 1.0.11 → 1.0.12
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/custom/DataTable.js +1 -0
- package/dist/custom/button.js +241 -1
- package/dist/custom/index.js +1 -1
- package/dist/error/errorOverlay.js +1 -1
- package/dist/hooks/nixFor.js +6 -4
- 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 +1251 -1028
- package/dist-types/context/context.d.ts +1 -1
- package/dist-types/custom/DataTable.d.ts +0 -0
- package/dist-types/custom/button.d.ts +35 -1
- package/dist-types/custom/index.d.ts +1 -1
- package/dist-types/router/router.d.ts +14 -10
- package/dist-types/runtime.d.ts +117 -40
- package/package.json +8 -6
|
File without changes
|
|
@@ -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,2 @@
|
|
|
1
|
-
export { Button } from "./button";
|
|
1
|
+
export { Button, PrimaryButton, SecondaryButton, SuccessButton, DangerButton, WarningButton, InfoButton, LightButton, DarkButton, LinkButton, } from "./button";
|
|
2
2
|
export { Path } from "./path";
|
|
@@ -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,120 @@ 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 nextWork;
|
|
83
134
|
private deletions;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
135
|
+
mountRoot(vnode: VNode, container: Element): void;
|
|
136
|
+
scheduleUpdate(fiber: FynixFiber, priority?: Priority): void;
|
|
137
|
+
private scheduleRender;
|
|
138
|
+
private workLoop;
|
|
139
|
+
private performWork;
|
|
140
|
+
private updateComponentFiber;
|
|
141
|
+
private updateHostFiber;
|
|
87
142
|
private reconcileChildren;
|
|
88
143
|
private commitRoot;
|
|
89
144
|
private commitWork;
|
|
90
145
|
private commitDeletion;
|
|
91
|
-
private
|
|
146
|
+
private unmountFiber;
|
|
147
|
+
private runEffects;
|
|
148
|
+
private vnodeToFiber;
|
|
149
|
+
private cloneFiber;
|
|
150
|
+
private findDomParent;
|
|
151
|
+
private findNearestDom;
|
|
152
|
+
private findNextDomSibling;
|
|
92
153
|
}
|
|
93
|
-
|
|
154
|
+
declare const fiberReconciler: FiberReconciler;
|
|
155
|
+
export declare const __debug__: {
|
|
156
|
+
getSchedulerState: () => {
|
|
157
|
+
isScheduled: boolean;
|
|
158
|
+
isWorking: boolean;
|
|
159
|
+
currentPriority: Priority;
|
|
160
|
+
queueSize: number;
|
|
161
|
+
batchedUpdatesSize: number;
|
|
162
|
+
idCounter: number;
|
|
163
|
+
};
|
|
164
|
+
getQueueMetrics: () => {
|
|
165
|
+
pending: number;
|
|
166
|
+
batched: number;
|
|
167
|
+
isActive: boolean;
|
|
168
|
+
currentPriority: Priority;
|
|
169
|
+
};
|
|
170
|
+
getFiberReconciler: () => FiberReconciler;
|
|
171
|
+
getErrorConfig: () => ErrorHandlerConfig;
|
|
172
|
+
getPerfConfig: () => PerformanceProfileConfig;
|
|
173
|
+
collectGarbage: () => void;
|
|
174
|
+
clearSchedulerQueue: () => void;
|
|
175
|
+
getAsyncContext: () => {
|
|
176
|
+
currentBatchStore: AsyncBatchingStore | null;
|
|
177
|
+
batchingStorageAvailable: boolean;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
94
180
|
declare class HierarchicalStore {
|
|
95
181
|
private root;
|
|
96
182
|
private selectorCache;
|
|
97
183
|
private stateSnapshot;
|
|
98
184
|
select<T>(selector: (state: any) => T): T;
|
|
99
|
-
optimisticUpdate<T>(path: string, update: T,
|
|
185
|
+
optimisticUpdate<T>(path: string, update: T, onRollback?: () => void): {
|
|
100
186
|
commit: () => void;
|
|
101
187
|
rollback: () => void;
|
|
102
188
|
};
|
|
103
|
-
private getState;
|
|
104
|
-
private get;
|
|
105
189
|
private set;
|
|
106
|
-
private clearRollback;
|
|
107
|
-
private invalidateSelectors;
|
|
108
190
|
}
|
|
109
191
|
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;
|
|
192
|
+
declare function mount(AppComponent: ComponentFunction, root: string | Element, props?: any): void;
|
|
193
|
+
declare function hydrate(AppComponent: ComponentFunction, root: string | Element, props?: any): void;
|
|
194
|
+
export declare function memo(Component: ComponentFunction, propsAreEqual?: (oldProps: any, newProps: any) => boolean): ComponentFunction;
|
|
120
195
|
export declare function renderComponent(Component: ComponentFunction, props?: any): VNode;
|
|
121
|
-
export declare function
|
|
122
|
-
|
|
123
|
-
|
|
196
|
+
export declare function ErrorBoundary({ fallback, children, }: {
|
|
197
|
+
fallback: (error: Error) => VNode;
|
|
198
|
+
children?: VNode[];
|
|
199
|
+
}): VNode;
|
|
200
|
+
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, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fynixui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core package for Fynix UI framework - A lightweight, reactive UI framework with TypeScript support.",
|
|
6
6
|
"main": "./dist/fynix/index.js",
|
|
@@ -201,6 +201,8 @@
|
|
|
201
201
|
"test": "vitest run",
|
|
202
202
|
"test:watch": "vitest",
|
|
203
203
|
"test:coverage": "vitest run --coverage",
|
|
204
|
+
"benchmark": "vitest run --config vitest.bench.config.ts --reporter=verbose",
|
|
205
|
+
"benchmark:watch": "vitest --config vitest.bench.config.ts",
|
|
204
206
|
"prepublishOnly": "npm run build",
|
|
205
207
|
"prepack": "npm run build",
|
|
206
208
|
"version": "npm run format && git add -A",
|
|
@@ -214,12 +216,13 @@
|
|
|
214
216
|
"esbuild": "^0.24.2",
|
|
215
217
|
"eslint": "^9.18.0",
|
|
216
218
|
"fdir": "^6.5.0",
|
|
219
|
+
"jsdom": "^29.0.0",
|
|
217
220
|
"prettier": "^3.4.2",
|
|
218
221
|
"rimraf": "^6.1.2",
|
|
219
222
|
"rollup": "^4.56.0",
|
|
220
223
|
"typescript": "^5.9.3",
|
|
221
|
-
"
|
|
222
|
-
"
|
|
224
|
+
"vite": "^7.1.11",
|
|
225
|
+
"vitest": "^2.1.8"
|
|
223
226
|
},
|
|
224
227
|
"peerDependencies": {
|
|
225
228
|
"typescript": ">=5.0.0",
|
|
@@ -249,6 +252,5 @@
|
|
|
249
252
|
"./types/global.d.ts"
|
|
250
253
|
]
|
|
251
254
|
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
+
}
|
|
256
|
+
}
|