@claspo/common 6.0.13 → 6.0.14-theme.50
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/component-manifest/ComponentManifest.interface.d.ts +2 -0
- package/component-manifest/PropertyPaneManifest.interface.d.ts +19 -9
- package/component-manifest/PropertyPaneManifest.interface.js +1 -1
- package/document/Document.interface.d.ts +8 -0
- package/document/Document.interface.js +1 -1
- package/element/ThemeCssVars.d.ts +7 -0
- package/element/ThemeCssVars.js +1 -0
- package/package.json +1 -1
- package/theme/theme.utils.d.ts +7 -0
- package/theme/theme.utils.js +1 -0
|
@@ -37,6 +37,8 @@ export interface ComponentManifestI {
|
|
|
37
37
|
resourcesPropPaths?: string[][];
|
|
38
38
|
syncEnabled?: boolean;
|
|
39
39
|
stylesImitationEnabled?: boolean;
|
|
40
|
+
showComponentOptionsPropertyPaneOnInsert?: boolean;
|
|
41
|
+
showIntegrationFieldMappingPropertyPaneOnInsert?: boolean;
|
|
40
42
|
}
|
|
41
43
|
export declare enum ManifestMappingType {
|
|
42
44
|
TEXT = "TEXT",
|
|
@@ -23,17 +23,20 @@ export interface BasePropertyPaneManifestModelI {
|
|
|
23
23
|
disableControlIfPropPathMatchValue?: DisableControlIfPropPathMatchValueParamsI;
|
|
24
24
|
disableValidation?: boolean;
|
|
25
25
|
children?: BasePropertyPaneManifestModelI[];
|
|
26
|
-
|
|
26
|
+
valueTransformers?: ValueTransformerConfig[];
|
|
27
27
|
mode?: string;
|
|
28
28
|
}
|
|
29
29
|
export interface DisableControlIfPropPathMatchValueParamsI {
|
|
30
30
|
propPath: string[];
|
|
31
31
|
value: any;
|
|
32
32
|
}
|
|
33
|
-
export interface
|
|
34
|
-
name:
|
|
33
|
+
export interface ValueTransformerConfig<TParams = undefined> {
|
|
34
|
+
name: ValueTransformerName;
|
|
35
35
|
params?: TParams;
|
|
36
36
|
}
|
|
37
|
+
export declare enum ValueTransformerName {
|
|
38
|
+
PIXELS = "px"
|
|
39
|
+
}
|
|
37
40
|
export declare enum PropertyPaneManifestModelType {
|
|
38
41
|
CONTROL = "CONTROL",
|
|
39
42
|
TEXT = "TEXT",
|
|
@@ -98,7 +101,8 @@ export declare enum ClPropertyPaneManifestModelName {
|
|
|
98
101
|
FEEDBACK_TYPE = "FEEDBACK_TYPE",
|
|
99
102
|
FEEDBACK_ICONS_SELECT = "FEEDBACK_ICONS_SELECT",
|
|
100
103
|
FEEDBACK_ACTIONS = "FEEDBACK_ACTIONS",
|
|
101
|
-
FLOATING_BOX_POSITION = "FLOATING_BOX_POSITION"
|
|
104
|
+
FLOATING_BOX_POSITION = "FLOATING_BOX_POSITION",
|
|
105
|
+
WIDGET_THEME_SELECT = "WIDGET_THEME_SELECT"
|
|
102
106
|
}
|
|
103
107
|
export interface GroupPropertyPaneManifestModelI extends BasePropertyPaneManifestModelI {
|
|
104
108
|
children: BasePropertyPaneManifestModelI[];
|
|
@@ -110,16 +114,23 @@ export interface BorderPropertyPaneManifestParamsI {
|
|
|
110
114
|
minValue?: number;
|
|
111
115
|
maxValue?: number;
|
|
112
116
|
hideAdditionalParams?: boolean;
|
|
117
|
+
label?: string;
|
|
118
|
+
}
|
|
119
|
+
export interface BoxShadowPropertyPaneManifestModelI extends BasePropertyPaneManifestModelI {
|
|
120
|
+
params?: BoxShadowPropertyPaneManifestParamsI;
|
|
121
|
+
}
|
|
122
|
+
export interface BoxShadowPropertyPaneManifestParamsI {
|
|
123
|
+
label?: string;
|
|
113
124
|
}
|
|
114
125
|
export interface BackgroundPropertyPaneManifestModelI extends BasePropertyPaneManifestModelI {
|
|
115
126
|
params?: BackgroundPropertyPaneManifestParamsI;
|
|
116
127
|
}
|
|
117
128
|
export interface BackgroundPropertyPaneManifestParamsI {
|
|
118
|
-
label
|
|
119
|
-
onlyColorSelection
|
|
120
|
-
disableGradientSelection
|
|
129
|
+
label?: string;
|
|
130
|
+
onlyColorSelection?: boolean;
|
|
131
|
+
disableGradientSelection?: boolean;
|
|
121
132
|
hideSwitch?: boolean;
|
|
122
|
-
property
|
|
133
|
+
property?: string;
|
|
123
134
|
disabledColor?: string;
|
|
124
135
|
}
|
|
125
136
|
export interface TabPropertyPaneManifestModelI extends BasePropertyPaneManifestModelI {
|
|
@@ -206,7 +217,6 @@ export interface TextInputPropertyPaneManifestParamsI {
|
|
|
206
217
|
placeholder?: string;
|
|
207
218
|
validators?: BaseInputValidatorsI;
|
|
208
219
|
defaultValue?: any;
|
|
209
|
-
transformers?: TransformerConfig[];
|
|
210
220
|
}
|
|
211
221
|
export interface VideoUrlPropertyPaneManifestModelI extends BasePropertyPaneManifestModelI {
|
|
212
222
|
params: VideoUrlPropertyPaneManifestParamsI;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var PropertyPaneManifestModelType;!function(T){T.CONTROL="CONTROL",T.TEXT="TEXT",T.GROUP="GROUP"}(PropertyPaneManifestModelType||(PropertyPaneManifestModelType={}));export var ClPropertyPaneManifestModelName;!function(T){T.SIZE="SIZE",T.INDENTATION="INDENTATION",T.ALIGNMENT="ALIGNMENT",T.BACKGROUND="BACKGROUND",T.BACKDROP_FILTER="BACKDROP_FILTER",T.BACKGROUND_MARKER_SELECTED="BACKGROUND_MARKER_SELECTED",T.BORDERS="BORDERS",T.BOX_SHADOW="BOX_SHADOW",T.BORDER_RADIUS="BORDER_RADIUS",T.TEXT_PARAMS="TEXT_PARAMS",T.TEXT_INPUT="TEXT_INPUT",T.SWITCH="SWITCH",T.SWITCH_WITH_INPUT="SWITCH_WITH_INPUT",T.INPUT_VALIDATION="INPUT_VALIDATION",T.INPUT_LABEL="INPUT_LABEL",T.TEXT_COLOR="TEXT_COLOR",T.SELECT="SELECT",T.RADIO_BUTTONS="RADIO_BUTTONS",T.IMAGE_SOURCES="IMAGE_SOURCES",T.COUNTRY_PHONE_SELECT="COUNTRY_PHONE_SELECT",T.HOVER_ANIMATION="HOVER_ANIMATION",T.ACTIONS="ACTIONS",T.NPS_ACTIONS="NPS_ACTIONS",T.DATEPICKER="DATEPICKER",T.DATEPICKER_COUNTDOWN_TIMER="DATEPICKER_COUNTDOWN_TIMER",T.DISPLAY="DISPLAY",T.COMPONENT_OPTIONS="COMPONENT_OPTIONS",T.COLOR_SELECT="COLOR_SELECT",T.FLOATING_COMPONENT_POSITION="FLOATING_COMPONENT_POSITION",T.LOOP_ANIMATION="LOOP_ANIMATION",T.VIDEO_URL="VIDEO_URL",T.VIDEO_CUSTOM_COVER="VIDEO_CUSTOM_COVER",T.WIDGET_LAYOUT_SELECT="WIDGET_LAYOUT_SELECT",T.MULTIPLE_INPUT_SIZE="MULTIPLE_INPUT_SIZE",T.DATE_FORMAT="DATE_FORMAT",T.ICON="ICON",T.PROMOCODE_ICON="PROMOCODE_ICON",T.ICON_SELECT="ICON_SELECT",T.TEXT_VISIBILITY="TEXT_VISIBILITY",T.SLIDER_SETTINGS="SLIDER_SETTINGS",T.SLIDER_MANAGE_SLIDES="SLIDER_MANAGE_SLIDES",T.SLIDER_MODES="SLIDER_MODES",T.SLIDER_NAVIGATION_BUTTONS="SLIDER_NAVIGATION_BUTTONS",T.SLIDER_INDICATION="SLIDER_INDICATION",T.SLIDER_SLIDESHOW_ANIMATION="SLIDER_SLIDESHOW_ANIMATION",T.INTEGRATION_FIELD_MAPPING="INTEGRATION_FIELD_MAPPING",T.SUPPORTED_LANGUAGES="SUPPORTED_LANGUAGES",T.LIST_POSITION="LIST_POSITION",T.SOCIAL_ICON_SIZE="SOCIAL_ICON_SIZE",T.SOCIAL_TYPE_AND_ICON_SELECT="SOCIAL_TYPE_AND_ICON_SELECT",T.COLUMNS="COLUMNS",T.INSERT_BLOCK="INSERT_BLOCK",T.NUMBER_INPUT="NUMBER_INPUT",T.PRIZE_SETTINGS="PRIZE_SETTINGS",T.ROOT_COMPONENT_SELECT="ROOT_COMPONENT_SELECT",T.FEEDBACK_TYPE="FEEDBACK_TYPE",T.FEEDBACK_ICONS_SELECT="FEEDBACK_ICONS_SELECT",T.FEEDBACK_ACTIONS="FEEDBACK_ACTIONS",T.FLOATING_BOX_POSITION="FLOATING_BOX_POSITION"}(ClPropertyPaneManifestModelName||(ClPropertyPaneManifestModelName={}));export var TabPropertyPaneManifestType;!function(T){T.DESKTOP_STYLES="DESKTOP_STYLES",T.MOBILE_STYLES="MOBILE_STYLES"}(TabPropertyPaneManifestType||(TabPropertyPaneManifestType={}));export var TextPropertyPaneManifestParamsType;!function(T){T.SECONDARY="SECONDARY"}(TextPropertyPaneManifestParamsType||(TextPropertyPaneManifestParamsType={}));export var SizePropertyPaneOption;!function(T){T.FIXED="fixed",T.FILL="fill",T.HUG="hug"}(SizePropertyPaneOption||(SizePropertyPaneOption={}));export var IndentationPropertyPaneManifestType;!function(T){T.PADDING="PADDING",T.MARGIN="MARGIN"}(IndentationPropertyPaneManifestType||(IndentationPropertyPaneManifestType={}));
|
|
1
|
+
export var ValueTransformerName;!function(T){T.PIXELS="px"}(ValueTransformerName||(ValueTransformerName={}));export var PropertyPaneManifestModelType;!function(T){T.CONTROL="CONTROL",T.TEXT="TEXT",T.GROUP="GROUP"}(PropertyPaneManifestModelType||(PropertyPaneManifestModelType={}));export var ClPropertyPaneManifestModelName;!function(T){T.SIZE="SIZE",T.INDENTATION="INDENTATION",T.ALIGNMENT="ALIGNMENT",T.BACKGROUND="BACKGROUND",T.BACKDROP_FILTER="BACKDROP_FILTER",T.BACKGROUND_MARKER_SELECTED="BACKGROUND_MARKER_SELECTED",T.BORDERS="BORDERS",T.BOX_SHADOW="BOX_SHADOW",T.BORDER_RADIUS="BORDER_RADIUS",T.TEXT_PARAMS="TEXT_PARAMS",T.TEXT_INPUT="TEXT_INPUT",T.SWITCH="SWITCH",T.SWITCH_WITH_INPUT="SWITCH_WITH_INPUT",T.INPUT_VALIDATION="INPUT_VALIDATION",T.INPUT_LABEL="INPUT_LABEL",T.TEXT_COLOR="TEXT_COLOR",T.SELECT="SELECT",T.RADIO_BUTTONS="RADIO_BUTTONS",T.IMAGE_SOURCES="IMAGE_SOURCES",T.COUNTRY_PHONE_SELECT="COUNTRY_PHONE_SELECT",T.HOVER_ANIMATION="HOVER_ANIMATION",T.ACTIONS="ACTIONS",T.NPS_ACTIONS="NPS_ACTIONS",T.DATEPICKER="DATEPICKER",T.DATEPICKER_COUNTDOWN_TIMER="DATEPICKER_COUNTDOWN_TIMER",T.DISPLAY="DISPLAY",T.COMPONENT_OPTIONS="COMPONENT_OPTIONS",T.COLOR_SELECT="COLOR_SELECT",T.FLOATING_COMPONENT_POSITION="FLOATING_COMPONENT_POSITION",T.LOOP_ANIMATION="LOOP_ANIMATION",T.VIDEO_URL="VIDEO_URL",T.VIDEO_CUSTOM_COVER="VIDEO_CUSTOM_COVER",T.WIDGET_LAYOUT_SELECT="WIDGET_LAYOUT_SELECT",T.MULTIPLE_INPUT_SIZE="MULTIPLE_INPUT_SIZE",T.DATE_FORMAT="DATE_FORMAT",T.ICON="ICON",T.PROMOCODE_ICON="PROMOCODE_ICON",T.ICON_SELECT="ICON_SELECT",T.TEXT_VISIBILITY="TEXT_VISIBILITY",T.SLIDER_SETTINGS="SLIDER_SETTINGS",T.SLIDER_MANAGE_SLIDES="SLIDER_MANAGE_SLIDES",T.SLIDER_MODES="SLIDER_MODES",T.SLIDER_NAVIGATION_BUTTONS="SLIDER_NAVIGATION_BUTTONS",T.SLIDER_INDICATION="SLIDER_INDICATION",T.SLIDER_SLIDESHOW_ANIMATION="SLIDER_SLIDESHOW_ANIMATION",T.INTEGRATION_FIELD_MAPPING="INTEGRATION_FIELD_MAPPING",T.SUPPORTED_LANGUAGES="SUPPORTED_LANGUAGES",T.LIST_POSITION="LIST_POSITION",T.SOCIAL_ICON_SIZE="SOCIAL_ICON_SIZE",T.SOCIAL_TYPE_AND_ICON_SELECT="SOCIAL_TYPE_AND_ICON_SELECT",T.COLUMNS="COLUMNS",T.INSERT_BLOCK="INSERT_BLOCK",T.NUMBER_INPUT="NUMBER_INPUT",T.PRIZE_SETTINGS="PRIZE_SETTINGS",T.ROOT_COMPONENT_SELECT="ROOT_COMPONENT_SELECT",T.FEEDBACK_TYPE="FEEDBACK_TYPE",T.FEEDBACK_ICONS_SELECT="FEEDBACK_ICONS_SELECT",T.FEEDBACK_ACTIONS="FEEDBACK_ACTIONS",T.FLOATING_BOX_POSITION="FLOATING_BOX_POSITION",T.WIDGET_THEME_SELECT="WIDGET_THEME_SELECT"}(ClPropertyPaneManifestModelName||(ClPropertyPaneManifestModelName={}));export var TabPropertyPaneManifestType;!function(T){T.DESKTOP_STYLES="DESKTOP_STYLES",T.MOBILE_STYLES="MOBILE_STYLES"}(TabPropertyPaneManifestType||(TabPropertyPaneManifestType={}));export var TextPropertyPaneManifestParamsType;!function(T){T.SECONDARY="SECONDARY"}(TextPropertyPaneManifestParamsType||(TextPropertyPaneManifestParamsType={}));export var SizePropertyPaneOption;!function(T){T.FIXED="fixed",T.FILL="fill",T.HUG="hug"}(SizePropertyPaneOption||(SizePropertyPaneOption={}));export var IndentationPropertyPaneManifestType;!function(T){T.PADDING="PADDING",T.MARGIN="MARGIN"}(IndentationPropertyPaneManifestType||(IndentationPropertyPaneManifestType={}));
|
|
@@ -140,6 +140,13 @@ export interface ClDocumentShowWidgetActionParamsI {
|
|
|
140
140
|
export interface ClDocumentRequestActionParamsI extends ClDocumentSubscribeContactActionParamsI {
|
|
141
141
|
countAsTargetAction?: boolean;
|
|
142
142
|
}
|
|
143
|
+
export declare enum DefaultSchemaTokens {
|
|
144
|
+
ACCENT = "accent"
|
|
145
|
+
}
|
|
146
|
+
export type ThemeColorSchemaI = Record<string, string>;
|
|
147
|
+
export interface ThemeI {
|
|
148
|
+
schema: ThemeColorSchemaI;
|
|
149
|
+
}
|
|
143
150
|
export interface ClDocumentSharedI {
|
|
144
151
|
headerFontFamily: string;
|
|
145
152
|
textFontFamily: string;
|
|
@@ -158,6 +165,7 @@ export interface ClDocumentSharedI {
|
|
|
158
165
|
linkParams?: ClDocumentLinkParamsI;
|
|
159
166
|
mobileBreakpointWidth?: number;
|
|
160
167
|
zIndex?: number;
|
|
168
|
+
theme?: ThemeI;
|
|
161
169
|
}
|
|
162
170
|
export interface ClDialogParamsI {
|
|
163
171
|
background: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var ClComponentType;!function(T){T.VIEW="VIEW",T.CONTAINER="CONTAINER",T.TEXT="TEXT",T.INPUT="INPUT",T.BUTTON="BUTTON",T.IMAGE="IMAGE",T.CONSENT="CONSENT",T.COUNTDOWN_TIMER="COUNTDOWN_TIMER",T.PROMO_CODE="PROMO_CODE",T.MULTIPLE_INPUT="MULTIPLE_INPUT",T.VIDEO="VIDEO",T.SLIDER="SLIDER",T.SLIDE="SLIDE",T.SOCIAL="SOCIAL",T.COLUMNS="COLUMNS",T.COLUMN="COLUMN",T.PRIZE_BASED_GAMING="PRIZE_BASED_GAMING"}(ClComponentType||(ClComponentType={}));export var ClDocumentHandlerType;!function(T){T.CLICK="CLICK"}(ClDocumentHandlerType||(ClDocumentHandlerType={}));export var ClDocumentActionType;!function(T){T.SHOW_WIDGET="SHOW_WIDGET",T.OPEN_LINK="OPEN_LINK",T.SUBSCRIBE_CONTACT="SUBSCRIBE_CONTACT",T.REQUEST="REQUEST",T.CLOSE_WIDGET="CLOSE_WIDGET",T.GO_TO_VIEW="GO_TO_VIEW",T.GO_TO_PREVIOUS_VIEW="GO_TO_PREVIOUS_VIEW",T.GO_TO_NEXT_VIEW="GO_TO_NEXT_VIEW",T.CLICK="CLICK"}(ClDocumentActionType||(ClDocumentActionType={}));export var ClDocumentOpenLinkActionTarget;!function(T){T.SELF="_self",T.BLANK="_blank"}(ClDocumentOpenLinkActionTarget||(ClDocumentOpenLinkActionTarget={}));export var ClWidgetVerticalPosition;!function(T){T.TOP="TOP",T.CENTER="CENTER",T.BOTTOM="BOTTOM"}(ClWidgetVerticalPosition||(ClWidgetVerticalPosition={}));export var ClWidgetHorizontalPosition;!function(T){T.LEFT="LEFT",T.CENTER="CENTER",T.RIGHT="RIGHT"}(ClWidgetHorizontalPosition||(ClWidgetHorizontalPosition={}));export var ClLauncherEntryAnimationType;!function(T){T.SLIDE_TO_TOP="SLIDE_TO_TOP",T.SLIDE_TO_BOTTOM="SLIDE_TO_BOTTOM",T.SLIDE_TO_LEFT="SLIDE_TO_LEFT",T.SLIDE_TO_RIGHT="SLIDE_TO_RIGHT"}(ClLauncherEntryAnimationType||(ClLauncherEntryAnimationType={}));export var ClLoopAnimationType;!function(T){T.PULSE="PULSE",T.VIBRATE="VIBRATE",T.WOBBLE="WOBBLE",T.SHAKE="SHAKE",T.JELLO="JELLO",T.BOUNCE="BOUNCE",T.BLINK="BLINK",T.FLICKER="FLICKER",T.PING="PING"}(ClLoopAnimationType||(ClLoopAnimationType={}));export var ClCloseButtonHorizontalPosition;!function(T){T.LEFT="LEFT",T.RIGHT="RIGHT"}(ClCloseButtonHorizontalPosition||(ClCloseButtonHorizontalPosition={}));
|
|
1
|
+
export var ClComponentType;!function(T){T.VIEW="VIEW",T.CONTAINER="CONTAINER",T.TEXT="TEXT",T.INPUT="INPUT",T.BUTTON="BUTTON",T.IMAGE="IMAGE",T.CONSENT="CONSENT",T.COUNTDOWN_TIMER="COUNTDOWN_TIMER",T.PROMO_CODE="PROMO_CODE",T.MULTIPLE_INPUT="MULTIPLE_INPUT",T.VIDEO="VIDEO",T.SLIDER="SLIDER",T.SLIDE="SLIDE",T.SOCIAL="SOCIAL",T.COLUMNS="COLUMNS",T.COLUMN="COLUMN",T.PRIZE_BASED_GAMING="PRIZE_BASED_GAMING"}(ClComponentType||(ClComponentType={}));export var ClDocumentHandlerType;!function(T){T.CLICK="CLICK"}(ClDocumentHandlerType||(ClDocumentHandlerType={}));export var ClDocumentActionType;!function(T){T.SHOW_WIDGET="SHOW_WIDGET",T.OPEN_LINK="OPEN_LINK",T.SUBSCRIBE_CONTACT="SUBSCRIBE_CONTACT",T.REQUEST="REQUEST",T.CLOSE_WIDGET="CLOSE_WIDGET",T.GO_TO_VIEW="GO_TO_VIEW",T.GO_TO_PREVIOUS_VIEW="GO_TO_PREVIOUS_VIEW",T.GO_TO_NEXT_VIEW="GO_TO_NEXT_VIEW",T.CLICK="CLICK"}(ClDocumentActionType||(ClDocumentActionType={}));export var ClDocumentOpenLinkActionTarget;!function(T){T.SELF="_self",T.BLANK="_blank"}(ClDocumentOpenLinkActionTarget||(ClDocumentOpenLinkActionTarget={}));export var DefaultSchemaTokens;!function(T){T.ACCENT="accent"}(DefaultSchemaTokens||(DefaultSchemaTokens={}));export var ClWidgetVerticalPosition;!function(T){T.TOP="TOP",T.CENTER="CENTER",T.BOTTOM="BOTTOM"}(ClWidgetVerticalPosition||(ClWidgetVerticalPosition={}));export var ClWidgetHorizontalPosition;!function(T){T.LEFT="LEFT",T.CENTER="CENTER",T.RIGHT="RIGHT"}(ClWidgetHorizontalPosition||(ClWidgetHorizontalPosition={}));export var ClLauncherEntryAnimationType;!function(T){T.SLIDE_TO_TOP="SLIDE_TO_TOP",T.SLIDE_TO_BOTTOM="SLIDE_TO_BOTTOM",T.SLIDE_TO_LEFT="SLIDE_TO_LEFT",T.SLIDE_TO_RIGHT="SLIDE_TO_RIGHT"}(ClLauncherEntryAnimationType||(ClLauncherEntryAnimationType={}));export var ClLoopAnimationType;!function(T){T.PULSE="PULSE",T.VIBRATE="VIBRATE",T.WOBBLE="WOBBLE",T.SHAKE="SHAKE",T.JELLO="JELLO",T.BOUNCE="BOUNCE",T.BLINK="BLINK",T.FLICKER="FLICKER",T.PING="PING"}(ClLoopAnimationType||(ClLoopAnimationType={}));export var ClCloseButtonHorizontalPosition;!function(T){T.LEFT="LEFT",T.RIGHT="RIGHT"}(ClCloseButtonHorizontalPosition||(ClCloseButtonHorizontalPosition={}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import CssVarsOperations from "./CssVarsOperations";
|
|
2
|
+
export declare function prepareKeys(schema: any): {};
|
|
3
|
+
export default class ThemeCssVars extends CssVarsOperations {
|
|
4
|
+
static override(schema: {} | undefined, element: any): void;
|
|
5
|
+
static apply(schema: {} | undefined, element: any): void;
|
|
6
|
+
static get(varName: any, element: any): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{toCssVarToken}from"../theme/theme.utils";import CssVarsOperations from"./CssVarsOperations";function getRgbaColor(r){return(null==r?void 0:r.startsWith("rgb("))?r.replace("rgb(","rgba(").replace(")",", 1)"):r}function trim(r){return"#"==r.charAt(0)?r.substring(1,7):r}function convertToRGB(r){return[parseInt(trim(r).substring(0,2),16),parseInt(trim(r).substring(2,4),16),parseInt(trim(r).substring(4,6),16)]}function parseColorToRGB(r){if(!r)return[0,0,0,1];const t=r.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);if(t){return[parseInt(t[1],10),parseInt(t[2],10),parseInt(t[3],10),t[4]?parseFloat(t[4]):1]}if(r.startsWith("#")){const t=trim(r);if(3===t.length){return[parseInt(t[0]+t[0],16),parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),1]}if(6===t.length){const r=convertToRGB(t);return[r[0],r[1],r[2],1]}}return[0,0,0,1]}function generateGradientColors(r,t,e){if(!r||!t||e<=0)return[];const s=parseColorToRGB(r),o=parseColorToRGB(t),n=[];for(let r=0;r<e;r++){const t=r/(e-1||1),a=Math.round(s[0]+(o[0]-s[0])*t),i=Math.round(s[1]+(o[1]-s[1])*t),p=Math.round(s[2]+(o[2]-s[2])*t),u=void 0!==s[3]&&void 0!==o[3]?s[3]+(o[3]-s[3])*t:1;n.push(`rgba(${a}, ${i}, ${p}, ${u})`)}return n}export function prepareKeys(r){const t=Object.keys(r).reduce((t,e)=>(t[toCssVarToken(e)]=r[e],t),{}),e=getRgbaColor(r.text),s=generateGradientColors(getRgbaColor(r.background),e,18);return s.pop(),s.shift(),s.forEach((r,e)=>{t[toCssVarToken(`background-${e+1}`)]=r}),t}export default class ThemeCssVars extends CssVarsOperations{static override(r={},t){const e=prepareKeys(r);super.override(e,t)}static apply(r={},t){const e=prepareKeys(r);super.apply(e,t)}static get(r,t){const e=toCssVarToken(r);return super.get(e,t)}}
|
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ThemeI } from "../document/Document.interface";
|
|
2
|
+
export declare const THEME_CSS_VAR_PREFIX = "cl-schema-";
|
|
3
|
+
export declare function toCssVarToken(token: string): string;
|
|
4
|
+
export declare function formCssVarToSchemaToken(cssVar?: string): string;
|
|
5
|
+
export declare function extractRgbFromFallbackValue(value: string): string | null;
|
|
6
|
+
export declare function extractColor(value: string, theme?: ThemeI | null): string | null;
|
|
7
|
+
export declare function createTheme(schema?: Record<string, string>): ThemeI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{DefaultSchemaTokens}from"../document/Document.interface";export const THEME_CSS_VAR_PREFIX="cl-schema-";export function toCssVarToken(e){return`cl-schema-${e}`}export function formCssVarToSchemaToken(e=""){return e.replace(/var\(\s*(--[^,\s)]+).*\)/,"$1").replace("--cl-schema-","")}export function extractRgbFromFallbackValue(e){const r=String(e).match(/var\([^,]+,\s*(rgb(?:a)?\([^)]+\))\)/);return r&&r[1]?r[1]:null}export function extractColor(e,r){var t;const n=String(e||"");if(n.startsWith("var(")){if(!r)return null;const e=formCssVarToSchemaToken(n),a=null===(t=r.schema)||void 0===t?void 0:t[e];return a||(extractRgbFromFallbackValue(n)||null)}return n}export function createTheme(e={}){return 0===Object.keys(e).length&&(e={[DefaultSchemaTokens.ACCENT]:"#000000"}),{schema:Object.assign({},e)}}
|