@prismora/angular 0.0.0-stage → 0.1.1
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 +24 -2
- package/dist/index.d.ts +28 -0
- package/dist/index.js +69 -0
- package/package.json +41 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Aravind Kumar and Prismora contributors
|
|
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
|
-
#
|
|
1
|
+
# @prismora/angular
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Angular forms integration for Prismora web components: ngModel, formControl and the custom-elements schema.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm install @prismora/angular @prismora/elements @prismora/css
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import '@prismora/elements/input';
|
|
11
|
+
import { FormsModule } from '@angular/forms';
|
|
12
|
+
import { CUSTOM_ELEMENTS_SCHEMA, Component } from '@angular/core';
|
|
13
|
+
import { PRISMORA_FORMS } from '@prismora/angular';
|
|
14
|
+
|
|
15
|
+
@Component({
|
|
16
|
+
imports: [FormsModule, ...PRISMORA_FORMS],
|
|
17
|
+
schemas: [CUSTOM_ELEMENTS_SCHEMA], // allows <pm-*> tags
|
|
18
|
+
template: `<pm-input label="Name" [(ngModel)]="name"></pm-input>`,
|
|
19
|
+
})
|
|
20
|
+
export class Profile { name = ''; }
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Published in Angular's partial-compilation format; supports Angular 17 and later.
|
|
24
|
+
|
|
25
|
+
Documentation: [prismora.design/docs/frameworks](https://prismora.design/docs/frameworks) · Part of [Prismora](https://github.com/axxra/prismora), one seed, every theme. MIT licence.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ControlValueAccessor } from '@angular/forms';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/** ngModel / formControl support for value-based Prismora controls. */
|
|
4
|
+
export declare class PmValueAccessor implements ControlValueAccessor {
|
|
5
|
+
#private;
|
|
6
|
+
writeValue(v: string | null): void;
|
|
7
|
+
registerOnChange(fn: (v: string) => void): void;
|
|
8
|
+
registerOnTouched(fn: () => void): void;
|
|
9
|
+
setDisabledState(d: boolean): void;
|
|
10
|
+
onEvent(e: Event): void;
|
|
11
|
+
onBlur(): void;
|
|
12
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PmValueAccessor, never>;
|
|
13
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<PmValueAccessor, "pm-cascader[ngModel],pm-cascader[formControl],pm-cascader[formControlName],pm-checkbox-group[ngModel],pm-checkbox-group[formControl],pm-checkbox-group[formControlName],pm-color-picker[ngModel],pm-color-picker[formControl],pm-color-picker[formControlName],pm-combobox[ngModel],pm-combobox[formControl],pm-combobox[formControlName],pm-date-picker[ngModel],pm-date-picker[formControl],pm-date-picker[formControlName],pm-editor[ngModel],pm-editor[formControl],pm-editor[formControlName],pm-input[ngModel],pm-input[formControl],pm-input[formControlName],pm-number-input[ngModel],pm-number-input[formControl],pm-number-input[formControlName],pm-pin-input[ngModel],pm-pin-input[formControl],pm-pin-input[formControlName],pm-radio-group[ngModel],pm-radio-group[formControl],pm-radio-group[formControlName],pm-range-slider[ngModel],pm-range-slider[formControl],pm-range-slider[formControlName],pm-rating[ngModel],pm-rating[formControl],pm-rating[formControlName],pm-segmented[ngModel],pm-segmented[formControl],pm-segmented[formControlName],pm-select[ngModel],pm-select[formControl],pm-select[formControlName],pm-slider[ngModel],pm-slider[formControl],pm-slider[formControlName],pm-textarea[ngModel],pm-textarea[formControl],pm-textarea[formControlName],pm-time-picker[ngModel],pm-time-picker[formControl],pm-time-picker[formControlName],pm-toggle-group[ngModel],pm-toggle-group[formControl],pm-toggle-group[formControlName],pm-transfer[ngModel],pm-transfer[formControl],pm-transfer[formControlName],pm-tree-select[ngModel],pm-tree-select[formControl],pm-tree-select[formControlName]", never, {}, {}, never, never, true, never>;
|
|
14
|
+
}
|
|
15
|
+
/** ngModel / formControl support for checkbox-like Prismora controls. */
|
|
16
|
+
export declare class PmCheckedAccessor implements ControlValueAccessor {
|
|
17
|
+
#private;
|
|
18
|
+
writeValue(v: boolean | null): void;
|
|
19
|
+
registerOnChange(fn: (v: boolean) => void): void;
|
|
20
|
+
registerOnTouched(fn: () => void): void;
|
|
21
|
+
setDisabledState(d: boolean): void;
|
|
22
|
+
onEvent(e: Event): void;
|
|
23
|
+
onBlur(): void;
|
|
24
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<PmCheckedAccessor, never>;
|
|
25
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<PmCheckedAccessor, "pm-checkbox[ngModel],pm-checkbox[formControl],pm-checkbox[formControlName],pm-switch[ngModel],pm-switch[formControl],pm-switch[formControlName]", never, {}, {}, never, never, true, never>;
|
|
26
|
+
}
|
|
27
|
+
export declare const PRISMORA_FORMS: readonly [typeof PmValueAccessor, typeof PmCheckedAccessor];
|
|
28
|
+
export { toast, type ToastOptions } from '@prismora/elements/toast';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Generated by tools/codegen-wrappers.ts from components.json — do not edit.
|
|
2
|
+
import { Directive, ElementRef, HostListener, forwardRef, inject } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
// Elements are not registered here: import the ones you use, e.g. `import '@prismora/elements/input';`
|
|
6
|
+
// (or `import '@prismora/elements/define';` for all of them).
|
|
7
|
+
// Components that use <pm-*> tags add `schemas: [CUSTOM_ELEMENTS_SCHEMA]` (from @angular/core) themselves: Angular's
|
|
8
|
+
// compiler reads schemas statically and cannot see the value of a constant exported by a compiled library.
|
|
9
|
+
/** ngModel / formControl support for value-based Prismora controls. */
|
|
10
|
+
export class PmValueAccessor {
|
|
11
|
+
#el = inject((ElementRef));
|
|
12
|
+
#onChange = () => { };
|
|
13
|
+
#onTouched = () => { };
|
|
14
|
+
writeValue(v) { this.#el.nativeElement.value = v ?? ''; }
|
|
15
|
+
registerOnChange(fn) { this.#onChange = fn; }
|
|
16
|
+
registerOnTouched(fn) { this.#onTouched = fn; }
|
|
17
|
+
setDisabledState(d) { this.#el.nativeElement.disabled = d; }
|
|
18
|
+
onEvent(e) { this.#onChange(e.detail?.value ?? this.#el.nativeElement.value); }
|
|
19
|
+
onBlur() { this.#onTouched(); }
|
|
20
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.2", ngImport: i0, type: PmValueAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
21
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.2", type: PmValueAccessor, isStandalone: true, selector: "pm-cascader[ngModel],pm-cascader[formControl],pm-cascader[formControlName],pm-checkbox-group[ngModel],pm-checkbox-group[formControl],pm-checkbox-group[formControlName],pm-color-picker[ngModel],pm-color-picker[formControl],pm-color-picker[formControlName],pm-combobox[ngModel],pm-combobox[formControl],pm-combobox[formControlName],pm-date-picker[ngModel],pm-date-picker[formControl],pm-date-picker[formControlName],pm-editor[ngModel],pm-editor[formControl],pm-editor[formControlName],pm-input[ngModel],pm-input[formControl],pm-input[formControlName],pm-number-input[ngModel],pm-number-input[formControl],pm-number-input[formControlName],pm-pin-input[ngModel],pm-pin-input[formControl],pm-pin-input[formControlName],pm-radio-group[ngModel],pm-radio-group[formControl],pm-radio-group[formControlName],pm-range-slider[ngModel],pm-range-slider[formControl],pm-range-slider[formControlName],pm-rating[ngModel],pm-rating[formControl],pm-rating[formControlName],pm-segmented[ngModel],pm-segmented[formControl],pm-segmented[formControlName],pm-select[ngModel],pm-select[formControl],pm-select[formControlName],pm-slider[ngModel],pm-slider[formControl],pm-slider[formControlName],pm-textarea[ngModel],pm-textarea[formControl],pm-textarea[formControlName],pm-time-picker[ngModel],pm-time-picker[formControl],pm-time-picker[formControlName],pm-toggle-group[ngModel],pm-toggle-group[formControl],pm-toggle-group[formControlName],pm-transfer[ngModel],pm-transfer[formControl],pm-transfer[formControlName],pm-tree-select[ngModel],pm-tree-select[formControl],pm-tree-select[formControlName]", host: { listeners: { "pm-input": "onEvent($event)", "pm-change": "onEvent($event)", "focusout": "onBlur()" } }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => PmValueAccessor), multi: true }], ngImport: i0 });
|
|
22
|
+
}
|
|
23
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.2", ngImport: i0, type: PmValueAccessor, decorators: [{
|
|
24
|
+
type: Directive,
|
|
25
|
+
args: [{
|
|
26
|
+
selector: 'pm-cascader[ngModel],pm-cascader[formControl],pm-cascader[formControlName],pm-checkbox-group[ngModel],pm-checkbox-group[formControl],pm-checkbox-group[formControlName],pm-color-picker[ngModel],pm-color-picker[formControl],pm-color-picker[formControlName],pm-combobox[ngModel],pm-combobox[formControl],pm-combobox[formControlName],pm-date-picker[ngModel],pm-date-picker[formControl],pm-date-picker[formControlName],pm-editor[ngModel],pm-editor[formControl],pm-editor[formControlName],pm-input[ngModel],pm-input[formControl],pm-input[formControlName],pm-number-input[ngModel],pm-number-input[formControl],pm-number-input[formControlName],pm-pin-input[ngModel],pm-pin-input[formControl],pm-pin-input[formControlName],pm-radio-group[ngModel],pm-radio-group[formControl],pm-radio-group[formControlName],pm-range-slider[ngModel],pm-range-slider[formControl],pm-range-slider[formControlName],pm-rating[ngModel],pm-rating[formControl],pm-rating[formControlName],pm-segmented[ngModel],pm-segmented[formControl],pm-segmented[formControlName],pm-select[ngModel],pm-select[formControl],pm-select[formControlName],pm-slider[ngModel],pm-slider[formControl],pm-slider[formControlName],pm-textarea[ngModel],pm-textarea[formControl],pm-textarea[formControlName],pm-time-picker[ngModel],pm-time-picker[formControl],pm-time-picker[formControlName],pm-toggle-group[ngModel],pm-toggle-group[formControl],pm-toggle-group[formControlName],pm-transfer[ngModel],pm-transfer[formControl],pm-transfer[formControlName],pm-tree-select[ngModel],pm-tree-select[formControl],pm-tree-select[formControlName]',
|
|
27
|
+
standalone: true,
|
|
28
|
+
providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => PmValueAccessor), multi: true }],
|
|
29
|
+
}]
|
|
30
|
+
}], propDecorators: { onEvent: [{
|
|
31
|
+
type: HostListener,
|
|
32
|
+
args: ['pm-input', ['$event']]
|
|
33
|
+
}, {
|
|
34
|
+
type: HostListener,
|
|
35
|
+
args: ['pm-change', ['$event']]
|
|
36
|
+
}], onBlur: [{
|
|
37
|
+
type: HostListener,
|
|
38
|
+
args: ['focusout']
|
|
39
|
+
}] } });
|
|
40
|
+
/** ngModel / formControl support for checkbox-like Prismora controls. */
|
|
41
|
+
export class PmCheckedAccessor {
|
|
42
|
+
#el = inject((ElementRef));
|
|
43
|
+
#onChange = () => { };
|
|
44
|
+
#onTouched = () => { };
|
|
45
|
+
writeValue(v) { this.#el.nativeElement.checked = Boolean(v); }
|
|
46
|
+
registerOnChange(fn) { this.#onChange = fn; }
|
|
47
|
+
registerOnTouched(fn) { this.#onTouched = fn; }
|
|
48
|
+
setDisabledState(d) { this.#el.nativeElement.disabled = d; }
|
|
49
|
+
onEvent(e) { this.#onChange(e.detail?.checked ?? this.#el.nativeElement.checked); }
|
|
50
|
+
onBlur() { this.#onTouched(); }
|
|
51
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.3.2", ngImport: i0, type: PmCheckedAccessor, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
52
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.3.2", type: PmCheckedAccessor, isStandalone: true, selector: "pm-checkbox[ngModel],pm-checkbox[formControl],pm-checkbox[formControlName],pm-switch[ngModel],pm-switch[formControl],pm-switch[formControlName]", host: { listeners: { "pm-change": "onEvent($event)", "focusout": "onBlur()" } }, providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => PmCheckedAccessor), multi: true }], ngImport: i0 });
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.3.2", ngImport: i0, type: PmCheckedAccessor, decorators: [{
|
|
55
|
+
type: Directive,
|
|
56
|
+
args: [{
|
|
57
|
+
selector: 'pm-checkbox[ngModel],pm-checkbox[formControl],pm-checkbox[formControlName],pm-switch[ngModel],pm-switch[formControl],pm-switch[formControlName]',
|
|
58
|
+
standalone: true,
|
|
59
|
+
providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => PmCheckedAccessor), multi: true }],
|
|
60
|
+
}]
|
|
61
|
+
}], propDecorators: { onEvent: [{
|
|
62
|
+
type: HostListener,
|
|
63
|
+
args: ['pm-change', ['$event']]
|
|
64
|
+
}], onBlur: [{
|
|
65
|
+
type: HostListener,
|
|
66
|
+
args: ['focusout']
|
|
67
|
+
}] } });
|
|
68
|
+
export const PRISMORA_FORMS = [PmValueAccessor, PmCheckedAccessor];
|
|
69
|
+
export { toast } from '@prismora/elements/toast';
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prismora/angular",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Angular forms integration for Prismora web components (generated).",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"prismora",
|
|
7
|
+
"design-system",
|
|
8
|
+
"angular",
|
|
9
|
+
"forms"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://prismora.design",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/axxra/prismora/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/axxra/prismora.git",
|
|
18
|
+
"directory": "packages/angular"
|
|
19
|
+
},
|
|
20
|
+
"author": "Aravind Kumar",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"default": "./dist/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@prismora/elements": "^0.1.1"
|
|
35
|
+
},
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@angular/core": ">=17",
|
|
38
|
+
"@angular/forms": ">=17"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
}
|
|
43
|
+
}
|