@africode/core 5.0.1 → 5.0.3

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 (41) hide show
  1. package/COMPONENT_SCHEMA.json +103 -69
  2. package/components/base.d.ts +1 -1
  3. package/components/base.js +71 -21
  4. package/core/a2ui-schema-manager.js +9 -2
  5. package/core/a2ui.js +131 -43
  6. package/core/actions.js +27 -0
  7. package/core/bun-runtime.js +207 -724
  8. package/core/cli/commands/dev.js +23 -3
  9. package/core/compliance.js +6 -5
  10. package/core/config.js +7 -5
  11. package/core/enhanced-hmr.js +16 -14
  12. package/core/file-router.js +42 -282
  13. package/core/hmr.js +8 -7
  14. package/core/html.d.ts +15 -101
  15. package/core/html.js +53 -129
  16. package/core/lipa-namba-journey.js +74 -12
  17. package/core/logging.js +14 -0
  18. package/core/middleware.js +82 -0
  19. package/core/nida-cig-middleware.js +13 -8
  20. package/core/plugins/index.js +345 -312
  21. package/core/request-identity.js +44 -0
  22. package/core/sdk.js +22 -0
  23. package/core/session-store.js +68 -0
  24. package/core/state.js +34 -0
  25. package/core/websocket.js +22 -20
  26. package/dist/africode.js +108 -112
  27. package/dist/africode.js.map +6 -6
  28. package/dist/build-info.json +3 -3
  29. package/dist/components.js +351 -351
  30. package/dist/components.js.map +6 -6
  31. package/package.json +3 -3
  32. package/scripts/generate-component-schema.js +1 -1
  33. package/templates/starter/package.json +1 -1
  34. package/templates/starter/src/pages/index.html +14 -4
  35. package/templates/starter/src/pages/index.js +13 -28
  36. package/templates/starter-3d/package.json +1 -1
  37. package/templates/starter-3d/src/pages/index.html +13 -3
  38. package/templates/starter-react/package.json +1 -1
  39. package/templates/starter-react/src/pages/index.html +13 -3
  40. package/templates/starter-tailwind/package.json +1 -1
  41. package/templates/starter-tailwind/src/pages/index.html +13 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@africode/core",
3
- "version": "5.0.1",
3
+ "version": "5.0.3",
4
4
  "description": "Bun-native full-stack framework with generative AI, fintech compliance, and real-time performance - built for Tanzanian digital economy",
5
5
  "module": "src/index.ts",
6
6
  "main": "src/index.ts",
@@ -14,8 +14,8 @@
14
14
  "./components/*": "./components/*"
15
15
  },
16
16
  "bin": {
17
- "africode": "./bin/cli.ts",
18
- "create-africode": "./bin/scaffold.ts"
17
+ "africode": "./bin/africode.js",
18
+ "create-africode": "./bin/create-africode.js"
19
19
  },
20
20
  "scripts": {
21
21
  "dev": "bun run bin/africode.js dev",
@@ -14,7 +14,7 @@ const OUTPUT_FILE = 'COMPONENT_SCHEMA.json';
14
14
 
15
15
  function parseComponentFile(filePath) {
16
16
  const content = readFileSync(filePath, 'utf8');
17
- const fileName = filePath.split('/').pop().replace('.js', '');
17
+ const fileName = filePath.split(/[/\\]/).pop().replace('.js', '');
18
18
 
19
19
  // Extract class name
20
20
  const classMatch = content.match(/export class (\w+)/);
@@ -9,6 +9,6 @@
9
9
  "migrate": "africode migrate"
10
10
  },
11
11
  "dependencies": {
12
- "africode": "^1.0.0"
12
+ "@africode/core": "^5.0.2"
13
13
  }
14
14
  }
@@ -6,11 +6,21 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title>Welcome to AfriCode</title>
8
8
 
9
+ <!-- Import Map: resolves bare module specifiers for the browser -->
10
+ <script type="importmap">
11
+ {
12
+ "imports": {
13
+ "africode": "/node_modules/@africode/core/src/index.ts",
14
+ "africode/components": "/node_modules/@africode/core/components/index.js"
15
+ }
16
+ }
17
+ </script>
18
+
9
19
  <!-- Theme -->
10
- <link rel="stylesheet" href="/node_modules/africode/styles/africanity.css">
11
- <link rel="stylesheet" href="/node_modules/africode/styles/typography.css">
20
+ <link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
21
+ <link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
12
22
  <link rel="stylesheet" href="/styles/main.css">
13
- <script type="module" src="/node_modules/africode/core/sdk.js"></script>
23
+ <script type="module" src="/node_modules/@africode/core/src/index.ts"></script>
14
24
 
15
25
  <!-- SDK & Components -->
16
26
  <script type="module">
@@ -31,7 +41,7 @@
31
41
  <div
32
42
  style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 40px;">
33
43
  <af-card title="Getting Started">
34
- <p>Edit <code>pages/index.html</code> to change this page.</p>
44
+ <p>Edit <code>src/pages/index.html</code> to change this page.</p>
35
45
  <af-button variant="primary">Read Docs</af-button>
36
46
  </af-card>
37
47
 
@@ -1,32 +1,17 @@
1
1
  import { html, Layout } from 'africode';
2
2
 
3
- /**
4
- * Home Page
5
- * Route: /
6
- */
7
- export default function HomePage() {
8
- return Layout({
9
- title: "Welcome to AfriCode",
10
- children: html`
11
- <af-navbar logo="My App" theme="dark"></af-navbar>
12
-
13
- <main style="max-width: 1000px; margin: 0 auto; padding: 40px;">
14
- <af-hero
15
- title="Next-Gen African Web"
16
- subtitle="Built with the AfriCode JS Framework."
17
- pattern="kente">
18
- </af-hero>
19
-
20
- <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 40px;">
21
- <af-card title="JS-First Architecture">
22
- <p>No more HTML files. Logic and View utilize <code>pages/index.js</code>.</p>
23
- </af-card>
3
+ export function loader() {
4
+ return { title: 'Welcome to AfriCode' };
5
+ }
24
6
 
25
- <af-card title="Component System">
26
- <p>Import components and use them directly in your template literals.</p>
27
- </af-card>
28
- </div>
29
- </main>
30
- `
31
- });
7
+ export default function HomePage({ data }) {
8
+ return Layout({
9
+ title: data?.title || 'Welcome to AfriCode',
10
+ children: html`
11
+ <main>
12
+ <h1>Welcome to AfriCode</h1>
13
+ <p>Your African-centric full-stack framework is ready.</p>
14
+ </main>
15
+ `
16
+ });
32
17
  }
@@ -9,7 +9,7 @@
9
9
  "migrate": "africode migrate"
10
10
  },
11
11
  "dependencies": {
12
- "africode": "^2.4.0",
12
+ "@africode/core": "^5.0.2",
13
13
  "three": "^0.160.0"
14
14
  }
15
15
  }
@@ -6,11 +6,21 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title>Welcome to AfriCode</title>
8
8
 
9
+ <!-- Import Map: resolves bare module specifiers for the browser -->
10
+ <script type="importmap">
11
+ {
12
+ "imports": {
13
+ "africode": "/node_modules/@africode/core/src/index.ts",
14
+ "africode/components": "/node_modules/@africode/core/components/index.js"
15
+ }
16
+ }
17
+ </script>
18
+
9
19
  <!-- Theme -->
10
- <link rel="stylesheet" href="/node_modules/africode/styles/africanity.css">
11
- <link rel="stylesheet" href="/node_modules/africode/styles/typography.css">
20
+ <link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
21
+ <link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
12
22
  <link rel="stylesheet" href="/styles/main.css">
13
- <script type="module" src="/node_modules/africode/core/sdk.js"></script>
23
+ <script type="module" src="/node_modules/@africode/core/src/index.ts"></script>
14
24
 
15
25
  <!-- SDK & Components -->
16
26
  <script type="module">
@@ -9,7 +9,7 @@
9
9
  "migrate": "africode migrate"
10
10
  },
11
11
  "dependencies": {
12
- "africode": "^1.0.0",
12
+ "@africode/core": "^5.0.2",
13
13
  "react": "^19.0.0",
14
14
  "react-dom": "^19.0.0"
15
15
  }
@@ -6,11 +6,21 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title>Welcome to AfriCode</title>
8
8
 
9
+ <!-- Import Map: resolves bare module specifiers for the browser -->
10
+ <script type="importmap">
11
+ {
12
+ "imports": {
13
+ "africode": "/node_modules/@africode/core/src/index.ts",
14
+ "africode/components": "/node_modules/@africode/core/components/index.js"
15
+ }
16
+ }
17
+ </script>
18
+
9
19
  <!-- Theme -->
10
- <link rel="stylesheet" href="/node_modules/africode/styles/africanity.css">
11
- <link rel="stylesheet" href="/node_modules/africode/styles/typography.css">
20
+ <link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
21
+ <link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
12
22
  <link rel="stylesheet" href="/styles/main.css">
13
- <script type="module" src="/node_modules/africode/core/sdk.js"></script>
23
+ <script type="module" src="/node_modules/@africode/core/src/index.ts"></script>
14
24
 
15
25
  <!-- SDK & Components -->
16
26
  <script type="module">
@@ -10,7 +10,7 @@
10
10
  "migrate": "africode migrate"
11
11
  },
12
12
  "dependencies": {
13
- "africode": "^1.0.0"
13
+ "@africode/core": "^5.0.2"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@tailwindcss/cli": "^4.0.0",
@@ -6,11 +6,21 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
7
  <title>Welcome to AfriCode</title>
8
8
 
9
+ <!-- Import Map: resolves bare module specifiers for the browser -->
10
+ <script type="importmap">
11
+ {
12
+ "imports": {
13
+ "africode": "/node_modules/@africode/core/src/index.ts",
14
+ "africode/components": "/node_modules/@africode/core/components/index.js"
15
+ }
16
+ }
17
+ </script>
18
+
9
19
  <!-- Theme -->
10
- <link rel="stylesheet" href="/node_modules/africode/styles/africanity.css">
11
- <link rel="stylesheet" href="/node_modules/africode/styles/typography.css">
20
+ <link rel="stylesheet" href="/node_modules/@africode/core/styles/africanity.css">
21
+ <link rel="stylesheet" href="/node_modules/@africode/core/styles/typography.css">
12
22
  <link rel="stylesheet" href="/styles/main.css">
13
- <script type="module" src="/node_modules/africode/core/sdk.js"></script>
23
+ <script type="module" src="/node_modules/@africode/core/src/index.ts"></script>
14
24
 
15
25
  <!-- SDK & Components -->
16
26
  <script type="module">