@claspo/common 6.0.0-theme.15 → 6.0.0-theme.17
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.
|
@@ -49,6 +49,9 @@ export interface ClDocumentActionI<T = any> {
|
|
|
49
49
|
type: string;
|
|
50
50
|
params?: T;
|
|
51
51
|
}
|
|
52
|
+
export declare enum DefaultSchemaTokens {
|
|
53
|
+
ACCENT = "accent"
|
|
54
|
+
}
|
|
52
55
|
export type ThemeColorSchemaI = Record<string, string>;
|
|
53
56
|
export interface ThemeI {
|
|
54
57
|
schema: ThemeColorSchemaI;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var ClWidgetVerticalPosition;!function(o){o.TOP="TOP",o.CENTER="CENTER",o.BOTTOM="BOTTOM"}(ClWidgetVerticalPosition||(ClWidgetVerticalPosition={}));export var ClWidgetHorizontalPosition;!function(o){o.LEFT="LEFT",o.CENTER="CENTER",o.RIGHT="RIGHT"}(ClWidgetHorizontalPosition||(ClWidgetHorizontalPosition={}));export var ClLauncherEntryAnimationType;!function(o){o.SLIDE_TO_TOP="SLIDE_TO_TOP",o.SLIDE_TO_BOTTOM="SLIDE_TO_BOTTOM",o.SLIDE_TO_LEFT="SLIDE_TO_LEFT",o.SLIDE_TO_RIGHT="SLIDE_TO_RIGHT"}(ClLauncherEntryAnimationType||(ClLauncherEntryAnimationType={}));export var ClLoopAnimationType;!function(o){o.PULSE="PULSE",o.VIBRATE="VIBRATE",o.WOBBLE="WOBBLE",o.SHAKE="SHAKE",o.JELLO="JELLO",o.BOUNCE="BOUNCE",o.BLINK="BLINK",o.FLICKER="FLICKER",o.PING="PING"}(ClLoopAnimationType||(ClLoopAnimationType={}));export var ClCloseButtonHorizontalPosition;!function(o){o.LEFT="LEFT",o.RIGHT="RIGHT"}(ClCloseButtonHorizontalPosition||(ClCloseButtonHorizontalPosition={}));
|
|
1
|
+
export var DefaultSchemaTokens;!function(o){o.ACCENT="accent"}(DefaultSchemaTokens||(DefaultSchemaTokens={}));export var ClWidgetVerticalPosition;!function(o){o.TOP="TOP",o.CENTER="CENTER",o.BOTTOM="BOTTOM"}(ClWidgetVerticalPosition||(ClWidgetVerticalPosition={}));export var ClWidgetHorizontalPosition;!function(o){o.LEFT="LEFT",o.CENTER="CENTER",o.RIGHT="RIGHT"}(ClWidgetHorizontalPosition||(ClWidgetHorizontalPosition={}));export var ClLauncherEntryAnimationType;!function(o){o.SLIDE_TO_TOP="SLIDE_TO_TOP",o.SLIDE_TO_BOTTOM="SLIDE_TO_BOTTOM",o.SLIDE_TO_LEFT="SLIDE_TO_LEFT",o.SLIDE_TO_RIGHT="SLIDE_TO_RIGHT"}(ClLauncherEntryAnimationType||(ClLauncherEntryAnimationType={}));export var ClLoopAnimationType;!function(o){o.PULSE="PULSE",o.VIBRATE="VIBRATE",o.WOBBLE="WOBBLE",o.SHAKE="SHAKE",o.JELLO="JELLO",o.BOUNCE="BOUNCE",o.BLINK="BLINK",o.FLICKER="FLICKER",o.PING="PING"}(ClLoopAnimationType||(ClLoopAnimationType={}));export var ClCloseButtonHorizontalPosition;!function(o){o.LEFT="LEFT",o.RIGHT="RIGHT"}(ClCloseButtonHorizontalPosition||(ClCloseButtonHorizontalPosition={}));
|
package/element/ThemeCssVars.js
CHANGED
|
@@ -1 +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}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)}}
|
|
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
|
@@ -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)}}
|