@igo2/sdg-core 1.0.0-next.98 → 1.0.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/README.md CHANGED
@@ -1 +1,9 @@
1
1
  # Core
2
+
3
+ Documentation à venir
4
+
5
+ Installer le paquet de base qui comprend les styles et la logique de base
6
+
7
+ ```
8
+ npm install --save @igo2/sdg-core
9
+ ```
package/_index.scss ADDED
@@ -0,0 +1 @@
1
+ @forward './src';
@@ -1,118 +1,14 @@
1
+ import { BreakpointObserver } from '@angular/cdk/layout';
1
2
  import * as i0 from '@angular/core';
2
- import { makeEnvironmentProviders, Injectable, provideAppInitializer, inject, PLATFORM_ID, signal, Optional, Pipe } from '@angular/core';
3
- import { isPlatformServer, DOCUMENT } from '@angular/common';
4
- import * as i1 from '@angular/router';
5
- import { NavigationEnd } from '@angular/router';
6
- import { filter, first } from 'rxjs';
7
- import * as i1$1 from '@angular/cdk/layout';
8
-
9
- var AnalyticsFeatureKind;
10
- (function (AnalyticsFeatureKind) {
11
- AnalyticsFeatureKind[AnalyticsFeatureKind["GoogleAnalytic"] = 0] = "GoogleAnalytic";
12
- })(AnalyticsFeatureKind || (AnalyticsFeatureKind = {}));
13
-
14
- function provideAnalytics(...features) {
15
- const providers = [];
16
- for (const feature of features) {
17
- providers.push(...feature.providers);
18
- }
19
- return makeEnvironmentProviders(providers);
20
- }
21
-
22
- class GoogleAnalyticsService {
23
- router;
24
- routerEvents$$;
25
- constructor(router) {
26
- this.router = router;
27
- }
28
- initialize() {
29
- if (!gtag) {
30
- throw new Error('The gtag was not created for Google Analytics');
31
- }
32
- }
33
- trackEvent(eventName, eventParams) {
34
- gtag('event', eventName, eventParams);
35
- }
36
- trackFirstPageView() {
37
- if (this.routerEvents$$) {
38
- throw new Error('Page tracking is already instantiated for Google Analytics');
39
- }
40
- this.routerEvents$$ = this.router.events
41
- .pipe(filter((event) => event instanceof NavigationEnd), first())
42
- .subscribe((event) => {
43
- gtag('event', 'page_view', {
44
- page_path: event.urlAfterRedirects
45
- });
46
- });
47
- }
48
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GoogleAnalyticsService, deps: [{ token: i1.Router }], target: i0.ɵɵFactoryTarget.Injectable });
49
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GoogleAnalyticsService, providedIn: 'root' });
50
- }
51
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: GoogleAnalyticsService, decorators: [{
52
- type: Injectable,
53
- args: [{
54
- providedIn: 'root'
55
- }]
56
- }], ctorParameters: () => [{ type: i1.Router }] });
57
-
58
- function withGoogleAnalytics(options) {
59
- if (!options.targetId) {
60
- throw new Error('Vous devez configurer le targetId pour Google Analytics');
61
- }
62
- return {
63
- kind: AnalyticsFeatureKind.GoogleAnalytic,
64
- providers: [
65
- GoogleAnalyticsService,
66
- provideAppInitializer(() => {
67
- const platformId = inject(PLATFORM_ID);
68
- if (isPlatformServer(platformId)) {
69
- return;
70
- }
71
- const document = inject(DOCUMENT);
72
- const gaService = inject(GoogleAnalyticsService);
73
- return googleAnalyticsFactory(document, gaService, options);
74
- })
75
- ]
76
- };
77
- }
78
- function googleAnalyticsFactory(document, gaService, options) {
79
- // Dynamically load the Google Analytics script
80
- const script = document.createElement('script');
81
- script.async = true;
82
- script.src = `https://www.googletagmanager.com/gtag/js?id=${options.targetId}`;
83
- document.head.appendChild(script);
84
- script.onload = () => {
85
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
- const _window = window;
87
- _window['dataLayer'] = _window['dataLayer'] || [];
88
- _window['gtag'] = function () {
89
- // eslint-disable-next-line prefer-rest-params
90
- _window['dataLayer'].push(arguments);
91
- };
92
- gtag('js', new Date());
93
- // Disable automatic page view tracking
94
- gtag('config', options.targetId, {
95
- send_page_view: false,
96
- cookie_flags: 'SameSite=None;Secure',
97
- ...(options.config ?? {})
98
- });
99
- gaService.initialize();
100
- /**
101
- * Track the first page view but after we fallback on the default TagManager event. You can manage this event in the TagManger admin console.
102
- * https://support.google.com/tagmanager/answer/7679319?hl=en&ref_topic=7679108&sjid=1071553345249084852-NA
103
- */
104
- gaService.trackFirstPageView();
105
- };
106
- }
3
+ import { inject, signal, Injectable, Pipe, model, Directive } from '@angular/core';
107
4
 
108
5
  class BreakpointService {
109
- breakpointObserver;
110
- _isHandset = signal(false);
6
+ breakpointObserver = inject(BreakpointObserver);
7
+ _isHandset = signal(false, ...(ngDevMode ? [{ debugName: "_isHandset" }] : []));
111
8
  get isHandset() {
112
9
  return this._isHandset.asReadonly();
113
10
  }
114
- constructor(breakpointObserver) {
115
- this.breakpointObserver = breakpointObserver;
11
+ constructor() {
116
12
  this.handleBreakpoint();
117
13
  }
118
14
  handleBreakpoint() {
@@ -122,15 +18,15 @@ class BreakpointService {
122
18
  this._isHandset.set(result.matches);
123
19
  });
124
20
  }
125
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BreakpointService, deps: [{ token: i1$1.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Injectable });
126
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BreakpointService, providedIn: 'root' });
21
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BreakpointService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
22
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BreakpointService, providedIn: 'root' });
127
23
  }
128
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: BreakpointService, decorators: [{
24
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: BreakpointService, decorators: [{
129
25
  type: Injectable,
130
26
  args: [{
131
27
  providedIn: 'root'
132
28
  }]
133
- }], ctorParameters: () => [{ type: i1$1.BreakpointObserver }] });
29
+ }], ctorParameters: () => [] });
134
30
 
135
31
  const RouteTitleKey = 'RouteTitle';
136
32
  const RouteTranslateKey = 'TranslateKey';
@@ -151,25 +47,20 @@ class TitleResolver {
151
47
  }
152
48
 
153
49
  class TitleResolverPipe {
154
- titleResolver;
155
- constructor(titleResolver) {
156
- this.titleResolver = titleResolver;
157
- }
50
+ titleResolver = inject(TitleResolver, { optional: true });
158
51
  transform(value) {
159
52
  return resolveTitle(value, this.titleResolver);
160
53
  }
161
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TitleResolverPipe, deps: [{ token: TitleResolver, optional: true }], target: i0.ɵɵFactoryTarget.Pipe });
162
- static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: TitleResolverPipe, isStandalone: true, name: "titleResolver" });
54
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TitleResolverPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
55
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "20.3.9", ngImport: i0, type: TitleResolverPipe, isStandalone: true, name: "titleResolver" });
163
56
  }
164
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TitleResolverPipe, decorators: [{
57
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: TitleResolverPipe, decorators: [{
165
58
  type: Pipe,
166
59
  args: [{
167
60
  name: 'titleResolver',
168
61
  standalone: true
169
62
  }]
170
- }], ctorParameters: () => [{ type: TitleResolver, decorators: [{
171
- type: Optional
172
- }] }] });
63
+ }] });
173
64
 
174
65
  function pathIsExternal(path) {
175
66
  const regex = /^https?:\/\//;
@@ -181,9 +72,32 @@ function isSafeUrl(url) {
181
72
  return safePattern.test(url) && !unsafePattern.test(url.trim());
182
73
  }
183
74
 
75
+ class WithLabels {
76
+ labels = model({}, ...(ngDevMode ? [{ debugName: "labels" }] : []));
77
+ // eslint-disable-next-line @angular-eslint/prefer-inject
78
+ constructor(defaultLabels, labelsToken) {
79
+ this.setLabels(defaultLabels, labelsToken);
80
+ }
81
+ setLabels(defaultLabels, token) {
82
+ const labelsOverride = inject(token, { optional: true });
83
+ if (labelsOverride) {
84
+ this.labels.update((value) => ({
85
+ ...(defaultLabels ?? {}),
86
+ ...labelsOverride,
87
+ ...value
88
+ }));
89
+ }
90
+ }
91
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: WithLabels, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
92
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "20.3.9", type: WithLabels, isStandalone: true, inputs: { labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { labels: "labelsChange" }, ngImport: i0 });
93
+ }
94
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: WithLabels, decorators: [{
95
+ type: Directive
96
+ }], ctorParameters: () => [{ type: undefined }, { type: i0.InjectionToken }], propDecorators: { labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }, { type: i0.Output, args: ["labelsChange"] }] } });
97
+
184
98
  /**
185
99
  * Generated bundle index. Do not edit.
186
100
  */
187
101
 
188
- export { AnalyticsFeatureKind, BreakpointService, GoogleAnalyticsService, RouteTitleKey, RouteTranslateKey, TitleResolver, TitleResolverPipe, isSafeUrl, pathIsExternal, provideAnalytics, resolveTitle, withGoogleAnalytics };
102
+ export { BreakpointService, RouteTitleKey, RouteTranslateKey, TitleResolver, TitleResolverPipe, WithLabels, isSafeUrl, pathIsExternal, resolveTitle };
189
103
  //# sourceMappingURL=igo2-sdg-core.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"igo2-sdg-core.mjs","sources":["../../../packages/core/src/analytics/analytics.interface.ts","../../../packages/core/src/analytics/analytics.provider.ts","../../../packages/core/src/analytics/google-analytics/google-analytics.service.ts","../../../packages/core/src/analytics/google-analytics/google-analytics.provider.ts","../../../packages/core/src/layout/breakpoint/breakpoint.service.ts","../../../packages/core/src/router/router.ts","../../../packages/core/src/router/title-resolver/title-resolver.ts","../../../packages/core/src/router/title-resolver/title-resolver.pipe.ts","../../../packages/core/src/router/route.utils.ts","../../../packages/core/src/igo2-sdg-core.ts"],"sourcesContent":["import { EnvironmentProviders, Provider } from '@angular/core';\n\nexport interface AnalyticsFeature<KindT extends AnalyticsFeatureKind> {\n kind: KindT;\n providers: (Provider | EnvironmentProviders)[];\n}\n\nexport enum AnalyticsFeatureKind {\n GoogleAnalytic = 0\n}\n","import {\n EnvironmentProviders,\n Provider,\n makeEnvironmentProviders\n} from '@angular/core';\n\nimport { AnalyticsFeature, AnalyticsFeatureKind } from './analytics.interface';\n\nexport function provideAnalytics(\n ...features: AnalyticsFeature<AnalyticsFeatureKind>[]\n) {\n const providers: (Provider | EnvironmentProviders)[] = [];\n\n for (const feature of features) {\n providers.push(...feature.providers);\n }\n\n return makeEnvironmentProviders(providers);\n}\n","import { Injectable } from '@angular/core';\nimport { NavigationEnd, Router } from '@angular/router';\n\nimport { Subscription, filter, first } from 'rxjs';\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ndeclare let gtag: Function;\n\n@Injectable({\n providedIn: 'root'\n})\nexport class GoogleAnalyticsService {\n private routerEvents$$?: Subscription;\n\n constructor(private router: Router) {}\n\n initialize(): void {\n if (!gtag) {\n throw new Error('The gtag was not created for Google Analytics');\n }\n }\n\n trackEvent(eventName: string, eventParams: Record<string, unknown>): void {\n gtag('event', eventName, eventParams);\n }\n\n trackFirstPageView(): void {\n if (this.routerEvents$$) {\n throw new Error(\n 'Page tracking is already instantiated for Google Analytics'\n );\n }\n\n this.routerEvents$$ = this.router.events\n .pipe(\n filter((event) => event instanceof NavigationEnd),\n first()\n )\n .subscribe((event: NavigationEnd) => {\n gtag!('event', 'page_view', {\n page_path: event.urlAfterRedirects\n });\n });\n }\n}\n","import { DOCUMENT, isPlatformServer } from '@angular/common';\nimport { PLATFORM_ID, inject, provideAppInitializer } from '@angular/core';\n\nimport { AnalyticsFeature, AnalyticsFeatureKind } from '../analytics.interface';\nimport { IGoogleAnalyticsOptions } from './google-analytics.interface';\nimport { GoogleAnalyticsService } from './google-analytics.service';\n\nexport function withGoogleAnalytics(\n options: IGoogleAnalyticsOptions\n): AnalyticsFeature<AnalyticsFeatureKind.GoogleAnalytic> {\n if (!options.targetId) {\n throw new Error('Vous devez configurer le targetId pour Google Analytics');\n }\n\n return {\n kind: AnalyticsFeatureKind.GoogleAnalytic,\n providers: [\n GoogleAnalyticsService,\n provideAppInitializer(() => {\n const platformId = inject(PLATFORM_ID);\n if (isPlatformServer(platformId)) {\n return;\n }\n\n const document = inject(DOCUMENT);\n const gaService = inject(GoogleAnalyticsService);\n return googleAnalyticsFactory(document, gaService, options);\n })\n ]\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\ndeclare let gtag: Function;\n\nfunction googleAnalyticsFactory(\n document: Document,\n gaService: GoogleAnalyticsService,\n options: IGoogleAnalyticsOptions\n): void {\n // Dynamically load the Google Analytics script\n const script = document.createElement('script');\n script.async = true;\n script.src = `https://www.googletagmanager.com/gtag/js?id=${options.targetId}`;\n document.head.appendChild(script);\n\n script.onload = () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _window = window as any;\n _window['dataLayer'] = _window['dataLayer'] || [];\n _window['gtag'] = function () {\n // eslint-disable-next-line prefer-rest-params\n _window['dataLayer'].push(arguments);\n };\n\n gtag('js', new Date());\n\n // Disable automatic page view tracking\n gtag('config', options.targetId, {\n send_page_view: false,\n cookie_flags: 'SameSite=None;Secure',\n ...(options.config ?? {})\n });\n\n gaService.initialize();\n\n /**\n * Track the first page view but after we fallback on the default TagManager event. You can manage this event in the TagManger admin console.\n * https://support.google.com/tagmanager/answer/7679319?hl=en&ref_topic=7679108&sjid=1071553345249084852-NA\n */\n gaService.trackFirstPageView();\n };\n}\n","import { BreakpointObserver } from '@angular/cdk/layout';\nimport { Injectable, Signal, signal } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class BreakpointService {\n private _isHandset = signal(false);\n\n get isHandset(): Signal<boolean> {\n return this._isHandset.asReadonly();\n }\n\n constructor(private breakpointObserver: BreakpointObserver) {\n this.handleBreakpoint();\n }\n\n private handleBreakpoint(): void {\n this.breakpointObserver\n .observe('(max-width: 575px)')\n .subscribe((result) => {\n this._isHandset.set(result.matches);\n });\n }\n}\n","import { Route } from '@angular/router';\n\nimport { TitleResolver } from './title-resolver/title-resolver';\n\nexport const RouteTitleKey = 'RouteTitle';\nexport const RouteTranslateKey = 'TranslateKey';\n\nfunction hasStaticTitle(config: Route): boolean {\n return typeof config.title === 'string' || config.title === null;\n}\n\nexport function resolveTitle(\n config: Route,\n titleResolver?: TitleResolver\n): string | undefined {\n if (hasStaticTitle(config)) {\n return config.title as string;\n } else {\n return (\n titleResolver?.resolveStatic(config) ?? config.data?.[RouteTranslateKey] // try to fallback on the translation key\n );\n }\n}\n","import {\n ActivatedRouteSnapshot,\n MaybeAsync,\n Resolve,\n Route,\n RouterStateSnapshot\n} from '@angular/router';\n\nexport abstract class TitleResolver<T = string> implements Resolve<T> {\n abstract resolve(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): MaybeAsync<T>;\n abstract resolveStatic(route: Route): string | undefined;\n}\n","import { Optional, Pipe, PipeTransform } from '@angular/core';\n\nimport { SdgRoute } from '../route.interface';\nimport { resolveTitle } from '../router';\nimport { TitleResolver } from './title-resolver';\n\n@Pipe({\n name: 'titleResolver',\n standalone: true\n})\nexport class TitleResolverPipe implements PipeTransform {\n constructor(@Optional() private titleResolver: TitleResolver) {}\n\n transform(value: SdgRoute): string | undefined {\n return resolveTitle(value, this.titleResolver);\n }\n}\n","export function pathIsExternal(path: string): boolean {\n const regex = /^https?:\\/\\//;\n return regex.test(path);\n}\n\nexport function isSafeUrl(url: string): boolean {\n const safePattern = /^(https?:\\/\\/|\\/(?!\\/)|\\.\\/|\\.\\.\\/)/;\n const unsafePattern = /^(javascript:|data:|vbscript:)/i;\n return safePattern.test(url) && !unsafePattern.test(url.trim());\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["i1","i1.TitleResolver"],"mappings":";;;;;;;;IAOY;AAAZ,CAAA,UAAY,oBAAoB,EAAA;AAC9B,IAAA,oBAAA,CAAA,oBAAA,CAAA,gBAAA,CAAA,GAAA,CAAA,CAAA,GAAA,gBAAkB;AACpB,CAAC,EAFW,oBAAoB,KAApB,oBAAoB,GAE/B,EAAA,CAAA,CAAA;;ACDe,SAAA,gBAAgB,CAC9B,GAAG,QAAkD,EAAA;IAErD,MAAM,SAAS,GAAwC,EAAE;AAEzD,IAAA,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,SAAS,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;;AAGtC,IAAA,OAAO,wBAAwB,CAAC,SAAS,CAAC;AAC5C;;MCPa,sBAAsB,CAAA;AAGb,IAAA,MAAA;AAFZ,IAAA,cAAc;AAEtB,IAAA,WAAA,CAAoB,MAAc,EAAA;QAAd,IAAM,CAAA,MAAA,GAAN,MAAM;;IAE1B,UAAU,GAAA;QACR,IAAI,CAAC,IAAI,EAAE;AACT,YAAA,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC;;;IAIpE,UAAU,CAAC,SAAiB,EAAE,WAAoC,EAAA;AAChE,QAAA,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC;;IAGvC,kBAAkB,GAAA;AAChB,QAAA,IAA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IAAI,GAAG,iBAAiB,CAAC;;;AAG9E;;MCdsB,aAAa,CAAA;AAMlC;;MCJY,iBAAiB,CAAA;AACI,IAAA,aAAA;AAAhC,IAAA,WAAA,CAAgC,aAA4B,EAAA;QAA5B,IAAa,CAAA,aAAA,GAAb,aAAa;;AAE7C,IAAA,SAAS,CAAC,KAAe,EAAA;QACvB,OAAO,YAAY,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC;;wGAJrC,iBAAiB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAAC,aAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA;sGAAjB,iBAAiB,EAAA,YAAA,EAAA,IAAA,EAAA,IAAA,EAAA,eAAA,EAAA,CAAA;;4FAAjB,iBAAiB,EAAA,UAAA,EAAA,CAAA;kBAJ7B,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACJ,oBAAA,IAAI,EAAE,eAAe;AACrB,oBAAA,UAAU,EAAE;AACb,iBAAA;;0BAEc;;;ACXT,SAAU,cAAc,CAAC,IAAY,EAAA;IACzC,MAAM,KAAK,GAAG,cAAc;AAC5B,IAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;AACzB;AAEM,SAAU,SAAS,CAAC,GAAW,EAAA;IACnC,MAAM,WAAW,GAAG,qCAAqC;IACzD,MAAM,aAAa,GAAG,iCAAiC;AACvD,IAAA,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AACjE;;ACTA;;AAEG;;;;"}
1
+ {"version":3,"file":"igo2-sdg-core.mjs","sources":["../../../packages/core/src/layout/breakpoint/breakpoint.service.ts","../../../packages/core/src/router/router.ts","../../../packages/core/src/router/title-resolver/title-resolver.ts","../../../packages/core/src/router/title-resolver/title-resolver.pipe.ts","../../../packages/core/src/router/route.utils.ts","../../../packages/core/src/shared/with-labels.ts","../../../packages/core/src/igo2-sdg-core.ts"],"sourcesContent":["import { BreakpointObserver } from '@angular/cdk/layout';\nimport { Injectable, Signal, inject, signal } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class BreakpointService {\n private breakpointObserver = inject(BreakpointObserver);\n\n private _isHandset = signal(false);\n\n get isHandset(): Signal<boolean> {\n return this._isHandset.asReadonly();\n }\n\n constructor() {\n this.handleBreakpoint();\n }\n\n private handleBreakpoint(): void {\n this.breakpointObserver\n .observe('(max-width: 575px)')\n .subscribe((result) => {\n this._isHandset.set(result.matches);\n });\n }\n}\n","import { Route } from '@angular/router';\n\nimport { TitleResolver } from './title-resolver/title-resolver';\n\nexport const RouteTitleKey = 'RouteTitle';\nexport const RouteTranslateKey = 'TranslateKey';\n\nfunction hasStaticTitle(config: Route): boolean {\n return typeof config.title === 'string' || config.title === null;\n}\n\nexport function resolveTitle(\n config: Route,\n titleResolver?: TitleResolver | null\n): string | undefined {\n if (hasStaticTitle(config)) {\n return config.title as string;\n } else {\n return (\n titleResolver?.resolveStatic(config) ?? config.data?.[RouteTranslateKey] // try to fallback on the translation key\n );\n }\n}\n","import {\n ActivatedRouteSnapshot,\n MaybeAsync,\n Resolve,\n Route,\n RouterStateSnapshot\n} from '@angular/router';\n\nexport abstract class TitleResolver<T = string> implements Resolve<T> {\n abstract resolve(\n route: ActivatedRouteSnapshot,\n state: RouterStateSnapshot\n ): MaybeAsync<T>;\n abstract resolveStatic(route: Route): string | undefined;\n}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\n\nimport { SdgRoute } from '../route.interface';\nimport { resolveTitle } from '../router';\nimport { TitleResolver } from './title-resolver';\n\n@Pipe({\n name: 'titleResolver',\n standalone: true\n})\nexport class TitleResolverPipe implements PipeTransform {\n private titleResolver = inject(TitleResolver, { optional: true });\n\n transform(value: SdgRoute): string | undefined {\n return resolveTitle(value, this.titleResolver);\n }\n}\n","export function pathIsExternal(path: string): boolean {\n const regex = /^https?:\\/\\//;\n return regex.test(path);\n}\n\nexport function isSafeUrl(url: string): boolean {\n const safePattern = /^(https?:\\/\\/|\\/(?!\\/)|\\.\\/|\\.\\.\\/)/;\n const unsafePattern = /^(javascript:|data:|vbscript:)/i;\n return safePattern.test(url) && !unsafePattern.test(url.trim());\n}\n","import { Directive, InjectionToken, inject, model } from '@angular/core';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype Labels = Record<string, any>;\n\n@Directive()\nexport class WithLabels<T extends Labels> {\n labels = model<T>({} as T);\n\n // eslint-disable-next-line @angular-eslint/prefer-inject\n constructor(defaultLabels: T | undefined, labelsToken: InjectionToken<T>) {\n this.setLabels(defaultLabels, labelsToken);\n }\n\n private setLabels(defaultLabels: T | undefined, token: InjectionToken<T>) {\n const labelsOverride = inject(token, { optional: true });\n if (labelsOverride) {\n this.labels.update((value) => ({\n ...(defaultLabels ?? {}),\n ...labelsOverride,\n ...value\n }));\n }\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;MAMa,iBAAiB,CAAA;AACpB,IAAA,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAE/C,IAAA,UAAU,GAAG,MAAM,CAAC,KAAK,sDAAC;AAElC,IAAA,IAAI,SAAS,GAAA;AACX,QAAA,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE;IACrC;AAEA,IAAA,WAAA,GAAA;QACE,IAAI,CAAC,gBAAgB,EAAE;IACzB;IAEQ,gBAAgB,GAAA;AACtB,QAAA,IAAI,CAAC;aACF,OAAO,CAAC,oBAAoB;AAC5B,aAAA,SAAS,CAAC,CAAC,MAAM,KAAI;YACpB,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC;AACrC,QAAA,CAAC,CAAC;IACN;uGAnBW,iBAAiB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,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A,EAAA,IAAA,EAAA,UAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,IAAA,EAAA,EAAA,EAAA,OAAA,EAAA,EAAA,MAAA,EAAA,cAAA,EAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA;;2FAAV,UAAU,EAAA,UAAA,EAAA,CAAA;kBADtB;;;ACLD;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,5 +1,53 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="@igo2/sdg-core" />
5
- export * from './public-api';
1
+ import * as i0 from '@angular/core';
2
+ import { Signal, PipeTransform, InjectionToken } from '@angular/core';
3
+ import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot, MaybeAsync, Route } from '@angular/router';
4
+
5
+ declare class BreakpointService {
6
+ private breakpointObserver;
7
+ private _isHandset;
8
+ get isHandset(): Signal<boolean>;
9
+ constructor();
10
+ private handleBreakpoint;
11
+ static ɵfac: i0.ɵɵFactoryDeclaration<BreakpointService, never>;
12
+ static ɵprov: i0.ɵɵInjectableDeclaration<BreakpointService>;
13
+ }
14
+
15
+ declare abstract class TitleResolver<T = string> implements Resolve<T> {
16
+ abstract resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<T>;
17
+ abstract resolveStatic(route: Route): string | undefined;
18
+ }
19
+
20
+ declare const RouteTitleKey = "RouteTitle";
21
+ declare const RouteTranslateKey = "TranslateKey";
22
+ declare function resolveTitle(config: Route, titleResolver?: TitleResolver | null): string | undefined;
23
+
24
+ type SdgRoutes = SdgRoute[];
25
+ interface SdgRoute extends Route {
26
+ isHome?: boolean;
27
+ description?: string;
28
+ children?: SdgRoutes;
29
+ /** Hidden in the primary tabs navigation and in the breadcrumbs */
30
+ hidden?: boolean;
31
+ }
32
+
33
+ declare class TitleResolverPipe implements PipeTransform {
34
+ private titleResolver;
35
+ transform(value: SdgRoute): string | undefined;
36
+ static ɵfac: i0.ɵɵFactoryDeclaration<TitleResolverPipe, never>;
37
+ static ɵpipe: i0.ɵɵPipeDeclaration<TitleResolverPipe, "titleResolver", true>;
38
+ }
39
+
40
+ declare function pathIsExternal(path: string): boolean;
41
+ declare function isSafeUrl(url: string): boolean;
42
+
43
+ type Labels = Record<string, any>;
44
+ declare class WithLabels<T extends Labels> {
45
+ labels: i0.ModelSignal<T>;
46
+ constructor(defaultLabels: T | undefined, labelsToken: InjectionToken<T>);
47
+ private setLabels;
48
+ static ɵfac: i0.ɵɵFactoryDeclaration<WithLabels<any>, never>;
49
+ static ɵdir: i0.ɵɵDirectiveDeclaration<WithLabels<any>, never, never, { "labels": { "alias": "labels"; "required": false; "isSignal": true; }; }, { "labels": "labelsChange"; }, never, never, true, never>;
50
+ }
51
+
52
+ export { BreakpointService, RouteTitleKey, RouteTranslateKey, TitleResolver, TitleResolverPipe, WithLabels, isSafeUrl, pathIsExternal, resolveTitle };
53
+ export type { SdgRoute, SdgRoutes };
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "name": "@igo2/sdg-core",
3
- "version": "1.0.0-next.98",
3
+ "version": "1.0.0",
4
4
  "license": "LiLiQ-R",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/infra-geo-ouverte/sdg.git",
8
8
  "directory": "packages/core"
9
9
  },
10
+ "engines": {
11
+ "node": "^20.19.0 || ^22.12.0 || >=24.0.0"
12
+ },
10
13
  "exports": {
11
14
  ".": {
12
- "sass": "./src/_index.scss",
15
+ "sass": "./_index.scss",
13
16
  "types": "./index.d.ts",
14
17
  "default": "./fesm2022/igo2-sdg-core.mjs"
15
18
  },
@@ -21,12 +24,11 @@
21
24
  }
22
25
  },
23
26
  "peerDependencies": {
24
- "@angular/cdk": "^19.2.0",
25
- "@angular/common": "^19.2.0",
26
- "@angular/core": "^19.2.0",
27
- "@angular/material": "^19.2.0",
28
- "@angular/router": "^19.2.0",
29
- "bootstrap": "^5.3.0"
27
+ "@angular/cdk": "^20.0.0",
28
+ "@angular/common": "^20.0.0",
29
+ "@angular/core": "^20.0.0",
30
+ "@angular/material": "^20.0.0",
31
+ "@angular/router": "^20.0.0"
30
32
  },
31
33
  "dependencies": {
32
34
  "tslib": "^2.6.0"
@@ -114,3 +114,17 @@ $devices: (
114
114
  }
115
115
  }
116
116
  }
117
+
118
+ @mixin media-mobile-landscape() {
119
+ $breakpoint: breakpoint(mobile-landscape);
120
+ @if $breakpoint {
121
+ $max-width: map.get($grids, $breakpoint, max-width);
122
+ @if $max-width {
123
+ @media (max-width: max-width(mobile)) or ((max-width: $max-width) and (orientation: landscape)) {
124
+ @content;
125
+ }
126
+ } @else {
127
+ @content;
128
+ }
129
+ }
130
+ }
@@ -2,10 +2,8 @@
2
2
  @use './typography-utils' as *;
3
3
  @use '../tokens/token-utils';
4
4
 
5
- @mixin typo-set-base-styles {
6
- :root {
7
- font-size: var(--sdg-font-size-root-percent);
8
- }
5
+ @mixin typo-base {
6
+ font-size: var(--sdg-font-size-root-percent);
9
7
 
10
8
  body {
11
9
  color: var(--sdg-color-text);
@@ -81,7 +79,8 @@
81
79
  max-inline-size: var(--sdg-max-content-width);
82
80
  }
83
81
 
84
- h1 {
82
+ h1,
83
+ .h1 {
85
84
  @include header-font('h1');
86
85
  @include title-border;
87
86
 
@@ -93,7 +92,8 @@
93
92
  }
94
93
  }
95
94
 
96
- h2 {
95
+ h2,
96
+ .h2 {
97
97
  @include header-font('h2');
98
98
 
99
99
  @include breakpoints.media(mobile) {
@@ -102,7 +102,8 @@
102
102
  }
103
103
  }
104
104
 
105
- h3 {
105
+ h3,
106
+ .h3 {
106
107
  @include header-font('h3');
107
108
 
108
109
  @include breakpoints.media(mobile) {
@@ -110,15 +111,18 @@
110
111
  }
111
112
  }
112
113
 
113
- h4 {
114
+ h4,
115
+ .h4 {
114
116
  @include header-font('h4');
115
117
  }
116
118
 
117
- h5 {
119
+ h5,
120
+ .h5 {
118
121
  @include header-font('h5');
119
122
  }
120
123
 
121
- h6 {
124
+ h6,
125
+ .h6 {
122
126
  @include header-font('h6');
123
127
  }
124
128
 
@@ -134,6 +138,6 @@
134
138
  @mixin header-font($header) {
135
139
  font-size: var(--sdg-font-size-#{$header});
136
140
  line-height: var(--sdg-line-height-#{$header});
137
- margin-top: var(--sdg-title-margin-#{$header}-mt) !important;
138
- margin-bottom: var(--sdg-title-margin-#{$header}-mb) !important;
141
+ margin-top: var(--sdg-title-margin-#{$header}-mt);
142
+ margin-bottom: var(--sdg-title-margin-#{$header}-mb);
139
143
  }
@@ -23,12 +23,14 @@
23
23
  color: var(--sdg-color-white);
24
24
  }
25
25
 
26
- @include mat.form-field-overrides(
27
- (
28
- container-height: 40px,
29
- container-vertical-padding: 8px
30
- )
31
- );
26
+ mat-form-field {
27
+ @include mat.form-field-overrides(
28
+ (
29
+ container-height: 40px,
30
+ container-vertical-padding: 8px
31
+ )
32
+ );
33
+ }
32
34
 
33
35
  .mdc-icon-button.mat-mdc-button-base {
34
36
  @include mat.icon-button-overrides(
@@ -39,8 +41,8 @@
39
41
  // reset the default padding of Material. Igo is overriding it
40
42
  padding: calc(
41
43
  calc(
42
- var(--mdc-icon-button-state-layer-size, 40px) - var(
43
- --mdc-icon-button-icon-size,
44
+ var(--mat-icon-button-state-layer-size, 40px) - var(
45
+ --mat-icon-button-icon-size,
44
46
  24px
45
47
  )
46
48
  ) /
@@ -51,6 +51,24 @@
51
51
  }
52
52
  }
53
53
 
54
+ .mat-mdc-button-base {
55
+ &.on-primary {
56
+ @include mat.button-overrides(
57
+ (
58
+ filled-state-layer-color: var(--sdg-color-grey-pale),
59
+ outlined-state-layer-color: var(--sdg-color-grey-pale),
60
+ protected-state-layer-color: var(--sdg-color-grey-pale),
61
+ text-state-layer-color: var(--sdg-color-grey-pale)
62
+ )
63
+ );
64
+ @include mat.icon-button-overrides(
65
+ (
66
+ state-layer-color: var(--sdg-color-grey-pale)
67
+ )
68
+ );
69
+ }
70
+ }
71
+
54
72
  .mat-mdc-outlined-button {
55
73
  border-color: currentColor !important;
56
74
  border-width: 2px !important;
@@ -8,7 +8,7 @@
8
8
 
9
9
  $base-size: 8px;
10
10
  $checkbox-size: calc($base-size * 3);
11
- $size-with-padding: var(--mdc-checkbox-state-layer-size);
11
+ $size-with-padding: var(--mat-checkbox-state-layer-size);
12
12
 
13
13
  @include mat.checkbox-overrides(
14
14
  (
@@ -49,7 +49,7 @@
49
49
  height: $radio-button-size;
50
50
  width: $radio-button-size;
51
51
  padding: calc(
52
- (var(--mdc-radio-state-layer-size, 40px) - $radio-button-size) / 2
52
+ (var(--mat-radio-state-layer-size, 40px) - $radio-button-size) / 2
53
53
  );
54
54
 
55
55
  .mdc-radio__native-control:checked
@@ -98,7 +98,7 @@
98
98
  height: $radio-button-size;
99
99
  width: $radio-button-size;
100
100
  padding: calc(
101
- (var(--mdc-radio-state-layer-size, 40px) - $radio-button-size) / 2
101
+ (var(--mat-radio-state-layer-size, 40px) - $radio-button-size) / 2
102
102
  );
103
103
 
104
104
  .mdc-radio__background {
@@ -2,6 +2,7 @@
2
2
 
3
3
  @use '../style/overrides';
4
4
  @use '../style/elevation';
5
+ @use '../style/typography';
5
6
  @use './sys-colors';
6
7
  @use './sys-elevation';
7
8
  @use './sys-layout';
@@ -10,10 +11,7 @@
10
11
  @use './token-utils';
11
12
 
12
13
  @mixin theme($withDarkMode: false) {
13
- @include _system-colors();
14
- @include _system-typographies();
15
- @include _system-layout();
16
- @include _system-level-elevation();
14
+ @include system-tokens();
17
15
 
18
16
  @if ($withDarkMode) {
19
17
  body.dark-mode {
@@ -25,10 +23,19 @@
25
23
  background-color: var(--sdg-color-background);
26
24
  }
27
25
 
26
+ @include typography.typo-base();
27
+
28
28
  @include overrides.igo2-lib-overrides();
29
29
  @include overrides.material-overrides();
30
30
  }
31
31
 
32
+ @mixin system-tokens() {
33
+ @include _system-colors();
34
+ @include _system-typographies();
35
+ @include _system-layout();
36
+ @include _system-level-elevation();
37
+ }
38
+
32
39
  @mixin _system-level-elevation() {
33
40
  $elevations: sys-elevation.sys-elevation-values();
34
41
  @include token-utils.values($elevations);
@@ -1,8 +0,0 @@
1
- import { EnvironmentProviders, Provider } from '@angular/core';
2
- export interface AnalyticsFeature<KindT extends AnalyticsFeatureKind> {
3
- kind: KindT;
4
- providers: (Provider | EnvironmentProviders)[];
5
- }
6
- export declare enum AnalyticsFeatureKind {
7
- GoogleAnalytic = 0
8
- }
@@ -1,3 +0,0 @@
1
- import { EnvironmentProviders } from '@angular/core';
2
- import { AnalyticsFeature, AnalyticsFeatureKind } from './analytics.interface';
3
- export declare function provideAnalytics(...features: AnalyticsFeature<AnalyticsFeatureKind>[]): EnvironmentProviders;
@@ -1,10 +0,0 @@
1
- export interface IGoogleAnalyticsOptions {
2
- targetId: string;
3
- /**
4
- * See the config options https://developers.google.com/analytics/devguides/collection/ga4/reference/config
5
- * By default we set:
6
- * - send_page_view to false
7
- * - cookie_flags to SameSite=None;Secure
8
- **/
9
- config?: Record<string, unknown>;
10
- }
@@ -1,3 +0,0 @@
1
- import { AnalyticsFeature, AnalyticsFeatureKind } from '../analytics.interface';
2
- import { IGoogleAnalyticsOptions } from './google-analytics.interface';
3
- export declare function withGoogleAnalytics(options: IGoogleAnalyticsOptions): AnalyticsFeature<AnalyticsFeatureKind.GoogleAnalytic>;
@@ -1,12 +0,0 @@
1
- import { Router } from '@angular/router';
2
- import * as i0 from "@angular/core";
3
- export declare class GoogleAnalyticsService {
4
- private router;
5
- private routerEvents$$?;
6
- constructor(router: Router);
7
- initialize(): void;
8
- trackEvent(eventName: string, eventParams: Record<string, unknown>): void;
9
- trackFirstPageView(): void;
10
- static ɵfac: i0.ɵɵFactoryDeclaration<GoogleAnalyticsService, never>;
11
- static ɵprov: i0.ɵɵInjectableDeclaration<GoogleAnalyticsService>;
12
- }
@@ -1,3 +0,0 @@
1
- export * from './google-analytics.interface';
2
- export * from './google-analytics.provider';
3
- export * from './google-analytics.service';
@@ -1,3 +0,0 @@
1
- export * from './analytics.interface';
2
- export * from './analytics.provider';
3
- export * from './google-analytics';
@@ -1,12 +0,0 @@
1
- import { BreakpointObserver } from '@angular/cdk/layout';
2
- import { Signal } from '@angular/core';
3
- import * as i0 from "@angular/core";
4
- export declare class BreakpointService {
5
- private breakpointObserver;
6
- private _isHandset;
7
- get isHandset(): Signal<boolean>;
8
- constructor(breakpointObserver: BreakpointObserver);
9
- private handleBreakpoint;
10
- static ɵfac: i0.ɵɵFactoryDeclaration<BreakpointService, never>;
11
- static ɵprov: i0.ɵɵInjectableDeclaration<BreakpointService>;
12
- }
@@ -1 +0,0 @@
1
- export * from './breakpoint.service';
package/layout/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './breakpoint';
package/public-api.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export * from './analytics';
2
- export * from './layout';
3
- export * from './router';
package/router/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './router';
2
- export * from './route.interface';
3
- export * from './title-resolver';
4
- export * from './route.utils';
@@ -1,9 +0,0 @@
1
- import { Route } from '@angular/router';
2
- export type SdgRoutes = SdgRoute[];
3
- export interface SdgRoute extends Route {
4
- isHome?: boolean;
5
- description?: string;
6
- children?: SdgRoutes;
7
- /** Hidden in the primary tabs navigation and in the breadcrumbs */
8
- hidden?: boolean;
9
- }
@@ -1,2 +0,0 @@
1
- export declare function pathIsExternal(path: string): boolean;
2
- export declare function isSafeUrl(url: string): boolean;
@@ -1,5 +0,0 @@
1
- import { Route } from '@angular/router';
2
- import { TitleResolver } from './title-resolver/title-resolver';
3
- export declare const RouteTitleKey = "RouteTitle";
4
- export declare const RouteTranslateKey = "TranslateKey";
5
- export declare function resolveTitle(config: Route, titleResolver?: TitleResolver): string | undefined;
@@ -1,2 +0,0 @@
1
- export * from './title-resolver';
2
- export * from './title-resolver.pipe';
@@ -1,5 +0,0 @@
1
- import { ActivatedRouteSnapshot, MaybeAsync, Resolve, Route, RouterStateSnapshot } from '@angular/router';
2
- export declare abstract class TitleResolver<T = string> implements Resolve<T> {
3
- abstract resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<T>;
4
- abstract resolveStatic(route: Route): string | undefined;
5
- }
@@ -1,11 +0,0 @@
1
- import { PipeTransform } from '@angular/core';
2
- import { SdgRoute } from '../route.interface';
3
- import { TitleResolver } from './title-resolver';
4
- import * as i0 from "@angular/core";
5
- export declare class TitleResolverPipe implements PipeTransform {
6
- private titleResolver;
7
- constructor(titleResolver: TitleResolver);
8
- transform(value: SdgRoute): string | undefined;
9
- static ɵfac: i0.ɵɵFactoryDeclaration<TitleResolverPipe, [{ optional: true; }]>;
10
- static ɵpipe: i0.ɵɵPipeDeclaration<TitleResolverPipe, "titleResolver", true>;
11
- }