@kubuild/components 0.0.1 → 0.2.0
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.
- package/LICENSE +21 -0
- package/README.md +110 -0
- package/dist/blocks.d.ts +16 -0
- package/dist/blocks.d.ts.map +1 -0
- package/dist/definitions.d.ts +5 -0
- package/dist/definitions.d.ts.map +1 -1
- package/dist/index.cjs +2191 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2160 -19
- package/dist/index.js.map +1 -1
- package/dist/traits.d.ts +50 -0
- package/dist/traits.d.ts.map +1 -1
- package/package.json +11 -12
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kustora
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# @kubuild/components
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@kubuild/components)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
Component registry, schema definitions, traits, prop types, and starter form/layout block templates for **KUBUILD**.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 📦 Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Using pnpm (recommended)
|
|
15
|
+
pnpm add @kubuild/components @kubuild/core @kubuild/schema
|
|
16
|
+
|
|
17
|
+
# Using npm
|
|
18
|
+
npm install @kubuild/components @kubuild/core @kubuild/schema
|
|
19
|
+
|
|
20
|
+
# Using yarn
|
|
21
|
+
yarn add @kubuild/components @kubuild/core @kubuild/schema
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## ✨ Features
|
|
27
|
+
|
|
28
|
+
- **Component Registry**: Unified registry (`componentRegistry`) of built-in components:
|
|
29
|
+
- Layout: `container`, `section`, `grid`, `flex`
|
|
30
|
+
- Typography: `heading`, `text`, `paragraph`, `link`
|
|
31
|
+
- Media: `image`, `video`, `icon`
|
|
32
|
+
- Interactive & Forms: `form`, `input`, `textarea`, `select`, `checkbox`, `radio`, `button`, `button-submit`
|
|
33
|
+
- Data & Modals: `table`, `table-row`, `table-cell`, `modal`
|
|
34
|
+
- **Component Traits**: Declarative configuration for traits (properties, labels, input types, default values, validation rules).
|
|
35
|
+
- **Starter Block Templates**: Production-ready blocks in `STARTER_BLOCKS`:
|
|
36
|
+
- **Contact Us Form**: Form block with validation, inputs (Name, Email, Message), and submit action.
|
|
37
|
+
- **Newsletter Subscription**: Inline form with email input and submit handler.
|
|
38
|
+
- **Lead Generation**: Multi-field lead capture form.
|
|
39
|
+
- **Hero & Content Sections**: Responsive hero banners and feature grids.
|
|
40
|
+
- **Structural Integrity Rules**: Enforces parent-child constraints (e.g. table cells must be inside table rows, form inputs must be inside form nodes, submit buttons cannot be nested inside another button).
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## 🚀 Quick Usage
|
|
45
|
+
|
|
46
|
+
### Accessing the Component Registry
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { componentRegistry } from '@kubuild/components';
|
|
50
|
+
|
|
51
|
+
// Retrieve definition for a specific component
|
|
52
|
+
const buttonDef = componentRegistry.get('button');
|
|
53
|
+
|
|
54
|
+
console.log('Button default props:', buttonDef?.defaultProps);
|
|
55
|
+
console.log('Button traits:', buttonDef?.traits);
|
|
56
|
+
|
|
57
|
+
// Check all registered components
|
|
58
|
+
const allComponents = componentRegistry.getAll();
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Using Starter Form Templates
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { STARTER_BLOCKS } from '@kubuild/components';
|
|
65
|
+
|
|
66
|
+
// Find the Contact Us starter block
|
|
67
|
+
const contactFormBlock = STARTER_BLOCKS.find(b => b.id === 'contact-us-form');
|
|
68
|
+
|
|
69
|
+
if (contactFormBlock) {
|
|
70
|
+
console.log('Template name:', contactFormBlock.name);
|
|
71
|
+
console.log('Preconfigured node tree:', contactFormBlock.node);
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Registering Custom Components
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
import { componentRegistry, type ComponentDefinition } from '@kubuild/components';
|
|
79
|
+
|
|
80
|
+
const customCardDef: ComponentDefinition = {
|
|
81
|
+
type: 'custom-card',
|
|
82
|
+
name: 'Custom Card',
|
|
83
|
+
category: 'Custom',
|
|
84
|
+
icon: 'credit-card',
|
|
85
|
+
defaultProps: {
|
|
86
|
+
title: 'Card Title',
|
|
87
|
+
body: 'Card description content.'
|
|
88
|
+
},
|
|
89
|
+
traits: [
|
|
90
|
+
{
|
|
91
|
+
name: 'title',
|
|
92
|
+
label: 'Title',
|
|
93
|
+
type: 'text'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'body',
|
|
97
|
+
label: 'Body Text',
|
|
98
|
+
type: 'textarea'
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
componentRegistry.register(customCardDef);
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## 📄 License
|
|
109
|
+
|
|
110
|
+
MIT © [KUBUILD](https://github.com/kustora/kubuild)
|
package/dist/blocks.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Node } from '@kubuild/schema';
|
|
2
|
+
export interface BlockDefinition {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
category: 'layout' | 'sections' | 'ui' | 'pricing' | 'cta' | 'forms' | string;
|
|
6
|
+
categoryLabel?: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
thumbnailSvg?: string;
|
|
10
|
+
createNodeTree: (generateId?: (prefix?: string) => string) => Node;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Predefined Starter Layout Blocks (STORA-241) and Pre-composed UI Blocks (STORA-242).
|
|
14
|
+
*/
|
|
15
|
+
export declare const STARTER_BLOCKS: BlockDefinition[];
|
|
16
|
+
//# sourceMappingURL=blocks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocks.d.ts","sourceRoot":"","sources":["../src/blocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAoB,MAAM,iBAAiB,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,IAAI,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAC9E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,MAAM,KAAK,IAAI,CAAC;CACpE;AAOD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,eAAe,EA+uC3C,CAAC"}
|
package/dist/definitions.d.ts
CHANGED
|
@@ -26,7 +26,12 @@ export declare const inputDefinition: ComponentDefinition;
|
|
|
26
26
|
export declare const textareaDefinition: ComponentDefinition;
|
|
27
27
|
export declare const selectDefinition: ComponentDefinition;
|
|
28
28
|
export declare const checkboxDefinition: ComponentDefinition;
|
|
29
|
+
export declare const switchDefinition: ComponentDefinition;
|
|
30
|
+
export declare const radioGroupDefinition: ComponentDefinition;
|
|
29
31
|
export declare const radioDefinition: ComponentDefinition;
|
|
32
|
+
export declare const radioItemDefinition: ComponentDefinition;
|
|
33
|
+
export declare const fileUploadDefinition: ComponentDefinition;
|
|
34
|
+
export declare const buttonSubmitDefinition: ComponentDefinition;
|
|
30
35
|
export declare const coreComponentDefinitions: ComponentDefinition[];
|
|
31
36
|
export declare function createDefaultComponentRegistry(): ComponentRegistry;
|
|
32
37
|
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../src/definitions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":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