@africode/core 5.0.3 → 5.0.5
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/COMPONENT_SCHEMA.json +990 -836
- package/README.md +30 -0
- package/components/index.js +14 -0
- package/components/ui-badge.js +61 -0
- package/components/ui-button.js +149 -0
- package/components/ui-card.js +75 -0
- package/components/ui-input.js +110 -0
- package/components/ui-switch.js +85 -0
- package/core/cli/commands/build.js +33 -2
- package/core/cli/commands/dev.js +38 -1
- package/core/lipa-namba-journey.js +28 -6
- package/core/sdk-browser.js +140 -0
- package/dist/africode.js +604 -353
- package/dist/africode.js.map +22 -10
- package/dist/build-info.json +3 -3
- package/dist/components.js +554 -304
- package/dist/components.js.map +9 -4
- package/package.json +6 -5
- package/templates/starter/src/pages/index.html +2 -2
- package/templates/starter-3d/src/pages/index.html +2 -2
- package/templates/starter-react/src/pages/index.html +2 -2
- package/templates/starter-tailwind/src/pages/index.html +2 -2
- package/templates/starter-tailwind/src/pages/index.js +30 -0
- package/templates/starter-tailwind/tailwind.config.cjs +18 -0
- package/src/index.ts +0 -196
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@africode/core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.5",
|
|
4
4
|
"description": "Bun-native full-stack framework with generative AI, fintech compliance, and real-time performance - built for Tanzanian digital economy",
|
|
5
|
-
"module": "
|
|
6
|
-
"main": "
|
|
7
|
-
"types": "
|
|
5
|
+
"module": "core/sdk.js",
|
|
6
|
+
"main": "core/sdk.js",
|
|
7
|
+
"types": "core/sdk.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"exports": {
|
|
10
|
-
".": "./
|
|
10
|
+
".": "./core/sdk.js",
|
|
11
|
+
"./browser": "./core/sdk-browser.js",
|
|
11
12
|
"./styles": "./styles/africanity.css",
|
|
12
13
|
"./core/*": "./core/*",
|
|
13
14
|
"./components": "./components/index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<script type="importmap">
|
|
11
11
|
{
|
|
12
12
|
"imports": {
|
|
13
|
-
"africode": "/node_modules/@africode/core/
|
|
13
|
+
"africode": "/node_modules/@africode/core/core/sdk-browser.js",
|
|
14
14
|
"africode/components": "/node_modules/@africode/core/components/index.js"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
|
|
21
21
|
<link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
|
|
22
22
|
<link rel="stylesheet" href="/styles/main.css">
|
|
23
|
-
<script type="module" src="/node_modules/@africode/core/
|
|
23
|
+
<script type="module" src="/node_modules/@africode/core/core/sdk-browser.js"></script>
|
|
24
24
|
|
|
25
25
|
<!-- SDK & Components -->
|
|
26
26
|
<script type="module">
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<script type="importmap">
|
|
11
11
|
{
|
|
12
12
|
"imports": {
|
|
13
|
-
"africode": "/node_modules/@africode/core/
|
|
13
|
+
"africode": "/node_modules/@africode/core/core/sdk-browser.js",
|
|
14
14
|
"africode/components": "/node_modules/@africode/core/components/index.js"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
|
|
21
21
|
<link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
|
|
22
22
|
<link rel="stylesheet" href="/styles/main.css">
|
|
23
|
-
<script type="module" src="/node_modules/@africode/core/
|
|
23
|
+
<script type="module" src="/node_modules/@africode/core/core/sdk-browser.js"></script>
|
|
24
24
|
|
|
25
25
|
<!-- SDK & Components -->
|
|
26
26
|
<script type="module">
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<script type="importmap">
|
|
11
11
|
{
|
|
12
12
|
"imports": {
|
|
13
|
-
"africode": "/node_modules/@africode/core/
|
|
13
|
+
"africode": "/node_modules/@africode/core/core/sdk-browser.js",
|
|
14
14
|
"africode/components": "/node_modules/@africode/core/components/index.js"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
|
|
21
21
|
<link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
|
|
22
22
|
<link rel="stylesheet" href="/styles/main.css">
|
|
23
|
-
<script type="module" src="/node_modules/@africode/core/
|
|
23
|
+
<script type="module" src="/node_modules/@africode/core/core/sdk-browser.js"></script>
|
|
24
24
|
|
|
25
25
|
<!-- SDK & Components -->
|
|
26
26
|
<script type="module">
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<script type="importmap">
|
|
11
11
|
{
|
|
12
12
|
"imports": {
|
|
13
|
-
"africode": "/node_modules/@africode/core/
|
|
13
|
+
"africode": "/node_modules/@africode/core/core/sdk-browser.js",
|
|
14
14
|
"africode/components": "/node_modules/@africode/core/components/index.js"
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
|
|
21
21
|
<link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
|
|
22
22
|
<link rel="stylesheet" href="/styles/main.css">
|
|
23
|
-
<script type="module" src="/node_modules/@africode/core/
|
|
23
|
+
<script type="module" src="/node_modules/@africode/core/core/sdk-browser.js"></script>
|
|
24
24
|
|
|
25
25
|
<!-- SDK & Components -->
|
|
26
26
|
<script type="module">
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '../tailwind-loader.js';
|
|
1
2
|
import { html, Layout } from 'africode';
|
|
2
3
|
|
|
3
4
|
/**
|
|
@@ -31,6 +32,35 @@ export default function HomePage() {
|
|
|
31
32
|
<p>Run <code>npm run dev</code> and Tailwind compiles alongside AfriCode's dev server.</p>
|
|
32
33
|
</af-card>
|
|
33
34
|
</div>
|
|
35
|
+
|
|
36
|
+
<section style="margin-top: 40px;">
|
|
37
|
+
<h2>AfriCode UI Kit Demo</h2>
|
|
38
|
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 24px; margin-top: 24px;">
|
|
39
|
+
<af-card bordered clickable>
|
|
40
|
+
<h3>UI Button</h3>
|
|
41
|
+
<af-ui-button variant="primary" size="lg">Primary Action</af-ui-button>
|
|
42
|
+
<af-ui-button variant="secondary" size="md">Secondary</af-ui-button>
|
|
43
|
+
</af-card>
|
|
44
|
+
|
|
45
|
+
<af-card bordered>
|
|
46
|
+
<h3>UI Input</h3>
|
|
47
|
+
<af-ui-input label="Email" placeholder="you@example.com"></af-ui-input>
|
|
48
|
+
</af-card>
|
|
49
|
+
|
|
50
|
+
<af-card bordered>
|
|
51
|
+
<h3>UI Kit Extras</h3>
|
|
52
|
+
<div style="display: grid; gap: 16px;">
|
|
53
|
+
<af-ui-badge variant="success">Live</af-ui-badge>
|
|
54
|
+
<af-ui-switch size="md" checked></af-ui-switch>
|
|
55
|
+
</div>
|
|
56
|
+
</af-card>
|
|
57
|
+
|
|
58
|
+
<af-card bordered>
|
|
59
|
+
<h3>UI Card</h3>
|
|
60
|
+
<p>This card is part of the AfriCode-native UI Kit.</p>
|
|
61
|
+
</af-card>
|
|
62
|
+
</div>
|
|
63
|
+
</section>
|
|
34
64
|
</main>
|
|
35
65
|
`
|
|
36
66
|
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
content: [
|
|
3
|
+
'./src/**/*.{js,ts,jsx,tsx,html}',
|
|
4
|
+
'./components/**/*.{js,ts}',
|
|
5
|
+
'./templates/**/*.{js,ts,jsx,tsx,html}'
|
|
6
|
+
],
|
|
7
|
+
theme: {
|
|
8
|
+
extend: {
|
|
9
|
+
colors: {
|
|
10
|
+
brand: '#1C7ED6'
|
|
11
|
+
},
|
|
12
|
+
boxShadow: {
|
|
13
|
+
soft: '0 10px 30px rgba(15, 23, 42, 0.08)'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
plugins: []
|
|
18
|
+
};
|
package/src/index.ts
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AfriCode v5.0.0 - Autonomous Framework Entry Point
|
|
3
|
-
* African-centric full-stack framework with AI safety and fintech compliance
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { createReactiveState, subscribe, createSignal, createEffect } from '../core/state.js';
|
|
7
|
-
import { store, actions } from '../core/store.js';
|
|
8
|
-
import patterns from '../core/patterns.js';
|
|
9
|
-
import * as motion from '../core/motion.js';
|
|
10
|
-
import { hydrate } from '../core/hydration.js';
|
|
11
|
-
import { html, Layout } from '../core/html.js';
|
|
12
|
-
import { schemas, Validation, rules, afri, AfriFieldBuilder, normalizeInput, buildSchema } from '../core/validation.js';
|
|
13
|
-
import { createFramework, getConfig } from '../core/config.js';
|
|
14
|
-
import {
|
|
15
|
-
AfriCodeError, ValidationError, InvalidUrlError,
|
|
16
|
-
SecurityError, CsrfError, RateLimitError,
|
|
17
|
-
DatabaseError, ComponentError
|
|
18
|
-
} from '../core/errors.js';
|
|
19
|
-
|
|
20
|
-
// v5.0.0 autonomous features
|
|
21
|
-
import { initA2UI, A2UIRenderer, A2UIProtocol } from '../core/a2ui.js';
|
|
22
|
-
import { NIDAClient, TIPSClient, AMLComplianceEngine, ComplianceMiddleware } from '../core/compliance.js';
|
|
23
|
-
import { initBunRuntime, HotReloadEngine, BunHTTPServer, BunDatabase, PerformanceMonitor } from '../core/bun-runtime.js';
|
|
24
|
-
import { EnhancedHMRMiddleware } from '../core/enhanced-hmr.js';
|
|
25
|
-
import { A2uiSchemaManager } from '../core/a2ui-schema-manager.js';
|
|
26
|
-
import { LipaNambaJourney } from '../core/lipa-namba-journey.js';
|
|
27
|
-
|
|
28
|
-
import { componentMap as coreMap } from '../components/index.js';
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* AfriCode Framework Class
|
|
32
|
-
* Autonomous application lifecycle management
|
|
33
|
-
*/
|
|
34
|
-
export class AfriCode {
|
|
35
|
-
private config: any;
|
|
36
|
-
private server?: BunHTTPServer;
|
|
37
|
-
private hmr?: EnhancedHMRMiddleware;
|
|
38
|
-
private schemaManager?: A2uiSchemaManager;
|
|
39
|
-
|
|
40
|
-
constructor(config: {
|
|
41
|
-
port?: number;
|
|
42
|
-
pagesDir?: string;
|
|
43
|
-
publicDir?: string;
|
|
44
|
-
enableHMR?: boolean;
|
|
45
|
-
enableA2UI?: boolean;
|
|
46
|
-
fintechCompliance?: boolean;
|
|
47
|
-
} = {}) {
|
|
48
|
-
this.config = {
|
|
49
|
-
port: 3000,
|
|
50
|
-
pagesDir: 'pages',
|
|
51
|
-
publicDir: 'public',
|
|
52
|
-
enableHMR: true,
|
|
53
|
-
enableA2UI: true,
|
|
54
|
-
fintechCompliance: true,
|
|
55
|
-
...config
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Initialize the autonomous framework
|
|
61
|
-
*/
|
|
62
|
-
async initialize(): Promise<void> {
|
|
63
|
-
console.log('🚀 Initializing AfriCode v5.0.0...');
|
|
64
|
-
|
|
65
|
-
// Initialize Bun runtime
|
|
66
|
-
await initBunRuntime();
|
|
67
|
-
|
|
68
|
-
// Initialize A2UI schema manager
|
|
69
|
-
if (this.config.enableA2UI) {
|
|
70
|
-
this.schemaManager = new A2uiSchemaManager();
|
|
71
|
-
await this.schemaManager.generateManifest();
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Initialize HMR if enabled
|
|
75
|
-
if (this.config.enableHMR) {
|
|
76
|
-
this.hmr = new EnhancedHMRMiddleware({
|
|
77
|
-
port: this.config.port + 1,
|
|
78
|
-
watchPaths: [this.config.pagesDir, 'components', 'core']
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
console.log('✅ AfriCode initialized successfully');
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Start the autonomous server
|
|
87
|
-
*/
|
|
88
|
-
async start(): Promise<void> {
|
|
89
|
-
await this.initialize();
|
|
90
|
-
|
|
91
|
-
// Create HTTP server with file-based routing
|
|
92
|
-
this.server = new BunHTTPServer({
|
|
93
|
-
port: this.config.port,
|
|
94
|
-
pagesDir: this.config.pagesDir,
|
|
95
|
-
publicDir: this.config.publicDir,
|
|
96
|
-
middleware: [
|
|
97
|
-
this.config.fintechCompliance ? new ComplianceMiddleware() : null,
|
|
98
|
-
this.hmr
|
|
99
|
-
].filter(Boolean)
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
// Start HMR if enabled
|
|
103
|
-
if (this.hmr) {
|
|
104
|
-
await this.hmr.initialize(this.server);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
await this.server.start();
|
|
108
|
-
console.log(`🌐 Server running on http://localhost:${this.config.port}`);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Stop the framework
|
|
113
|
-
*/
|
|
114
|
-
async stop(): Promise<void> {
|
|
115
|
-
if (this.server) {
|
|
116
|
-
await this.server.stop();
|
|
117
|
-
}
|
|
118
|
-
if (this.hmr) {
|
|
119
|
-
await this.hmr.shutdown();
|
|
120
|
-
}
|
|
121
|
-
console.log('🛑 AfriCode stopped');
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Utility to initialize the full framework (legacy compatibility)
|
|
127
|
-
*/
|
|
128
|
-
export function init(projectComponentMap: Record<string, any> = {}): void {
|
|
129
|
-
if (typeof window !== 'undefined') {
|
|
130
|
-
console.log('🌍 AfriCode SDK Initialized (Zero-Config Mode)');
|
|
131
|
-
|
|
132
|
-
// Merge project map with core map
|
|
133
|
-
const finalMap = { ...coreMap, ...projectComponentMap };
|
|
134
|
-
|
|
135
|
-
if (Object.keys(finalMap).length > 0) {
|
|
136
|
-
hydrate(finalMap);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// Core exports
|
|
142
|
-
export {
|
|
143
|
-
createReactiveState,
|
|
144
|
-
subscribe,
|
|
145
|
-
createSignal,
|
|
146
|
-
createEffect,
|
|
147
|
-
store,
|
|
148
|
-
actions,
|
|
149
|
-
patterns,
|
|
150
|
-
motion,
|
|
151
|
-
hydrate,
|
|
152
|
-
html,
|
|
153
|
-
Layout,
|
|
154
|
-
schemas,
|
|
155
|
-
Validation,
|
|
156
|
-
rules,
|
|
157
|
-
afri,
|
|
158
|
-
AfriFieldBuilder,
|
|
159
|
-
normalizeInput,
|
|
160
|
-
buildSchema,
|
|
161
|
-
createFramework,
|
|
162
|
-
getConfig,
|
|
163
|
-
AfriCodeError,
|
|
164
|
-
ValidationError,
|
|
165
|
-
InvalidUrlError,
|
|
166
|
-
SecurityError,
|
|
167
|
-
CsrfError,
|
|
168
|
-
RateLimitError,
|
|
169
|
-
DatabaseError,
|
|
170
|
-
ComponentError
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
// v5.0.0 autonomous exports
|
|
174
|
-
export {
|
|
175
|
-
initA2UI,
|
|
176
|
-
A2UIRenderer,
|
|
177
|
-
A2UIProtocol,
|
|
178
|
-
NIDAClient,
|
|
179
|
-
TIPSClient,
|
|
180
|
-
AMLComplianceEngine,
|
|
181
|
-
ComplianceMiddleware,
|
|
182
|
-
initBunRuntime,
|
|
183
|
-
HotReloadEngine,
|
|
184
|
-
BunHTTPServer,
|
|
185
|
-
BunDatabase,
|
|
186
|
-
PerformanceMonitor,
|
|
187
|
-
EnhancedHMRMiddleware,
|
|
188
|
-
A2uiSchemaManager,
|
|
189
|
-
LipaNambaJourney
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
// Component exports
|
|
193
|
-
export { componentMap as components } from '../components/index.js';
|
|
194
|
-
|
|
195
|
-
// Re-export for convenience
|
|
196
|
-
export default AfriCode;
|