@engagently/types 2.6.0 → 2.7.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/common/_types/ConfigDefinition.d.ts +3 -2
- package/dist/common/_types/WidgetDefinitions.d.ts +1 -1
- package/dist/i18n/i18n.d.ts +10 -0
- package/dist/main/lib/engagently.d.ts +5 -1
- package/dist/ui/themes/config/_types.d.ts +40 -0
- package/dist/ui/themes/config/animation.d.ts +22 -0
- package/dist/ui/themes/config/breakpoints.d.ts +4 -0
- package/dist/ui/themes/config/components.d.ts +28 -0
- package/dist/ui/themes/config/index.d.ts +10 -0
- package/dist/ui/themes/config/levels.d.ts +9 -0
- package/dist/ui/themes/config/palette.d.ts +1 -2
- package/dist/ui/themes/config/shadows.d.ts +14 -0
- package/dist/ui/themes/config/shape.d.ts +5 -0
- package/dist/ui/themes/config/spacing.d.ts +6 -0
- package/dist/ui/themes/config/typography.d.ts +20 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { defaultResources } from '../../i18n/i18n';
|
|
2
2
|
import type { AvailableThemes, ColorSchemesConfig } from '../../ui/themes/_types';
|
|
3
|
-
import type { PaletteConfig } from '../../ui/themes/config';
|
|
3
|
+
import type { PaletteConfig, ThemeSettings } from '../../ui/themes/config';
|
|
4
4
|
import type { CombinedError, Operation } from '@urql/preact';
|
|
5
5
|
import type { EgyEntities, MessageEvents } from './WidgetDefinitions';
|
|
6
6
|
import type { DsmFeatureName, PlmFeatureName } from '../lib/api/enums';
|
|
@@ -10,7 +10,7 @@ export type CallbackFn = (data: {
|
|
|
10
10
|
payload?: unknown;
|
|
11
11
|
}) => void;
|
|
12
12
|
export type ErrorCallbackFn = (error: CombinedError, operation: Operation) => void;
|
|
13
|
-
export type EventHooks = 'onAny' | 'onChangeViewMode' | 'onLoadMoreComments' | 'onLoadMoreReplies';
|
|
13
|
+
export type EventHooks = 'onAny' | 'onChangeViewMode' | 'onLoadMoreComments' | 'onLoadMoreReplies' | 'onSetup';
|
|
14
14
|
export declare const EventHookMessageEventMap: Record<EventHooks, MessageEvents | MessageEvents[]>;
|
|
15
15
|
export type Translations = Record<string, DeepPartial<typeof defaultResources.en>>;
|
|
16
16
|
/**
|
|
@@ -23,6 +23,7 @@ export interface EngageConfig {
|
|
|
23
23
|
strategy?: string;
|
|
24
24
|
palette?: PaletteConfig;
|
|
25
25
|
theme?: `${AvailableThemes}`;
|
|
26
|
+
themeSettings?: Partial<ThemeSettings>;
|
|
26
27
|
defaultLanguage?: string;
|
|
27
28
|
translations?: Translations;
|
|
28
29
|
dev?: boolean;
|
|
@@ -94,7 +94,7 @@ export interface PollWidget {
|
|
|
94
94
|
/**
|
|
95
95
|
* Events that can be used by the pub/sub implementation for window.postMessage
|
|
96
96
|
*/
|
|
97
|
-
export type MessageEvents = 'EGY_SIGN_IN' | 'EGY_SIGN_OUT' | 'EGY_SIGNED_OUT' | 'EGY_AUTHENTICATED' | 'EGY_AUTHENTICATION_FAILED' | 'EGY_TOGGLE_COLOR_SCHEME' | 'EGY_CHANGE_LANGUAGE' | 'EGY_CHANGE_VIEW_MODE' | 'EGY_LOAD_MORE_COMMENTS' | 'EGY_LOAD_MORE_REPLIES' | 'EGY_REINIT';
|
|
97
|
+
export type MessageEvents = 'EGY_SETUP' | 'EGY_SIGN_IN' | 'EGY_SIGN_OUT' | 'EGY_SIGNED_OUT' | 'EGY_AUTHENTICATED' | 'EGY_AUTHENTICATION_FAILED' | 'EGY_TOGGLE_COLOR_SCHEME' | 'EGY_CHANGE_LANGUAGE' | 'EGY_CHANGE_VIEW_MODE' | 'EGY_LOAD_MORE_COMMENTS' | 'EGY_LOAD_MORE_REPLIES' | 'EGY_REINIT';
|
|
98
98
|
export declare const EGY_AUTH = "egy_auth";
|
|
99
99
|
export type EgyAuth = {
|
|
100
100
|
accessToken: string;
|
package/dist/i18n/i18n.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export declare const defaultResources: {
|
|
|
46
46
|
"load-more": string;
|
|
47
47
|
"load-newer-comments": string;
|
|
48
48
|
"load-older-comments": string;
|
|
49
|
+
"load-newer-replies": string;
|
|
50
|
+
"load-older-replies": string;
|
|
49
51
|
options: string;
|
|
50
52
|
reply: string;
|
|
51
53
|
"reply-do": string;
|
|
@@ -121,8 +123,11 @@ export declare const defaultResources: {
|
|
|
121
123
|
};
|
|
122
124
|
reactions: {
|
|
123
125
|
REACTION1: string;
|
|
126
|
+
REACTION1_zero: string;
|
|
124
127
|
REACTION2: string;
|
|
128
|
+
REACTION2_zero: string;
|
|
125
129
|
REACTION3: string;
|
|
130
|
+
REACTION3_zero: string;
|
|
126
131
|
};
|
|
127
132
|
"reply-as": string;
|
|
128
133
|
"reply-to": string;
|
|
@@ -279,6 +284,8 @@ export declare const defaultResources: {
|
|
|
279
284
|
"load-more": string;
|
|
280
285
|
"load-newer-comments": string;
|
|
281
286
|
"load-older-comments": string;
|
|
287
|
+
"load-newer-replies": string;
|
|
288
|
+
"load-older-replies": string;
|
|
282
289
|
options: string;
|
|
283
290
|
reply: string;
|
|
284
291
|
"reply-do": string;
|
|
@@ -354,8 +361,11 @@ export declare const defaultResources: {
|
|
|
354
361
|
};
|
|
355
362
|
reactions: {
|
|
356
363
|
REACTION1: string;
|
|
364
|
+
REACTION1_zero: string;
|
|
357
365
|
REACTION2: string;
|
|
366
|
+
REACTION2_zero: string;
|
|
358
367
|
REACTION3: string;
|
|
368
|
+
REACTION3_zero: string;
|
|
359
369
|
};
|
|
360
370
|
"reply-as": string;
|
|
361
371
|
"reply-to": string;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { CommunityConfig, EngageConfig, Translations } from '../../common/_types/ConfigDefinition';
|
|
2
2
|
import type { SignOutOptions } from '../../common/lib/api/session';
|
|
3
|
+
type SignInOptions = Partial<{
|
|
4
|
+
token: string | null;
|
|
5
|
+
}>;
|
|
3
6
|
export type Engagently = {
|
|
4
7
|
config?: EngageConfig;
|
|
5
8
|
communityConfig?: DeepPartial<CommunityConfig>;
|
|
6
9
|
changeLanguage: (languageCode: string) => void;
|
|
7
10
|
toggleColorScheme: (mode: 'auto' | 'dark' | 'light') => void;
|
|
8
|
-
signOut: (options?: SignOutOptions) => Promise<
|
|
11
|
+
signOut: (options?: SignOutOptions) => Promise<void>;
|
|
12
|
+
signIn: (options?: SignInOptions) => Promise<void>;
|
|
9
13
|
reinit: (config: Partial<EngageConfig>) => Promise<void>;
|
|
10
14
|
remoteTranslations?: Translations | null;
|
|
11
15
|
} & {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type emptyTheme from '../../themes/unstyled';
|
|
2
|
+
import type { ButtonSizes, ButtonVariants, ComponentColorScheme, ThemeAnimations, ThemeBreakpoints, ThemeLevels, ThemePalette, ThemeShadows, ThemeShape, ThemeSpacing, ThemeTypography } from '../../themes/config';
|
|
3
|
+
import type { ColorSchemesConfig } from '../../themes/_types';
|
|
4
|
+
/**
|
|
5
|
+
* Theme styles are custom styles that are different depending on the chosen
|
|
6
|
+
* theme. For example in theme-a the button could have a drop shadow, whereas
|
|
7
|
+
* in theme-b the button is flat.
|
|
8
|
+
*/
|
|
9
|
+
export type ThemeStyles = typeof emptyTheme;
|
|
10
|
+
/**
|
|
11
|
+
* Theme settings are general options to control the look and feel of the
|
|
12
|
+
* application. For example the avatar size, or the line thickness.
|
|
13
|
+
* This should allow for easy customization without having to change a bunch
|
|
14
|
+
* of styles.
|
|
15
|
+
*/
|
|
16
|
+
export type ThemeSettings = {
|
|
17
|
+
avatarSize: number;
|
|
18
|
+
buttonDiscussionFocusColor?: ComponentColorScheme;
|
|
19
|
+
buttonDiscussionFocusVariant: ButtonVariants;
|
|
20
|
+
buttonRepliesColor?: ComponentColorScheme;
|
|
21
|
+
buttonRepliesVariant: ButtonVariants;
|
|
22
|
+
lineThickness: number;
|
|
23
|
+
viewControlTabSize?: ButtonSizes;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Theme values is where colors, spacing and typography is defined, and can
|
|
27
|
+
* be customized by the user. The palette will change based on the mode.
|
|
28
|
+
*/
|
|
29
|
+
export type ThemeValues = {
|
|
30
|
+
animation: ThemeAnimations;
|
|
31
|
+
breakpoints: ThemeBreakpoints;
|
|
32
|
+
levels: ThemeLevels;
|
|
33
|
+
mode: `${ColorSchemesConfig.light}` | `${ColorSchemesConfig.dark}`;
|
|
34
|
+
palette: ThemePalette;
|
|
35
|
+
settings: ThemeSettings;
|
|
36
|
+
shadows: ThemeShadows;
|
|
37
|
+
shape: ThemeShape;
|
|
38
|
+
spacing: ThemeSpacing;
|
|
39
|
+
typography: ThemeTypography;
|
|
40
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CSSObject } from 'tss-react';
|
|
2
|
+
export type AnimationStyles = {
|
|
3
|
+
enter: CSSObject;
|
|
4
|
+
enterTo: CSSObject;
|
|
5
|
+
enterFrom: CSSObject;
|
|
6
|
+
leave: CSSObject;
|
|
7
|
+
leaveTo: CSSObject;
|
|
8
|
+
leaveFrom: CSSObject;
|
|
9
|
+
};
|
|
10
|
+
export type ThemeAnimations = {
|
|
11
|
+
durations: {
|
|
12
|
+
fast: string;
|
|
13
|
+
slow: string;
|
|
14
|
+
};
|
|
15
|
+
effects: {
|
|
16
|
+
bounce: string;
|
|
17
|
+
flash: (startBgColor: string, endBgColor: string) => string;
|
|
18
|
+
pulse: string;
|
|
19
|
+
spin: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const animation: ThemeAnimations;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SHARED ACROSS COMPONENTS
|
|
3
|
+
*/
|
|
4
|
+
export declare const COMPONENT_COLOR_SCHEME: readonly ["primary", "secondary", "error", "warning", "info", "success"];
|
|
5
|
+
export type ComponentColorScheme = (typeof COMPONENT_COLOR_SCHEME)[number];
|
|
6
|
+
export declare const TYPOGRAPHY_COLOR_SCHEME: readonly ["primary", "secondary", "hint"];
|
|
7
|
+
export type TypographyColorScheme = (typeof TYPOGRAPHY_COLOR_SCHEME)[number];
|
|
8
|
+
/**
|
|
9
|
+
* INDIVIDUAL COMPONENT VARIATIONS
|
|
10
|
+
*/
|
|
11
|
+
/** Button */
|
|
12
|
+
export declare const BUTTON_VARIANTS: readonly ["filled", "outlined", "ghost", "link"];
|
|
13
|
+
export declare const BUTTON_SIZES: readonly ["default", "compact", "large"];
|
|
14
|
+
export declare const ICON_BUTTON_VARIANTS: readonly ["filled", "outlined", "ghost"];
|
|
15
|
+
export type ButtonVariants = (typeof BUTTON_VARIANTS)[number];
|
|
16
|
+
export type ButtonSizes = (typeof BUTTON_SIZES)[number];
|
|
17
|
+
export type IconButtonVariants = (typeof ICON_BUTTON_VARIANTS)[number];
|
|
18
|
+
/** Chip */
|
|
19
|
+
export declare const CHIP_VARIANTS: readonly ["filled", "outlined"];
|
|
20
|
+
export type ChipVariants = (typeof CHIP_VARIANTS)[number];
|
|
21
|
+
/** Switch */
|
|
22
|
+
export declare const SWITCH_SIZES: readonly ["default", "compact"];
|
|
23
|
+
export declare const SWITCH_LABEL_POSITIONS: readonly ["left", "right"];
|
|
24
|
+
export type SwitchSizes = (typeof SWITCH_SIZES)[number];
|
|
25
|
+
export type SwitchLabelPositions = (typeof SWITCH_LABEL_POSITIONS)[number];
|
|
26
|
+
/** Typography */
|
|
27
|
+
export declare const TYPOGRAPHY_VARIANTS: readonly ["p", "h1", "h2", "h3", "h4", "h5", "span", "div"];
|
|
28
|
+
export type TypographyVariants = (typeof TYPOGRAPHY_VARIANTS)[number];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from './_types';
|
|
2
|
+
export * from './animation';
|
|
3
|
+
export * from './breakpoints';
|
|
4
|
+
export * from './components';
|
|
5
|
+
export * from './levels';
|
|
6
|
+
export * from './palette';
|
|
7
|
+
export * from './shadows';
|
|
8
|
+
export * from './shape';
|
|
9
|
+
export * from './spacing';
|
|
10
|
+
export * from './typography';
|
|
@@ -56,5 +56,4 @@ export type PaletteConfig = {
|
|
|
56
56
|
declare const generateDefaultPalette: () => Omit<ThemePalette, 'background' | 'text' | 'mode' | 'elements' | 'default'>;
|
|
57
57
|
declare const generatePaletteLight: () => ThemePalette;
|
|
58
58
|
declare const generatePaletteDark: () => ThemePalette;
|
|
59
|
-
|
|
60
|
-
export { generateDefaultPalette, generatePaletteDark, generatePaletteLight, mergePalette, };
|
|
59
|
+
export { generateDefaultPalette, generatePaletteDark, generatePaletteLight };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type IsNumberOrString<T> = T extends undefined ? string : number;
|
|
2
|
+
export type ThemeSpacing = typeof spacing;
|
|
3
|
+
declare const spacing: <T extends true | undefined = undefined>(space: number, options?: {
|
|
4
|
+
asNumber?: T | undefined;
|
|
5
|
+
} | undefined) => IsNumberOrString<T>;
|
|
6
|
+
export { spacing };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
type Typography = {
|
|
2
|
+
fontSize: string;
|
|
3
|
+
fontWeight: string;
|
|
4
|
+
};
|
|
5
|
+
export type ThemeTypography = {
|
|
6
|
+
alert: Typography;
|
|
7
|
+
body: Typography;
|
|
8
|
+
button: Typography;
|
|
9
|
+
caption: Typography;
|
|
10
|
+
chip: Typography;
|
|
11
|
+
fontFamily: string;
|
|
12
|
+
h1: Typography;
|
|
13
|
+
h2: Typography;
|
|
14
|
+
h3: Typography;
|
|
15
|
+
h4: Typography;
|
|
16
|
+
h5: Typography;
|
|
17
|
+
paragraph: Typography;
|
|
18
|
+
};
|
|
19
|
+
declare const typography: ThemeTypography;
|
|
20
|
+
export { typography };
|