Appearance
๐ Quick Start Guide โ
Create your first widget with XCON Studio Widget Framework in 5 minutes!
๐ Requirements โ
- Node.js 18+
- NPM 9+
- Basic TypeScript knowledge
๐ฏ 1. Create Widget โ
bash
# Create widget
npx @xcons/cli web create -n my-awesome
# Enter directory
cd my-awesome
# Install dependencies
npm install
# Start development
npm run devGo to http://localhost:4201 in your browser.
๐ 2. Widget Code โ
Separate Template File โ
typescript
@Widget({
selector: '.my-widget',
templateUrl: './widget.html',
styleUrls: ['./widget.css']
})
export class MyWidget {
@xproperty() name: string = 'World';
}๐ 3. Build and Usage โ
bash
# Build
npm run build
# Preview
npm run previewUsage in HTML โ
html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="widget.css">
</head>
<body>
<div class="my-first-widget"></div>
<script src="https://unpkg.com/@xcons/core@latest/dist/core.js"></script>
<script src="https://unpkg.com/@xcons/common@latest/dist/common.js"></script>
<script src="widget.js"></script>
<script>
XConBootstrap.run({
widgets: [{ widget: MyFirstWidget, initMode: 'auto' }]
});
</script>
</body>
</html>๐ฏ Basic Features โ
Decorators โ
@xproperty()- Reactive property@xcomputed()- Computed value@xinject()- Service injection@xsingleton()- Singleton service
Template Directives โ
x:text="value"- Text displayx:model="property"- Two-way data bindingx:on:click="method"- Event bindingx:if="condition"- Conditional displayx:for="item in items"- List renderingx:class:active="isActive"- Class binding
๐ ๏ธ NPM Commands โ
bash
npm run dev # Development server
npm run build # Production build
npm run preview # Build preview
npm run clean # Clean