@fynixorg/ui 1.0.7 → 1.0.9
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/plugins/vite-plugin-res.js +17 -80
- package/dist/plugins/vite-plugin-res.js.map +2 -2
- package/package.json +3 -3
- package/types/global.d.ts +9 -6
- package/types/jsx.d.ts +34 -11
- package/dist/build.d.ts +0 -1
- package/dist/context/context.d.ts +0 -99
- package/dist/custom/Outlet.d.ts +0 -0
- package/dist/custom/button.d.ts +0 -62
- package/dist/custom/index.d.ts +0 -2
- package/dist/custom/path.d.ts +0 -71
- package/dist/error/errorOverlay.d.ts +0 -26
- package/dist/fynix/index.d.ts +0 -4
- package/dist/hooks/nixAsync.d.ts +0 -13
- package/dist/hooks/nixAsyncCache.d.ts +0 -7
- package/dist/hooks/nixAsyncDebounce.d.ts +0 -28
- package/dist/hooks/nixAsyncQuery.d.ts +0 -40
- package/dist/hooks/nixCallback.d.ts +0 -30
- package/dist/hooks/nixComputed.d.ts +0 -93
- package/dist/hooks/nixDebounce.d.ts +0 -32
- package/dist/hooks/nixEffect.d.ts +0 -64
- package/dist/hooks/nixForm.d.ts +0 -15
- package/dist/hooks/nixFormAsync.d.ts +0 -20
- package/dist/hooks/nixInterval.d.ts +0 -26
- package/dist/hooks/nixLazy.d.ts +0 -19
- package/dist/hooks/nixLazyAsync.d.ts +0 -26
- package/dist/hooks/nixLazyFormAsync.d.ts +0 -29
- package/dist/hooks/nixLocalStorage.d.ts +0 -22
- package/dist/hooks/nixMemo.d.ts +0 -8
- package/dist/hooks/nixPrevious.d.ts +0 -18
- package/dist/hooks/nixRef.d.ts +0 -10
- package/dist/hooks/nixState.d.ts +0 -73
- package/dist/hooks/nixStore.d.ts +0 -9
- package/dist/plugins/vite-plugin-res.d.ts +0 -16
- package/dist/router/router.d.ts +0 -53
- package/dist/runtime.d.ts +0 -91
|
@@ -2,89 +2,29 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
import { transform } from "esbuild";
|
|
4
4
|
function fynix() {
|
|
5
|
-
const failedFiles = /* @__PURE__ */ new Set();
|
|
6
|
-
const COMPILE_SUCCESS_COLOR = "\x1B[32m";
|
|
7
|
-
const COMPILE_ERROR_COLOR = "\x1B[31m";
|
|
8
|
-
const RESET_COLOR = "\x1B[0m";
|
|
9
|
-
const BOLD = "\x1B[1m";
|
|
10
5
|
return {
|
|
11
|
-
name: "vite-plugin-
|
|
6
|
+
name: "vite-plugin-res",
|
|
12
7
|
enforce: "pre",
|
|
13
8
|
async transform(code, id) {
|
|
14
|
-
if (
|
|
9
|
+
if (!id.includes("/src/"))
|
|
15
10
|
return null;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
console.log(
|
|
31
|
-
`${COMPILE_SUCCESS_COLOR}\u2713${RESET_COLOR} ${BOLD}${fileName}${RESET_COLOR} ${COMPILE_SUCCESS_COLOR}compiled successfully!${RESET_COLOR} ${timestamp}`
|
|
32
|
-
);
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
code: result.code,
|
|
36
|
-
map: result.map
|
|
37
|
-
};
|
|
38
|
-
} catch (error) {
|
|
39
|
-
failedFiles.add(id);
|
|
40
|
-
const lines = code.split("\n");
|
|
41
|
-
const errorLine = error.location?.line || 1;
|
|
42
|
-
const errorColumn = error.location?.column || 0;
|
|
43
|
-
const start = Math.max(0, errorLine - 4);
|
|
44
|
-
const end = Math.min(lines.length, errorLine + 3);
|
|
45
|
-
const codeFrame = lines.slice(start, end).map((line, i) => {
|
|
46
|
-
const lineNum = start + i + 1;
|
|
47
|
-
const isErrorLine = lineNum === errorLine;
|
|
48
|
-
const prefix = isErrorLine ? "> " : " ";
|
|
49
|
-
const formattedLine = `${prefix}${lineNum.toString().padStart(4)} | ${line}`;
|
|
50
|
-
if (isErrorLine && errorColumn > 0) {
|
|
51
|
-
const pointer = " ".repeat(prefix.length + 6 + errorColumn) + "^";
|
|
52
|
-
return `${formattedLine}
|
|
53
|
-
${pointer}`;
|
|
54
|
-
}
|
|
55
|
-
return formattedLine;
|
|
56
|
-
}).join("\n");
|
|
57
|
-
const fileName = id.split("/").pop();
|
|
58
|
-
const errorMessage = `
|
|
59
|
-
${COMPILE_ERROR_COLOR}\u2717 Fynix Transform Error${RESET_COLOR} in ${BOLD}${fileName}${RESET_COLOR}
|
|
60
|
-
|
|
61
|
-
${error.text || error.message}
|
|
62
|
-
|
|
63
|
-
${codeFrame}
|
|
64
|
-
`.trim();
|
|
65
|
-
console.error(errorMessage);
|
|
66
|
-
const viteError = Object.assign(
|
|
67
|
-
new Error(error.text || error.message),
|
|
68
|
-
{
|
|
69
|
-
id,
|
|
70
|
-
plugin: "vite-plugin-fynix",
|
|
71
|
-
loc: {
|
|
72
|
-
file: id,
|
|
73
|
-
line: errorLine,
|
|
74
|
-
column: errorColumn
|
|
75
|
-
},
|
|
76
|
-
frame: codeFrame
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
this.error(viteError);
|
|
80
|
-
}
|
|
11
|
+
if (!id.endsWith(".ts") && !id.endsWith(".js") && !id.endsWith(".fnx"))
|
|
12
|
+
return null;
|
|
13
|
+
this.addWatchFile(id);
|
|
14
|
+
const result = await transform(code, {
|
|
15
|
+
loader: "jsx",
|
|
16
|
+
jsxFactory: "Fynix",
|
|
17
|
+
jsxFragment: "Fynix.Fragment",
|
|
18
|
+
sourcemap: true,
|
|
19
|
+
sourcefile: id
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
code: result.code,
|
|
23
|
+
map: result.map
|
|
24
|
+
};
|
|
81
25
|
},
|
|
82
26
|
handleHotUpdate({ file, server }) {
|
|
83
|
-
if (
|
|
84
|
-
server.ws.send({
|
|
85
|
-
type: "custom",
|
|
86
|
-
event: "fynix:clear-overlay"
|
|
87
|
-
});
|
|
27
|
+
if (file.endsWith(".ts") || file.endsWith(".js") || file.endsWith(".fnx")) {
|
|
88
28
|
server.ws.send({ type: "full-reload" });
|
|
89
29
|
return [];
|
|
90
30
|
}
|
|
@@ -92,7 +32,4 @@ ${codeFrame}
|
|
|
92
32
|
};
|
|
93
33
|
}
|
|
94
34
|
__name(fynix, "fynix");
|
|
95
|
-
export {
|
|
96
|
-
fynix
|
|
97
|
-
};
|
|
98
35
|
//# sourceMappingURL=vite-plugin-res.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../plugins/vite-plugin-res.js"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;
|
|
4
|
+
"sourcesContent": ["import { transform } from \"esbuild\";\r\nfunction fynix() {\r\n return {\r\n name: \"vite-plugin-res\",\r\n enforce: \"pre\",\r\n async transform(code, id) {\r\n if (!id.includes(\"/src/\")) return null;\r\n if (!id.endsWith(\".ts\") && !id.endsWith(\".js\") && !id.endsWith(\".fnx\"))\r\n return null;\r\n this.addWatchFile(id);\r\n const result = await transform(code, {\r\n loader: \"jsx\",\r\n jsxFactory: \"Fynix\",\r\n jsxFragment: \"Fynix.Fragment\",\r\n sourcemap: true,\r\n sourcefile: id,\r\n });\r\n return {\r\n code: result.code,\r\n map: result.map,\r\n };\r\n },\r\n handleHotUpdate({ file, server }) {\r\n if (\r\n file.endsWith(\".ts\") ||\r\n file.endsWith(\".js\") ||\r\n file.endsWith(\".fnx\")\r\n ) {\r\n server.ws.send({ type: \"full-reload\" });\r\n return [];\r\n }\r\n },\r\n };\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;AAAA,SAAS,iBAAiB;AAC1B,SAAS,QAAQ;AACf,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,MAAM,UAAU,MAAM,IAAI;AACxB,UAAI,CAAC,GAAG,SAAS,OAAO;AAAG,eAAO;AAClC,UAAI,CAAC,GAAG,SAAS,KAAK,KAAK,CAAC,GAAG,SAAS,KAAK,KAAK,CAAC,GAAG,SAAS,MAAM;AACnE,eAAO;AACT,WAAK,aAAa,EAAE;AACpB,YAAM,SAAS,MAAM,UAAU,MAAM;AAAA,QACnC,QAAQ;AAAA,QACR,YAAY;AAAA,QACZ,aAAa;AAAA,QACb,WAAW;AAAA,QACX,YAAY;AAAA,MACd,CAAC;AACD,aAAO;AAAA,QACL,MAAM,OAAO;AAAA,QACb,KAAK,OAAO;AAAA,MACd;AAAA,IACF;AAAA,IACA,gBAAgB,EAAE,MAAM,OAAO,GAAG;AAChC,UACE,KAAK,SAAS,KAAK,KACnB,KAAK,SAAS,KAAK,KACnB,KAAK,SAAS,MAAM,GACpB;AACA,eAAO,GAAG,KAAK,EAAE,MAAM,cAAc,CAAC;AACtC,eAAO,CAAC;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACF;AAhCS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fynixorg/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Core package for Fynix UI framework.",
|
|
6
6
|
"main": "dist/fynix/index.js",
|
|
7
|
-
"types": "
|
|
7
|
+
"types": "runtime.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": "./dist/runtime.js",
|
|
10
10
|
"./context": "./dist/context/context.js",
|
|
@@ -59,4 +59,4 @@
|
|
|
59
59
|
"scripts": {
|
|
60
60
|
"build": "node build.js"
|
|
61
61
|
}
|
|
62
|
-
}
|
|
62
|
+
}
|
package/types/global.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Virtual DOM node type for Fynix
|
|
2
|
+
* Virtual DOM node type for Fynix (unified with runtime.d.ts)
|
|
3
3
|
*/
|
|
4
4
|
type VNode = {
|
|
5
|
-
type: any;
|
|
6
|
-
props: any
|
|
7
|
-
key:
|
|
5
|
+
type: string | symbol | ((props: any) => any);
|
|
6
|
+
props: Record<string, any>;
|
|
7
|
+
key: string | number | null;
|
|
8
|
+
_domNode?: Node;
|
|
9
|
+
_rendered?: VNode;
|
|
10
|
+
_state?: any;
|
|
8
11
|
};
|
|
9
12
|
// global.d.ts - Fynix Global Type Declarations
|
|
10
13
|
|
|
@@ -56,7 +59,7 @@ interface NixFormState<T extends Record<string, any>> {
|
|
|
56
59
|
isSubmitting: boolean;
|
|
57
60
|
errors: { [K in keyof T]?: string };
|
|
58
61
|
handleSubmit: (
|
|
59
|
-
onSubmit: (values: T) => void | Promise<void
|
|
62
|
+
onSubmit: (values: T) => void | Promise<void>,
|
|
60
63
|
) => (e?: Event) => Promise<void>;
|
|
61
64
|
reset: () => void;
|
|
62
65
|
setFieldValue: <K extends keyof T>(field: K, value: T[K]) => void;
|
|
@@ -170,7 +173,7 @@ interface ImportMeta {
|
|
|
170
173
|
as?: "url" | "raw";
|
|
171
174
|
/** Custom import query */
|
|
172
175
|
query?: Record<string, string | number | boolean>;
|
|
173
|
-
}
|
|
176
|
+
},
|
|
174
177
|
) => Record<string, T>;
|
|
175
178
|
|
|
176
179
|
/** Environment variables */
|
package/types/jsx.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ export {};
|
|
|
3
3
|
declare global {
|
|
4
4
|
namespace JSX {
|
|
5
5
|
type Element = FynixJSX.Element;
|
|
6
|
-
interface ElementChildrenAttribute
|
|
6
|
+
interface ElementChildrenAttribute
|
|
7
|
+
extends FynixJSX.ElementChildrenAttribute {}
|
|
7
8
|
interface IntrinsicElements extends FynixJSX.IntrinsicElements {}
|
|
8
9
|
// Optionally, add more interfaces if needed
|
|
9
10
|
}
|
|
@@ -11,7 +12,8 @@ declare global {
|
|
|
11
12
|
// JSX Type Definitions for Fynix
|
|
12
13
|
|
|
13
14
|
declare namespace FynixJSX {
|
|
14
|
-
type
|
|
15
|
+
// Use the VNode type for JSX elements for better type inference
|
|
16
|
+
type Element = VNode;
|
|
15
17
|
|
|
16
18
|
interface ElementChildrenAttribute {
|
|
17
19
|
children: {};
|
|
@@ -78,7 +80,9 @@ declare namespace FynixJSX {
|
|
|
78
80
|
"r-mouseup"?: (this: HTMLElement, event: MouseEvent) => void;
|
|
79
81
|
"r-mousemove"?: (this: HTMLElement, event: MouseEvent) => void;
|
|
80
82
|
"r-scroll"?: (this: HTMLElement, event: Event) => void;
|
|
81
|
-
"r-class"?:
|
|
83
|
+
"r-class"?:
|
|
84
|
+
| string
|
|
85
|
+
| { value: string; subscribe: (cb: () => void) => () => void };
|
|
82
86
|
rc?: string | { value: string; subscribe: (cb: () => void) => () => void };
|
|
83
87
|
|
|
84
88
|
// Data attributes
|
|
@@ -115,10 +119,29 @@ declare namespace FynixJSX {
|
|
|
115
119
|
}
|
|
116
120
|
|
|
117
121
|
interface InputHTMLAttributes extends HTMLAttributes {
|
|
118
|
-
type?:
|
|
119
|
-
| "
|
|
120
|
-
| "
|
|
121
|
-
| "
|
|
122
|
+
type?:
|
|
123
|
+
| "button"
|
|
124
|
+
| "checkbox"
|
|
125
|
+
| "color"
|
|
126
|
+
| "date"
|
|
127
|
+
| "datetime-local"
|
|
128
|
+
| "email"
|
|
129
|
+
| "file"
|
|
130
|
+
| "hidden"
|
|
131
|
+
| "image"
|
|
132
|
+
| "month"
|
|
133
|
+
| "number"
|
|
134
|
+
| "password"
|
|
135
|
+
| "radio"
|
|
136
|
+
| "range"
|
|
137
|
+
| "reset"
|
|
138
|
+
| "search"
|
|
139
|
+
| "submit"
|
|
140
|
+
| "tel"
|
|
141
|
+
| "text"
|
|
142
|
+
| "time"
|
|
143
|
+
| "url"
|
|
144
|
+
| "week";
|
|
122
145
|
value?: string | number | readonly string[];
|
|
123
146
|
placeholder?: string;
|
|
124
147
|
checked?: boolean;
|
|
@@ -450,14 +473,14 @@ declare namespace FynixJSX {
|
|
|
450
473
|
strokeOpacity?: string | number;
|
|
451
474
|
fillOpacity?: string | number;
|
|
452
475
|
opacity?: string | number;
|
|
453
|
-
|
|
476
|
+
|
|
454
477
|
// SVG specific
|
|
455
478
|
viewBox?: string;
|
|
456
479
|
xmlns?: string;
|
|
457
480
|
xmlnsXlink?: string;
|
|
458
481
|
preserveAspectRatio?: string;
|
|
459
482
|
transform?: string;
|
|
460
|
-
|
|
483
|
+
|
|
461
484
|
// Geometry
|
|
462
485
|
width?: string | number;
|
|
463
486
|
height?: string | number;
|
|
@@ -475,11 +498,11 @@ declare namespace FynixJSX {
|
|
|
475
498
|
d?: string;
|
|
476
499
|
points?: string;
|
|
477
500
|
pathLength?: number;
|
|
478
|
-
|
|
501
|
+
|
|
479
502
|
// Text
|
|
480
503
|
textAnchor?: "start" | "middle" | "end";
|
|
481
504
|
dominantBaseline?: "auto" | "middle" | "hanging" | "alphabetic";
|
|
482
|
-
|
|
505
|
+
|
|
483
506
|
// Gradient/Filter
|
|
484
507
|
offset?: string | number;
|
|
485
508
|
stopColor?: string;
|
package/dist/build.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Set the active component context.
|
|
3
|
-
* Called internally by the runtime when entering/exiting component rendering.
|
|
4
|
-
*
|
|
5
|
-
* @param {ComponentContext|null} ctx - The component context to set as active, or null to clear
|
|
6
|
-
* @returns {void}
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* // Internal usage in runtime
|
|
10
|
-
* setActiveContext(componentContext);
|
|
11
|
-
* const result = Component(props);
|
|
12
|
-
* setActiveContext(null);
|
|
13
|
-
*/
|
|
14
|
-
export function setActiveContext(ctx: ComponentContext | null): void;
|
|
15
|
-
/**
|
|
16
|
-
* @fileoverview Component context management for Fynix framework.
|
|
17
|
-
* Tracks the currently rendering component to enable hooks to access component state.
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* @typedef {Object} ComponentContext
|
|
21
|
-
* @property {Array<any>} hooks - Array of hook states
|
|
22
|
-
* @property {number} hookIndex - Current hook index during render
|
|
23
|
-
* @property {Array<Function>} effects - Array of effect cleanup functions
|
|
24
|
-
* @property {Array<Function>} cleanups - Array of cleanup functions
|
|
25
|
-
* @property {Array<Function>} [stateCleanups] - Array of state cleanup functions
|
|
26
|
-
* @property {Object} _vnode - Associated virtual node
|
|
27
|
-
* @property {Set<any>} _accessedStates - Set of states accessed during render
|
|
28
|
-
* @property {Set<any>} _subscriptions - Set of active subscriptions
|
|
29
|
-
* @property {Array<Function>} _subscriptionCleanups - Array of subscription cleanup functions
|
|
30
|
-
* @property {number} version - Component version for tracking updates
|
|
31
|
-
* @property {Function|null} rerender - Function to trigger component re-render
|
|
32
|
-
* @property {Function} Component - Component function
|
|
33
|
-
* @property {boolean} _isMounted - Whether component is mounted
|
|
34
|
-
* @property {boolean} _isRerendering - Whether component is currently re-rendering
|
|
35
|
-
*/
|
|
36
|
-
/**
|
|
37
|
-
* The currently active component context.
|
|
38
|
-
* This is set during component rendering to allow hooks to access the component's state.
|
|
39
|
-
* @type {ComponentContext|null}
|
|
40
|
-
*/
|
|
41
|
-
export let activeContext: ComponentContext | null;
|
|
42
|
-
export type ComponentContext = {
|
|
43
|
-
/**
|
|
44
|
-
* - Array of hook states
|
|
45
|
-
*/
|
|
46
|
-
hooks: Array<any>;
|
|
47
|
-
/**
|
|
48
|
-
* - Current hook index during render
|
|
49
|
-
*/
|
|
50
|
-
hookIndex: number;
|
|
51
|
-
/**
|
|
52
|
-
* - Array of effect cleanup functions
|
|
53
|
-
*/
|
|
54
|
-
effects: Array<Function>;
|
|
55
|
-
/**
|
|
56
|
-
* - Array of cleanup functions
|
|
57
|
-
*/
|
|
58
|
-
cleanups: Array<Function>;
|
|
59
|
-
/**
|
|
60
|
-
* - Array of state cleanup functions
|
|
61
|
-
*/
|
|
62
|
-
stateCleanups?: Array<Function>;
|
|
63
|
-
/**
|
|
64
|
-
* - Associated virtual node
|
|
65
|
-
*/
|
|
66
|
-
_vnode: any;
|
|
67
|
-
/**
|
|
68
|
-
* - Set of states accessed during render
|
|
69
|
-
*/
|
|
70
|
-
_accessedStates: Set<any>;
|
|
71
|
-
/**
|
|
72
|
-
* - Set of active subscriptions
|
|
73
|
-
*/
|
|
74
|
-
_subscriptions: Set<any>;
|
|
75
|
-
/**
|
|
76
|
-
* - Array of subscription cleanup functions
|
|
77
|
-
*/
|
|
78
|
-
_subscriptionCleanups: Array<Function>;
|
|
79
|
-
/**
|
|
80
|
-
* - Component version for tracking updates
|
|
81
|
-
*/
|
|
82
|
-
version: number;
|
|
83
|
-
/**
|
|
84
|
-
* - Function to trigger component re-render
|
|
85
|
-
*/
|
|
86
|
-
rerender: Function | null;
|
|
87
|
-
/**
|
|
88
|
-
* - Component function
|
|
89
|
-
*/
|
|
90
|
-
Component: Function;
|
|
91
|
-
/**
|
|
92
|
-
* - Whether component is mounted
|
|
93
|
-
*/
|
|
94
|
-
_isMounted: boolean;
|
|
95
|
-
/**
|
|
96
|
-
* - Whether component is currently re-rendering
|
|
97
|
-
*/
|
|
98
|
-
_isRerendering: boolean;
|
|
99
|
-
};
|
package/dist/custom/Outlet.d.ts
DELETED
|
File without changes
|
package/dist/custom/button.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef {Object} ButtonProps
|
|
3
|
-
* @property {string} [value=""] - Button text content
|
|
4
|
-
* @property {string} [type="button"] - Button type (button, submit, reset)
|
|
5
|
-
* @property {boolean} [disabled=false] - Whether button is disabled
|
|
6
|
-
* @property {string} [rc] - Reactive class attribute (Fynix-specific)
|
|
7
|
-
* @property {string} [class] - CSS class names
|
|
8
|
-
* @property {(this: HTMLElement, event: MouseEvent) => void} [r-click] - Click event handler
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Button component for Fynix applications.
|
|
12
|
-
* Renders a native HTML button element with Fynix event handling.
|
|
13
|
-
*
|
|
14
|
-
* @param {ButtonProps & Record<string, any>} props - Component props
|
|
15
|
-
* @returns {VNode} Button element virtual node
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* // Basic button
|
|
19
|
-
* <Button value="Click Me" />
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* // With click handler
|
|
23
|
-
* <Button
|
|
24
|
-
* value="Submit"
|
|
25
|
-
* r-click={() => console.log('Clicked!')}
|
|
26
|
-
* />
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* // Submit button with styling
|
|
30
|
-
* <Button
|
|
31
|
-
* value="Save"
|
|
32
|
-
* type="submit"
|
|
33
|
-
* rc="px-4 py-2 bg-blue-500 text-white rounded"
|
|
34
|
-
* />
|
|
35
|
-
*/
|
|
36
|
-
export function Button({ value, ...props }: ButtonProps & Record<string, any>): VNode;
|
|
37
|
-
export type ButtonProps = {
|
|
38
|
-
/**
|
|
39
|
-
* - Button text content
|
|
40
|
-
*/
|
|
41
|
-
value?: string;
|
|
42
|
-
/**
|
|
43
|
-
* - Button type (button, submit, reset)
|
|
44
|
-
*/
|
|
45
|
-
type?: string;
|
|
46
|
-
/**
|
|
47
|
-
* - Whether button is disabled
|
|
48
|
-
*/
|
|
49
|
-
disabled?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* - Reactive class attribute (Fynix-specific)
|
|
52
|
-
*/
|
|
53
|
-
rc?: string;
|
|
54
|
-
/**
|
|
55
|
-
* - CSS class names
|
|
56
|
-
*/
|
|
57
|
-
class?: string;
|
|
58
|
-
/**
|
|
59
|
-
* - Click event handler
|
|
60
|
-
*/
|
|
61
|
-
"r-click"?: (this: HTMLElement, event: MouseEvent) => void;
|
|
62
|
-
};
|
package/dist/custom/index.d.ts
DELETED
package/dist/custom/path.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* SPA navigation link component for Fynix router.
|
|
3
|
-
* Automatically handles client-side navigation and prop passing between routes.
|
|
4
|
-
*
|
|
5
|
-
* @param {PathProps & Record<string, any>} options - Component props
|
|
6
|
-
* @returns {VNode} Anchor element virtual node
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* // Basic navigation
|
|
10
|
-
* <Path to="/about" value="About Us" />
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* // Navigate with props
|
|
14
|
-
* <Path
|
|
15
|
-
* to="/user/123"
|
|
16
|
-
* value="View Profile"
|
|
17
|
-
* props={{ userId: 123, fromSearch: true }}
|
|
18
|
-
* />
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* // External link
|
|
22
|
-
* <Path
|
|
23
|
-
* to="https://github.com"
|
|
24
|
-
* value="GitHub"
|
|
25
|
-
* target="_blank"
|
|
26
|
-
* rel="noopener noreferrer"
|
|
27
|
-
* />
|
|
28
|
-
*
|
|
29
|
-
* @example
|
|
30
|
-
* // With styling
|
|
31
|
-
* <Path
|
|
32
|
-
* to="/dashboard"
|
|
33
|
-
* value="Dashboard"
|
|
34
|
-
* rc="px-4 py-2 bg-blue-500 text-white rounded"
|
|
35
|
-
* />
|
|
36
|
-
*/
|
|
37
|
-
export function Path({ to, value, props: routeProps, ...attrs }: PathProps & Record<string, any>): VNode;
|
|
38
|
-
export type PathProps = {
|
|
39
|
-
/**
|
|
40
|
-
* - URL to navigate to (relative or absolute)
|
|
41
|
-
*/
|
|
42
|
-
to?: string;
|
|
43
|
-
/**
|
|
44
|
-
* - Link text content
|
|
45
|
-
*/
|
|
46
|
-
value?: string;
|
|
47
|
-
/**
|
|
48
|
-
* - Props to pass to the destination route component
|
|
49
|
-
*/
|
|
50
|
-
props?: Record<string, any>;
|
|
51
|
-
/**
|
|
52
|
-
* - Link target (_blank, _self, etc.)
|
|
53
|
-
*/
|
|
54
|
-
target?: string;
|
|
55
|
-
/**
|
|
56
|
-
* - Link relationship (noopener, noreferrer, etc.)
|
|
57
|
-
*/
|
|
58
|
-
rel?: string;
|
|
59
|
-
/**
|
|
60
|
-
* - Reactive class attribute (Fynix-specific)
|
|
61
|
-
*/
|
|
62
|
-
rc?: string;
|
|
63
|
-
/**
|
|
64
|
-
* - CSS class names
|
|
65
|
-
*/
|
|
66
|
-
class?: string;
|
|
67
|
-
/**
|
|
68
|
-
* - Element ID
|
|
69
|
-
*/
|
|
70
|
-
id?: string;
|
|
71
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Development error overlay for Fynix applications.
|
|
3
|
-
* Displays runtime errors in a user-friendly overlay during development.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Display an error overlay with error details.
|
|
7
|
-
* Shows error message, stack trace, and a close button.
|
|
8
|
-
*
|
|
9
|
-
* @param {Error} error - The error object to display
|
|
10
|
-
* @returns {void}
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* try {
|
|
14
|
-
* // some code
|
|
15
|
-
* } catch (err) {
|
|
16
|
-
* showErrorOverlay(err);
|
|
17
|
-
* }
|
|
18
|
-
*/
|
|
19
|
-
export function showErrorOverlay(error: Error): void;
|
|
20
|
-
/**
|
|
21
|
-
* Remove the error overlay from the DOM.
|
|
22
|
-
* Fades out the overlay before removing it.
|
|
23
|
-
*
|
|
24
|
-
* @returns {void}
|
|
25
|
-
*/
|
|
26
|
-
export function removeErrorOverlay(): void;
|
package/dist/fynix/index.d.ts
DELETED
package/dist/hooks/nixAsync.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Async state helper with AbortController support.
|
|
3
|
-
*
|
|
4
|
-
* @template T
|
|
5
|
-
* @param {(signal: AbortSignal) => Promise<T>} promiseFactory
|
|
6
|
-
*/
|
|
7
|
-
export function nixAsync<T>(promiseFactory: (signal: AbortSignal) => Promise<T>): {
|
|
8
|
-
data: import("./nixState").NixState;
|
|
9
|
-
error: import("./nixState").NixState;
|
|
10
|
-
loading: import("./nixState").NixState;
|
|
11
|
-
run: () => Promise<void>;
|
|
12
|
-
cancel: () => void;
|
|
13
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Debounced and cancellable async data fetcher with caching and deduping.
|
|
3
|
-
*
|
|
4
|
-
* @param {() => Promise<any>} promiseFactory - Async function that returns a promise.
|
|
5
|
-
* @param {Object} [options={}] - Options for debounce, caching, and abort.
|
|
6
|
-
* @param {number} [options.delay=300] - Debounce delay in ms.
|
|
7
|
-
* @param {boolean} [options.leading=false] - Run on leading edge.
|
|
8
|
-
* @param {boolean} [options.trailing=true] - Run on trailing edge.
|
|
9
|
-
* @param {number} [options.maxWait] - Max wait time before forced invocation.
|
|
10
|
-
* @param {boolean} [options.cache=true] - Enable caching of last result.
|
|
11
|
-
* @param {AbortSignal} [options.signal] - Optional AbortSignal to cancel request.
|
|
12
|
-
* @returns {Object} { data, error, loading, run, cancel }
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* const controller = new AbortController();
|
|
16
|
-
* const { data, error, loading, run, cancel } = nixAsyncDebounce(
|
|
17
|
-
* () => fetch('/api/data').then(r => r.json()),
|
|
18
|
-
* { delay: 500, maxWait: 2000, leading: true, signal: controller.signal }
|
|
19
|
-
* );
|
|
20
|
-
*/
|
|
21
|
-
export function nixAsyncDebounce(promiseFactory: () => Promise<any>, options?: {
|
|
22
|
-
delay?: number;
|
|
23
|
-
leading?: boolean;
|
|
24
|
-
trailing?: boolean;
|
|
25
|
-
maxWait?: number;
|
|
26
|
-
cache?: boolean;
|
|
27
|
-
signal?: AbortSignal;
|
|
28
|
-
}): any;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified async query helper with:
|
|
3
|
-
* - AbortController cancellation
|
|
4
|
-
* - Request deduping
|
|
5
|
-
* - Shared caching
|
|
6
|
-
*
|
|
7
|
-
* @template T
|
|
8
|
-
* @param {string} key
|
|
9
|
-
* Unique cache key representing the request
|
|
10
|
-
*
|
|
11
|
-
* @param {(signal: AbortSignal) => Promise<T>} queryFn
|
|
12
|
-
* Function that performs the async operation
|
|
13
|
-
*
|
|
14
|
-
* @param {{
|
|
15
|
-
* ttl?: number
|
|
16
|
-
* }} [options]
|
|
17
|
-
*
|
|
18
|
-
* @returns {{
|
|
19
|
-
* data: { value: T | null },
|
|
20
|
-
* error: { value: Error | null },
|
|
21
|
-
* loading: { value: boolean },
|
|
22
|
-
* run: () => Promise<void>,
|
|
23
|
-
* cancel: () => void
|
|
24
|
-
* }}
|
|
25
|
-
*/
|
|
26
|
-
export function nixAsyncQuery<T>(key: string, queryFn: (signal: AbortSignal) => Promise<T>, options?: {
|
|
27
|
-
ttl?: number;
|
|
28
|
-
}): {
|
|
29
|
-
data: {
|
|
30
|
-
value: T | null;
|
|
31
|
-
};
|
|
32
|
-
error: {
|
|
33
|
-
value: Error | null;
|
|
34
|
-
};
|
|
35
|
-
loading: {
|
|
36
|
-
value: boolean;
|
|
37
|
-
};
|
|
38
|
-
run: () => Promise<void>;
|
|
39
|
-
cancel: () => void;
|
|
40
|
-
};
|