@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.
@@ -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-fynix",
6
+ name: "vite-plugin-res",
12
7
  enforce: "pre",
13
8
  async transform(code, id) {
14
- if (!/\.(js|fnx)$/.test(id) || /node_modules/.test(id)) {
9
+ if (!id.includes("/src/"))
15
10
  return null;
16
- }
17
- try {
18
- const result = await transform(code, {
19
- loader: "tsx",
20
- jsxFactory: "Fynix",
21
- jsxFragment: "Fynix.Fragment",
22
- sourcemap: true,
23
- sourcefile: id,
24
- target: "es2020"
25
- });
26
- if (failedFiles.has(id)) {
27
- failedFiles.delete(id);
28
- const fileName = id.split("/").pop();
29
- const timestamp = (/* @__PURE__ */ new Date()).toLocaleTimeString();
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 (/\.(js|fnx)$/.test(file) && !/node_modules/.test(file)) {
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": ["/**\r\n * @fileoverview Vite plugin for Fynix JSX transformation.\r\n * Transforms JSX syntax to Fynix function calls using esbuild.\r\n * Integrates with Fynix's error overlay system.\r\n */\r\n\r\nimport { transform } from \"esbuild\";\r\n\r\n/**\r\n * Vite plugin for transforming Fynix JSX files.\r\n * Automatically transforms .js and .fnx files.\r\n *\r\n * @returns {Object} Vite plugin object\r\n *\r\n * @example\r\n * // vite.config.js\r\n * import { defineConfig } from 'vite';\r\n * import { fynix } from '@fynixorg/ui/plugins/vite-plugin-fynix';\r\n *\r\n * export default defineConfig({\r\n * plugins: [fynix()]\r\n * });\r\n */\r\nexport function fynix() {\r\n const failedFiles = new Set();\r\n const COMPILE_SUCCESS_COLOR = \"\\x1b[32m\"; // Green\r\n const COMPILE_ERROR_COLOR = \"\\x1b[31m\"; // Red\r\n const RESET_COLOR = \"\\x1b[0m\";\r\n const BOLD = \"\\x1b[1m\";\r\n\r\n return {\r\n name: \"vite-plugin-fynix\",\r\n enforce: \"pre\",\r\n\r\n async transform(code, id) {\r\n // Only transform .js and .fnx files, exclude node_modules\r\n if (!/\\.(js|fnx)$/.test(id) || /node_modules/.test(id)) {\r\n return null;\r\n }\r\n\r\n try {\r\n const result = await transform(code, {\r\n loader: \"tsx\",\r\n jsxFactory: \"Fynix\",\r\n jsxFragment: \"Fynix.Fragment\",\r\n sourcemap: true,\r\n sourcefile: id,\r\n target: \"es2020\",\r\n });\r\n\r\n // Check if this file previously failed\r\n if (failedFiles.has(id)) {\r\n failedFiles.delete(id);\r\n const fileName = id.split(\"/\").pop();\r\n const timestamp = new Date().toLocaleTimeString();\r\n\r\n console.log(\r\n `${COMPILE_SUCCESS_COLOR}\u2713${RESET_COLOR} ` +\r\n `${BOLD}${fileName}${RESET_COLOR} ` +\r\n `${COMPILE_SUCCESS_COLOR}compiled successfully!${RESET_COLOR} ` +\r\n `${timestamp}`,\r\n );\r\n }\r\n\r\n return {\r\n code: result.code,\r\n map: result.map,\r\n };\r\n } catch (error) {\r\n // Mark this file as failed\r\n failedFiles.add(id);\r\n\r\n // Create a detailed error with code frame\r\n const lines = code.split(\"\\n\");\r\n const errorLine = error.location?.line || 1;\r\n const errorColumn = error.location?.column || 0;\r\n\r\n // Show 3 lines before and after the error\r\n const start = Math.max(0, errorLine - 4);\r\n const end = Math.min(lines.length, errorLine + 3);\r\n\r\n const codeFrame = lines\r\n .slice(start, end)\r\n .map((line, i) => {\r\n const lineNum = start + i + 1;\r\n const isErrorLine = lineNum === errorLine;\r\n const prefix = isErrorLine ? \"> \" : \" \";\r\n const formattedLine = `${prefix}${lineNum.toString().padStart(4)} | ${line}`;\r\n\r\n if (isErrorLine && errorColumn > 0) {\r\n const pointer = \" \".repeat(prefix.length + 6 + errorColumn) + \"^\";\r\n return `${formattedLine}\\n${pointer}`;\r\n }\r\n return formattedLine;\r\n })\r\n .join(\"\\n\");\r\n\r\n const fileName = id.split(\"/\").pop();\r\n const errorMessage = `\r\n${COMPILE_ERROR_COLOR}\u2717 Fynix Transform Error${RESET_COLOR} in ${BOLD}${fileName}${RESET_COLOR}\r\n\r\n${error.text || error.message}\r\n\r\n${codeFrame}\r\n `.trim();\r\n\r\n // Log to terminal\r\n console.error(errorMessage);\r\n\r\n // Create error object for Vite's error overlay\r\n const viteError = Object.assign(\r\n new Error(error.text || error.message),\r\n {\r\n id: id,\r\n plugin: \"vite-plugin-fynix\",\r\n loc: {\r\n file: id,\r\n line: errorLine,\r\n column: errorColumn,\r\n },\r\n frame: codeFrame,\r\n },\r\n );\r\n\r\n this.error(viteError);\r\n }\r\n },\r\n\r\n handleHotUpdate({ file, server }) {\r\n // Only reload for .js and .fnx files, exclude node_modules\r\n if (/\\.(js|fnx)$/.test(file) && !/node_modules/.test(file)) {\r\n // Clear Fynix error overlay on HMR\r\n server.ws.send({\r\n type: \"custom\",\r\n event: \"fynix:clear-overlay\",\r\n });\r\n\r\n // Full reload for Fynix components\r\n server.ws.send({ type: \"full-reload\" });\r\n return [];\r\n }\r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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.7",
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": "dist/runtime.d.ts",
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: any;
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 extends FynixJSX.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 Element = any;
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"?: string | { value: string; subscribe: (cb: () => void) => () => void };
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?: "button" | "checkbox" | "color" | "date" | "datetime-local"
119
- | "email" | "file" | "hidden" | "image" | "month" | "number"
120
- | "password" | "radio" | "range" | "reset" | "search"
121
- | "submit" | "tel" | "text" | "time" | "url" | "week";
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
- };
File without changes
@@ -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
- };
@@ -1,2 +0,0 @@
1
- export { Button } from "./button";
2
- export { Path } from "./path";
@@ -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;
@@ -1,4 +0,0 @@
1
- export * from "../runtime.js";
2
- export * from "../router/router.js";
3
- export { Fynix } from "../runtime.js";
4
- export { default as createFynix } from "../router/router.js";
@@ -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,7 +0,0 @@
1
- export function nixAsyncCached(key: any, promiseFactory: any): {
2
- data: import("./nixState").NixState;
3
- error: import("./nixState").NixState;
4
- loading: import("./nixState").NixState;
5
- run: () => Promise<void>;
6
- cancel: () => void;
7
- };
@@ -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
- };