@spw-ds/spw-angular-library 1.4.0 → 1.4.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/README.md CHANGED
@@ -1,16 +1,16 @@
1
- # SPW Design System
2
-
3
- Le **SPW Design System** est une bibliothèque de composants Web conçue pour créer des interfaces utilisateur cohérentes, accessibles et maintenables dans toutes les applications web du Service Public de Wallonie.
4
-
5
- ## Documentation et guides
6
-
7
- - [Documentation complète sur ZeroHeight](https://zeroheight.com/2310c7a1e/p/44e962-design-system-du-spw) : Découvrez les principes de design, les guidelines, et les spécifications de chaque composant.
8
- - [Storybook interactif](https://main--6698db7bdfc632c36f76afdb.chromatic.com/) : Explorez et testez les composants en action, avec des exemples détaillés et des cas d'utilisation.
9
-
10
- ## Compatibilité
11
-
12
- Les composants sont développés en utilisant [StencilJS](https://stenciljs.com/), ce qui garantit une compatibilité native avec tous les frameworks modernes (tels que React et Angular) ainsi qu'avec des projets sans framework.
13
-
14
- ## Contribution
15
-
16
- Pour contribuer ou poser des questions, référez-vous à [notre documentation ZeroHeight](https://zeroheight.com/2310c7a1e/p/44e962-design-system-du-spw) ou [contactez l’équipe de développement](mailto:pierre.henrion.ext@spw.wallonie.be).
1
+ # SPW Design System
2
+
3
+ Le **SPW Design System** est une bibliothèque de composants Web conçue pour créer des interfaces utilisateur cohérentes, accessibles et maintenables dans toutes les applications web du Service Public de Wallonie.
4
+
5
+ ## Documentation et guides
6
+
7
+ - [Documentation complète sur ZeroHeight](https://zeroheight.com/2310c7a1e/p/44e962-design-system-du-spw) : Découvrez les principes de design, les guidelines, et les spécifications de chaque composant.
8
+ - [Storybook interactif](https://main--6698db7bdfc632c36f76afdb.chromatic.com/) : Explorez et testez les composants en action, avec des exemples détaillés et des cas d'utilisation.
9
+
10
+ ## Compatibilité
11
+
12
+ Les composants sont développés en utilisant [StencilJS](https://stenciljs.com/), ce qui garantit une compatibilité native avec tous les frameworks modernes (tels que React et Angular) ainsi qu'avec des projets sans framework.
13
+
14
+ ## Contribution
15
+
16
+ Pour contribuer ou poser des questions, référez-vous à [notre documentation ZeroHeight](https://zeroheight.com/2310c7a1e/p/44e962-design-system-du-spw) ou [contactez l’équipe de développement](mailto:pierre.henrion.ext@spw.wallonie.be).
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/spw-angular-library",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@spw-ds/spw-angular-library",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Design System du SPW. Librairie Angular.",
5
5
  "readme": "../../../../README.md",
6
6
  "peerDependencies": {
7
- "@angular/common": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
8
- "@angular/core": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
9
- "@angular/forms": "^18.0.0 || ^19.0.0 || ^20.0.0 || ^21.0.0",
10
- "@spw-ds/spw-stencil-library": "1.4.0"
7
+ "@angular/common": ">=18.0.0",
8
+ "@angular/core": ">=18.0.0",
9
+ "@angular/forms": ">=18.0.0",
10
+ "@spw-ds/spw-stencil-library": "1.4.1"
11
11
  },
12
12
  "repository": {
13
13
  "type": "git",
@@ -16,16 +16,8 @@
16
16
  "dependencies": {
17
17
  "tslib": "^2.7.0"
18
18
  },
19
- "sideEffects": false,
20
- "module": "fesm2022/spw-ds-spw-angular-library.mjs",
21
- "typings": "index.d.ts",
22
- "exports": {
23
- "./package.json": {
24
- "default": "./package.json"
25
- },
26
- ".": {
27
- "types": "./index.d.ts",
28
- "default": "./fesm2022/spw-ds-spw-angular-library.mjs"
29
- }
30
- }
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "sideEffects": false
31
23
  }
@@ -0,0 +1,8 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { DIRECTIVES } from './stencil-generated';
3
+
4
+ @NgModule({
5
+ imports: [...DIRECTIVES],
6
+ exports: [...DIRECTIVES],
7
+ })
8
+ export class SpwDesignSystemDirectivesModule {}
@@ -0,0 +1,16 @@
1
+ import { APP_INITIALIZER, NgModule } from '@angular/core';
2
+ import { defineCustomElements } from '@spw-ds/spw-stencil-library/loader';
3
+ import { SpwDesignSystemDirectivesModule } from './spw-design-system-directives.module';
4
+
5
+ @NgModule({
6
+ imports: [SpwDesignSystemDirectivesModule],
7
+ exports: [SpwDesignSystemDirectivesModule],
8
+ providers: [
9
+ {
10
+ provide: APP_INITIALIZER,
11
+ useFactory: () => defineCustomElements,
12
+ multi: true,
13
+ },
14
+ ],
15
+ })
16
+ export class SpwDesignSystemModule {}
@@ -0,0 +1,65 @@
1
+ /* eslint-disable */
2
+ /* tslint:disable */
3
+ import { fromEvent } from 'rxjs';
4
+
5
+ export const proxyInputs = (Cmp: any, inputs: string[]) => {
6
+ const Prototype = Cmp.prototype;
7
+ inputs.forEach((item) => {
8
+ Object.defineProperty(Prototype, item, {
9
+ get() {
10
+ return this.el[item];
11
+ },
12
+ set(val: any) {
13
+ this.z.runOutsideAngular(() => (this.el[item] = val));
14
+ },
15
+ /**
16
+ * In the event that proxyInputs is called
17
+ * multiple times re-defining these inputs
18
+ * will cause an error to be thrown. As a result
19
+ * we set configurable: true to indicate these
20
+ * properties can be changed.
21
+ */
22
+ configurable: true,
23
+ });
24
+ });
25
+ };
26
+
27
+ export const proxyMethods = (Cmp: any, methods: string[]) => {
28
+ const Prototype = Cmp.prototype;
29
+ methods.forEach((methodName) => {
30
+ Prototype[methodName] = function () {
31
+ const args = arguments;
32
+ return this.z.runOutsideAngular(() => this.el[methodName].apply(this.el, args));
33
+ };
34
+ });
35
+ };
36
+
37
+ export const proxyOutputs = (instance: any, el: any, events: string[]) => {
38
+ events.forEach((eventName) => (instance[eventName] = fromEvent(el, eventName)));
39
+ };
40
+
41
+ export const defineCustomElement = (tagName: string, customElement: any) => {
42
+ if (customElement !== undefined && typeof customElements !== 'undefined' && !customElements.get(tagName)) {
43
+ customElements.define(tagName, customElement);
44
+ }
45
+ };
46
+
47
+ // tslint:disable-next-line: only-arrow-functions
48
+ export function ProxyCmp(opts: { defineCustomElementFn?: () => void; inputs?: any; methods?: any }) {
49
+ const decorator = function (cls: any) {
50
+ const { defineCustomElementFn, inputs, methods } = opts;
51
+
52
+ if (defineCustomElementFn !== undefined) {
53
+ defineCustomElementFn();
54
+ }
55
+
56
+ if (inputs) {
57
+ proxyInputs(cls, inputs);
58
+ }
59
+ if (methods) {
60
+ proxyMethods(cls, methods);
61
+ }
62
+ return cls;
63
+ };
64
+ return decorator;
65
+ }