@claspo/common 6.0.3 → 6.0.4-theme.18

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.
@@ -12,6 +12,10 @@ export interface ClBaseComponentI {
12
12
  label?: string;
13
13
  children?: ClBaseComponentI[];
14
14
  componentRef?: any;
15
+ focusParentOnClick?: boolean;
16
+ preventDraggable?: boolean;
17
+ recursiveRemove?: boolean;
18
+ canStack?: boolean;
15
19
  }
16
20
  export declare enum ClComponentType {
17
21
  VIEW = "VIEW",
@@ -67,6 +71,13 @@ export interface ClDocumentHandlerI {
67
71
  export declare enum ClDocumentHandlerType {
68
72
  CLICK = "CLICK"
69
73
  }
74
+ export declare enum DefaultSchemaTokens {
75
+ ACCENT = "accent"
76
+ }
77
+ export type ThemeColorSchemaI = Record<string, string>;
78
+ export interface ThemeI {
79
+ schema: ThemeColorSchemaI;
80
+ }
70
81
  export interface ClDocumentActionI<T = any> {
71
82
  type: ClDocumentActionType;
72
83
  params?: T;
@@ -155,6 +166,7 @@ export interface ClDocumentSharedI {
155
166
  linkParams?: ClDocumentLinkParamsI;
156
167
  mobileBreakpointWidth?: number;
157
168
  zIndex?: number;
169
+ theme?: ThemeI;
158
170
  }
159
171
  export interface ClDialogParamsI {
160
172
  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 DefaultSchemaTokens;!function(T){T.ACCENT="accent"}(DefaultSchemaTokens||(DefaultSchemaTokens={}));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={}));
@@ -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",
3
+ "version": "6.0.4-theme.18",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -0,0 +1,4 @@
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 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 createTheme(e={}){return 0===Object.keys(e).length&&(e={[DefaultSchemaTokens.ACCENT]:"#000000"}),{schema:Object.assign({},e)}}