@pallasoft/ps-design-system 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/LICENSE +32 -0
- package/README.md +10 -0
- package/dist/constants/pallasoft-design-tokens.d.ts +34 -0
- package/dist/constants/pallasoft-design-tokens.js +40 -0
- package/dist/enums/pallasoft-animation-name.d.ts +5 -0
- package/dist/enums/pallasoft-animation-name.js +9 -0
- package/dist/enums/pallasoft-color-name.d.ts +10 -0
- package/dist/enums/pallasoft-color-name.js +14 -0
- package/dist/enums/pallasoft-font-family.d.ts +4 -0
- package/dist/enums/pallasoft-font-family.js +8 -0
- package/dist/enums/pallasoft-theme-mode.d.ts +5 -0
- package/dist/enums/pallasoft-theme-mode.js +9 -0
- package/dist/enums/pallasoft-viewport-tier.d.ts +5 -0
- package/dist/enums/pallasoft-viewport-tier.js +9 -0
- package/dist/enums/pallasoft-z-index.d.ts +12 -0
- package/dist/enums/pallasoft-z-index.js +16 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +27 -0
- package/dist/services/pallasoft-class-name-service.d.ts +3 -0
- package/dist/services/pallasoft-class-name-service.js +9 -0
- package/dist/services/pallasoft-theme-mode-service.d.ts +12 -0
- package/dist/services/pallasoft-theme-mode-service.js +49 -0
- package/dist/services/pallasoft-viewport-service.d.ts +8 -0
- package/dist/services/pallasoft-viewport-service.js +22 -0
- package/dist/styles.css +1424 -0
- package/dist/tailwind-preset.d.ts +2 -0
- package/dist/tailwind-preset.js +144 -0
- package/package.json +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Pallasoft Proprietary License
|
|
2
|
+
|
|
3
|
+
Version 1.0, 23-Jan-2024
|
|
4
|
+
|
|
5
|
+
1. Grant of License:
|
|
6
|
+
Pallasoft grants you a non-exclusive, non-transferable, revocable license to use the software, solely for internal business purposes.
|
|
7
|
+
|
|
8
|
+
2. Restrictions:
|
|
9
|
+
You may not:
|
|
10
|
+
a. Distribute or sublicense the software to third parties.
|
|
11
|
+
b. Reverse engineer, decompile, or disassemble the software.
|
|
12
|
+
c. Remove or alter any proprietary notices or labels on the software.
|
|
13
|
+
|
|
14
|
+
3. Ownership:
|
|
15
|
+
Pallasoft retains all right, title, and interest in and to the software, including all intellectual property rights.
|
|
16
|
+
|
|
17
|
+
4. Confidentiality:
|
|
18
|
+
You agree to keep the software confidential and not disclose it to third parties.
|
|
19
|
+
|
|
20
|
+
5. Support and Updates:
|
|
21
|
+
This license does not entitle you to support or updates. Pallasoft may, at its discretion, provide support and updates.
|
|
22
|
+
|
|
23
|
+
6. Termination:
|
|
24
|
+
This license is effective until terminated. Pallasoft may terminate the license at any time if you breach any terms. Upon termination, you must cease using the software.
|
|
25
|
+
|
|
26
|
+
7. Governing Law:
|
|
27
|
+
This license is governed by the Canadian Laws. Any disputes arising out of this license shall be resolved in the courts of Canada.
|
|
28
|
+
|
|
29
|
+
8. Contact Information:
|
|
30
|
+
For inquiries regarding this license, contact operations@pallasoft.com.
|
|
31
|
+
|
|
32
|
+
[End of License]
|
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# @pallasoft/ps-design-system
|
|
2
|
+
|
|
3
|
+
Shared Pallasoft design system package.
|
|
4
|
+
|
|
5
|
+
## Scripts
|
|
6
|
+
|
|
7
|
+
- `npm run build` compiles the package into `dist`.
|
|
8
|
+
- `npm run lint` runs ESLint using the shared package baseline.
|
|
9
|
+
- `npm run format:check` checks Prettier formatting.
|
|
10
|
+
- `npm run release` publishes through semantic-release.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const PallasoftColorTokens: {
|
|
2
|
+
readonly accent: "rgb(var(--ps-color-accent-rgb, 37 99 235) / <alpha-value>)";
|
|
3
|
+
readonly accentSoft: "rgb(var(--ps-color-accent-soft-rgb, 239 246 255) / <alpha-value>)";
|
|
4
|
+
readonly chart1: "rgb(var(--ps-chart-1-rgb, 71 85 105) / <alpha-value>)";
|
|
5
|
+
readonly chart2: "rgb(var(--ps-chart-2-rgb, 15 159 110) / <alpha-value>)";
|
|
6
|
+
readonly chart3: "rgb(var(--ps-chart-3-rgb, 37 99 235) / <alpha-value>)";
|
|
7
|
+
readonly chart4: "rgb(var(--ps-chart-4-rgb, 217 119 6) / <alpha-value>)";
|
|
8
|
+
readonly chart5: "rgb(var(--ps-chart-5-rgb, 124 58 237) / <alpha-value>)";
|
|
9
|
+
readonly danger: "rgb(var(--ps-color-danger-rgb, 220 38 38) / <alpha-value>)";
|
|
10
|
+
readonly dangerSoft: "rgb(var(--ps-color-danger-soft-rgb, 254 242 242) / <alpha-value>)";
|
|
11
|
+
readonly ink: "rgb(var(--ps-color-ink-rgb, 15 23 42) / <alpha-value>)";
|
|
12
|
+
readonly line: "rgb(var(--ps-color-line-rgb, 226 232 240) / <alpha-value>)";
|
|
13
|
+
readonly mist: "rgb(var(--ps-color-mist-rgb, 239 246 255) / <alpha-value>)";
|
|
14
|
+
readonly primary: "rgb(var(--ps-color-primary-rgb) / <alpha-value>)";
|
|
15
|
+
readonly primaryDark: "rgb(var(--ps-color-primary-dark-rgb) / <alpha-value>)";
|
|
16
|
+
readonly primarySoft: "rgb(var(--ps-color-primary-soft-rgb) / <alpha-value>)";
|
|
17
|
+
readonly secondary: "rgb(var(--ps-color-secondary-rgb) / <alpha-value>)";
|
|
18
|
+
readonly secondaryDark: "rgb(var(--ps-color-secondary-dark-rgb) / <alpha-value>)";
|
|
19
|
+
readonly secondarySoft: "rgb(var(--ps-color-secondary-soft-rgb) / <alpha-value>)";
|
|
20
|
+
readonly success: "rgb(var(--ps-color-success-rgb, 22 163 74) / <alpha-value>)";
|
|
21
|
+
readonly successSoft: "rgb(var(--ps-color-success-soft-rgb, 240 253 244) / <alpha-value>)";
|
|
22
|
+
readonly surface: "rgb(var(--ps-color-surface-rgb, 255 255 255) / <alpha-value>)";
|
|
23
|
+
readonly warning: "rgb(var(--ps-color-warning-rgb, 217 119 6) / <alpha-value>)";
|
|
24
|
+
readonly warningSoft: "rgb(var(--ps-color-warning-soft-rgb, 255 247 237) / <alpha-value>)";
|
|
25
|
+
};
|
|
26
|
+
export declare const PallasoftFontTokens: Record<string, string[]>;
|
|
27
|
+
export declare const PallasoftShadowTokens: {
|
|
28
|
+
readonly card: "none";
|
|
29
|
+
readonly floating: "none";
|
|
30
|
+
readonly glass: "none";
|
|
31
|
+
readonly interactive: "none";
|
|
32
|
+
readonly panel: "none";
|
|
33
|
+
readonly subtle: "none";
|
|
34
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PallasoftShadowTokens = exports.PallasoftFontTokens = exports.PallasoftColorTokens = void 0;
|
|
4
|
+
exports.PallasoftColorTokens = {
|
|
5
|
+
accent: 'rgb(var(--ps-color-accent-rgb, 37 99 235) / <alpha-value>)',
|
|
6
|
+
accentSoft: 'rgb(var(--ps-color-accent-soft-rgb, 239 246 255) / <alpha-value>)',
|
|
7
|
+
chart1: 'rgb(var(--ps-chart-1-rgb, 71 85 105) / <alpha-value>)',
|
|
8
|
+
chart2: 'rgb(var(--ps-chart-2-rgb, 15 159 110) / <alpha-value>)',
|
|
9
|
+
chart3: 'rgb(var(--ps-chart-3-rgb, 37 99 235) / <alpha-value>)',
|
|
10
|
+
chart4: 'rgb(var(--ps-chart-4-rgb, 217 119 6) / <alpha-value>)',
|
|
11
|
+
chart5: 'rgb(var(--ps-chart-5-rgb, 124 58 237) / <alpha-value>)',
|
|
12
|
+
danger: 'rgb(var(--ps-color-danger-rgb, 220 38 38) / <alpha-value>)',
|
|
13
|
+
dangerSoft: 'rgb(var(--ps-color-danger-soft-rgb, 254 242 242) / <alpha-value>)',
|
|
14
|
+
ink: 'rgb(var(--ps-color-ink-rgb, 15 23 42) / <alpha-value>)',
|
|
15
|
+
line: 'rgb(var(--ps-color-line-rgb, 226 232 240) / <alpha-value>)',
|
|
16
|
+
mist: 'rgb(var(--ps-color-mist-rgb, 239 246 255) / <alpha-value>)',
|
|
17
|
+
primary: 'rgb(var(--ps-color-primary-rgb) / <alpha-value>)',
|
|
18
|
+
primaryDark: 'rgb(var(--ps-color-primary-dark-rgb) / <alpha-value>)',
|
|
19
|
+
primarySoft: 'rgb(var(--ps-color-primary-soft-rgb) / <alpha-value>)',
|
|
20
|
+
secondary: 'rgb(var(--ps-color-secondary-rgb) / <alpha-value>)',
|
|
21
|
+
secondaryDark: 'rgb(var(--ps-color-secondary-dark-rgb) / <alpha-value>)',
|
|
22
|
+
secondarySoft: 'rgb(var(--ps-color-secondary-soft-rgb) / <alpha-value>)',
|
|
23
|
+
success: 'rgb(var(--ps-color-success-rgb, 22 163 74) / <alpha-value>)',
|
|
24
|
+
successSoft: 'rgb(var(--ps-color-success-soft-rgb, 240 253 244) / <alpha-value>)',
|
|
25
|
+
surface: 'rgb(var(--ps-color-surface-rgb, 255 255 255) / <alpha-value>)',
|
|
26
|
+
warning: 'rgb(var(--ps-color-warning-rgb, 217 119 6) / <alpha-value>)',
|
|
27
|
+
warningSoft: 'rgb(var(--ps-color-warning-soft-rgb, 255 247 237) / <alpha-value>)',
|
|
28
|
+
};
|
|
29
|
+
exports.PallasoftFontTokens = {
|
|
30
|
+
brand: ['Manrope', 'ui-sans-serif', 'system-ui'],
|
|
31
|
+
sans: ['Manrope', 'ui-sans-serif', 'system-ui'],
|
|
32
|
+
};
|
|
33
|
+
exports.PallasoftShadowTokens = {
|
|
34
|
+
card: 'none',
|
|
35
|
+
floating: 'none',
|
|
36
|
+
glass: 'none',
|
|
37
|
+
interactive: 'none',
|
|
38
|
+
panel: 'none',
|
|
39
|
+
subtle: 'none',
|
|
40
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PallasoftAnimationName = void 0;
|
|
4
|
+
var PallasoftAnimationName;
|
|
5
|
+
(function (PallasoftAnimationName) {
|
|
6
|
+
PallasoftAnimationName["FadeIn"] = "ps-fade-in";
|
|
7
|
+
PallasoftAnimationName["ScaleIn"] = "ps-scale-in";
|
|
8
|
+
PallasoftAnimationName["SlideUp"] = "ps-slide-up";
|
|
9
|
+
})(PallasoftAnimationName || (exports.PallasoftAnimationName = PallasoftAnimationName = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PallasoftColorName = void 0;
|
|
4
|
+
var PallasoftColorName;
|
|
5
|
+
(function (PallasoftColorName) {
|
|
6
|
+
PallasoftColorName["Danger"] = "danger";
|
|
7
|
+
PallasoftColorName["Ink"] = "ink";
|
|
8
|
+
PallasoftColorName["Line"] = "line";
|
|
9
|
+
PallasoftColorName["Mist"] = "mist";
|
|
10
|
+
PallasoftColorName["Primary"] = "primary";
|
|
11
|
+
PallasoftColorName["Success"] = "success";
|
|
12
|
+
PallasoftColorName["Surface"] = "surface";
|
|
13
|
+
PallasoftColorName["Warning"] = "warning";
|
|
14
|
+
})(PallasoftColorName || (exports.PallasoftColorName = PallasoftColorName = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PallasoftFontFamily = void 0;
|
|
4
|
+
var PallasoftFontFamily;
|
|
5
|
+
(function (PallasoftFontFamily) {
|
|
6
|
+
PallasoftFontFamily["Brand"] = "brand";
|
|
7
|
+
PallasoftFontFamily["Sans"] = "sans";
|
|
8
|
+
})(PallasoftFontFamily || (exports.PallasoftFontFamily = PallasoftFontFamily = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PallasoftThemeMode = void 0;
|
|
4
|
+
var PallasoftThemeMode;
|
|
5
|
+
(function (PallasoftThemeMode) {
|
|
6
|
+
PallasoftThemeMode["Dark"] = "dark";
|
|
7
|
+
PallasoftThemeMode["Light"] = "light";
|
|
8
|
+
PallasoftThemeMode["System"] = "system";
|
|
9
|
+
})(PallasoftThemeMode || (exports.PallasoftThemeMode = PallasoftThemeMode = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PallasoftViewportTier = void 0;
|
|
4
|
+
var PallasoftViewportTier;
|
|
5
|
+
(function (PallasoftViewportTier) {
|
|
6
|
+
PallasoftViewportTier["Mobile"] = "mobile";
|
|
7
|
+
PallasoftViewportTier["Tablet"] = "tablet";
|
|
8
|
+
PallasoftViewportTier["Desktop"] = "desktop";
|
|
9
|
+
})(PallasoftViewportTier || (exports.PallasoftViewportTier = PallasoftViewportTier = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PallasoftZIndex = void 0;
|
|
4
|
+
var PallasoftZIndex;
|
|
5
|
+
(function (PallasoftZIndex) {
|
|
6
|
+
PallasoftZIndex[PallasoftZIndex["Base"] = 0] = "Base";
|
|
7
|
+
PallasoftZIndex[PallasoftZIndex["Docked"] = 10] = "Docked";
|
|
8
|
+
PallasoftZIndex[PallasoftZIndex["Sticky"] = 30] = "Sticky";
|
|
9
|
+
PallasoftZIndex[PallasoftZIndex["Header"] = 40] = "Header";
|
|
10
|
+
PallasoftZIndex[PallasoftZIndex["Dropdown"] = 700] = "Dropdown";
|
|
11
|
+
PallasoftZIndex[PallasoftZIndex["Popover"] = 800] = "Popover";
|
|
12
|
+
PallasoftZIndex[PallasoftZIndex["Overlay"] = 900] = "Overlay";
|
|
13
|
+
PallasoftZIndex[PallasoftZIndex["Modal"] = 1000] = "Modal";
|
|
14
|
+
PallasoftZIndex[PallasoftZIndex["Toast"] = 1100] = "Toast";
|
|
15
|
+
PallasoftZIndex[PallasoftZIndex["TopLayer"] = 1200] = "TopLayer";
|
|
16
|
+
})(PallasoftZIndex || (exports.PallasoftZIndex = PallasoftZIndex = {}));
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './constants/pallasoft-design-tokens';
|
|
2
|
+
export * from './enums/pallasoft-animation-name';
|
|
3
|
+
export * from './enums/pallasoft-color-name';
|
|
4
|
+
export * from './enums/pallasoft-font-family';
|
|
5
|
+
export * from './enums/pallasoft-theme-mode';
|
|
6
|
+
export * from './enums/pallasoft-viewport-tier';
|
|
7
|
+
export * from './enums/pallasoft-z-index';
|
|
8
|
+
export * from './services/pallasoft-class-name-service';
|
|
9
|
+
export * from './services/pallasoft-theme-mode-service';
|
|
10
|
+
export * from './services/pallasoft-viewport-service';
|
|
11
|
+
export * from './tailwind-preset';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./constants/pallasoft-design-tokens"), exports);
|
|
18
|
+
__exportStar(require("./enums/pallasoft-animation-name"), exports);
|
|
19
|
+
__exportStar(require("./enums/pallasoft-color-name"), exports);
|
|
20
|
+
__exportStar(require("./enums/pallasoft-font-family"), exports);
|
|
21
|
+
__exportStar(require("./enums/pallasoft-theme-mode"), exports);
|
|
22
|
+
__exportStar(require("./enums/pallasoft-viewport-tier"), exports);
|
|
23
|
+
__exportStar(require("./enums/pallasoft-z-index"), exports);
|
|
24
|
+
__exportStar(require("./services/pallasoft-class-name-service"), exports);
|
|
25
|
+
__exportStar(require("./services/pallasoft-theme-mode-service"), exports);
|
|
26
|
+
__exportStar(require("./services/pallasoft-viewport-service"), exports);
|
|
27
|
+
__exportStar(require("./tailwind-preset"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PallasoftClassNameService = void 0;
|
|
4
|
+
class PallasoftClassNameService {
|
|
5
|
+
static merge(...classNames) {
|
|
6
|
+
return classNames.filter(Boolean).join(' ');
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.PallasoftClassNameService = PallasoftClassNameService;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PallasoftThemeMode } from '../enums/pallasoft-theme-mode';
|
|
2
|
+
export declare class PallasoftThemeModeService {
|
|
3
|
+
static getDefaultMode(): PallasoftThemeMode;
|
|
4
|
+
static getResolvedMode(mode: PallasoftThemeMode, prefersDarkMode: boolean): PallasoftThemeMode;
|
|
5
|
+
static getRootClassName(mode: PallasoftThemeMode, prefersDarkMode?: boolean): string;
|
|
6
|
+
static getStorageKey(): string;
|
|
7
|
+
static getStoredMode(storage?: Storage): PallasoftThemeMode;
|
|
8
|
+
static storeMode(mode: PallasoftThemeMode, storage?: Storage): void;
|
|
9
|
+
static applyModeToElement(element: HTMLElement, mode: PallasoftThemeMode, prefersDarkMode?: boolean): PallasoftThemeMode;
|
|
10
|
+
static getNextMode(mode: PallasoftThemeMode): PallasoftThemeMode;
|
|
11
|
+
static getInlineBootScript(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PallasoftThemeModeService = void 0;
|
|
4
|
+
const pallasoft_theme_mode_1 = require("../enums/pallasoft-theme-mode");
|
|
5
|
+
const storageKey = 'pallasoft-theme-mode';
|
|
6
|
+
const themeClassNames = ['ps-theme-light', 'ps-theme-dark'];
|
|
7
|
+
class PallasoftThemeModeService {
|
|
8
|
+
static getDefaultMode() {
|
|
9
|
+
return pallasoft_theme_mode_1.PallasoftThemeMode.System;
|
|
10
|
+
}
|
|
11
|
+
static getResolvedMode(mode, prefersDarkMode) {
|
|
12
|
+
if (mode === pallasoft_theme_mode_1.PallasoftThemeMode.System) {
|
|
13
|
+
return prefersDarkMode ? pallasoft_theme_mode_1.PallasoftThemeMode.Dark : pallasoft_theme_mode_1.PallasoftThemeMode.Light;
|
|
14
|
+
}
|
|
15
|
+
return mode;
|
|
16
|
+
}
|
|
17
|
+
static getRootClassName(mode, prefersDarkMode = false) {
|
|
18
|
+
const resolvedMode = this.getResolvedMode(mode, prefersDarkMode);
|
|
19
|
+
return resolvedMode === pallasoft_theme_mode_1.PallasoftThemeMode.Dark ? 'ps-theme-dark' : 'ps-theme-light';
|
|
20
|
+
}
|
|
21
|
+
static getStorageKey() {
|
|
22
|
+
return storageKey;
|
|
23
|
+
}
|
|
24
|
+
static getStoredMode(storage) {
|
|
25
|
+
const value = storage?.getItem(storageKey);
|
|
26
|
+
if (value === pallasoft_theme_mode_1.PallasoftThemeMode.Dark || value === pallasoft_theme_mode_1.PallasoftThemeMode.Light || value === pallasoft_theme_mode_1.PallasoftThemeMode.System) {
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
return this.getDefaultMode();
|
|
30
|
+
}
|
|
31
|
+
static storeMode(mode, storage) {
|
|
32
|
+
storage?.setItem(storageKey, mode);
|
|
33
|
+
}
|
|
34
|
+
static applyModeToElement(element, mode, prefersDarkMode = false) {
|
|
35
|
+
const resolvedMode = this.getResolvedMode(mode, prefersDarkMode);
|
|
36
|
+
element.classList.remove(...themeClassNames);
|
|
37
|
+
element.classList.add(this.getRootClassName(mode, prefersDarkMode));
|
|
38
|
+
element.dataset.psThemeMode = mode;
|
|
39
|
+
element.dataset.psResolvedThemeMode = resolvedMode;
|
|
40
|
+
return resolvedMode;
|
|
41
|
+
}
|
|
42
|
+
static getNextMode(mode) {
|
|
43
|
+
return mode === pallasoft_theme_mode_1.PallasoftThemeMode.Dark ? pallasoft_theme_mode_1.PallasoftThemeMode.Light : pallasoft_theme_mode_1.PallasoftThemeMode.Dark;
|
|
44
|
+
}
|
|
45
|
+
static getInlineBootScript() {
|
|
46
|
+
return `(function(){try{var k='${storageKey}';var m=localStorage.getItem(k);var d=window.matchMedia('(prefers-color-scheme: dark)').matches;var r=(m==='${pallasoft_theme_mode_1.PallasoftThemeMode.Dark}')?'${pallasoft_theme_mode_1.PallasoftThemeMode.Dark}':(m==='${pallasoft_theme_mode_1.PallasoftThemeMode.Light}')?'${pallasoft_theme_mode_1.PallasoftThemeMode.Light}':(d?'${pallasoft_theme_mode_1.PallasoftThemeMode.Dark}':'${pallasoft_theme_mode_1.PallasoftThemeMode.Light}');var el=document.documentElement;el.classList.remove('${themeClassNames[0]}','${themeClassNames[1]}');el.classList.add('ps-theme-'+r);el.dataset.psThemeMode=m||'${pallasoft_theme_mode_1.PallasoftThemeMode.System}';el.dataset.psResolvedThemeMode=r;}catch(e){}})();`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.PallasoftThemeModeService = PallasoftThemeModeService;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PallasoftViewportTier } from '../enums/pallasoft-viewport-tier';
|
|
2
|
+
export declare class PallasoftViewportService {
|
|
3
|
+
static readonly tabletMinWidth = 768;
|
|
4
|
+
static readonly desktopMinWidth = 1024;
|
|
5
|
+
static getTier(width: number): PallasoftViewportTier;
|
|
6
|
+
static getTabletQuery(): string;
|
|
7
|
+
static getDesktopQuery(): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PallasoftViewportService = void 0;
|
|
4
|
+
const pallasoft_viewport_tier_1 = require("../enums/pallasoft-viewport-tier");
|
|
5
|
+
class PallasoftViewportService {
|
|
6
|
+
static getTier(width) {
|
|
7
|
+
if (width >= this.desktopMinWidth)
|
|
8
|
+
return pallasoft_viewport_tier_1.PallasoftViewportTier.Desktop;
|
|
9
|
+
if (width >= this.tabletMinWidth)
|
|
10
|
+
return pallasoft_viewport_tier_1.PallasoftViewportTier.Tablet;
|
|
11
|
+
return pallasoft_viewport_tier_1.PallasoftViewportTier.Mobile;
|
|
12
|
+
}
|
|
13
|
+
static getTabletQuery() {
|
|
14
|
+
return `(min-width: ${this.tabletMinWidth}px) and (max-width: ${this.desktopMinWidth - 1}px)`;
|
|
15
|
+
}
|
|
16
|
+
static getDesktopQuery() {
|
|
17
|
+
return `(min-width: ${this.desktopMinWidth}px)`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.PallasoftViewportService = PallasoftViewportService;
|
|
21
|
+
PallasoftViewportService.tabletMinWidth = 768;
|
|
22
|
+
PallasoftViewportService.desktopMinWidth = 1024;
|