1.2.0 β’ Published 10 months ago
@marlink-technologies/mrlnk v1.2.0
MRLNK
A modern, lightweight TypeScript UI framework for building responsive and accessible web applications. MRLNK is designed to work seamlessly with any JavaScript framework or vanilla JS, with special support for Webflow integration.
β¨ Why MRLNK?
- π― Zero Dependencies - Only core dependencies (GSAP, Floating UI) for essential features
- π Performance First - Lightweight (~12KB gzipped), tree-shakeable components with minimal DOM operations
- π¨ Customizable - Extensive theming system using CSS custom properties
- βΏ Accessible - WCAG 2.1 compliant components with full keyboard navigation
- π¦ Framework Agnostic - Works with any framework or vanilla JavaScript
- π§ TypeScript Native - Full type safety and excellent IDE support
- π Webflow Ready - Special integration support for Webflow projects
- π Live Reload - Development server with hot reload support
- π± Responsive - Mobile-first design approach
- π Type Safe - Full TypeScript support with IntelliSense
π Getting Started
Common Use Cases
- Simple Component Usage
// Create and mount a button
const button = App.Component.Button.create({
text: 'Click me',
variant: 'primary',
});
document.body.appendChild(button);
// Create a color picker with preview
const picker = App.Component.ColorPicker.create({
onChange: (color) => (document.body.style.backgroundColor = color),
});
document.body.appendChild(picker);- Form Validation
const form = document.createElement('form');
const input = App.Component.Input.create({
label: 'Email',
type: 'email',
required: true,
validation: {
pattern: /^[^@]+@[^@]+\.[^@]+$/,
message: 'Please enter a valid email',
},
});
const submit = App.Component.Button.create({
text: 'Submit',
type: 'submit',
onClick: (e) => {
e.preventDefault();
if (input.validate()) {
console.log('Form valid!');
}
},
});
form.appendChild(input);
form.appendChild(submit);- Modal Dialog
const modal = App.Component.Modal.create({
title: 'Confirmation',
content: 'Are you sure you want to proceed?',
buttons: [
{
text: 'Cancel',
variant: 'secondary',
onClick: () => modal.hide(),
},
{
text: 'Confirm',
variant: 'primary',
onClick: () => {
console.log('Confirmed!');
modal.hide();
},
},
],
});
const openButton = App.Component.Button.create({
text: 'Open Modal',
onClick: () => modal.show(),
});- Data Display
const table = App.Component.Table.create({
columns: [
{ field: 'name', header: 'Name' },
{ field: 'age', header: 'Age' },
],
data: [
{ name: 'John', age: 30 },
{ name: 'Jane', age: 25 },
],
sortable: true,
pagination: {
pageSize: 10,
},
});π¦ Installation
Prerequisites
- Node.js (v16 or higher)
- npm (v7 or higher) or pnpm (recommended)
- TypeScript (v4.5 or higher)
# Using npm
npm install @marlink-technologies/mrlnk
# Using pnpm (recommended)
pnpm add @marlink-technologies/mrlnk
# Using yarn
yarn add @marlink-technologies/mrlnkCDN Usage
<!-- Production version -->
<script src="https://cdn.jsdelivr.net/npm/@marlink-technologies/mrlnk@latest/dist/index.js"></script>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@marlink-technologies/mrlnk@latest/dist/style.css"
/>
<!-- Development version -->
<script src="http://localhost:3000/index.js"></script>
<link rel="stylesheet" href="http://localhost:3000/style.css" />π― Quick Start
Basic Usage
import { App } from '@marlink-technologies/mrlnk';
// Create a button
const button = App.Component.Button.create({
text: 'Click me',
variant: 'primary',
onClick: () => console.log('Button clicked!'),
});
// Add it to the DOM
document.body.appendChild(button);Framework Integration
React
import { useEffect, useRef } from 'react';
import { App } from '@marlink-technologies/mrlnk';
function Button({ onClick }) {
const containerRef = useRef(null);
useEffect(() => {
if (!containerRef.current) return;
const button = App.Component.Button.create({
text: 'Click me',
onClick,
});
containerRef.current.appendChild(button);
return () => button.remove();
}, [onClick]);
return <div ref={containerRef} />;
}Vue
<template>
<div ref="container"></div>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
import { App } from '@marlink-technologies/mrlnk';
const container = ref(null);
let button = null;
onMounted(() => {
if (!container.value) return;
button = App.Component.Button.create({
text: 'Click me',
onClick: () => emit('click'),
});
container.value.appendChild(button);
});
onUnmounted(() => button?.remove());
</script>Webflow Integration
- Add the MRLNK script and styles to your Webflow project settings:
<script
defer
src="https://cdn.jsdelivr.net/npm/@marlink-technologies/mrlnk@latest/dist/index.js"
></script>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@marlink-technologies/mrlnk@latest/dist/style.css"
/>- Create a custom code block in Webflow:
<div id="mrlnk-component"></div>
<script>
document.addEventListener('DOMContentLoaded', () => {
const component = App.Component.Button.create({
text: 'Webflow Button',
variant: 'primary',
});
document.getElementById('mrlnk-component').appendChild(component);
});
</script>π Documentation
- Framework Overview - Architecture & core concepts
- Development Guide - Development workflow & best practices
- Components Map - Available components & usage
- Theming Guide - Customization & styling
- Playground - Interactive examples
- Architecture - Technical diagrams & flows
π οΈ Development
Setting Up Development Environment
- Clone the repository:
git clone https://github.com/Marlink-Technologies/mrlnk.git
cd mrlnk- Install dependencies:
pnpm install- Start development server:
pnpm devAvailable Commands
# Start development server (http://localhost:3000)
pnpm dev
# Build for production (outputs to /dist)
pnpm build
# Run tests in headless mode
pnpm test
# Run tests in browser
pnpm test:headed
# Format code with Prettier
pnpm format
# Run ESLint checks
pnpm lint
# Fix ESLint issues
pnpm lint:fix
# Check TypeScript types
pnpm check
# Create a new release
pnpm release
# Update dependencies interactively
pnpm updateDevelopment Tips
- Live Reloading: The development server includes live reloading by default
- Path Aliases: Use
$utils/*for importing from the utils directory - Type Checking: Run
pnpm checkbefore committing changes - Testing: Write tests for new components in the
/testsdirectory
π Browser Support
| Browser | Version |
|---|---|
| Chrome | β₯ 90 |
| Firefox | β₯ 88 |
| Safari | β₯ 14 |
| Edge | β₯ 90 |
| Opera | β₯ 76 |
π§ Tech Stack
- TypeScript - Type-safe component development
- GSAP - Smooth animations and transitions
- Floating UI - Positioning for tooltips and popovers
- ESBuild - Fast bundling and compilation
- Playwright - End-to-end testing
- Changesets - Version management and changelogs
π€ Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests (
pnpm test) - Create a changeset (
pnpm changeset) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See our Contributing Guide for more details.
π Troubleshooting
Common Issues
Components not rendering
- Check if MRLNK is properly imported
- Verify the CDN links are accessible
- Check browser console for errors
Styling issues
- Ensure the CSS file is properly loaded
- Check if custom properties are correctly defined
- Verify CSS specificity
TypeScript errors
- Make sure @types are installed
- Check TypeScript version compatibility
- Verify tsconfig.json settings
Getting Help
π License
MRLNK is licensed under the ISC License - see the LICENSE file for details.
π Credits
Created and maintained by Marlink Technologies.
π Quick Links
π¨ Theming
Custom Properties
:root {
/* Colors */
--mlk-color-primary: #007bff;
--mlk-color-secondary: #6c757d;
--mlk-color-success: #28a745;
--mlk-color-danger: #dc3545;
/* Typography */
--mlk-font-family: system-ui, -apple-system, sans-serif;
--mlk-font-size-base: 16px;
--mlk-line-height: 1.5;
/* Spacing */
--mlk-spacing-unit: 8px;
--mlk-border-radius: 4px;
/* Transitions */
--mlk-transition-duration: 200ms;
--mlk-transition-timing: ease-in-out;
}Dark Mode
[data-theme='dark'] {
--mlk-color-primary: #0d6efd;
--mlk-color-secondary: #495057;
--mlk-background: #212529;
--mlk-text: #f8f9fa;
}π Performance
| Metric | Value |
|---|---|
| Bundle Size (gzipped) | ~12KB |
| First Paint | < 100ms |
| Time to Interactive | < 200ms |
| Memory Usage | < 5MB |
| Tree-shaking | Supported |
π Security
- All dependencies are regularly updated
- No eval() or innerHTML usage
- XSS protection built-in
- CSP compatible
- Regular security audits
πΊοΈ Roadmap
- Server Components Support
- Web Components Export
- SSR Support
- Animation System
- Form Builder
- Data Grid
- Chart Components
- Mobile Components