@pleodigital/design-system-votey 1.0.136 → 1.0.138
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 +46 -0
- package/dist/angular/fesm2022/pleodigital-design-system-votey-angular.mjs +128 -0
- package/dist/angular/fesm2022/pleodigital-design-system-votey-angular.mjs.map +1 -0
- package/dist/angular/types/pleodigital-design-system-votey-angular.d.ts +42 -0
- package/dist/css/tokens.angular.css +4453 -0
- package/dist/css/tokens.css +5 -2
- package/dist/css/tokens.tailwind.css +4 -0
- package/dist/scss/_variables_dark.scss +5 -2
- package/dist/scss/_variables_light.scss +5 -2
- package/package.json +48 -4
package/README.md
CHANGED
|
@@ -1,2 +1,48 @@
|
|
|
1
1
|
# design-system-votey
|
|
2
2
|
Repository for handling tokens (Votey app)
|
|
3
|
+
|
|
4
|
+
## Walidacja tokenów
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm run validate:tokens
|
|
8
|
+
npm run test:tokens
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`validate:tokens` sprawdza `tokens/base/colors.json` przed uruchomieniem Style Dictionary. Core colors muszą być nieprzezroczyste; validator odrzuca alpha HEX, `rgba()`/`hsla()`, `transparent`, `color-mix(... transparent)` oraz obiektowe kolory z alpha mniejszym niż `1`.
|
|
12
|
+
|
|
13
|
+
Build tokenów wymaga Node.js 22 lub nowszego. Pipeline używa Style Dictionary `5.5.0` oraz `@tokens-studio/sd-transforms` `2.0.3`:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run build:tokens
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
`npm run build:tokens` uruchamia walidację automatycznie przed zapisem plików do `dist`. Te same testy działają w CI dla zmian tokenów, skryptów walidacyjnych oraz merge requestów tworzonych przez workflow Tokens Studio.
|
|
20
|
+
|
|
21
|
+
## Font families
|
|
22
|
+
|
|
23
|
+
Foundation font families są zdefiniowane w `tokens/type/core/value.json`:
|
|
24
|
+
|
|
25
|
+
- `font-family.open-sans` — font produktu CRM;
|
|
26
|
+
- `font-family.satoshi` — font produktu PWA oraz interfejsu Storybooka.
|
|
27
|
+
|
|
28
|
+
Build Angular publikuje je jako `--font-family-open-sans` i `--font-family-satoshi`. Responsywne role `--typo-*` CRM wskazują na `--font-family-open-sans`. Storybook używa `--font-family-satoshi` globalnie. Istniejąca zmienna `--font-satoshi` w `votey-user-app` pozostaje bez zmian.
|
|
29
|
+
|
|
30
|
+
## Runtime Angulara
|
|
31
|
+
|
|
32
|
+
Kod Angulara jest publikowany przez osobne wejście, dzięki czemu nie trafia do aplikacji Reactowej:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { provideVoteyDeviceDetection } from "@pleodigital/design-system-votey/angular";
|
|
36
|
+
|
|
37
|
+
export const appConfig: ApplicationConfig = {
|
|
38
|
+
providers: [provideVoteyDeviceDetection()],
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Provider inicjalizuje `VoteyDeviceService`, reaguje na zmianę rozmiaru okna i ustawia na `body` atrybuty `data-device` oraz `data-orientation`. Ustawia również zmienną `--vh`. Atrybut `data-device` aktywuje reguły responsive z `dist/css/tokens.angular.css`.
|
|
43
|
+
|
|
44
|
+
Build wejścia Angulara:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm run build:angular
|
|
48
|
+
```
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, PLATFORM_ID, Injectable, provideEnvironmentInitializer } from '@angular/core';
|
|
4
|
+
import DeviceDetector from 'node-device-detector';
|
|
5
|
+
import { BehaviorSubject } from 'rxjs';
|
|
6
|
+
|
|
7
|
+
const DEFAULT_DIMENSIONS = {
|
|
8
|
+
width: 0,
|
|
9
|
+
height: 0,
|
|
10
|
+
mobileBreakpoint: 375,
|
|
11
|
+
tabletBreakpoint: 1024,
|
|
12
|
+
laptopBreakpoint: 1280,
|
|
13
|
+
desktopBreakpoint: 1920,
|
|
14
|
+
};
|
|
15
|
+
class VoteyDeviceService {
|
|
16
|
+
document = inject(DOCUMENT);
|
|
17
|
+
platformId = inject(PLATFORM_ID);
|
|
18
|
+
deviceTypeSubject = new BehaviorSubject(null);
|
|
19
|
+
dimensionsSubject = new BehaviorSubject(DEFAULT_DIMENSIONS);
|
|
20
|
+
initializedSubject = new BehaviorSubject(false);
|
|
21
|
+
listeningForResize = false;
|
|
22
|
+
deviceType$ = this.deviceTypeSubject.asObservable();
|
|
23
|
+
deviceDimensions$ = this.dimensionsSubject.asObservable();
|
|
24
|
+
initialized$ = this.initializedSubject.asObservable();
|
|
25
|
+
currentDevice = null;
|
|
26
|
+
deviceOrientation = "vertical";
|
|
27
|
+
isMobileDevice = false;
|
|
28
|
+
isTabletDevice = false;
|
|
29
|
+
isDesktopDevice = false;
|
|
30
|
+
handleResize = () => {
|
|
31
|
+
const browserWindow = this.document.defaultView;
|
|
32
|
+
if (browserWindow) {
|
|
33
|
+
this.update(browserWindow.innerWidth, browserWindow.innerHeight);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
initialize() {
|
|
37
|
+
if (!isPlatformBrowser(this.platformId)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const browserWindow = this.document.defaultView;
|
|
41
|
+
if (!browserWindow) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.update(browserWindow.innerWidth, browserWindow.innerHeight);
|
|
45
|
+
if (!this.listeningForResize) {
|
|
46
|
+
browserWindow.addEventListener("resize", this.handleResize, {
|
|
47
|
+
passive: true,
|
|
48
|
+
});
|
|
49
|
+
this.listeningForResize = true;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
update(innerWidth, innerHeight) {
|
|
53
|
+
const browserWindow = this.document.defaultView;
|
|
54
|
+
if (!browserWindow) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
this.dimensionsSubject.next({
|
|
58
|
+
...DEFAULT_DIMENSIONS,
|
|
59
|
+
width: innerWidth,
|
|
60
|
+
height: innerHeight,
|
|
61
|
+
});
|
|
62
|
+
this.deviceOrientation =
|
|
63
|
+
innerWidth > innerHeight ? "horizontal" : "vertical";
|
|
64
|
+
this.detectDevice(browserWindow.navigator);
|
|
65
|
+
this.applyDocumentState(innerHeight);
|
|
66
|
+
this.initializedSubject.next(true);
|
|
67
|
+
}
|
|
68
|
+
ngOnDestroy() {
|
|
69
|
+
const browserWindow = this.document.defaultView;
|
|
70
|
+
if (browserWindow && this.listeningForResize) {
|
|
71
|
+
browserWindow.removeEventListener("resize", this.handleResize);
|
|
72
|
+
this.listeningForResize = false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
detectDevice(browserNavigator) {
|
|
76
|
+
const detector = new DeviceDetector({
|
|
77
|
+
clientIndexes: true,
|
|
78
|
+
deviceIndexes: true,
|
|
79
|
+
osIndexes: true,
|
|
80
|
+
deviceAliasCode: false,
|
|
81
|
+
deviceTrusted: false,
|
|
82
|
+
deviceInfo: false,
|
|
83
|
+
maxUserAgentSize: 500,
|
|
84
|
+
});
|
|
85
|
+
const result = detector.detect(browserNavigator.userAgent);
|
|
86
|
+
const isTouchMac = result.device.type === "desktop" &&
|
|
87
|
+
browserNavigator.maxTouchPoints > 2 &&
|
|
88
|
+
/Macintosh/.test(browserNavigator.userAgent);
|
|
89
|
+
this.isMobileDevice =
|
|
90
|
+
result.device.type === "smartphone" ||
|
|
91
|
+
result.device.type === "phablet" ||
|
|
92
|
+
result.device.type === "feature phone";
|
|
93
|
+
this.isTabletDevice = result.device.type === "tablet" || isTouchMac;
|
|
94
|
+
this.isDesktopDevice = !this.isMobileDevice && !this.isTabletDevice;
|
|
95
|
+
this.currentDevice = this.isMobileDevice
|
|
96
|
+
? "mobile"
|
|
97
|
+
: this.isTabletDevice
|
|
98
|
+
? "tablet"
|
|
99
|
+
: "desktop";
|
|
100
|
+
}
|
|
101
|
+
applyDocumentState(innerHeight) {
|
|
102
|
+
if (!this.currentDevice) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this.deviceTypeSubject.next(this.currentDevice);
|
|
106
|
+
this.document.body.setAttribute("data-device", this.currentDevice);
|
|
107
|
+
this.document.body.setAttribute("data-orientation", this.deviceOrientation);
|
|
108
|
+
this.document.documentElement.style.setProperty("--vh", `${innerHeight / 100}px`);
|
|
109
|
+
}
|
|
110
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: VoteyDeviceService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
111
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: VoteyDeviceService, providedIn: "root" });
|
|
112
|
+
}
|
|
113
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: VoteyDeviceService, decorators: [{
|
|
114
|
+
type: Injectable,
|
|
115
|
+
args: [{
|
|
116
|
+
providedIn: "root",
|
|
117
|
+
}]
|
|
118
|
+
}] });
|
|
119
|
+
function provideVoteyDeviceDetection() {
|
|
120
|
+
return provideEnvironmentInitializer(() => inject(VoteyDeviceService).initialize());
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Generated bundle index. Do not edit.
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
export { VoteyDeviceService, provideVoteyDeviceDetection };
|
|
128
|
+
//# sourceMappingURL=pleodigital-design-system-votey-angular.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pleodigital-design-system-votey-angular.mjs","sources":["../../../angular/src/lib/votey-device.service.ts","../../../angular/src/pleodigital-design-system-votey-angular.ts"],"sourcesContent":["import { DOCUMENT, isPlatformBrowser } from \"@angular/common\";\nimport {\n EnvironmentProviders,\n inject,\n Injectable,\n OnDestroy,\n PLATFORM_ID,\n provideEnvironmentInitializer,\n} from \"@angular/core\";\nimport DeviceDetector from \"node-device-detector\";\nimport { BehaviorSubject, Observable } from \"rxjs\";\n\nexport type VoteyDevice = \"mobile\" | \"tablet\" | \"desktop\";\nexport type VoteyDeviceOrientation = \"vertical\" | \"horizontal\";\n\nexport interface VoteyDeviceDimensions {\n width: number;\n height: number;\n mobileBreakpoint: 375;\n tabletBreakpoint: 1024;\n laptopBreakpoint: 1280;\n desktopBreakpoint: 1920;\n}\n\nconst DEFAULT_DIMENSIONS: VoteyDeviceDimensions = {\n width: 0,\n height: 0,\n mobileBreakpoint: 375,\n tabletBreakpoint: 1024,\n laptopBreakpoint: 1280,\n desktopBreakpoint: 1920,\n};\n\n@Injectable({\n providedIn: \"root\",\n})\nexport class VoteyDeviceService implements OnDestroy {\n private readonly document: Document = inject(DOCUMENT);\n private readonly platformId: object = inject(PLATFORM_ID);\n private readonly deviceTypeSubject = new BehaviorSubject<VoteyDevice | null>(\n null,\n );\n private readonly dimensionsSubject =\n new BehaviorSubject<VoteyDeviceDimensions>(DEFAULT_DIMENSIONS);\n private readonly initializedSubject = new BehaviorSubject<boolean>(false);\n private listeningForResize = false;\n\n public readonly deviceType$: Observable<VoteyDevice | null> =\n this.deviceTypeSubject.asObservable();\n public readonly deviceDimensions$: Observable<VoteyDeviceDimensions> =\n this.dimensionsSubject.asObservable();\n public readonly initialized$: Observable<boolean> =\n this.initializedSubject.asObservable();\n\n public currentDevice: VoteyDevice | null = null;\n public deviceOrientation: VoteyDeviceOrientation = \"vertical\";\n public isMobileDevice = false;\n public isTabletDevice = false;\n public isDesktopDevice = false;\n\n private readonly handleResize = (): void => {\n const browserWindow = this.document.defaultView;\n\n if (browserWindow) {\n this.update(browserWindow.innerWidth, browserWindow.innerHeight);\n }\n };\n\n public initialize(): void {\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n\n const browserWindow = this.document.defaultView;\n\n if (!browserWindow) {\n return;\n }\n\n this.update(browserWindow.innerWidth, browserWindow.innerHeight);\n\n if (!this.listeningForResize) {\n browserWindow.addEventListener(\"resize\", this.handleResize, {\n passive: true,\n });\n this.listeningForResize = true;\n }\n }\n\n public update(innerWidth: number, innerHeight: number): void {\n const browserWindow = this.document.defaultView;\n\n if (!browserWindow) {\n return;\n }\n\n this.dimensionsSubject.next({\n ...DEFAULT_DIMENSIONS,\n width: innerWidth,\n height: innerHeight,\n });\n this.deviceOrientation =\n innerWidth > innerHeight ? \"horizontal\" : \"vertical\";\n\n this.detectDevice(browserWindow.navigator);\n this.applyDocumentState(innerHeight);\n this.initializedSubject.next(true);\n }\n\n public ngOnDestroy(): void {\n const browserWindow = this.document.defaultView;\n\n if (browserWindow && this.listeningForResize) {\n browserWindow.removeEventListener(\"resize\", this.handleResize);\n this.listeningForResize = false;\n }\n }\n\n private detectDevice(browserNavigator: Navigator): void {\n const detector = new DeviceDetector({\n clientIndexes: true,\n deviceIndexes: true,\n osIndexes: true,\n deviceAliasCode: false,\n deviceTrusted: false,\n deviceInfo: false,\n maxUserAgentSize: 500,\n });\n const result = detector.detect(browserNavigator.userAgent);\n const isTouchMac =\n result.device.type === \"desktop\" &&\n browserNavigator.maxTouchPoints > 2 &&\n /Macintosh/.test(browserNavigator.userAgent);\n\n this.isMobileDevice =\n result.device.type === \"smartphone\" ||\n result.device.type === \"phablet\" ||\n result.device.type === \"feature phone\";\n this.isTabletDevice = result.device.type === \"tablet\" || isTouchMac;\n this.isDesktopDevice = !this.isMobileDevice && !this.isTabletDevice;\n this.currentDevice = this.isMobileDevice\n ? \"mobile\"\n : this.isTabletDevice\n ? \"tablet\"\n : \"desktop\";\n }\n\n private applyDocumentState(innerHeight: number): void {\n if (!this.currentDevice) {\n return;\n }\n\n this.deviceTypeSubject.next(this.currentDevice);\n this.document.body.setAttribute(\"data-device\", this.currentDevice);\n this.document.body.setAttribute(\n \"data-orientation\",\n this.deviceOrientation,\n );\n this.document.documentElement.style.setProperty(\n \"--vh\",\n `${innerHeight / 100}px`,\n );\n }\n}\n\nexport function provideVoteyDeviceDetection(): EnvironmentProviders {\n return provideEnvironmentInitializer((): void =>\n inject(VoteyDeviceService).initialize(),\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAwBA,MAAM,kBAAkB,GAA0B;AAChD,IAAA,KAAK,EAAE,CAAC;AACR,IAAA,MAAM,EAAE,CAAC;AACT,IAAA,gBAAgB,EAAE,GAAG;AACrB,IAAA,gBAAgB,EAAE,IAAI;AACtB,IAAA,gBAAgB,EAAE,IAAI;AACtB,IAAA,iBAAiB,EAAE,IAAI;CACxB;MAKY,kBAAkB,CAAA;AACZ,IAAA,QAAQ,GAAa,MAAM,CAAC,QAAQ,CAAC;AACrC,IAAA,UAAU,GAAW,MAAM,CAAC,WAAW,CAAC;AACxC,IAAA,iBAAiB,GAAG,IAAI,eAAe,CACtD,IAAI,CACL;AACgB,IAAA,iBAAiB,GAChC,IAAI,eAAe,CAAwB,kBAAkB,CAAC;AAC/C,IAAA,kBAAkB,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC;IACjE,kBAAkB,GAAG,KAAK;AAElB,IAAA,WAAW,GACzB,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE;AACvB,IAAA,iBAAiB,GAC/B,IAAI,CAAC,iBAAiB,CAAC,YAAY,EAAE;AACvB,IAAA,YAAY,GAC1B,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE;IAEjC,aAAa,GAAuB,IAAI;IACxC,iBAAiB,GAA2B,UAAU;IACtD,cAAc,GAAG,KAAK;IACtB,cAAc,GAAG,KAAK;IACtB,eAAe,GAAG,KAAK;IAEb,YAAY,GAAG,MAAW;AACzC,QAAA,MAAM,aAAa,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW;QAE/C,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,EA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A;AAC5C,QAAA,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACvB;QACF;QAEA,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC;AAC/C,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC;AAClE,QAAA,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAC7B,kBAAkB,EAClB,IAAI,CAAC,iBAAiB,CACvB;AACD,QAAA,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,WAAW,CAC7C,MAAM,EACN,CAAA,EAAG,WAAW,GAAG,GAAG,CAAA,EAAA,CAAI,CACzB;IACH;wGA9HW,kBAAkB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAlB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kBAAkB,cAFjB,MAAM,EAAA,CAAA;;4FAEP,kBAAkB,EAAA,UAAA,EAAA,CAAA;kBAH9B,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE,MAAM;AACnB,iBAAA;;SAkIe,2BAA2B,GAAA;AACzC,IAAA,OAAO,6BAA6B,CAAC,MACnC,MAAM,CAAC,kBAAkB,CAAC,CAAC,UAAU,EAAE,CACxC;AACH;;ACzKA;;AAEG;;;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EnvironmentProviders, OnDestroy } from '@angular/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
type VoteyDevice = "mobile" | "tablet" | "desktop";
|
|
6
|
+
type VoteyDeviceOrientation = "vertical" | "horizontal";
|
|
7
|
+
interface VoteyDeviceDimensions {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
mobileBreakpoint: 375;
|
|
11
|
+
tabletBreakpoint: 1024;
|
|
12
|
+
laptopBreakpoint: 1280;
|
|
13
|
+
desktopBreakpoint: 1920;
|
|
14
|
+
}
|
|
15
|
+
declare class VoteyDeviceService implements OnDestroy {
|
|
16
|
+
private readonly document;
|
|
17
|
+
private readonly platformId;
|
|
18
|
+
private readonly deviceTypeSubject;
|
|
19
|
+
private readonly dimensionsSubject;
|
|
20
|
+
private readonly initializedSubject;
|
|
21
|
+
private listeningForResize;
|
|
22
|
+
readonly deviceType$: Observable<VoteyDevice | null>;
|
|
23
|
+
readonly deviceDimensions$: Observable<VoteyDeviceDimensions>;
|
|
24
|
+
readonly initialized$: Observable<boolean>;
|
|
25
|
+
currentDevice: VoteyDevice | null;
|
|
26
|
+
deviceOrientation: VoteyDeviceOrientation;
|
|
27
|
+
isMobileDevice: boolean;
|
|
28
|
+
isTabletDevice: boolean;
|
|
29
|
+
isDesktopDevice: boolean;
|
|
30
|
+
private readonly handleResize;
|
|
31
|
+
initialize(): void;
|
|
32
|
+
update(innerWidth: number, innerHeight: number): void;
|
|
33
|
+
ngOnDestroy(): void;
|
|
34
|
+
private detectDevice;
|
|
35
|
+
private applyDocumentState;
|
|
36
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<VoteyDeviceService, never>;
|
|
37
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<VoteyDeviceService>;
|
|
38
|
+
}
|
|
39
|
+
declare function provideVoteyDeviceDetection(): EnvironmentProviders;
|
|
40
|
+
|
|
41
|
+
export { VoteyDeviceService, provideVoteyDeviceDetection };
|
|
42
|
+
export type { VoteyDevice, VoteyDeviceDimensions, VoteyDeviceOrientation };
|