@africode/core 5.0.0

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 (136) hide show
  1. package/AFRICODE_FRAMEWORK_GUIDE.md +707 -0
  2. package/LICENSE +623 -0
  3. package/README.md +442 -0
  4. package/bin/africode.js +73 -0
  5. package/bin/africode.js.1758507140 +343 -0
  6. package/bin/cli.ts +83 -0
  7. package/bin/create-africode.js +158 -0
  8. package/bin/scaffold.ts +219 -0
  9. package/components/accordion.js +183 -0
  10. package/components/alert.js +131 -0
  11. package/components/auth.js +172 -0
  12. package/components/avatar.js +117 -0
  13. package/components/badge.js +104 -0
  14. package/components/base.d.ts +139 -0
  15. package/components/base.js +184 -0
  16. package/components/button.js +164 -0
  17. package/components/card.js +137 -0
  18. package/components/cultural-card.js +243 -0
  19. package/components/divider.js +83 -0
  20. package/components/dropdown.js +171 -0
  21. package/components/error-boundary.js +155 -0
  22. package/components/form.js +131 -0
  23. package/components/grid.js +273 -0
  24. package/components/hero.js +138 -0
  25. package/components/icon.js +36 -0
  26. package/components/index.js +57 -0
  27. package/components/input.js +256 -0
  28. package/components/kanga-card.js +185 -0
  29. package/components/language-switcher.js +108 -0
  30. package/components/loader.js +80 -0
  31. package/components/modal.js +262 -0
  32. package/components/motion.js +84 -0
  33. package/components/navbar.js +236 -0
  34. package/components/pattern-showcase.js +225 -0
  35. package/components/progress.js +134 -0
  36. package/components/react.js +111 -0
  37. package/components/section.js +54 -0
  38. package/components/select.js +322 -0
  39. package/components/sidebar.js +180 -0
  40. package/components/skeleton.js +85 -0
  41. package/components/table.js +181 -0
  42. package/components/tabs.js +202 -0
  43. package/components/theme-toggle.js +82 -0
  44. package/components/toast.js +139 -0
  45. package/components/tooltip.js +167 -0
  46. package/core/a2ui-schema-manager.js +344 -0
  47. package/core/a2ui.js +431 -0
  48. package/core/bun-runtime.js +799 -0
  49. package/core/cli/commands/add.js +23 -0
  50. package/core/cli/commands/audit.js +58 -0
  51. package/core/cli/commands/build.js +137 -0
  52. package/core/cli/commands/create-plugin.js +241 -0
  53. package/core/cli/commands/dev.js +228 -0
  54. package/core/cli/commands/lint.js +23 -0
  55. package/core/cli/commands/test.js +34 -0
  56. package/core/cli/migrator.js +71 -0
  57. package/core/cli/ui.js +46 -0
  58. package/core/compliance.js +628 -0
  59. package/core/config.js +263 -0
  60. package/core/db-advanced.js +481 -0
  61. package/core/db.js +284 -0
  62. package/core/enhanced-hmr.js +404 -0
  63. package/core/errors.js +222 -0
  64. package/core/file-router.js +290 -0
  65. package/core/heartbeat.js +64 -0
  66. package/core/hmr-client.js +204 -0
  67. package/core/hmr.js +196 -0
  68. package/core/html.d.ts +116 -0
  69. package/core/html.js +160 -0
  70. package/core/hydration.js +52 -0
  71. package/core/lipa-namba-journey.js +572 -0
  72. package/core/motion.js +106 -0
  73. package/core/nida-cig-middleware.js +455 -0
  74. package/core/patterns.d.ts +124 -0
  75. package/core/patterns.js +833 -0
  76. package/core/plugins/index.js +312 -0
  77. package/core/router.js +387 -0
  78. package/core/sdk-client.js +62 -0
  79. package/core/sdk.d.ts +133 -0
  80. package/core/sdk.js +123 -0
  81. package/core/seo.js +76 -0
  82. package/core/server/auth-endpoints.js +339 -0
  83. package/core/server/auth.js +180 -0
  84. package/core/server/csrf.js +206 -0
  85. package/core/server/db.js +39 -0
  86. package/core/server/middleware.js +324 -0
  87. package/core/server/rate-limit.js +238 -0
  88. package/core/server/render.js +69 -0
  89. package/core/server/router.js +120 -0
  90. package/core/shim.js +28 -0
  91. package/core/state.d.ts +86 -0
  92. package/core/state.js +242 -0
  93. package/core/store.d.ts +122 -0
  94. package/core/store.js +61 -0
  95. package/core/validation.d.ts +233 -0
  96. package/core/validation.js +590 -0
  97. package/core/websocket.js +639 -0
  98. package/dist/africode.js +2905 -0
  99. package/dist/africode.js.map +61 -0
  100. package/dist/build-info.json +23 -0
  101. package/dist/components.js +2888 -0
  102. package/dist/components.js.map +58 -0
  103. package/dist/styles/africanity.css +322 -0
  104. package/dist/styles/typography.css +141 -0
  105. package/docs/IDE-Guide.md +50 -0
  106. package/package.json +110 -0
  107. package/src/index.ts +196 -0
  108. package/styles/africanity.css +322 -0
  109. package/styles/typography.css +141 -0
  110. package/templates/starter/.env.example +15 -0
  111. package/templates/starter/africode.config.js +40 -0
  112. package/templates/starter/package.json +14 -0
  113. package/templates/starter/src/pages/index.html +46 -0
  114. package/templates/starter/src/pages/index.js +32 -0
  115. package/templates/starter/src/styles/main.css +4 -0
  116. package/templates/starter-3d/.env.example +7 -0
  117. package/templates/starter-3d/africode.config.js +29 -0
  118. package/templates/starter-3d/components/af-model-viewer.js +125 -0
  119. package/templates/starter-3d/package.json +15 -0
  120. package/templates/starter-3d/src/pages/index.html +46 -0
  121. package/templates/starter-3d/src/pages/index.js +50 -0
  122. package/templates/starter-3d/src/styles/main.css +4 -0
  123. package/templates/starter-react/.env.example +15 -0
  124. package/templates/starter-react/africode.config.js +40 -0
  125. package/templates/starter-react/package.json +16 -0
  126. package/templates/starter-react/src/pages/index.html +46 -0
  127. package/templates/starter-react/src/pages/index.js +68 -0
  128. package/templates/starter-react/src/styles/main.css +4 -0
  129. package/templates/starter-tailwind/.env.example +15 -0
  130. package/templates/starter-tailwind/africode.config.js +40 -0
  131. package/templates/starter-tailwind/package.json +20 -0
  132. package/templates/starter-tailwind/src/pages/index.html +46 -0
  133. package/templates/starter-tailwind/src/pages/index.js +37 -0
  134. package/templates/starter-tailwind/src/styles/main.css +4 -0
  135. package/templates/starter-tailwind/src/styles/tailwind.css +1 -0
  136. package/templates/starter-tailwind/src/tailwind-loader.js +30 -0
@@ -0,0 +1,46 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Welcome to AfriCode</title>
8
+
9
+ <!-- Theme -->
10
+ <link rel="stylesheet" href="/node_modules/africode/styles/africanity.css">
11
+ <link rel="stylesheet" href="/node_modules/africode/styles/typography.css">
12
+ <link rel="stylesheet" href="/styles/main.css">
13
+ <script type="module" src="/node_modules/africode/core/sdk.js"></script>
14
+
15
+ <!-- SDK & Components -->
16
+ <script type="module">
17
+ import 'africode/components';
18
+ import { store } from 'africode';
19
+
20
+ console.log('AfriCode State Engine:', store);
21
+ </script>
22
+ </head>
23
+
24
+ <body>
25
+ <af-navbar logo="Starter App" theme="dark"></af-navbar>
26
+
27
+ <main style="max-width: 1200px; margin: 0 auto; padding: 40px;">
28
+ <af-hero title="Umoja" subtitle="You are running on the AfriCode Framework." pattern="kente">
29
+ </af-hero>
30
+
31
+ <div
32
+ style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 40px;">
33
+ <af-card title="Getting Started">
34
+ <p>Edit <code>pages/index.html</code> to change this page.</p>
35
+ <af-button variant="primary">Read Docs</af-button>
36
+ </af-card>
37
+
38
+ <af-kanga-card proverb="Haba na haba hujaza kibaba.">
39
+ <h3>Steady Progress</h3>
40
+ <p>Little by little fills the measure.</p>
41
+ </af-kanga-card>
42
+ </div>
43
+ </main>
44
+ </body>
45
+
46
+ </html>
@@ -0,0 +1,37 @@
1
+ import { html, Layout } from 'africode';
2
+
3
+ /**
4
+ * Home Page — Tailwind Starter
5
+ * Route: /
6
+ *
7
+ * Tailwind utility classes work inside AfriCode components because
8
+ * the compiled CSS is injected into the Shadow DOM via tailwind-loader.js.
9
+ */
10
+ export default function HomePage() {
11
+ return Layout({
12
+ title: "AfriCode + Tailwind",
13
+ children: html`
14
+ <af-navbar logo="Tailwind App" theme="dark"></af-navbar>
15
+
16
+ <main style="max-width: 1000px; margin: 0 auto; padding: 40px;">
17
+ <af-hero
18
+ title="AfriCode + Tailwind CSS"
19
+ subtitle="Utility-first styling inside Web Components."
20
+ pattern="kente">
21
+ </af-hero>
22
+
23
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 40px;">
24
+ <af-card>
25
+ <h3>Shadow DOM Friendly</h3>
26
+ <p>Tailwind utilities are injected into every component's Shadow Root via ConstructableStyleSheet.</p>
27
+ </af-card>
28
+
29
+ <af-card>
30
+ <h3>Zero Config</h3>
31
+ <p>Run <code>npm run dev</code> and Tailwind compiles alongside AfriCode's dev server.</p>
32
+ </af-card>
33
+ </div>
34
+ </main>
35
+ `
36
+ });
37
+ }
@@ -0,0 +1,4 @@
1
+ /* Custom Application Styles */
2
+ :root {
3
+ --brand-color: #FCD116;
4
+ }
@@ -0,0 +1 @@
1
+ @import "tailwindcss";
@@ -0,0 +1,30 @@
1
+ /**
2
+ * AfriCode + Tailwind CSS Integration
3
+ *
4
+ * This script loads the compiled Tailwind CSS output and injects it
5
+ * into AfriCode's global sheet system. Once injected, every AfriCode
6
+ * Web Component that calls `this.loadStyles()` will automatically
7
+ * adopt Tailwind utility classes inside its Shadow DOM.
8
+ *
9
+ * Usage: import this file in your src/index.js (or any entry point).
10
+ */
11
+ import { AfriCodeComponent } from 'africode/components/base.js';
12
+
13
+ async function injectTailwind() {
14
+ try {
15
+ const response = await fetch('/styles/tailwind.out.css');
16
+ if (!response.ok) {
17
+ console.warn('[AfriCode/Tailwind] Could not load tailwind.out.css — did you run build:css?');
18
+ return;
19
+ }
20
+ const css = await response.text();
21
+ const sheet = new CSSStyleSheet();
22
+ sheet.replaceSync(css);
23
+ AfriCodeComponent.injectGlobalSheet(sheet);
24
+ console.log('[AfriCode/Tailwind] Tailwind utilities injected into Shadow DOM.');
25
+ } catch (err) {
26
+ console.warn('[AfriCode/Tailwind] Failed to inject Tailwind:', err);
27
+ }
28
+ }
29
+
30
+ injectTailwind();