@claspo/common 6.0.10 → 6.0.12-theme.33
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 +0 -1
- package/component-manifest/PropertyPaneManifest.interface.d.ts +2 -1
- package/component-manifest/PropertyPaneManifest.interface.js +1 -1
- package/document/Document.interface.d.ts +8 -1
- package/document/Document.interface.js +1 -1
- package/element/ThemeCssVars.d.ts +7 -0
- package/element/ThemeCssVars.js +1 -0
- package/package.json +4 -3
- package/theme/theme.utils.d.ts +7 -0
- package/theme/theme.utils.js +1 -0
|
@@ -17,7 +17,6 @@ export interface ComponentManifestI {
|
|
|
17
17
|
focusParentOnClick?: boolean;
|
|
18
18
|
preventDraggable?: boolean;
|
|
19
19
|
recursiveRemove?: boolean;
|
|
20
|
-
canStack?: boolean;
|
|
21
20
|
i18n?: ComponentManifestTranslationI;
|
|
22
21
|
children?: ClBaseComponentI[];
|
|
23
22
|
mappingTypes?: ManifestMappingType[];
|
|
@@ -98,7 +98,8 @@ export declare enum ClPropertyPaneManifestModelName {
|
|
|
98
98
|
FEEDBACK_TYPE = "FEEDBACK_TYPE",
|
|
99
99
|
FEEDBACK_ICONS_SELECT = "FEEDBACK_ICONS_SELECT",
|
|
100
100
|
FEEDBACK_ACTIONS = "FEEDBACK_ACTIONS",
|
|
101
|
-
FLOATING_BOX_POSITION = "FLOATING_BOX_POSITION"
|
|
101
|
+
FLOATING_BOX_POSITION = "FLOATING_BOX_POSITION",
|
|
102
|
+
WIDGET_THEME_SELECT = "WIDGET_THEME_SELECT"
|
|
102
103
|
}
|
|
103
104
|
export interface GroupPropertyPaneManifestModelI extends BasePropertyPaneManifestModelI {
|
|
104
105
|
children: BasePropertyPaneManifestModelI[];
|
|
@@ -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 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={}));
|
|
@@ -15,7 +15,6 @@ export interface ClBaseComponentI {
|
|
|
15
15
|
focusParentOnClick?: boolean;
|
|
16
16
|
preventDraggable?: boolean;
|
|
17
17
|
recursiveRemove?: boolean;
|
|
18
|
-
canStack?: boolean;
|
|
19
18
|
}
|
|
20
19
|
export declare enum ClComponentType {
|
|
21
20
|
VIEW = "VIEW",
|
|
@@ -141,6 +140,13 @@ export interface ClDocumentShowWidgetActionParamsI {
|
|
|
141
140
|
export interface ClDocumentRequestActionParamsI extends ClDocumentSubscribeContactActionParamsI {
|
|
142
141
|
countAsTargetAction?: boolean;
|
|
143
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
|
+
}
|
|
144
150
|
export interface ClDocumentSharedI {
|
|
145
151
|
headerFontFamily: string;
|
|
146
152
|
textFontFamily: string;
|
|
@@ -159,6 +165,7 @@ export interface ClDocumentSharedI {
|
|
|
159
165
|
linkParams?: ClDocumentLinkParamsI;
|
|
160
166
|
mobileBreakpointWidth?: number;
|
|
161
167
|
zIndex?: number;
|
|
168
|
+
theme?: ThemeI;
|
|
162
169
|
}
|
|
163
170
|
export interface ClDialogParamsI {
|
|
164
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
|
+
export function prepareKeys(schema: any): {};
|
|
2
|
+
export default class ThemeCssVars extends CssVarsOperations {
|
|
3
|
+
static override(schema: {} | undefined, element: any): void;
|
|
4
|
+
static apply(schema: {} | undefined, element: any): void;
|
|
5
|
+
static get(varName: any, element: any): string;
|
|
6
|
+
}
|
|
7
|
+
import CssVarsOperations from "./CssVarsOperations";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import CssVarsOperations from"./CssVarsOperations";function toCssVarToken(r){return`cl-schema-${r}`}function getRgbaColor(r){return(null==r?void 0:r.startsWith("rgb("))?r.replace("rgb(","rgba(").replace(")",", 1)"):r}function hex(r){var t="0123456789abcdef",e=parseInt(r);return 0==e||isNaN(r)?"00":(e=Math.round(Math.min(Math.max(0,e),255)),t.charAt((e-e%16)/16)+t.charAt(e%16))}function convertToHex(r){return hex(r[0])+hex(r[1])+hex(r[2])}function trim(r){return"#"==r.charAt(0)?r.substring(1,7):r}function convertToRGB(r){var t=[];return t[0]=parseInt(trim(r).substring(0,2),16),t[1]=parseInt(trim(r).substring(2,4),16),t[2]=parseInt(trim(r).substring(4,6),16),t}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 n=parseColorToRGB(r),s=parseColorToRGB(t),o=[];for(let r=0;r<e;r++){const t=r/(e-1||1),a=Math.round(n[0]+(s[0]-n[0])*t),i=Math.round(n[1]+(s[1]-n[1])*t),u=Math.round(n[2]+(s[2]-n[2])*t),c=void 0!==n[3]&&void 0!==s[3]?n[3]+(s[3]-n[3])*t:1;o.push(`rgba(${a}, ${i}, ${u}, ${c})`)}return o}export function prepareKeys(r){const t=Object.keys(r).reduce((t,e)=>(t[toCssVarToken(e)]=r[e],t),{}),e=getRgbaColor(r.text),n=generateGradientColors(getRgbaColor(r.background),e,18);return n.pop(),n.shift(),n.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claspo/common",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.12-theme.33",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"build:docs": "rm -rf ./docs && typedoc --options typedoc.md.json && npx concat-md --decrease-title-levels docs > docs/index.md && find docs -name '*.md' ! -name 'index.md' -delete",
|
|
25
25
|
"minify": "find out -name '*.js' ! -name '*.d.js' -exec terser {} --compress --mangle --output {} \\;",
|
|
26
26
|
"dev": " tsc --project tsconfig.json --watch",
|
|
27
|
-
"package": "npm i && npm run test && npm run build && npm run build:docs && cp package.json README.md LICENSE.md out && cd out && npm publish --access=public && cd .."
|
|
27
|
+
"package": "npm i && npm run test && npm run build && npm run build:docs && cp package.json README.md LICENSE.md out && cd out && npm publish --access=public && cd ..",
|
|
28
|
+
"sync:docs": "node ../../scripts/sync-docs.js --package=common"
|
|
28
29
|
},
|
|
29
30
|
"dependencies": {
|
|
30
31
|
"velocityjs": "2.0.6"
|
|
@@ -43,6 +44,6 @@
|
|
|
43
44
|
"typescript": "^5.8.2"
|
|
44
45
|
},
|
|
45
46
|
"author": "alex-chernysh",
|
|
46
|
-
"license": "",
|
|
47
|
+
"license": "LICENSE.md",
|
|
47
48
|
"homepage": "https://docs.claspo.io/docs/claspocommon"
|
|
48
49
|
}
|
|
@@ -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)}}
|