{"_id":"@banastechnologie/antcloud-sdk","name":"@banastechnologie/antcloud-sdk","dist-tags":{"latest":"2.0.0"},"versions":{"2.0.0":{"name":"@banastechnologie/antcloud-sdk","version":"2.0.0","description":"🐜 AntCloud WebComponents SDK - Robust WASM module loading with caching","main":"ant-module.js","module":"ant-module.js","type":"module","exports":{".":{"import":"./ant-module.js","default":"./ant-module.js"}},"scripts":{"test":"echo \"No tests yet\" && exit 0"},"repository":{"type":"git","url":"git+https://github.com/yannbanas/antcloud-sdk.git"},"keywords":["wasm","webassembly","webcomponents","custom-elements","antcloud","anthive","serverless","micro-frontend","sdk"],"author":{"name":"banastechnologie"},"license":"MIT","bugs":{"url":"https://github.com/yannbanas/antcloud-sdk/issues"},"homepage":"https://github.com/yannbanas/antcloud-sdk#readme","gitHead":"acff8c348bc7df0e88662c879e9ad552f523ce21","_id":"@banastechnologie/antcloud-sdk@2.0.0","_nodeVersion":"12.22.9","_npmVersion":"8.5.1","dist":{"integrity":"sha512-oC5HhFv20teyfo1zh7tNeU3XjWE0+L+SFrAEZjWxfDJdUbhw8Xn3NxhIcWPvLmlc9kmH+nmcZXTfDlo5o26tGQ==","shasum":"3670a8787f20bd9ab1096fd96c97a247d9f8a20d","tarball":"https://registry.npmjs.org/@banastechnologie/antcloud-sdk/-/antcloud-sdk-2.0.0.tgz","fileCount":4,"unpackedSize":43319,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAiohW9P/giQsOdOFjbFnKj/LQ8BTsIBEMAnaJ5gWuj7AiEA8W/iAXMoTHNEMfYh62swiJz0xInH7n9FhReQ6hUqsK8="}]},"_npmUser":{"name":"banastechnologie","email":"yann.banas@banastechnologie.cloud"},"directories":{},"maintainers":[{"name":"banastechnologie","email":"yann.banas@banastechnologie.cloud"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/antcloud-sdk_2.0.0_1769278036898_0.2519563658131032"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-24T18:07:16.765Z","2.0.0":"2026-01-24T18:07:17.035Z","modified":"2026-01-24T18:07:17.287Z"},"maintainers":[{"name":"banastechnologie","email":"yann.banas@banastechnologie.cloud"}],"description":"🐜 AntCloud WebComponents SDK - Robust WASM module loading with caching","homepage":"https://github.com/yannbanas/antcloud-sdk#readme","keywords":["wasm","webassembly","webcomponents","custom-elements","antcloud","anthive","serverless","micro-frontend","sdk"],"repository":{"type":"git","url":"git+https://github.com/yannbanas/antcloud-sdk.git"},"author":{"name":"banastechnologie"},"bugs":{"url":"https://github.com/yannbanas/antcloud-sdk/issues"},"license":"MIT","readme":"# 🐜 AntCloud SDK\n\n**Robust WebAssembly module loading with caching and dynamic UI binding.**\n\n[![npm version](https://img.shields.io/npm/v/@banastechnologie/antcloud-sdk.svg)](https://www.npmjs.com/package/@banastechnologie/antcloud-sdk)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n## Quick Start\n\n```html\n<!-- Include SDK from CDN -->\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/yannbanas/antcloud-sdk@main/ant-module.js\"></script>\n\n<!-- Use the component -->\n<ant-module name=\"fibonacci\"></ant-module>\n```\n\n**That's it!** The SDK automatically:\n- Fetches package info from registry\n- Caches WASM in IndexedDB (downloads only on new version)\n- Loads UI template\n- Binds all events\n- Executes WASM functions\n\n## CDN Links\n\n```html\n<!-- jsDelivr (recommended) -->\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/yannbanas/antcloud-sdk@main/ant-module.js\"></script>\n\n<!-- With specific version tag -->\n<script type=\"module\" src=\"https://cdn.jsdelivr.net/gh/yannbanas/antcloud-sdk@v2.0.0/ant-module.js\"></script>\n\n<!-- unpkg (after npm publish) -->\n<script type=\"module\" src=\"https://unpkg.com/@banastechnologie/antcloud-sdk\"></script>\n```\n\n## Features\n\n| Feature | Description |\n|---------|-------------|\n| 📦 **IndexedDB Cache** | WASM downloaded only once per version |\n| ⚡ **Fast Reload** | Cached modules load instantly |\n| 🎨 **Dynamic UI** | Binds to `data-ant-*` attributes automatically |\n| 🔄 **Version Check** | Always uses latest version from registry |\n| 🔌 **Clean API** | Simple programmatic control |\n\n## How Caching Works\n\n```\nFirst visit:\n  └─► Fetch package info (check version)\n  └─► No cache → Download WASM → Store in IndexedDB\n  └─► Load UI → Render → Ready!\n\nReturn visit (same version):\n  └─► Fetch package info → v1.2.0\n  └─► Cache exists with v1.2.0 → Use cached WASM ✅\n  └─► No download needed!\n\nAfter new version published:\n  └─► Fetch package info → v1.3.0 (new!)\n  └─► Cache has v1.2.0 → Download v1.3.0\n  └─► Update cache → Ready!\n```\n\n## Attributes\n\n| Attribute | Description | Default |\n|-----------|-------------|---------|\n| `name` | Package name (required) | - |\n| `registry` | Registry URL | `https://antcloud-registry.up.railway.app` |\n| `no-cache` | Disable caching (for development) | - |\n\n```html\n<!-- Basic usage -->\n<ant-module name=\"fibonacci\"></ant-module>\n\n<!-- Custom registry -->\n<ant-module name=\"my-package\" registry=\"https://my-registry.com\"></ant-module>\n\n<!-- Disable cache (dev mode) -->\n<ant-module name=\"fibonacci\" no-cache></ant-module>\n```\n\n## UI Template Attributes\n\nThe SDK binds these `data-ant-*` attributes in your UI template:\n\n| Attribute | Description |\n|-----------|-------------|\n| `data-ant-function=\"name\"` | Function selector (tab/button) |\n| `data-ant-inputs=\"name\"` | Input group for a function |\n| `data-ant-input=\"n\"` | Input field |\n| `data-ant-type=\"i32\\|i64\\|f32\\|f64\"` | Input type for conversion |\n| `data-ant-display=\"n\"` | Display value (for sliders) |\n| `data-ant-execute` | Execute button |\n| `data-ant-output` | Result container |\n| `data-ant-value` | Result value |\n| `data-ant-time` | Execution time |\n| `data-ant-expr` | Expression called |\n| `data-ant-status-dot` | Status indicator |\n| `data-ant-status-text` | Status text |\n| `data-ant-true-label` | Label for true (bool functions) |\n| `data-ant-false-label` | Label for false (bool functions) |\n\n## Template Variables\n\nUse these in your UI HTML:\n\n```html\n{{name}}        → Package name\n{{version}}     → Latest version\n{{author}}      → Package author\n{{description}} → Package description\n{{license}}     → Package license\n{{downloads}}   → Download count\n{{stars}}       → Star count\n```\n\n## JavaScript API\n\n```javascript\nconst module = document.querySelector('ant-module');\n\n// Wait for ready\nmodule.addEventListener('ant-ready', (e) => {\n  console.log(e.detail.name, e.detail.version, e.detail.functions);\n});\n\n// Listen for results\nmodule.addEventListener('ant-result', (e) => {\n  console.log(e.detail.function, e.detail.result, e.detail.time);\n});\n\n// Listen for errors\nmodule.addEventListener('ant-error', (e) => {\n  console.error(e.detail.error);\n});\n\n// Programmatic control\nmodule.setValues({ n: 42 });\nmodule.getValues();              // { n: \"42\" }\nmodule.setFunction('is_fibonacci');\nmodule.getFunction();            // \"is_fibonacci\"\nmodule.getFunctions();           // [\"fibonacci\", \"is_fibonacci\", ...]\n\n// Execute and get result\nconst result = await module.invoke('fibonacci', { n: 50 });\n\n// Clear cache (force re-download)\nawait module.clearCache();\n```\n\n## Publishing Packages\n\nCreate a WASM module with UI and publish to AntHive registry:\n\n```bash\n# Publish package with UI\ncurl -X POST https://antcloud-registry.up.railway.app/api/v1/packages \\\n  -H \"Authorization: Bearer YOUR_API_KEY\" \\\n  -F \"manifest=@anthive.yaml\" \\\n  -F \"wasm=@my-function.wasm\" \\\n  -F \"ui=@ui.html\"\n```\n\n### Example UI Template\n\nYour `ui.html` should be **HTML/CSS only** (no JavaScript). The SDK handles all logic:\n\n```html\n<style>\n  :host { display: block; font-family: system-ui; }\n  /* ... your styles ... */\n</style>\n\n<div class=\"card\">\n  <h2>{{name}}</h2>\n  <p>{{description}}</p>\n  \n  <!-- Function tabs -->\n  <div class=\"tabs\">\n    <button data-ant-function=\"calculate\">calculate()</button>\n    <button data-ant-function=\"check\">check()</button>\n  </div>\n  \n  <!-- Inputs -->\n  <div data-ant-inputs=\"calculate\">\n    <input type=\"range\" data-ant-input=\"n\" data-ant-type=\"i32\" min=\"0\" max=\"100\" value=\"10\">\n    <span data-ant-display=\"n\">10</span>\n  </div>\n  \n  <!-- Execute -->\n  <button data-ant-execute>▶ Execute</button>\n  \n  <!-- Result -->\n  <div data-ant-output>\n    <span data-ant-value></span>\n    <span data-ant-time></span>\n  </div>\n</div>\n```\n\n## Registry\n\nDefault registry: [antcloud-registry.up.railway.app](https://antcloud-registry.up.railway.app)\n\nBrowse available packages and documentation at the registry homepage.\n\n## License\n\nMIT © [BanasTechnologie](https://github.com/yannbanas)\n","readmeFilename":"README.md","_rev":"1-d98ac3974bf3b97d4258a4d809207737"}