@forcecalendar/interface 1.4.0 → 1.5.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/dist/force-calendar-interface.esm.js +66 -41
- package/dist/force-calendar-interface.esm.js.map +1 -1
- package/dist/force-calendar-interface.umd.js +16 -16
- package/dist/force-calendar-interface.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ForceCalendar.js +20 -2
- package/src/utils/StyleUtils.js +28 -0
- package/types/components/ForceCalendar.d.ts +6 -0
- package/types/utils/StyleUtils.d.ts +26 -0
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import { BaseComponent } from '../core/BaseComponent.js';
|
|
8
8
|
import StateManager from '../core/StateManager.js';
|
|
9
|
-
import { StyleUtils } from '../utils/StyleUtils.js';
|
|
9
|
+
import { StyleUtils, THEME_PRESETS } from '../utils/StyleUtils.js';
|
|
10
10
|
import { DateUtils } from '../utils/DateUtils.js';
|
|
11
11
|
import { DOMUtils } from '../utils/DOMUtils.js';
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@ export class ForceCalendar extends BaseComponent {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
static get observedAttributes() {
|
|
29
|
-
return ['view', 'date', 'locale', 'timezone', 'week-starts-on', 'height'];
|
|
29
|
+
return ['view', 'date', 'locale', 'timezone', 'week-starts-on', 'height', 'theme'];
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
constructor() {
|
|
@@ -801,7 +801,25 @@ export class ForceCalendar extends BaseComponent {
|
|
|
801
801
|
return '<div id="calendar-view-container"></div>';
|
|
802
802
|
}
|
|
803
803
|
|
|
804
|
+
/**
|
|
805
|
+
* Apply a named theme preset (e.g. theme="slds") as host-level custom
|
|
806
|
+
* properties so it cascades into the shadow DOM and stays overridable
|
|
807
|
+
* by page-level --fc-* variables.
|
|
808
|
+
*/
|
|
809
|
+
_applyTheme(name) {
|
|
810
|
+
const preset = THEME_PRESETS[name];
|
|
811
|
+
for (const token of Object.keys(THEME_PRESETS.slds)) {
|
|
812
|
+
if (preset && preset[token]) {
|
|
813
|
+
this.style.setProperty(token, preset[token]);
|
|
814
|
+
} else {
|
|
815
|
+
this.style.removeProperty(token);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
|
|
804
820
|
afterRender() {
|
|
821
|
+
this._applyTheme(this.getAttribute('theme'));
|
|
822
|
+
|
|
805
823
|
// Manually instantiate and mount view renderer (bypasses Locker Service)
|
|
806
824
|
const container = this.$('#calendar-view-container');
|
|
807
825
|
|
package/src/utils/StyleUtils.js
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
* StyleUtils - Styling utilities and theme management
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Named theme presets applied via the <forcecal-main theme="..."> attribute.
|
|
7
|
+
* Each maps design tokens to a platform's visual language.
|
|
8
|
+
*/
|
|
9
|
+
export const THEME_PRESETS = {
|
|
10
|
+
// Salesforce Lightning Design System: looks native on the platform
|
|
11
|
+
slds: {
|
|
12
|
+
'--fc-primary-color': '#0176d3',
|
|
13
|
+
'--fc-primary-hover': '#014486',
|
|
14
|
+
'--fc-primary-light': '#eef4ff',
|
|
15
|
+
'--fc-accent-color': '#0b5cab',
|
|
16
|
+
'--fc-text-color': '#181818',
|
|
17
|
+
'--fc-text-secondary': '#706e6b',
|
|
18
|
+
'--fc-text-light': '#939393',
|
|
19
|
+
'--fc-border-color': '#e5e5e5',
|
|
20
|
+
'--fc-border-color-hover': '#c9c9c9',
|
|
21
|
+
'--fc-background': '#ffffff',
|
|
22
|
+
'--fc-background-alt': '#f3f3f3',
|
|
23
|
+
'--fc-background-hover': '#f3f3f3',
|
|
24
|
+
'--fc-background-active': '#d8e6fe',
|
|
25
|
+
'--fc-danger-color': '#ea001e',
|
|
26
|
+
'--fc-success-color': '#2e844a',
|
|
27
|
+
'--fc-border-radius': '0.25rem',
|
|
28
|
+
'--fc-border-radius-sm': '0.125rem',
|
|
29
|
+
'--fc-font-family': "'Salesforce Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif"
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
5
33
|
export class StyleUtils {
|
|
6
34
|
/**
|
|
7
35
|
* Default theme colors
|
|
@@ -59,6 +59,12 @@ export declare class ForceCalendar extends BaseComponent {
|
|
|
59
59
|
getStyles(): string;
|
|
60
60
|
template(): string;
|
|
61
61
|
renderView(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Apply a named theme preset (e.g. theme="slds") as host-level custom
|
|
64
|
+
* properties so it cascades into the shadow DOM and stays overridable
|
|
65
|
+
* by page-level --fc-* variables.
|
|
66
|
+
*/
|
|
67
|
+
_applyTheme(name: any): void;
|
|
62
68
|
afterRender(): void;
|
|
63
69
|
handleNavigation(event: any): void;
|
|
64
70
|
handleViewChange(event: any): void;
|
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* StyleUtils - Styling utilities and theme management
|
|
3
3
|
*/
|
|
4
|
+
/**
|
|
5
|
+
* Named theme presets applied via the <forcecal-main theme="..."> attribute.
|
|
6
|
+
* Each maps design tokens to a platform's visual language.
|
|
7
|
+
*/
|
|
8
|
+
export declare const THEME_PRESETS: {
|
|
9
|
+
slds: {
|
|
10
|
+
'--fc-primary-color': string;
|
|
11
|
+
'--fc-primary-hover': string;
|
|
12
|
+
'--fc-primary-light': string;
|
|
13
|
+
'--fc-accent-color': string;
|
|
14
|
+
'--fc-text-color': string;
|
|
15
|
+
'--fc-text-secondary': string;
|
|
16
|
+
'--fc-text-light': string;
|
|
17
|
+
'--fc-border-color': string;
|
|
18
|
+
'--fc-border-color-hover': string;
|
|
19
|
+
'--fc-background': string;
|
|
20
|
+
'--fc-background-alt': string;
|
|
21
|
+
'--fc-background-hover': string;
|
|
22
|
+
'--fc-background-active': string;
|
|
23
|
+
'--fc-danger-color': string;
|
|
24
|
+
'--fc-success-color': string;
|
|
25
|
+
'--fc-border-radius': string;
|
|
26
|
+
'--fc-border-radius-sm': string;
|
|
27
|
+
'--fc-font-family': string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
4
30
|
export declare class StyleUtils {
|
|
5
31
|
/**
|
|
6
32
|
* Default theme colors
|