@learningmap/web-component
A framework-agnostic web component for integrating learning maps into any web application.
Installation
Via npm
npm install @learningmap/web-component
# or
pnpm add @learningmap/web-component
# or
yarn add @learningmap/web-component
Via CDN
<script src="https://unpkg.com/@learningmap/web-component"></script>
<link rel="stylesheet" href="https://unpkg.com/@learningmap/web-component/dist/web-component.css">
Usage
Basic Editor
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/@learningmap/web-component/dist/web-component.css">
<script src="https://unpkg.com/@learningmap/web-component"></script>
</head>
<body>
<hyperbook-learningmap-editor
language="en"
roadmap-data='{"nodes": [], "edges": [], "settings": {}, "version": 1}'
></hyperbook-learningmap-editor>
<script>
const editor = document.querySelector('hyperbook-learningmap-editor');
editor.addEventListener('change', (event) => {
const roadmapData = event.detail;
console.log('Roadmap saved:', roadmapData);
// Save to your backend
});
</script>
</body>
</html>