fractostate 1.0.0 → 1.0.2

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.
Files changed (52) hide show
  1. package/dist/cjs/index.js +2 -0
  2. package/dist/cjs/package.json +3 -0
  3. package/dist/cjs/src/index.js +66 -0
  4. package/dist/cjs/src/index.js.map +1 -0
  5. package/dist/cjs/src/proxy.js +289 -0
  6. package/dist/cjs/src/proxy.js.map +1 -0
  7. package/dist/cjs/src/store.js +373 -0
  8. package/dist/cjs/src/store.js.map +1 -0
  9. package/dist/esm/index.js +2 -0
  10. package/dist/esm/package.json +3 -0
  11. package/dist/esm/src/index.js +63 -0
  12. package/dist/esm/src/index.js.map +1 -0
  13. package/dist/esm/src/proxy.js +286 -0
  14. package/dist/esm/src/proxy.js.map +1 -0
  15. package/dist/esm/src/store.js +371 -0
  16. package/dist/esm/src/store.js.map +1 -0
  17. package/dist/index.d.ts +124 -0
  18. package/package.json +49 -9
  19. package/docs/api-reference.md +0 -46
  20. package/docs/architecture.md +0 -27
  21. package/docs/getting-started.md +0 -94
  22. package/src/index.ts +0 -82
  23. package/src/proxy.ts +0 -313
  24. package/src/store.ts +0 -324
  25. package/src/types.ts +0 -126
  26. package/test/README.md +0 -73
  27. package/test/eslint.config.js +0 -23
  28. package/test/index.html +0 -13
  29. package/test/package.json +0 -47
  30. package/test/postcss.config.mjs +0 -7
  31. package/test/public/vite.svg +0 -1
  32. package/test/src/App.css +0 -42
  33. package/test/src/App.tsx +0 -44
  34. package/test/src/assets/react.svg +0 -1
  35. package/test/src/components/CartDrawer.tsx +0 -79
  36. package/test/src/components/Navbar.tsx +0 -48
  37. package/test/src/components/Notifications.tsx +0 -27
  38. package/test/src/components/ProductList.tsx +0 -56
  39. package/test/src/flows.ts +0 -7
  40. package/test/src/index.css +0 -33
  41. package/test/src/layout/Layout.tsx +0 -68
  42. package/test/src/layout/ProtectedRoute.tsx +0 -19
  43. package/test/src/main.tsx +0 -10
  44. package/test/src/pages/LoginPage.tsx +0 -86
  45. package/test/src/pages/ProfilePage.tsx +0 -48
  46. package/test/src/pages/ShopPage.tsx +0 -54
  47. package/test/src/store/auth.ts +0 -39
  48. package/test/src/store/flows.ts +0 -74
  49. package/test/tsconfig.app.json +0 -31
  50. package/test/tsconfig.json +0 -7
  51. package/test/tsconfig.node.json +0 -29
  52. package/test/vite.config.ts +0 -16
@@ -1,74 +0,0 @@
1
- import { defineFlow } from "fractostate";
2
-
3
- export interface Product {
4
- id: number;
5
- name: string;
6
- price: number;
7
- image: string;
8
- category: string;
9
- }
10
-
11
- export interface CartItem extends Product {
12
- quantity: number;
13
- }
14
-
15
- // --- Cart Flow ---
16
- export const CartFlow = defineFlow<{ items: CartItem[] }>("cart", {
17
- items: [],
18
- });
19
-
20
- // --- User Flow ---
21
- export const UserFlow = defineFlow<{
22
- name: string;
23
- isPremium: boolean;
24
- avatar: string;
25
- }>("user", {
26
- name: "Marc Ansene",
27
- isPremium: true,
28
- avatar: "https://api.dicebear.com/7.x/avataaars/svg?seed=Marc",
29
- });
30
-
31
- // --- Shop Flow ---
32
- export const ShopProducts = [
33
- {
34
- id: 1,
35
- name: "Fractal Watch",
36
- price: 299,
37
- category: "Accessories",
38
- image: "⌚",
39
- },
40
- { id: 2, name: "Neon Hoodie", price: 89, category: "Apparel", image: "🧥" },
41
- {
42
- id: 3,
43
- name: "Quantum Buds",
44
- price: 159,
45
- category: "Electronics",
46
- image: "🎧",
47
- },
48
- {
49
- id: 4,
50
- name: "Void Keyboard",
51
- price: 199,
52
- category: "Electronics",
53
- image: "⌨️",
54
- },
55
- ];
56
-
57
- export const ShopFlow = defineFlow<{
58
- loading: boolean;
59
- category: string;
60
- search: string;
61
- }>("shop", {
62
- loading: false,
63
- category: "All",
64
- search: "",
65
- });
66
-
67
- // --- UI / Notification Flow ---
68
- export const UIFlow = defineFlow<{
69
- cartOpen: boolean;
70
- notifications: { id: number; text: string; type: "success" | "error" }[];
71
- }>("ui", {
72
- cartOpen: false,
73
- notifications: [],
74
- });
@@ -1,31 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
- "target": "ES2022",
5
- "useDefineForClassFields": true,
6
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
7
- "module": "ESNext",
8
- "types": ["vite/client"],
9
- "skipLibCheck": true,
10
- "paths": {
11
- "fractostate": ["../src"]
12
- },
13
-
14
- /* Bundler mode */
15
- "moduleResolution": "bundler",
16
- "allowImportingTsExtensions": true,
17
- "verbatimModuleSyntax": true,
18
- "moduleDetection": "force",
19
- "noEmit": true,
20
- "jsx": "react-jsx",
21
-
22
- /* Linting */
23
- "strict": true,
24
- "noUnusedLocals": true,
25
- "noUnusedParameters": true,
26
- "erasableSyntaxOnly": true,
27
- "noFallthroughCasesInSwitch": true,
28
- "noUncheckedSideEffectImports": true
29
- },
30
- "include": ["src", "postcss.config.mjs"]
31
- }
@@ -1,7 +0,0 @@
1
- {
2
- "files": [],
3
- "references": [
4
- { "path": "./tsconfig.app.json" },
5
- { "path": "./tsconfig.node.json" }
6
- ]
7
- }
@@ -1,29 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
- "target": "ES2023",
5
- "lib": ["ES2023"],
6
- "module": "ESNext",
7
- "types": ["node"],
8
- "skipLibCheck": true,
9
-
10
- /* Bundler mode */
11
- "moduleResolution": "bundler",
12
- "allowImportingTsExtensions": true,
13
- "verbatimModuleSyntax": true,
14
- "moduleDetection": "force",
15
- "noEmit": true,
16
-
17
- /* Linting */
18
- "strict": true,
19
- "noUnusedLocals": true,
20
- "noUnusedParameters": true,
21
- "erasableSyntaxOnly": true,
22
- "noFallthroughCasesInSwitch": true,
23
- "noUncheckedSideEffectImports": true,
24
- "paths": {
25
- "fractostate": ["../src"]
26
- }
27
- },
28
- "include": ["vite.config.ts"]
29
- }
@@ -1,16 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import react from "@vitejs/plugin-react";
3
-
4
- import path from "path";
5
-
6
- // https://vite.dev/config/
7
- export default defineConfig({
8
- plugins: [react()],
9
- resolve: {
10
- alias: {
11
- fractostate: path.resolve(__dirname, "../src"),
12
- react: path.resolve(__dirname, "./node_modules/react"),
13
- "react-dom": path.resolve(__dirname, "./node_modules/react-dom"),
14
- },
15
- },
16
- });