ladrillosjs 2.0.0-beta.4 → 2.0.0-beta.4.2

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 (2) hide show
  1. package/README.md +0 -112
  2. package/package.json +5 -3
package/README.md CHANGED
@@ -31,7 +31,6 @@ A lightweight, zero-dependency web component framework for building modular web
31
31
  - [Shadow DOM](#shadow-dom)
32
32
  - [Styling Components](#styling-components)
33
33
  - [Performance & Caching](#performance--caching)
34
- - [Creating Component Libraries](#creating-component-libraries)
35
34
  - [Common Patterns](#common-patterns)
36
35
  - [Keyboard Events](#keyboard-events)
37
36
  - [Form Validation](#form-validation)
@@ -1595,117 +1594,6 @@ LadrillosJS includes built-in performance optimizations:
1595
1594
  - Event listeners are automatically cleaned up
1596
1595
  - Conditional rendering skips hidden elements
1597
1596
 
1598
- ## Creating Component Libraries
1599
-
1600
- LadrillosJS makes it easy to create and publish reusable component libraries. Developers can use your components in their projects with full TypeScript support.
1601
-
1602
- ### Quick Example
1603
-
1604
- **Create a library:**
1605
-
1606
- ```typescript
1607
- // src/types/index.ts - Define interfaces
1608
- export interface ButtonProps {
1609
- variant?: 'primary' | 'secondary';
1610
- size?: 'sm' | 'md' | 'lg';
1611
- }
1612
-
1613
- export interface AwesomeButton extends HTMLElement {
1614
- variant?: ButtonProps['variant'];
1615
- size?: ButtonProps['size'];
1616
- setLoading(state: boolean): void;
1617
- }
1618
-
1619
- // src/components/Button/button.html
1620
- <button class="btn-{variant}" onclick="handleClick()">
1621
- <slot>{label}</slot>
1622
- </button>
1623
-
1624
- <script>
1625
- let variant = this.getAttribute('variant') || 'primary';
1626
- let label = this.getAttribute('label') || 'Click';
1627
-
1628
- export const handleClick = () => {
1629
- $emit('button:click', { timestamp: Date.now() });
1630
- };
1631
- </script>
1632
-
1633
- // src/index.ts - Export registry
1634
- export * from './types';
1635
- export * from './components/Button';
1636
-
1637
- export const AWESOME_COMPONENTS = [
1638
- { name: 'awesome-button', path: './components/Button/button.html' }
1639
- ];
1640
-
1641
- export const registerAwesomeComponents = async () => {
1642
- const { registerComponents } = await import('ladrillosjs');
1643
- return registerComponents(AWESOME_COMPONENTS);
1644
- };
1645
- ```
1646
-
1647
- **Consumers use it:**
1648
-
1649
- ```typescript
1650
- import {
1651
- registerAwesomeComponents,
1652
- createButton,
1653
- type AwesomeButton,
1654
- } from "@awesome/ui";
1655
-
1656
- // Register all components
1657
- await registerAwesomeComponents();
1658
-
1659
- // Use in HTML
1660
- <awesome-button variant="primary" label="Click Me"></awesome-button>;
1661
-
1662
- // Or programmatically with types
1663
- const btn = createButton() as AwesomeButton;
1664
- btn.setAttribute("variant", "secondary");
1665
- btn.setLoading(true);
1666
-
1667
- // Type-safe events
1668
- btn.addEventListener("button:click", (e) => {
1669
- console.log("Clicked:", e.detail.timestamp);
1670
- });
1671
- ```
1672
-
1673
- ### Key Features for Libraries
1674
-
1675
- ✅ **TypeScript Interfaces** - Full type definitions for all props, events, and methods
1676
- ✅ **Component Registry** - Easy batch registration
1677
- ✅ **Helper Functions** - `createButton()`, `configureCard()`, etc.
1678
- ✅ **Metadata Export** - Component documentation and metadata
1679
- ✅ **Multiple Formats** - ESM, CJS, UMD outputs
1680
- ✅ **Tree-Shakeable** - Only import what you use
1681
-
1682
- ### Creating Your Library
1683
-
1684
- 1. **Define TypeScript interfaces** for props, events, and typed element references
1685
- 2. **Create single-file `.html` components** with template, styles, and scripts
1686
- 3. **Export helper functions** for programmatic component creation
1687
- 4. **Create component registry** for batch registration
1688
- 5. **Configure package.json** with exports field for subpath imports
1689
- 6. **Build and publish** to NPM
1690
-
1691
- ### Example Projects
1692
-
1693
- - **[Full Example Library](samples/component-library/)** - Complete Button, Card, Modal components with TypeScript
1694
- - **[Library Demo App](samples/apps/component-library-demo/)** - Shows all usage patterns and integrations
1695
-
1696
- ### Complete Guide
1697
-
1698
- For detailed instructions on creating, building, and publishing component libraries, see the **[Library Authoring Guide](docs/LIBRARY_AUTHORING.md)**.
1699
-
1700
- Topics covered:
1701
-
1702
- - Project structure and best practices
1703
- - Component creation with HTML + TypeScript
1704
- - Building with Vite
1705
- - Publishing to NPM
1706
- - Consumer usage examples
1707
- - React/Vue integration patterns
1708
-
1709
1597
  ## Common Patterns
1710
1598
 
1711
1599
  ### Keyboard Events
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ladrillosjs",
3
- "version": "2.0.0-beta.4",
3
+ "version": "2.0.0-beta.4.2",
4
4
  "description": "A lightweight, zero-dependency web component framework for building modular web applications.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,16 +11,18 @@
11
11
  ],
12
12
  "types": "dist/index.d.ts",
13
13
  "main": "./dist/ladrillosjs.cjs.js",
14
- "module": "./src/index.ts",
14
+ "module": "./dist/ladrillosjs.es.js",
15
15
  "browser": "./dist/ladrillosjs.umd.js",
16
16
  "unpkg": "./dist/ladrillosjs.umd.js",
17
17
  "exports": {
18
18
  ".": {
19
+ "types": "./dist/index.d.ts",
19
20
  "browser": "./dist/ladrillosjs.umd.js",
20
- "import": "./src/index.ts",
21
+ "import": "./dist/ladrillosjs.es.js",
21
22
  "require": "./dist/ladrillosjs.cjs.js"
22
23
  },
23
24
  "./vite": {
25
+ "types": "./dist/vite.d.ts",
24
26
  "import": "./dist/vite.js",
25
27
  "require": "./dist/vite.cjs"
26
28
  }