@joralvmel/cosmos-angular 0.0.0-stage → 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jorge Andrés Álvarez Melchor (joralvmel)
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 CHANGED
@@ -1,3 +1,25 @@
1
- # Temporary Holding Version
1
+ # @joralvmel/cosmos-angular
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Angular components for [Cosmos UI](../../README.md).
4
+
5
+ Standalone Angular components for the Cosmos Web Components.
6
+
7
+ ```ts
8
+ import { Component } from '@angular/core';
9
+ import { CosmButtonComponent } from '@joralvmel/cosmos-angular';
10
+
11
+ @Component({
12
+ selector: 'app-toolbar',
13
+ imports: [CosmButtonComponent],
14
+ template: `<cosm-button variant="soft" (press)="save($event.detail.source)">Save</cosm-button>`,
15
+ })
16
+ export class ToolbarComponent {
17
+ save(source: string) {}
18
+ }
19
+ ```
20
+
21
+ `COSMOS_COMPONENTS` contains every component for `imports: [...COSMOS_COMPONENTS]`.
22
+
23
+ ## License
24
+
25
+ MIT
@@ -0,0 +1,31 @@
1
+ import { EventEmitter } from '@angular/core';
2
+ import type { ButtonPressDetail } from '@joralvmel/cosmos-core';
3
+ import type { ButtonSize, ButtonTone, ButtonType, ButtonVariant, CosmButton } from '@joralvmel/cosmos-elements';
4
+ import '@joralvmel/cosmos-elements/button';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Angular proxy of `<cosm-button>`. Inputs are forwarded as element properties; `(press)`
8
+ * re-emits the original `cosm-press` `CustomEvent`.
9
+ *
10
+ * ```html
11
+ * <cosm-button variant="soft" (press)="save($event.detail.source)">Save</cosm-button>
12
+ * ```
13
+ */
14
+ export declare class CosmButtonComponent {
15
+ /** The underlying custom element. */
16
+ readonly element: CosmButton;
17
+ set variant(value: ButtonVariant);
18
+ set tone(value: ButtonTone);
19
+ set size(value: ButtonSize);
20
+ set disabled(value: boolean);
21
+ set loading(value: boolean);
22
+ set fullWidth(value: boolean);
23
+ set type(value: ButtonType);
24
+ set label(value: string | undefined);
25
+ readonly press: EventEmitter<CustomEvent<ButtonPressDetail>>;
26
+ static ɵfac: i0.ɵɵFactoryDeclaration<CosmButtonComponent, never>;
27
+ static ɵcmp: i0.ɵɵComponentDeclaration<CosmButtonComponent, "cosm-button", never, { "variant": { "alias": "variant"; "required": false; }; "tone": { "alias": "tone"; "required": false; }; "size": { "alias": "size"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "loading": { "alias": "loading"; "required": false; }; "fullWidth": { "alias": "fullWidth"; "required": false; }; "type": { "alias": "type"; "required": false; }; "label": { "alias": "label"; "required": false; }; }, { "press": "press"; }, never, ["*"], true, never>;
28
+ static ngAcceptInputType_disabled: unknown;
29
+ static ngAcceptInputType_loading: unknown;
30
+ static ngAcceptInputType_fullWidth: unknown;
31
+ }
@@ -0,0 +1,75 @@
1
+ import { booleanAttribute, ChangeDetectionStrategy, Component, ElementRef, EventEmitter, Input, inject, Output, } from '@angular/core';
2
+ import '@joralvmel/cosmos-elements/button';
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Angular proxy of `<cosm-button>`. Inputs are forwarded as element properties; `(press)`
6
+ * re-emits the original `cosm-press` `CustomEvent`.
7
+ *
8
+ * ```html
9
+ * <cosm-button variant="soft" (press)="save($event.detail.source)">Save</cosm-button>
10
+ * ```
11
+ */
12
+ export class CosmButtonComponent {
13
+ constructor() {
14
+ /** The underlying custom element. */
15
+ this.element = inject(ElementRef).nativeElement;
16
+ this.press = new EventEmitter();
17
+ }
18
+ set variant(value) {
19
+ this.element.variant = value;
20
+ }
21
+ set tone(value) {
22
+ this.element.tone = value;
23
+ }
24
+ set size(value) {
25
+ this.element.size = value;
26
+ }
27
+ set disabled(value) {
28
+ this.element.disabled = value;
29
+ }
30
+ set loading(value) {
31
+ this.element.loading = value;
32
+ }
33
+ set fullWidth(value) {
34
+ this.element.fullWidth = value;
35
+ }
36
+ set type(value) {
37
+ this.element.type = value;
38
+ }
39
+ set label(value) {
40
+ this.element.label = value;
41
+ }
42
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.5", ngImport: i0, type: CosmButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
43
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "16.1.0", version: "22.2.5", type: CosmButtonComponent, isStandalone: true, selector: "cosm-button", inputs: { variant: "variant", tone: "tone", size: "size", disabled: ["disabled", "disabled", booleanAttribute], loading: ["loading", "loading", booleanAttribute], fullWidth: ["fullWidth", "fullWidth", booleanAttribute], type: "type", label: "label" }, outputs: { press: "press" }, host: { listeners: { "cosm-press": "press.emit($event)" } }, ngImport: i0, template: '<ng-content />', isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
44
+ }
45
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.5", ngImport: i0, type: CosmButtonComponent, decorators: [{
46
+ type: Component,
47
+ args: [{
48
+ selector: 'cosm-button',
49
+ template: '<ng-content />',
50
+ changeDetection: ChangeDetectionStrategy.OnPush,
51
+ host: { '(cosm-press)': 'press.emit($event)' },
52
+ }]
53
+ }], propDecorators: { variant: [{
54
+ type: Input
55
+ }], tone: [{
56
+ type: Input
57
+ }], size: [{
58
+ type: Input
59
+ }], disabled: [{
60
+ type: Input,
61
+ args: [{ transform: booleanAttribute }]
62
+ }], loading: [{
63
+ type: Input,
64
+ args: [{ transform: booleanAttribute }]
65
+ }], fullWidth: [{
66
+ type: Input,
67
+ args: [{ transform: booleanAttribute }]
68
+ }], type: [{
69
+ type: Input
70
+ }], label: [{
71
+ type: Input
72
+ }], press: [{
73
+ type: Output
74
+ }] } });
75
+ //# sourceMappingURL=button.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.component.js","sourceRoot":"","sources":["../../src/components/button.component.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,EACL,MAAM,EACN,MAAM,GACP,MAAM,eAAe,CAAC;AASvB,OAAO,mCAAmC,CAAC;;AAE3C;;;;;;;GAOG;AAOH,MAAM,OAAO,mBAAmB;IANhC;QAOE,qCAAqC;QAC5B,YAAO,GAAe,MAAM,CAAyB,UAAU,CAAC,CAAC,aAAa,CAAC;QA2BrE,UAAK,GAAG,IAAI,YAAY,EAAkC,CAAC;KAC/E;IA1BC,IAAa,OAAO,CAAC,KAAoB;QACvC,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC;IAC/B,CAAC;IACD,IAAa,IAAI,CAAC,KAAiB;QACjC,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;I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ent } from './components/button.component.js';
3
+ import { CosmButtonComponent } from './components/button.component.js';
4
+ /** Every Cosmos Angular component, for `imports: [...COSMOS_COMPONENTS]`. */
5
+ export declare const COSMOS_COMPONENTS: readonly [typeof CosmButtonComponent];
package/dist/index.js ADDED
@@ -0,0 +1,5 @@
1
+ export { CosmButtonComponent } from './components/button.component.js';
2
+ import { CosmButtonComponent } from './components/button.component.js';
3
+ /** Every Cosmos Angular component, for `imports: [...COSMOS_COMPONENTS]`. */
4
+ export const COSMOS_COMPONENTS = [CosmButtonComponent];
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,6EAA6E;AAC7E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,mBAAmB,CAAU,CAAC"}
package/llms.md ADDED
@@ -0,0 +1,104 @@
1
+ # @joralvmel/cosmos-angular
2
+
3
+ Angular standalone components for the Cosmos Web Components. Inputs map to element properties; outputs re-emit the original CustomEvent; form controls provide ControlValueAccessors.
4
+
5
+ <!-- generated:start (npm run llms, do not edit this block by hand) -->
6
+
7
+ ## Setup: Angular (standalone)
8
+
9
+ ```bash
10
+ npm install @joralvmel/cosmos-angular @joralvmel/cosmos-tokens
11
+ ```
12
+
13
+ **Load the tokens** (`angular.json`)
14
+
15
+ ```json
16
+ "styles": ["node_modules/@joralvmel/cosmos-tokens/dist/tokens.css", "src/styles.css"]
17
+ ```
18
+
19
+ **Choose theme and mode** (`src/index.html`)
20
+
21
+ ```html
22
+ <html data-theme="cosmos" data-mode="system">
23
+ ```
24
+
25
+ **Import components** (`src/app/app.component.ts`)
26
+
27
+ ```ts
28
+ import { Component } from '@angular/core';
29
+ import { CosmButtonComponent } from '@joralvmel/cosmos-angular';
30
+
31
+ @Component({
32
+ selector: 'app-root',
33
+ imports: [CosmButtonComponent],
34
+ template: `<cosm-button (press)="save($event.detail.source)">Save</cosm-button>`,
35
+ })
36
+ export class AppComponent {
37
+ save(source: string) {}
38
+ }
39
+ ```
40
+
41
+ - Components are standalone; import them individually or spread `COSMOS_COMPONENTS`.
42
+ - Outputs re-emit the original CustomEvent: use `$event.detail`. Form controls provide ControlValueAccessors.
43
+
44
+ Guide: https://joralvmel.github.io/cosmos-ui/guides/angular/
45
+
46
+ ## Components
47
+
48
+ Every component of this package (status of planned ones: https://joralvmel.github.io/cosmos-ui/components/status/).
49
+
50
+ ### `CosmButtonComponent` (`<cosm-button>`)
51
+
52
+ Triggers an action or submits a form.
53
+
54
+ | Prop | Type | Default | Description |
55
+ | --- | --- | --- | --- |
56
+ | `variant` | 'solid' \| 'soft' \| 'outline' \| 'ghost' | `solid` | Visual emphasis, from highest (solid) to lowest (ghost). |
57
+ | `tone` | 'primary' \| 'neutral' \| 'danger' | `primary` | Color role. Use danger for destructive actions. |
58
+ | `size` | 'sm' \| 'md' \| 'lg' | `md` | Control height and padding. |
59
+ | `disabled` | boolean | `false` | Prevents interaction and removes the button from the tab order. |
60
+ | `loading` | boolean | `false` | Shows a spinner, sets aria-busy and ignores presses while keeping focus. |
61
+ | `fullWidth` | boolean | `false` | Stretches the button to the width of its container. |
62
+ | `type` | 'button' \| 'submit' \| 'reset' | `button` | Form behavior of the button. |
63
+ | `label` | string | — | Accessible name when the visible content is not descriptive (icon-only buttons). |
64
+
65
+ Events: `(press)` → `ButtonPressDetail`.
66
+
67
+ ```ts
68
+ import { Component } from '@angular/core';
69
+ import { CosmButtonComponent } from '@joralvmel/cosmos-angular';
70
+ import type { ButtonPressDetail } from '@joralvmel/cosmos-core';
71
+
72
+ @Component({
73
+ selector: 'app-example',
74
+ imports: [CosmButtonComponent],
75
+ template: `<cosm-button (press)="onPress($event.detail)">Button</cosm-button>`,
76
+ })
77
+ export class ExampleComponent {
78
+ onPress(detail: ButtonPressDetail) {
79
+ console.log(detail);
80
+ }
81
+ }
82
+ ```
83
+
84
+ ## Themes
85
+
86
+ Built-in themes: `cosmos`, `nebula` (default `cosmos`), each with `light` and `dark` modes; `system` follows the OS.
87
+
88
+ ```html
89
+ <html data-theme="nebula" data-mode="system">
90
+ <!-- runtime: setTheme(name), setMode(mode) from @joralvmel/cosmos-tokens/runtime -->
91
+ ```
92
+
93
+ Custom themes: `defineTheme()` in `@joralvmel/cosmos-tokens` (https://joralvmel.github.io/cosmos-ui/theming/themes/).
94
+
95
+ ## Rules for AI assistants
96
+
97
+ - Use Cosmos components before writing custom UI; check `list_components` / the component status page for what exists.
98
+ - Style with Cosmos tokens: `var(--cosm-*)` in CSS or the Tailwind theme utilities (`bg-primary`, `text-fg-muted`, `rounded-md`). Never hard-code colors.
99
+ - Set the theme and mode with `data-theme` and `data-mode` on the root element (or `CosmosThemeProvider` on React Native).
100
+ - Keep accessibility: give icon-only buttons a `label`, never rely on color alone, keep keyboard support.
101
+ - Never render untrusted HTML (`innerHTML`, `dangerouslySetInnerHTML`) and never build class names from user input.
102
+ - Import the standalone components from `@joralvmel/cosmos-angular` (`CosmButtonComponent`…); outputs emit the CustomEvent (`$event.detail`).
103
+
104
+ <!-- generated:end -->
package/package.json CHANGED
@@ -1,6 +1,62 @@
1
1
  {
2
2
  "name": "@joralvmel/cosmos-angular",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Angular standalone components and forms integration for the Cosmos UI Web Components.",
5
+ "keywords": [
6
+ "angular",
7
+ "web-components",
8
+ "design-system",
9
+ "cosmos-ui"
10
+ ],
11
+ "type": "module",
12
+ "license": "MIT",
13
+ "author": "joralvmel",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/joralvmel/cosmos-ui.git",
17
+ "directory": "packages/angular"
18
+ },
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "sideEffects": true,
23
+ "files": [
24
+ "dist",
25
+ "llms.md"
26
+ ],
27
+ "main": "./dist/index.js",
28
+ "module": "./dist/index.js",
29
+ "types": "./dist/index.d.ts",
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "default": "./dist/index.js"
34
+ },
35
+ "./llms.md": "./llms.md",
36
+ "./package.json": "./package.json"
37
+ },
38
+ "scripts": {
39
+ "build": "ngc -p tsconfig.build.json",
40
+ "typecheck": "tsc -p tsconfig.json",
41
+ "test": "vitest run",
42
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
43
+ },
44
+ "dependencies": {
45
+ "@joralvmel/cosmos-core": "^0.1.0",
46
+ "@joralvmel/cosmos-elements": "^0.1.0",
47
+ "tslib": "^2.9.1"
48
+ },
49
+ "peerDependencies": {
50
+ "@angular/core": ">=21.0.0",
51
+ "@angular/forms": ">=21.0.0"
52
+ },
53
+ "devDependencies": {
54
+ "@angular/common": "^22.2.5",
55
+ "@angular/compiler": "^22.2.5",
56
+ "@angular/compiler-cli": "^22.2.5",
57
+ "@angular/core": "^22.2.5",
58
+ "@angular/forms": "^22.2.5",
59
+ "@angular/platform-browser": "^22.2.5",
60
+ "rxjs": "^7.8.2"
61
+ }
62
+ }