jac-client 0.2.6__py3-none-any.whl → 0.2.11__py3-none-any.whl
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.
- jac_client/examples/all-in-one/{src/button.jac → button.jac} +4 -3
- jac_client/examples/all-in-one/components/CategoryFilter.jac +47 -0
- jac_client/examples/all-in-one/components/Header.jac +17 -0
- jac_client/examples/all-in-one/components/ProfitOverview.jac +64 -0
- jac_client/examples/all-in-one/components/Summary.jac +76 -0
- jac_client/examples/all-in-one/components/TransactionForm.jac +188 -0
- jac_client/examples/all-in-one/components/TransactionItem.jac +62 -0
- jac_client/examples/all-in-one/components/TransactionList.jac +44 -0
- jac_client/examples/all-in-one/components/button.jac +8 -0
- jac_client/examples/all-in-one/components/navigation.jac +126 -0
- jac_client/examples/all-in-one/constants/categories.jac +36 -0
- jac_client/examples/all-in-one/constants/clients.jac +12 -0
- jac_client/examples/all-in-one/context/BudgetContext.jac +31 -0
- jac_client/examples/all-in-one/hooks/useBudget.jac +122 -0
- jac_client/examples/all-in-one/hooks/useLocalStorage.jac +37 -0
- jac_client/examples/all-in-one/main.jac +542 -0
- jac_client/examples/all-in-one/pages/BudgetPlanner.jac +140 -0
- jac_client/examples/all-in-one/pages/FeaturesTest.jac +157 -0
- jac_client/examples/all-in-one/pages/LandingPage.jac +124 -0
- jac_client/examples/all-in-one/pages/budget_planner_ui.cl.jac +65 -0
- jac_client/examples/all-in-one/pages/features_test_ui.cl.jac +675 -0
- jac_client/examples/all-in-one/pages/loginPage.jac +127 -0
- jac_client/examples/all-in-one/pages/nestedDemo.jac +54 -0
- jac_client/examples/all-in-one/pages/notFound.jac +18 -0
- jac_client/examples/all-in-one/pages/signupPage.jac +127 -0
- jac_client/examples/all-in-one/utils/formatters.jac +49 -0
- jac_client/examples/asset-serving/css-with-image/main.jac +92 -0
- jac_client/examples/asset-serving/image-asset/main.jac +56 -0
- jac_client/examples/asset-serving/import-alias/main.jac +109 -0
- jac_client/examples/basic/main.jac +23 -0
- jac_client/examples/basic-auth/main.jac +363 -0
- jac_client/examples/basic-auth-with-router/main.jac +451 -0
- jac_client/examples/basic-full-stack/main.jac +362 -0
- jac_client/examples/css-styling/js-styling/main.jac +63 -0
- jac_client/examples/css-styling/material-ui/main.jac +122 -0
- jac_client/examples/css-styling/pure-css/main.jac +55 -0
- jac_client/examples/css-styling/sass-example/main.jac +55 -0
- jac_client/examples/css-styling/styled-components/main.jac +62 -0
- jac_client/examples/css-styling/tailwind-example/main.jac +74 -0
- jac_client/examples/full-stack-with-auth/main.jac +696 -0
- jac_client/examples/little-x/main.jac +681 -0
- jac_client/examples/little-x/src/submit-button.jac +15 -14
- jac_client/examples/nested-folders/nested-advance/main.jac +26 -0
- jac_client/examples/nested-folders/nested-advance/src/ButtonRoot.jac +4 -6
- jac_client/examples/nested-folders/nested-advance/src/level1/ButtonSecondL.jac +9 -13
- jac_client/examples/nested-folders/nested-advance/src/level1/Card.jac +29 -32
- jac_client/examples/nested-folders/nested-advance/src/level1/level2/ButtonThirdL.jac +12 -18
- jac_client/examples/nested-folders/nested-basic/{src/app.jac → main.jac} +7 -5
- jac_client/examples/nested-folders/nested-basic/src/button.jac +4 -3
- jac_client/examples/nested-folders/nested-basic/src/components/button.jac +4 -3
- jac_client/examples/ts-support/main.jac +35 -0
- jac_client/examples/with-router/main.jac +286 -0
- jac_client/plugin/cli.jac +507 -470
- jac_client/plugin/client.jac +30 -12
- jac_client/plugin/client_runtime.cl.jac +25 -15
- jac_client/plugin/impl/client.impl.jac +126 -26
- jac_client/plugin/impl/client_runtime.impl.jac +182 -10
- jac_client/plugin/plugin_config.jac +216 -34
- jac_client/plugin/src/__init__.jac +0 -2
- jac_client/plugin/src/compiler.jac +2 -2
- jac_client/plugin/src/config_loader.jac +1 -0
- jac_client/plugin/src/desktop_config.jac +31 -0
- jac_client/plugin/src/impl/compiler.impl.jac +99 -30
- jac_client/plugin/src/impl/config_loader.impl.jac +8 -0
- jac_client/plugin/src/impl/desktop_config.impl.jac +191 -0
- jac_client/plugin/src/impl/jac_to_js.impl.jac +5 -1
- jac_client/plugin/src/impl/package_installer.impl.jac +20 -20
- jac_client/plugin/src/impl/vite_bundler.impl.jac +384 -144
- jac_client/plugin/src/package_installer.jac +1 -1
- jac_client/plugin/src/targets/desktop/sidecar/main.py +144 -0
- jac_client/plugin/src/targets/desktop_target.jac +37 -0
- jac_client/plugin/src/targets/impl/desktop_target.impl.jac +2347 -0
- jac_client/plugin/src/targets/impl/registry.impl.jac +64 -0
- jac_client/plugin/src/targets/impl/web_target.impl.jac +157 -0
- jac_client/plugin/src/targets/register.jac +21 -0
- jac_client/plugin/src/targets/registry.jac +87 -0
- jac_client/plugin/src/targets/web_target.jac +35 -0
- jac_client/plugin/src/vite_bundler.jac +15 -1
- jac_client/plugin/utils/__init__.jac +3 -0
- jac_client/plugin/utils/bun_installer.jac +16 -0
- jac_client/plugin/utils/impl/bun_installer.impl.jac +99 -0
- jac_client/templates/client.jacpack +72 -0
- jac_client/templates/fullstack.jacpack +61 -0
- jac_client/tests/conftest.py +110 -52
- jac_client/tests/fixtures/spawn_test/app.jac +64 -70
- jac_client/tests/fixtures/with-ts/app.jac +28 -28
- jac_client/tests/test_cli.py +280 -113
- jac_client/tests/test_e2e.py +232 -0
- jac_client/tests/test_helpers.py +58 -0
- jac_client/tests/test_it.py +325 -154
- jac_client/tests/test_it_desktop.py +891 -0
- {jac_client-0.2.6.dist-info → jac_client-0.2.11.dist-info}/METADATA +20 -11
- jac_client-0.2.11.dist-info/RECORD +113 -0
- {jac_client-0.2.6.dist-info → jac_client-0.2.11.dist-info}/WHEEL +1 -1
- jac_client/examples/all-in-one/src/app.jac +0 -841
- jac_client/examples/all-in-one/src/components/button.jac +0 -7
- jac_client/examples/asset-serving/css-with-image/src/app.jac +0 -88
- jac_client/examples/asset-serving/image-asset/src/app.jac +0 -55
- jac_client/examples/asset-serving/import-alias/src/app.jac +0 -111
- jac_client/examples/basic/src/app.jac +0 -21
- jac_client/examples/basic-auth/src/app.jac +0 -377
- jac_client/examples/basic-auth-with-router/src/app.jac +0 -464
- jac_client/examples/basic-full-stack/src/app.jac +0 -365
- jac_client/examples/css-styling/js-styling/src/app.jac +0 -84
- jac_client/examples/css-styling/material-ui/src/app.jac +0 -122
- jac_client/examples/css-styling/pure-css/src/app.jac +0 -64
- jac_client/examples/css-styling/sass-example/src/app.jac +0 -64
- jac_client/examples/css-styling/styled-components/src/app.jac +0 -71
- jac_client/examples/css-styling/tailwind-example/src/app.jac +0 -63
- jac_client/examples/full-stack-with-auth/src/app.jac +0 -722
- jac_client/examples/little-x/src/app.jac +0 -719
- jac_client/examples/nested-folders/nested-advance/src/app.jac +0 -35
- jac_client/examples/ts-support/src/app.jac +0 -35
- jac_client/examples/with-router/src/app.jac +0 -323
- jac_client/plugin/src/babel_processor.jac +0 -18
- jac_client/plugin/src/impl/babel_processor.impl.jac +0 -84
- jac_client-0.2.6.dist-info/RECORD +0 -74
- {jac_client-0.2.6.dist-info → jac_client-0.2.11.dist-info}/entry_points.txt +0 -0
- {jac_client-0.2.6.dist-info → jac_client-0.2.11.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Category constants and enums for Budget Planner
|
|
2
|
+
# Demonstrates: enum:pub, glob:pub exports
|
|
3
|
+
cl {
|
|
4
|
+
# Category enum - demonstrates enum:pub export
|
|
5
|
+
enum:pub Category { INCOME, FOOD, TRANSPORT, UTILITIES, ENTERTAINMENT, OTHER }
|
|
6
|
+
|
|
7
|
+
# Category colors - demonstrates glob:pub export
|
|
8
|
+
glob:pub CATEGORY_COLORS: dict = {
|
|
9
|
+
"INCOME": "#10b981",
|
|
10
|
+
"FOOD": "#f59e0b",
|
|
11
|
+
"TRANSPORT": "#3b82f6",
|
|
12
|
+
"UTILITIES": "#8b5cf6",
|
|
13
|
+
"ENTERTAINMENT": "#ec4899",
|
|
14
|
+
"OTHER": "#6b7280"
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
# Category labels for display
|
|
18
|
+
glob:pub CATEGORY_LABELS: dict = {
|
|
19
|
+
"INCOME": "Income",
|
|
20
|
+
"FOOD": "Food & Dining",
|
|
21
|
+
"TRANSPORT": "Transport",
|
|
22
|
+
"UTILITIES": "Utilities",
|
|
23
|
+
"ENTERTAINMENT": "Entertainment",
|
|
24
|
+
"OTHER": "Other"
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
# All category keys as a list
|
|
28
|
+
glob:pub CATEGORIES: list = [
|
|
29
|
+
"INCOME",
|
|
30
|
+
"FOOD",
|
|
31
|
+
"TRANSPORT",
|
|
32
|
+
"UTILITIES",
|
|
33
|
+
"ENTERTAINMENT",
|
|
34
|
+
"OTHER"
|
|
35
|
+
];
|
|
36
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Budget Context for global state management
|
|
2
|
+
# Demonstrates: createContext, useContext, Context.Provider
|
|
3
|
+
cl import from react {
|
|
4
|
+
createContext,
|
|
5
|
+
useContext
|
|
6
|
+
}
|
|
7
|
+
cl import from ..hooks.useBudget { useBudget }
|
|
8
|
+
|
|
9
|
+
cl {
|
|
10
|
+
# Create the context - demonstrates glob for context
|
|
11
|
+
glob:pub BudgetContext = createContext(None);
|
|
12
|
+
|
|
13
|
+
# Provider component - wraps app and provides budget state
|
|
14
|
+
def:pub BudgetProvider(children: any) -> any {
|
|
15
|
+
budget = useBudget();
|
|
16
|
+
|
|
17
|
+
return
|
|
18
|
+
<BudgetContext.Provider value={budget}>
|
|
19
|
+
{children}
|
|
20
|
+
</BudgetContext.Provider>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
# Custom hook to access budget context
|
|
24
|
+
def:pub useBudgetContext -> dict {
|
|
25
|
+
context = useContext(BudgetContext);
|
|
26
|
+
if context == None {
|
|
27
|
+
console.error("useBudgetContext must be used within BudgetProvider");
|
|
28
|
+
}
|
|
29
|
+
return context;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# Custom hook for budget operations
|
|
2
|
+
# Demonstrates: custom hooks, useState, array methods
|
|
3
|
+
cl import from react {
|
|
4
|
+
useCallback,
|
|
5
|
+
useMemo
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
cl {
|
|
9
|
+
# Main budget management hook
|
|
10
|
+
def:pub useBudget -> dict {
|
|
11
|
+
# Simple useState - no complex localStorage hook
|
|
12
|
+
[transactions, setTransactions] = useState([]);
|
|
13
|
+
|
|
14
|
+
# Add a new transaction
|
|
15
|
+
def addTransaction(
|
|
16
|
+
description: str,
|
|
17
|
+
amount: float,
|
|
18
|
+
category: str,
|
|
19
|
+
txType: str,
|
|
20
|
+
isBusiness: bool,
|
|
21
|
+
clientName: str
|
|
22
|
+
) -> None {
|
|
23
|
+
newTx = {
|
|
24
|
+
"id": Date.now().toString(),
|
|
25
|
+
"description": description,
|
|
26
|
+
"amount": amount,
|
|
27
|
+
"category": category,
|
|
28
|
+
"type": txType,
|
|
29
|
+
"date": Reflect.construct(Date, []).toISOString(),
|
|
30
|
+
"isBusinessTransaction": isBusiness,
|
|
31
|
+
"clientName": clientName if clientName != "" else None
|
|
32
|
+
};
|
|
33
|
+
setTransactions(transactions.concat([newTx]));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
# Delete a transaction by ID
|
|
37
|
+
def deleteTransaction(id: str) -> None {
|
|
38
|
+
filtered = transactions.filter(
|
|
39
|
+
lambda tx: dict -> bool { return tx["id"] != id; }
|
|
40
|
+
);
|
|
41
|
+
setTransactions(filtered);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Calculate totals
|
|
45
|
+
totalIncome = 0.0;
|
|
46
|
+
totalExpenses = 0.0;
|
|
47
|
+
for tx in transactions {
|
|
48
|
+
if tx["type"] == "income" {
|
|
49
|
+
totalIncome = totalIncome + tx["amount"];
|
|
50
|
+
} else {
|
|
51
|
+
totalExpenses = totalExpenses + tx["amount"];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
balance = totalIncome - totalExpenses;
|
|
55
|
+
|
|
56
|
+
# Calculate business/personal breakdown
|
|
57
|
+
businessIncome = 0.0;
|
|
58
|
+
businessExpenses = 0.0;
|
|
59
|
+
personalIncome = 0.0;
|
|
60
|
+
personalExpenses = 0.0;
|
|
61
|
+
|
|
62
|
+
for tx in transactions {
|
|
63
|
+
isBusiness = tx["isBusinessTransaction"] || false;
|
|
64
|
+
amount = tx["amount"];
|
|
65
|
+
|
|
66
|
+
if tx["type"] == "income" {
|
|
67
|
+
if isBusiness {
|
|
68
|
+
businessIncome = businessIncome + amount;
|
|
69
|
+
} else {
|
|
70
|
+
personalIncome = personalIncome + amount;
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
if isBusiness {
|
|
74
|
+
businessExpenses = businessExpenses + amount;
|
|
75
|
+
} else {
|
|
76
|
+
personalExpenses = personalExpenses + amount;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
# Tax calculations
|
|
82
|
+
TAX_RATE = 0.20;
|
|
83
|
+
taxReserve = businessIncome * TAX_RATE;
|
|
84
|
+
netProfit = businessIncome - businessExpenses - taxReserve;
|
|
85
|
+
|
|
86
|
+
# Get expense breakdown by category (for chart)
|
|
87
|
+
def getExpensesByCategory -> list {
|
|
88
|
+
categoryTotals = {};
|
|
89
|
+
for tx in transactions {
|
|
90
|
+
if tx["type"] == "expense" {
|
|
91
|
+
cat = tx["category"];
|
|
92
|
+
if categoryTotals[cat] {
|
|
93
|
+
categoryTotals[cat] = categoryTotals[cat] + tx["amount"];
|
|
94
|
+
} else {
|
|
95
|
+
categoryTotals[cat] = tx["amount"];
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
result = [];
|
|
100
|
+
for key in Object.keys(categoryTotals) {
|
|
101
|
+
result = result.concat([{"name": key, "value": categoryTotals[key]}]);
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
"transactions": transactions,
|
|
108
|
+
"addTransaction": addTransaction,
|
|
109
|
+
"deleteTransaction": deleteTransaction,
|
|
110
|
+
"totalIncome": totalIncome,
|
|
111
|
+
"totalExpenses": totalExpenses,
|
|
112
|
+
"balance": balance,
|
|
113
|
+
"expensesByCategory": getExpensesByCategory(),
|
|
114
|
+
"businessIncome": businessIncome,
|
|
115
|
+
"businessExpenses": businessExpenses,
|
|
116
|
+
"personalIncome": personalIncome,
|
|
117
|
+
"personalExpenses": personalExpenses,
|
|
118
|
+
"taxReserve": taxReserve,
|
|
119
|
+
"netProfit": netProfit
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Custom hook for localStorage persistence
|
|
2
|
+
# Demonstrates: custom hooks, try/except error handling, useEffect
|
|
3
|
+
cl import from react {
|
|
4
|
+
useEffect
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
cl {
|
|
8
|
+
# Custom hook for syncing state with localStorage
|
|
9
|
+
def useLocalStorage(key: str, initialValue: list) -> list {
|
|
10
|
+
# Initialize state with value from localStorage or default
|
|
11
|
+
[storedValue, setStoredValue] = useState(
|
|
12
|
+
lambda -> any { try {
|
|
13
|
+
item = window.localStorage.getItem(key);
|
|
14
|
+
if item {
|
|
15
|
+
return JSON.parse(item);
|
|
16
|
+
} else {
|
|
17
|
+
return initialValue;
|
|
18
|
+
}
|
|
19
|
+
} except Exception as e {
|
|
20
|
+
console.log("Error reading from localStorage");
|
|
21
|
+
return initialValue;
|
|
22
|
+
}}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
# Update localStorage when state changes
|
|
26
|
+
useEffect(
|
|
27
|
+
lambda -> None { try {
|
|
28
|
+
window.localStorage.setItem(key, JSON.stringify(storedValue));
|
|
29
|
+
} except Exception as e {
|
|
30
|
+
console.log("Error saving to localStorage");
|
|
31
|
+
}},
|
|
32
|
+
[key, storedValue]
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return [storedValue, setStoredValue];
|
|
36
|
+
}
|
|
37
|
+
}
|