Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ricos-common

Package Overview
Dependencies
Maintainers
1
Versions
1014
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ricos-common - npm Package Compare versions

Comparing version 7.11.1-alpha.3 to 7.11.1-alpha.4

2

dist/cjs/index.js

@@ -1,2 +0,2 @@

"use strict";function _interopDefault(ex){return ex&&"object"==typeof ex&&"default"in ex?ex.default:ex}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),lodash=require("lodash"),jss=require("jss"),jss__default=_interopDefault(jss),preset=_interopDefault(require("jss-preset-default")),extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};var __assign=function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};function __awaiter(thisArg,_arguments,P,generator){return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P((function(resolve){resolve(value)}))).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))}function __generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}function getBrightness(hexCode){var _hexCode=hexCode.replace("#","");return(299*parseInt(_hexCode.substr(0,2),16)+587*parseInt(_hexCode.substr(2,2),16)+114*parseInt(_hexCode.substr(4,2),16))/1e3}function adaptForeground(actionColor){return getBrightness(actionColor)<140?actionColor:"#000000"}function hexToRgbA(hexColor,opacity){var c;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hexColor))return 3===(c=hexColor.substring(1).split("")).length&&(c=[c[0],c[0],c[1],c[1],c[2],c[2]]),"rgba("+[(c="0x"+c.join(""))>>16&255,c>>8&255,255&c].join(",")+","+(opacity||1)+")";throw new Error("Bad Hex")}var utils=Object.freeze({__proto__:null,fallbackColor:"#000000",fallbackColorBright:"#ffffff",isBright:function(hexColor){return getBrightness(hexColor)>140},adaptForeground:adaptForeground,hexToRgbA:hexToRgbA}),TemplateExample=[{name:"color_1",reference:"white/black"},{name:"color_2",reference:"black/white"},{name:"color_3",reference:"primery-1"},{name:"color_4",reference:"primery-2"},{name:"color_5",reference:"primery-3"},{name:"color_11",reference:"color-1"},{name:"color_12",reference:"color-2"},{name:"color_13",reference:"color-3"},{name:"color_14",reference:"color-4"},{name:"color_15",reference:"color-5"},{name:"color_16",reference:"color-6"},{name:"color_17",reference:"color-7"},{name:"color_18",reference:"color-8"},{name:"color_19",reference:"color-9"},{name:"color_20",reference:"color-10"},{name:"color_21",reference:"color-11"},{name:"color_22",reference:"color-12"},{name:"color_23",reference:"color-13"},{name:"color_24",reference:"color-14"},{name:"color_25",reference:"color-15"},{name:"color_26",reference:"color-16"},{name:"color_27",reference:"color-17"},{name:"color_28",reference:"color-18"},{name:"color_29",reference:"color-19"},{name:"color_30",reference:"color-20"},{name:"color_31",reference:"color-21"},{name:"color_32",reference:"color-22"},{name:"color_33",reference:"color-23"},{name:"color_34",reference:"color-24"},{name:"color_35",reference:"color-25"}],themes={darkTheme:["#FFFFFF","#000000","#ED1C24","#0088CB","#FFCB05","#000000","#616161","#8C8C8C","#F3F3F3","#FFFFFF","#074B54","#0E95A7","#15E0FB","#89EFFC","#D9FBFF","#071F4E","#0E3E9B","#155DE9","#83A8F0","#ADC6F8","#221333","#442565","#663898","#9C7FBA","#C4AEDD","#27331B","#4E6636","#749851","#9BCB6C","#CAE5AF"]};var palettes=Object.keys(themes).reduce((function(acc,curr){var _a;return __assign(__assign({},acc),((_a={})[curr]=function(preset){return preset.map((function(color,i){return __assign(__assign({},TemplateExample[i]),{value:color})}))}(themes[curr]),_a))}),{}),COLORS={BG_COLOR:11,SECONDARY_COLOR:13,COLOR4:14,TEXT_COLOR:15,COLOR7:17,ACTION_COLOR:18};function commonStyles(colors){return{editor:{background:colors.bgColor,color:colors.textColor}}}var rawCss,prevPalette,paletteClasses,PALETTE_PRESETS={darkTheme:palettes.darkTheme},getColorValue=function(palette,code){return function(palette,code){return palette[code<=5?code-1:code-6]}(palette,code).value},ThemeGenerator=function(){function ThemeGenerator(isViewer,palette,themeGeneratorFunctions){void 0===themeGeneratorFunctions&&(themeGeneratorFunctions=[]),this.setPalette(palette),this.themeGeneratorFunctions=themeGeneratorFunctions,this.isViewer=isViewer}return ThemeGenerator.prototype.setPalette=function(palette){if("string"==typeof palette){if(!(palette in PALETTE_PRESETS))throw Error("Palette "+palette+" is unknown. Supported themes: "+PALETTE_PRESETS.toString());this.palette=PALETTE_PRESETS[palette]}else!function(palette){if(palette){if(0===palette.length)throw Error("Received empty palette colors array");var receivedColors=palette.map((function(val){return val.name})),missingColors=lodash.difference(Object.values(COLORS).map((function(num){return"color_"+num})),receivedColors);if(missingColors.length>0){var error=[];throw error.push("Some palette colors were not supplied:","\n"+missingColors+"\n","Palette array must include the following colors:",Object.entries(COLORS).map((function(entry){return entry[1]+" - "+entry[0]})).toString().split(",").join("\n"),""),Error(error.join("\n"))}}}(palette),this.palette=palette},ThemeGenerator.prototype.getStylesObject=function(){if(!this.palette)return{};var colors={actionColor:getColorValue(this.palette,COLORS.ACTION_COLOR),bgColor:getColorValue(this.palette,COLORS.BG_COLOR),textColor:getColorValue(this.palette,COLORS.TEXT_COLOR),secondaryColor:getColorValue(this.palette,COLORS.SECONDARY_COLOR),color7:hexToRgbA(getColorValue(this.palette,COLORS.COLOR7),.7),color4:getColorValue(this.palette,COLORS.COLOR4)},pluginThemes=this.themeGeneratorFunctions.map((function(themeGen){return themeGen(colors,utils)})),appStyles=this.isViewer?function(colors){var actionColor=colors.actionColor;return{quote:{"border-left-color":actionColor,"border-right-color":actionColor}}}(colors):lodash.merge(function(colors){var actionColor=adaptForeground(colors.actionColor),blockActionColorSettings={cursor:"default",boxShadow:"0 0 0 3px "+colors.actionColor},toolbarButtonStyle={color:actionColor,fill:actionColor},sliderTrack={background:actionColor},thumb=__assign(__assign({},sliderTrack),{border:"4px solid "+actionColor}),buttonsFooterStyle={"& $button_primary":{backgroundColor:actionColor},"& $button_primary:hover:not([disabled])":{backgroundColor:hexToRgbA(actionColor,.8)},"& $button_primary:disabled":{backgroundColor:"rgba(0, 0, 0, 0.4)"},"& $button_secondary":{color:actionColor,borderColor:actionColor},"& $button_secondary:hover":{color:hexToRgbA(actionColor,.6),borderColor:hexToRgbA(actionColor,.6)},"& $button_secondary:disabled":{backgroundColor:"rgba(0, 0, 0, 0.4)"}};return{hasFocus:blockActionColorSettings,pluginContainer:{},pluginContainerWrapper:{"&$pluginContainer:hover":blockActionColorSettings,"&$pluginContainer&$hasFocus":blockActionColorSettings},selectionList:{"& $selectionListOption:hover":{backgroundColor:hexToRgbA(actionColor,.05)},"& $selectionListOption$selectionListOption_selected":{color:actionColor,backgroundColor:hexToRgbA(actionColor,.1)},"& $selectionListOption_selected$selectionListOption:hover":{backgroundColor:hexToRgbA(actionColor,.1)}},selectionListOption:{},selectionListOption_selected:{},checkbox_wrapper:{"& $checkbox_icon":{border:"solid 1px "+actionColor},"& $checkbox_icon:hover":{color:hexToRgbA(actionColor,.1)},"& $checkbox_infoIcon:hover":{color:actionColor},"& $checkbox_inputLabel:hover $checkbox_icon_unchecked":{backgroundColor:hexToRgbA(actionColor,.1)},"& $checkbox_icon_checked":{backgroundColor:actionColor}},checkbox_icon:{},checkbox_infoIcon:{},checkbox_icon_checked:{},checkbox_inputLabel:{},checkbox_icon_unchecked:{},tabs_panel:{},tabs:{"& $tabs_panel":{padding:"24px 24px 30px"}},tabs_headers_option_selected:{},tabs_headers:{"& $tabs_headers_option_selected":{borderBottom:"solid 3px "+actionColor}},button_primary:{},button_secondary:{},settingsPanel_footer_fixed:buttonsFooterStyle,button_inputModal_modal_footer:buttonsFooterStyle,video_modal_container_big:buttonsFooterStyle,video_modal_container_small:buttonsFooterStyle,sliderWithInput_content:{"& $slider::-webkit-slider-runnable-track":sliderTrack,"& $slider::-webkit-slider-thumb":thumb},slider:{},radioGroup_button:{},radioGroup_input:{},radioGroup:{"& $radioGroup_input:checked + $radioGroup_button::after":{backgroundColor:actionColor}},colorPicker_add_color_button:{"& $colorPicker_add_color_label":{color:actionColor}},colorPicker_add_color_label:{},colorPicker_reset_color_button:{"& $colorPicker_reset_color_label":{color:actionColor}},colorPicker_reset_color_label:{},buttonsWrapper:{"& $buttonWrapper:hover button:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:focus button:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:hover label:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:focus label:not([disabled]) svg":toolbarButtonStyle},buttonWrapper:{"& $pluginToolbarButton:not($pluginToolbarButton_disabled)$pluginToolbarButton_active":toolbarButtonStyle,"& $pluginToolbarButton:not($pluginToolbarButton_disabled):focus svg":toolbarButtonStyle,"& $pluginToolbarButton:not($pluginToolbarButton_disabled):hover":toolbarButtonStyle},inlineToolbarButton_active:{color:actionColor},inlineToolbarButton_icon:{"&:hover":{color:actionColor,"& svg":{fill:actionColor}}},inlineToolbarButton_wrapper:{"& $inlineToolbarButton_icon:hover":{color:actionColor},"& $inlineToolbarButton_icon:hover svg":{fill:actionColor}},pluginToolbarButton_disabled:{},pluginToolbarButton_active:{},pluginToolbarButton:{"&:not($pluginToolbarButton_disabled):hover >:not($Dropdown-root) svg":{fill:actionColor}},"Dropdown-control":{},"Dropdown-option":{},"Dropdown-root":{"& $Dropdown-control:hover":{color:actionColor},"& $Dropdown-option:hover":{color:actionColor},"& $Dropdown-option:hover svg":toolbarButtonStyle}}}(colors),function(colors,utils){var adaptedActionColor=utils.adaptForeground(colors.actionColor),bgColor=colors.bgColor,actionColor=colors.actionColor;return{quote:{"border-left-color":actionColor,"border-right-color":actionColor},sideToolbar_floatingContainer:{textAlign:"start"},sideToolbar_floatingIcon:{"&:hover":{fill:actionColor}},footerToolbar:{"&$staticToolbar":{background:bgColor}},staticToolbar:{},footerToolbarButton_icon:{color:colors.textColor},footerToolbarButton_wrapper:{"& $footerToolbarButton:hover:not([disabled]) $footerToolbarButton_icon":{color:actionColor}},footerToolbarButton:{},inlineToolbarButton_active:{color:adaptedActionColor,fill:adaptedActionColor},inlineToolbarDropdownButton:{"&:hover svg":{fill:adaptedActionColor}}}}(colors,utils));return lodash.merge.apply(void 0,function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;var r=Array(s),k=0;for(i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r}([commonStyles(colors),appStyles],pluginThemes))},ThemeGenerator}(),defaultTheme={modalTheme:{content:{}}};function themeStrategy(isViewer,themeGeneratorFunctions,palette,cssOverride){var sheets=new jss.SheetsRegistry;if(prevPalette!==palette||!rawCss)if(palette){prevPalette=palette;var themeGenerator=new ThemeGenerator(isViewer,palette,themeGeneratorFunctions),sheet=jss__default.createStyleSheet(themeGenerator.getStylesObject());sheets.add(sheet),paletteClasses=sheet.classes,rawCss=sheets.toString()}else paletteClasses={},rawCss="";return{theme:__assign(__assign(__assign({},defaultTheme),paletteClasses),cssOverride),rawCss:rawCss}}jss__default.setup(preset());function pluginsStrategy(isViewer,plugins,childProps,cssOverride,content){var strategy;if(void 0===plugins&&(plugins=[]),isViewer){var emptyStrategy={config:{},typeMappers:[],decorators:[],inlineStyleMappers:[]};strategy=plugins.reduce((function(prev,curr){return function(prev,curr,cssOverride,content){var _a,type=curr.type,config=curr.config,typeMapper=curr.typeMapper,decorator=curr.decorator,inlineStyleMapper=curr.inlineStyleMapper,finalConfig=__assign(__assign({},prev.config),((_a={})[type]=config,_a));return{config:finalConfig,typeMappers:typeMapper&&prev.typeMappers.concat([typeMapper])||prev.typeMappers,decorators:decorator&&prev.decorators.concat([decorator(cssOverride,config)])||prev.decorators,inlineStyleMappers:inlineStyleMapper&&content&&prev.inlineStyleMappers.concat([null==inlineStyleMapper?void 0:inlineStyleMapper(finalConfig,content)])||prev.inlineStyleMappers}}(prev,curr,cssOverride,content)}),emptyStrategy)}else{emptyStrategy={config:{},plugins:[],ModalsMap:{}};strategy=plugins.reduce((function(prev,curr){return function(prev,curr){var _a,type=curr.type,config=curr.config,createPlugin=curr.createPlugin,ModalsMap=curr.ModalsMap;return{config:__assign(__assign({},prev.config),(_a={},_a[type]=config,_a)),plugins:prev.plugins.concat(createPlugin),ModalsMap:__assign(__assign({},prev.ModalsMap),ModalsMap)}}(prev,curr)}),emptyStrategy)}var childPluginProps=function(isViewer,_a,content){var _b=_a.config,config=void 0===_b?{}:_b,_c=_a.plugins,plugins=void 0===_c?[]:_c,_d=_a.ModalsMap,ModalsMap=void 0===_d?{}:_d,_e=_a.typeMappers,typeMappers=void 0===_e?[]:_e,_f=_a.decorators,decorators=void 0===_f?[]:_f,_g=_a.inlineStyleMappers,inlineStyleMappers=void 0===_g?[]:_g,_h=_a.theme,theme=void 0===_h?{}:_h;return isViewer?{config:config,typeMappers:typeMappers,decorators:decorators.map((function(decorator){return decorator(theme,config)})),inlineStyleMappers:content?inlineStyleMappers.map((function(mapper){return mapper(config,content)})):[]}:{config:config,plugins:plugins,ModalsMap:ModalsMap}}(isViewer,childProps,content);return lodash.merge(strategy,childPluginProps)}function localeStrategy(locale){return void 0===locale&&(locale="en"),__awaiter(this,void 0,void 0,(function(){var localeResource,err_1;return __generator(this,(function(_a){switch(_a.label){case 0:if("en"===locale)return[2,{locale:locale}];_a.label=1;case 1:return _a.trys.push([1,3,,4]),[4,new Promise((function(resolve){resolve(function(e){if(e&&e.__esModule)return e;var n={};return e&&Object.keys(e).forEach((function(k){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:!0,get:function(){return e[k]}})})),n.default=e,n}(require("wix-rich-content-common/dist/statics/locale/messages_"+locale+".json")))})).then((function(res){return res.default}))];case 2:return localeResource=_a.sent(),[2,{locale:locale,localeResource:localeResource}];case 3:throw err_1=_a.sent(),new Error("error while loading locale "+locale+":\n"+err_1);case 4:return[2]}}))}))}var module,x,lib=(function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.isPresent=function(t){return null!=t},exports.isDefined=function(t){return void 0!==t},exports.isFilled=function(t){return null!==t}}(module={exports:{}},module.exports),module.exports);(x=lib)&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")&&x.default;lib.isPresent;var lib_2=lib.isDefined,RicosEngine=(lib.isFilled,function(_super){function RicosEngine(props){var _this=_super.call(this,props)||this;return _this.updateLocale=function(){return __awaiter(_this,void 0,void 0,(function(){var _a,locale,children,_this=this;return __generator(this,(function(_b){switch(_b.label){case 0:return _a=this.props,locale=_a.locale,[4,localeStrategy((null==(children=_a.children)?void 0:children.props.locale)||locale).then((function(localeData){_this.setState({localeStrategy:localeData})}))];case 1:return _b.sent(),[2]}}))}))},_this.state={localeStrategy:{locale:props.locale}},_this}return function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(RicosEngine,_super),RicosEngine.prototype.componentDidMount=function(){this.updateLocale()},RicosEngine.prototype.componentWillReceiveProps=function(newProps){newProps.locale!==this.props.locale&&this.updateLocale()},RicosEngine.prototype.runStrategies=function(){var _a=this.props,cssOverride=_a.cssOverride,theme=_a.theme,_b=_a.plugins,plugins=void 0===_b?[]:_b,_c=_a.isViewer,isViewer=void 0!==_c&&_c,content=_a.content,children=_a.children,localeStrategy=this.state.localeStrategy,_d=themeStrategy(isViewer,plugins.map((function(plugin){return plugin.theme})).filter(lib_2),null==theme?void 0:theme.palette,cssOverride),themeStrategyResult=_d.theme,rawCss=_d.rawCss;return{strategyProps:lodash.merge({theme:themeStrategyResult},pluginsStrategy(isViewer,plugins,children.props,themeStrategyResult,content),localeStrategy),rawCss:rawCss}},RicosEngine.prototype.render=function(){var _a=this.props,_rcProps=_a._rcProps,children=_a.children,isMobile=_a.isMobile,toolbarSettings=_a.toolbarSettings,_b=_a.modalSettings,modalSettings=void 0===_b?{}:_b,placeholder=_a.placeholder,content=_a.content,RicosModal=_a.RicosModal,onError=_a.onError,_c=this.runStrategies(),strategyProps=_c.strategyProps,rawCss=_c.rawCss,_d=toolbarSettings||{},useStaticTextToolbar=_d.useStaticTextToolbar,textToolbarContainer=_d.textToolbarContainer,getToolbarSettings=_d.getToolbarSettings,openModal=modalSettings.openModal,closeModal=modalSettings.closeModal,ariaHiddenId=modalSettings.ariaHiddenId,ricosPropsToMerge={isMobile:isMobile,textToolbarType:isMobile||!textToolbarContainer&&!useStaticTextToolbar?"inline":"static",config:{getToolbarSettings:getToolbarSettings},initialState:content,placeholder:placeholder,onError:onError,helpers:{openModal:openModal,closeModal:closeModal}},mergedRCProps=lodash.merge(strategyProps,_rcProps,ricosPropsToMerge,children.props);return[React__default.createElement("style",{type:"text/css",key:"styleElement"},rawCss),React__default.createElement(RicosModal,__assign({ariaHiddenId:ariaHiddenId},mergedRCProps,{key:"ricosElement"}),React.Children.only(React__default.cloneElement(children,__assign({},mergedRCProps))))]},RicosEngine.defaultProps={locale:"en",isMobile:!1},RicosEngine}(React.Component));exports.RicosEngine=RicosEngine,exports.emptyState={blocks:[],entityMap:{}},exports.shouldRenderChild=function(expectedChildName,children){var child=React.Children.only(children),childName=null==child?void 0:child.type.displayName;return!!children&&childName===expectedChildName};
"use strict";function _interopDefault(ex){return ex&&"object"==typeof ex&&"default"in ex?ex.default:ex}Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),React__default=_interopDefault(React),lodash=require("lodash"),jss=require("jss"),jss__default=_interopDefault(jss),preset=_interopDefault(require("jss-preset-default")),extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};var __assign=function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};function __awaiter(thisArg,_arguments,P,generator){return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P((function(resolve){resolve(value)}))).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))}function __generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}function getBrightness(hexCode){var _hexCode=hexCode.replace("#","");return(299*parseInt(_hexCode.substr(0,2),16)+587*parseInt(_hexCode.substr(2,2),16)+114*parseInt(_hexCode.substr(4,2),16))/1e3}function adaptForeground(actionColor){return getBrightness(actionColor)<140?actionColor:"#000000"}function hexToRgbA(hexColor,opacity){var c;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hexColor))return 3===(c=hexColor.substring(1).split("")).length&&(c=[c[0],c[0],c[1],c[1],c[2],c[2]]),"rgba("+[(c="0x"+c.join(""))>>16&255,c>>8&255,255&c].join(",")+","+(opacity||1)+")";throw new Error("Bad Hex")}var utils=Object.freeze({__proto__:null,fallbackColor:"#000000",fallbackColorBright:"#ffffff",isBright:function(hexColor){return getBrightness(hexColor)>140},adaptForeground:adaptForeground,hexToRgbA:hexToRgbA}),TemplateExample=[{name:"color_1",reference:"white/black"},{name:"color_2",reference:"black/white"},{name:"color_3",reference:"primery-1"},{name:"color_4",reference:"primery-2"},{name:"color_5",reference:"primery-3"},{name:"color_11",reference:"color-1"},{name:"color_12",reference:"color-2"},{name:"color_13",reference:"color-3"},{name:"color_14",reference:"color-4"},{name:"color_15",reference:"color-5"},{name:"color_16",reference:"color-6"},{name:"color_17",reference:"color-7"},{name:"color_18",reference:"color-8"},{name:"color_19",reference:"color-9"},{name:"color_20",reference:"color-10"},{name:"color_21",reference:"color-11"},{name:"color_22",reference:"color-12"},{name:"color_23",reference:"color-13"},{name:"color_24",reference:"color-14"},{name:"color_25",reference:"color-15"},{name:"color_26",reference:"color-16"},{name:"color_27",reference:"color-17"},{name:"color_28",reference:"color-18"},{name:"color_29",reference:"color-19"},{name:"color_30",reference:"color-20"},{name:"color_31",reference:"color-21"},{name:"color_32",reference:"color-22"},{name:"color_33",reference:"color-23"},{name:"color_34",reference:"color-24"},{name:"color_35",reference:"color-25"}],themes={darkTheme:["#FFFFFF","#000000","#ED1C24","#0088CB","#FFCB05","#000000","#616161","#8C8C8C","#F3F3F3","#FFFFFF","#074B54","#0E95A7","#15E0FB","#89EFFC","#D9FBFF","#071F4E","#0E3E9B","#155DE9","#83A8F0","#ADC6F8","#221333","#442565","#663898","#9C7FBA","#C4AEDD","#27331B","#4E6636","#749851","#9BCB6C","#CAE5AF"]};var palettes=Object.keys(themes).reduce((function(acc,curr){var _a;return __assign(__assign({},acc),((_a={})[curr]=function(preset){return preset.map((function(color,i){return __assign(__assign({},TemplateExample[i]),{value:color})}))}(themes[curr]),_a))}),{}),COLORS={BG_COLOR:11,SECONDARY_COLOR:13,COLOR4:14,TEXT_COLOR:15,COLOR7:17,ACTION_COLOR:18};function commonStyles(colors){return{editor:{background:colors.bgColor,color:colors.textColor}}}var PALETTE_PRESETS={darkTheme:palettes.darkTheme},getColorValue=function(palette,code){return function(palette,code){return palette[code<=5?code-1:code-6]}(palette,code).value},ThemeGenerator=function(){function ThemeGenerator(isViewer,palette,themeGeneratorFunctions){void 0===themeGeneratorFunctions&&(themeGeneratorFunctions=[]),this.setPalette(palette),this.themeGeneratorFunctions=themeGeneratorFunctions,this.isViewer=isViewer}return ThemeGenerator.prototype.setPalette=function(palette){if("string"==typeof palette){if(!(palette in PALETTE_PRESETS))throw Error("Palette "+palette+" is unknown. Supported themes: "+PALETTE_PRESETS.toString());this.palette=PALETTE_PRESETS[palette]}else!function(palette){if(palette){if(0===palette.length)throw Error("Received empty palette colors array");var receivedColors=palette.map((function(val){return val.name})),missingColors=lodash.difference(Object.values(COLORS).map((function(num){return"color_"+num})),receivedColors);if(missingColors.length>0){var error=[];throw error.push("Some palette colors were not supplied:","\n"+missingColors+"\n","Palette array must include the following colors:",Object.entries(COLORS).map((function(entry){return entry[1]+" - "+entry[0]})).toString().split(",").join("\n"),""),Error(error.join("\n"))}}}(palette),this.palette=palette},ThemeGenerator.prototype.getStylesObject=function(){if(!this.palette)return{};var colors={actionColor:getColorValue(this.palette,COLORS.ACTION_COLOR),bgColor:getColorValue(this.palette,COLORS.BG_COLOR),textColor:getColorValue(this.palette,COLORS.TEXT_COLOR),secondaryColor:getColorValue(this.palette,COLORS.SECONDARY_COLOR),color7:hexToRgbA(getColorValue(this.palette,COLORS.COLOR7),.7),color4:getColorValue(this.palette,COLORS.COLOR4)},pluginThemes=this.themeGeneratorFunctions.map((function(themeGen){return themeGen(colors,utils)})),appStyles=this.isViewer?function(colors){var actionColor=colors.actionColor;return{quote:{"border-left-color":actionColor,"border-right-color":actionColor}}}(colors):lodash.merge(function(colors){var actionColor=adaptForeground(colors.actionColor),blockActionColorSettings={cursor:"default",boxShadow:"0 0 0 3px "+colors.actionColor},toolbarButtonStyle={color:actionColor,fill:actionColor},sliderTrack={background:actionColor},thumb=__assign(__assign({},sliderTrack),{border:"4px solid "+actionColor}),buttonsFooterStyle={"& $button_primary":{backgroundColor:actionColor},"& $button_primary:hover:not([disabled])":{backgroundColor:hexToRgbA(actionColor,.8)},"& $button_primary:disabled":{backgroundColor:"rgba(0, 0, 0, 0.4)"},"& $button_secondary":{color:actionColor,borderColor:actionColor},"& $button_secondary:hover":{color:hexToRgbA(actionColor,.6),borderColor:hexToRgbA(actionColor,.6)},"& $button_secondary:disabled":{backgroundColor:"rgba(0, 0, 0, 0.4)"}};return{hasFocus:blockActionColorSettings,pluginContainer:{},pluginContainerWrapper:{"&$pluginContainer:hover":blockActionColorSettings,"&$pluginContainer&$hasFocus":blockActionColorSettings},selectionList:{"& $selectionListOption:hover":{backgroundColor:hexToRgbA(actionColor,.05)},"& $selectionListOption$selectionListOption_selected":{color:actionColor,backgroundColor:hexToRgbA(actionColor,.1)},"& $selectionListOption_selected$selectionListOption:hover":{backgroundColor:hexToRgbA(actionColor,.1)}},selectionListOption:{},selectionListOption_selected:{},checkbox_wrapper:{"& $checkbox_icon":{border:"solid 1px "+actionColor},"& $checkbox_icon:hover":{color:hexToRgbA(actionColor,.1)},"& $checkbox_infoIcon:hover":{color:actionColor},"& $checkbox_inputLabel:hover $checkbox_icon_unchecked":{backgroundColor:hexToRgbA(actionColor,.1)},"& $checkbox_icon_checked":{backgroundColor:actionColor}},checkbox_icon:{},checkbox_infoIcon:{},checkbox_icon_checked:{},checkbox_inputLabel:{},checkbox_icon_unchecked:{},tabs_panel:{},tabs:{"& $tabs_panel":{padding:"24px 24px 30px"}},tabs_headers_option_selected:{},tabs_headers:{"& $tabs_headers_option_selected":{borderBottom:"solid 3px "+actionColor}},button_primary:{},button_secondary:{},settingsPanel_footer_fixed:buttonsFooterStyle,button_inputModal_modal_footer:buttonsFooterStyle,video_modal_container_big:buttonsFooterStyle,video_modal_container_small:buttonsFooterStyle,sliderWithInput_content:{"& $slider::-webkit-slider-runnable-track":sliderTrack,"& $slider::-webkit-slider-thumb":thumb},slider:{},radioGroup_button:{},radioGroup_input:{},radioGroup:{"& $radioGroup_input:checked + $radioGroup_button::after":{backgroundColor:actionColor}},colorPicker_add_color_button:{"& $colorPicker_add_color_label":{color:actionColor}},colorPicker_add_color_label:{},colorPicker_reset_color_button:{"& $colorPicker_reset_color_label":{color:actionColor}},colorPicker_reset_color_label:{},buttonsWrapper:{"& $buttonWrapper:hover button:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:focus button:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:hover label:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:focus label:not([disabled]) svg":toolbarButtonStyle},buttonWrapper:{"& $pluginToolbarButton:not($pluginToolbarButton_disabled)$pluginToolbarButton_active":toolbarButtonStyle,"& $pluginToolbarButton:not($pluginToolbarButton_disabled):focus svg":toolbarButtonStyle,"& $pluginToolbarButton:not($pluginToolbarButton_disabled):hover":toolbarButtonStyle},inlineToolbarButton_active:{color:actionColor},inlineToolbarButton_icon:{"&:hover":{color:actionColor,"& svg":{fill:actionColor}}},inlineToolbarButton_wrapper:{"& $inlineToolbarButton_icon:hover":{color:actionColor},"& $inlineToolbarButton_icon:hover svg":{fill:actionColor}},pluginToolbarButton_disabled:{},pluginToolbarButton_active:{},pluginToolbarButton:{"&:not($pluginToolbarButton_disabled):hover >:not($Dropdown-root) svg":{fill:actionColor}},"Dropdown-control":{},"Dropdown-option":{},"Dropdown-root":{"& $Dropdown-control:hover":{color:actionColor},"& $Dropdown-option:hover":{color:actionColor},"& $Dropdown-option:hover svg":toolbarButtonStyle}}}(colors),function(colors,utils){var adaptedActionColor=utils.adaptForeground(colors.actionColor),bgColor=colors.bgColor,actionColor=colors.actionColor;return{quote:{"border-left-color":actionColor,"border-right-color":actionColor},sideToolbar_floatingContainer:{textAlign:"start"},sideToolbar_floatingIcon:{"&:hover":{fill:actionColor}},footerToolbar:{"&$staticToolbar":{background:bgColor}},staticToolbar:{},footerToolbarButton_icon:{color:colors.textColor},footerToolbarButton_wrapper:{"& $footerToolbarButton:hover:not([disabled]) $footerToolbarButton_icon":{color:actionColor}},footerToolbarButton:{},inlineToolbarButton_active:{color:adaptedActionColor,fill:adaptedActionColor},inlineToolbarDropdownButton:{"&:hover svg":{fill:adaptedActionColor}}}}(colors,utils));return lodash.merge.apply(void 0,function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;var r=Array(s),k=0;for(i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r}([commonStyles(colors),appStyles],pluginThemes))},ThemeGenerator}(),defaultTheme={modalTheme:{content:{}}};function createThemeStrategy(){var themeState={};return function(args){return function(themeState,args){var isViewer=args.isViewer,themeGeneratorFunctions=args.themeGeneratorFunctions,palette=args.palette,cssOverride=args.cssOverride,sheets=new jss.SheetsRegistry;if(themeState.prevPalette!==palette||!themeState.rawCss)if(palette){themeState.prevPalette=palette;var themeGenerator=new ThemeGenerator(isViewer,palette,themeGeneratorFunctions),sheet=jss__default.createStyleSheet(themeGenerator.getStylesObject());sheets.add(sheet),themeState.paletteClasses=sheet.classes,themeState.rawCss=sheets.toString()}else themeState.paletteClasses={},themeState.rawCss="";return{theme:__assign(__assign(__assign({},defaultTheme),themeState.paletteClasses),cssOverride),rawCss:themeState.rawCss}}(themeState,args)}}jss__default.setup(preset());function pluginsStrategy(isViewer,plugins,childProps,cssOverride,content){var strategy;if(void 0===plugins&&(plugins=[]),isViewer){var emptyStrategy={config:{},typeMappers:[],decorators:[],inlineStyleMappers:[]};strategy=plugins.reduce((function(prev,curr){return function(prev,curr,cssOverride,content){var _a,type=curr.type,config=curr.config,typeMapper=curr.typeMapper,decorator=curr.decorator,inlineStyleMapper=curr.inlineStyleMapper,finalConfig=__assign(__assign({},prev.config),((_a={})[type]=config,_a));return{config:finalConfig,typeMappers:typeMapper&&prev.typeMappers.concat([typeMapper])||prev.typeMappers,decorators:decorator&&prev.decorators.concat([decorator(cssOverride,config)])||prev.decorators,inlineStyleMappers:inlineStyleMapper&&content&&prev.inlineStyleMappers.concat([null==inlineStyleMapper?void 0:inlineStyleMapper(finalConfig,content)])||prev.inlineStyleMappers}}(prev,curr,cssOverride,content)}),emptyStrategy)}else{emptyStrategy={config:{},plugins:[],ModalsMap:{}};strategy=plugins.reduce((function(prev,curr){return function(prev,curr){var _a,type=curr.type,config=curr.config,createPlugin=curr.createPlugin,ModalsMap=curr.ModalsMap;return{config:__assign(__assign({},prev.config),(_a={},_a[type]=config,_a)),plugins:prev.plugins.concat(createPlugin),ModalsMap:__assign(__assign({},prev.ModalsMap),ModalsMap)}}(prev,curr)}),emptyStrategy)}var childPluginProps=function(isViewer,_a,content){var _b=_a.config,config=void 0===_b?{}:_b,_c=_a.plugins,plugins=void 0===_c?[]:_c,_d=_a.ModalsMap,ModalsMap=void 0===_d?{}:_d,_e=_a.typeMappers,typeMappers=void 0===_e?[]:_e,_f=_a.decorators,decorators=void 0===_f?[]:_f,_g=_a.inlineStyleMappers,inlineStyleMappers=void 0===_g?[]:_g,_h=_a.theme,theme=void 0===_h?{}:_h;return isViewer?{config:config,typeMappers:typeMappers,decorators:decorators.map((function(decorator){return decorator(theme,config)})),inlineStyleMappers:content?inlineStyleMappers.map((function(mapper){return mapper(config,content)})):[]}:{config:config,plugins:plugins,ModalsMap:ModalsMap}}(isViewer,childProps,content);return lodash.merge(strategy,childPluginProps)}function localeStrategy(locale){return void 0===locale&&(locale="en"),__awaiter(this,void 0,void 0,(function(){var localeResource,err_1;return __generator(this,(function(_a){switch(_a.label){case 0:if("en"===locale)return[2,{locale:locale}];_a.label=1;case 1:return _a.trys.push([1,3,,4]),[4,new Promise((function(resolve){resolve(function(e){if(e&&e.__esModule)return e;var n={};return e&&Object.keys(e).forEach((function(k){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:!0,get:function(){return e[k]}})})),n.default=e,n}(require("wix-rich-content-common/dist/statics/locale/messages_"+locale+".json")))})).then((function(res){return res.default}))];case 2:return localeResource=_a.sent(),[2,{locale:locale,localeResource:localeResource}];case 3:throw err_1=_a.sent(),new Error("error while loading locale "+locale+":\n"+err_1);case 4:return[2]}}))}))}var module,x,lib=(function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.isPresent=function(t){return null!=t},exports.isDefined=function(t){return void 0!==t},exports.isFilled=function(t){return null!==t}}(module={exports:{}},module.exports),module.exports);(x=lib)&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")&&x.default;lib.isPresent;var lib_2=lib.isDefined,RicosEngine=(lib.isFilled,function(_super){function RicosEngine(props){var _this=_super.call(this,props)||this;return _this.updateLocale=function(){return __awaiter(_this,void 0,void 0,(function(){var _a,locale,children,_this=this;return __generator(this,(function(_b){switch(_b.label){case 0:return _a=this.props,locale=_a.locale,[4,localeStrategy((null==(children=_a.children)?void 0:children.props.locale)||locale).then((function(localeData){_this.setState({localeStrategy:localeData})}))];case 1:return _b.sent(),[2]}}))}))},_this.state={localeStrategy:{locale:props.locale}},_this.themeStrategy=createThemeStrategy(),_this}return function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(RicosEngine,_super),RicosEngine.prototype.componentDidMount=function(){this.updateLocale()},RicosEngine.prototype.componentWillReceiveProps=function(newProps){newProps.locale!==this.props.locale&&this.updateLocale()},RicosEngine.prototype.runStrategies=function(){var _a=this.props,cssOverride=_a.cssOverride,theme=_a.theme,_b=_a.plugins,plugins=void 0===_b?[]:_b,_c=_a.isViewer,isViewer=void 0!==_c&&_c,content=_a.content,children=_a.children,localeStrategy=this.state.localeStrategy,themeGeneratorFunctions=plugins.map((function(plugin){return plugin.theme})).filter(lib_2),_d=this.themeStrategy({isViewer:isViewer,themeGeneratorFunctions:themeGeneratorFunctions,palette:null==theme?void 0:theme.palette,cssOverride:cssOverride}),themeStrategyResult=_d.theme,rawCss=_d.rawCss;return{strategyProps:lodash.merge({theme:themeStrategyResult},pluginsStrategy(isViewer,plugins,children.props,themeStrategyResult,content),localeStrategy),rawCss:rawCss}},RicosEngine.prototype.render=function(){var _a=this.props,_rcProps=_a._rcProps,children=_a.children,isMobile=_a.isMobile,toolbarSettings=_a.toolbarSettings,_b=_a.modalSettings,modalSettings=void 0===_b?{}:_b,placeholder=_a.placeholder,content=_a.content,RicosModal=_a.RicosModal,onError=_a.onError,_c=this.runStrategies(),strategyProps=_c.strategyProps,rawCss=_c.rawCss,_d=toolbarSettings||{},useStaticTextToolbar=_d.useStaticTextToolbar,textToolbarContainer=_d.textToolbarContainer,getToolbarSettings=_d.getToolbarSettings,openModal=modalSettings.openModal,closeModal=modalSettings.closeModal,ariaHiddenId=modalSettings.ariaHiddenId,ricosPropsToMerge={isMobile:isMobile,textToolbarType:isMobile||!textToolbarContainer&&!useStaticTextToolbar?"inline":"static",config:{getToolbarSettings:getToolbarSettings},initialState:content,placeholder:placeholder,onError:onError,helpers:{openModal:openModal,closeModal:closeModal}},mergedRCProps=lodash.merge(strategyProps,_rcProps,ricosPropsToMerge,children.props);return[React__default.createElement("style",{type:"text/css",key:"styleElement"},rawCss),React__default.createElement(RicosModal,__assign({ariaHiddenId:ariaHiddenId},mergedRCProps,{key:"ricosElement"}),React.Children.only(React__default.cloneElement(children,__assign({},mergedRCProps))))]},RicosEngine.defaultProps={locale:"en",isMobile:!1},RicosEngine}(React.Component));exports.RicosEngine=RicosEngine,exports.emptyState={blocks:[],entityMap:{}},exports.shouldRenderChild=function(expectedChildName,children){var child=React.Children.only(children),childName=null==child?void 0:child.type.displayName;return!!children&&childName===expectedChildName};
//# sourceMappingURL=index.js.map

@@ -15,3 +15,3 @@ import React,{Children,Component}from"react";import{difference,merge}from"lodash";import jss,{SheetsRegistry}from"jss";import preset from"jss-preset-default";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};var __assign=function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};function __awaiter(thisArg,_arguments,P,generator){return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P((function(resolve){resolve(value)}))).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))}function __generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}function getBrightness(hexCode){var _hexCode=hexCode.replace("#","");return(299*parseInt(_hexCode.substr(0,2),16)+587*parseInt(_hexCode.substr(2,2),16)+114*parseInt(_hexCode.substr(4,2),16))/1e3}function adaptForeground(actionColor){return getBrightness(actionColor)<140?actionColor:"#000000"}function hexToRgbA(hexColor,opacity){var c;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hexColor))return 3===(c=hexColor.substring(1).split("")).length&&(c=[c[0],c[0],c[1],c[1],c[2],c[2]]),"rgba("+[(c="0x"+c.join(""))>>16&255,c>>8&255,255&c].join(",")+","+(opacity||1)+")";throw new Error("Bad Hex")}var utils=Object.freeze({__proto__:null,fallbackColor:"#000000",fallbackColorBright:"#ffffff",isBright:function(hexColor){return getBrightness(hexColor)>140},adaptForeground:adaptForeground,hexToRgbA:hexToRgbA}),TemplateExample=[{name:"color_1",reference:"white/black"},{name:"color_2",reference:"black/white"},{name:"color_3",reference:"primery-1"},{name:"color_4",reference:"primery-2"},{name:"color_5",reference:"primery-3"},{name:"color_11",reference:"color-1"},{name:"color_12",reference:"color-2"},{name:"color_13",reference:"color-3"},{name:"color_14",reference:"color-4"},{name:"color_15",reference:"color-5"},{name:"color_16",reference:"color-6"},{name:"color_17",reference:"color-7"},{name:"color_18",reference:"color-8"},{name:"color_19",reference:"color-9"},{name:"color_20",reference:"color-10"},{name:"color_21",reference:"color-11"},{name:"color_22",reference:"color-12"},{name:"color_23",reference:"color-13"},{name:"color_24",reference:"color-14"},{name:"color_25",reference:"color-15"},{name:"color_26",reference:"color-16"},{name:"color_27",reference:"color-17"},{name:"color_28",reference:"color-18"},{name:"color_29",reference:"color-19"},{name:"color_30",reference:"color-20"},{name:"color_31",reference:"color-21"},{name:"color_32",reference:"color-22"},{name:"color_33",reference:"color-23"},{name:"color_34",reference:"color-24"},{name:"color_35",reference:"color-25"}],themes={darkTheme:["#FFFFFF","#000000","#ED1C24","#0088CB","#FFCB05","#000000","#616161","#8C8C8C","#F3F3F3","#FFFFFF","#074B54","#0E95A7","#15E0FB","#89EFFC","#D9FBFF","#071F4E","#0E3E9B","#155DE9","#83A8F0","#ADC6F8","#221333","#442565","#663898","#9C7FBA","#C4AEDD","#27331B","#4E6636","#749851","#9BCB6C","#CAE5AF"]};var palettes=Object.keys(themes).reduce((function(acc,curr){var _a;return __assign(__assign({},acc),((_a={})[curr]=function(preset){return preset.map((function(color,i){return __assign(__assign({},TemplateExample[i]),{value:color})}))}(themes[curr]),_a))}),{}),COLORS={BG_COLOR:11,SECONDARY_COLOR:13,COLOR4:14,TEXT_COLOR:15,COLOR7:17,ACTION_COLOR:18};function commonStyles(colors){return{editor:{background:colors.bgColor,color:colors.textColor}}}var rawCss,prevPalette,paletteClasses,PALETTE_PRESETS={darkTheme:palettes.darkTheme},getColorValue=function(palette,code){return function(palette,code){return palette[code<=5?code-1:code-6]}(palette,code).value},ThemeGenerator=function(){function ThemeGenerator(isViewer,palette,themeGeneratorFunctions){void 0===themeGeneratorFunctions&&(themeGeneratorFunctions=[]),this.setPalette(palette),this.themeGeneratorFunctions=themeGeneratorFunctions,this.isViewer=isViewer}return ThemeGenerator.prototype.setPalette=function(palette){if("string"==typeof palette){if(!(palette in PALETTE_PRESETS))throw Error("Palette "+palette+" is unknown. Supported themes: "+PALETTE_PRESETS.toString());this.palette=PALETTE_PRESETS[palette]}else!function(palette){if(palette){if(0===palette.length)throw Error("Received empty palette colors array");var receivedColors=palette.map((function(val){return val.name})),missingColors=difference(Object.values(COLORS).map((function(num){return"color_"+num})),receivedColors);if(missingColors.length>0){var error=[];throw error.push("Some palette colors were not supplied:","\n"+missingColors+"\n","Palette array must include the following colors:",Object.entries(COLORS).map((function(entry){return entry[1]+" - "+entry[0]})).toString().split(",").join("\n"),""),Error(error.join("\n"))}}}(palette),this.palette=palette},ThemeGenerator.prototype.getStylesObject=function(){if(!this.palette)return{};var colors={actionColor:getColorValue(this.palette,COLORS.ACTION_COLOR),bgColor:getColorValue(this.palette,COLORS.BG_COLOR),textColor:getColorValue(this.palette,COLORS.TEXT_COLOR),secondaryColor:getColorValue(this.palette,COLORS.SECONDARY_COLOR),color7:hexToRgbA(getColorValue(this.palette,COLORS.COLOR7),.7),color4:getColorValue(this.palette,COLORS.COLOR4)},pluginThemes=this.themeGeneratorFunctions.map((function(themeGen){return themeGen(colors,utils)})),appStyles=this.isViewer?function(colors){var actionColor=colors.actionColor;return{quote:{"border-left-color":actionColor,"border-right-color":actionColor}}}(colors):merge(function(colors){var actionColor=adaptForeground(colors.actionColor),blockActionColorSettings={cursor:"default",boxShadow:"0 0 0 3px "+colors.actionColor},toolbarButtonStyle={color:actionColor,fill:actionColor},sliderTrack={background:actionColor},thumb=__assign(__assign({},sliderTrack),{border:"4px solid "+actionColor}),buttonsFooterStyle={"& $button_primary":{backgroundColor:actionColor},"& $button_primary:hover:not([disabled])":{backgroundColor:hexToRgbA(actionColor,.8)},"& $button_primary:disabled":{backgroundColor:"rgba(0, 0, 0, 0.4)"},"& $button_secondary":{color:actionColor,borderColor:actionColor},"& $button_secondary:hover":{color:hexToRgbA(actionColor,.6),borderColor:hexToRgbA(actionColor,.6)},"& $button_secondary:disabled":{backgroundColor:"rgba(0, 0, 0, 0.4)"}};return{hasFocus:blockActionColorSettings,pluginContainer:{},pluginContainerWrapper:{"&$pluginContainer:hover":blockActionColorSettings,"&$pluginContainer&$hasFocus":blockActionColorSettings},selectionList:{"& $selectionListOption:hover":{backgroundColor:hexToRgbA(actionColor,.05)},"& $selectionListOption$selectionListOption_selected":{color:actionColor,backgroundColor:hexToRgbA(actionColor,.1)},"& $selectionListOption_selected$selectionListOption:hover":{backgroundColor:hexToRgbA(actionColor,.1)}},selectionListOption:{},selectionListOption_selected:{},checkbox_wrapper:{"& $checkbox_icon":{border:"solid 1px "+actionColor},"& $checkbox_icon:hover":{color:hexToRgbA(actionColor,.1)},"& $checkbox_infoIcon:hover":{color:actionColor},"& $checkbox_inputLabel:hover $checkbox_icon_unchecked":{backgroundColor:hexToRgbA(actionColor,.1)},"& $checkbox_icon_checked":{backgroundColor:actionColor}},checkbox_icon:{},checkbox_infoIcon:{},checkbox_icon_checked:{},checkbox_inputLabel:{},checkbox_icon_unchecked:{},tabs_panel:{},tabs:{"& $tabs_panel":{padding:"24px 24px 30px"}},tabs_headers_option_selected:{},tabs_headers:{"& $tabs_headers_option_selected":{borderBottom:"solid 3px "+actionColor}},button_primary:{},button_secondary:{},settingsPanel_footer_fixed:buttonsFooterStyle,button_inputModal_modal_footer:buttonsFooterStyle,video_modal_container_big:buttonsFooterStyle,video_modal_container_small:buttonsFooterStyle,sliderWithInput_content:{"& $slider::-webkit-slider-runnable-track":sliderTrack,"& $slider::-webkit-slider-thumb":thumb},slider:{},radioGroup_button:{},radioGroup_input:{},radioGroup:{"& $radioGroup_input:checked + $radioGroup_button::after":{backgroundColor:actionColor}},colorPicker_add_color_button:{"& $colorPicker_add_color_label":{color:actionColor}},colorPicker_add_color_label:{},colorPicker_reset_color_button:{"& $colorPicker_reset_color_label":{color:actionColor}},colorPicker_reset_color_label:{},buttonsWrapper:{"& $buttonWrapper:hover button:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:focus button:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:hover label:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:focus label:not([disabled]) svg":toolbarButtonStyle},buttonWrapper:{"& $pluginToolbarButton:not($pluginToolbarButton_disabled)$pluginToolbarButton_active":toolbarButtonStyle,"& $pluginToolbarButton:not($pluginToolbarButton_disabled):focus svg":toolbarButtonStyle,"& $pluginToolbarButton:not($pluginToolbarButton_disabled):hover":toolbarButtonStyle},inlineToolbarButton_active:{color:actionColor},inlineToolbarButton_icon:{"&:hover":{color:actionColor,"& svg":{fill:actionColor}}},inlineToolbarButton_wrapper:{"& $inlineToolbarButton_icon:hover":{color:actionColor},"& $inlineToolbarButton_icon:hover svg":{fill:actionColor}},pluginToolbarButton_disabled:{},pluginToolbarButton_active:{},pluginToolbarButton:{"&:not($pluginToolbarButton_disabled):hover >:not($Dropdown-root) svg":{fill:actionColor}},"Dropdown-control":{},"Dropdown-option":{},"Dropdown-root":{"& $Dropdown-control:hover":{color:actionColor},"& $Dropdown-option:hover":{color:actionColor},"& $Dropdown-option:hover svg":toolbarButtonStyle}}}(colors),function(colors,utils){var adaptedActionColor=utils.adaptForeground(colors.actionColor),bgColor=colors.bgColor,actionColor=colors.actionColor;return{quote:{"border-left-color":actionColor,"border-right-color":actionColor},sideToolbar_floatingContainer:{textAlign:"start"},sideToolbar_floatingIcon:{"&:hover":{fill:actionColor}},footerToolbar:{"&$staticToolbar":{background:bgColor}},staticToolbar:{},footerToolbarButton_icon:{color:colors.textColor},footerToolbarButton_wrapper:{"& $footerToolbarButton:hover:not([disabled]) $footerToolbarButton_icon":{color:actionColor}},footerToolbarButton:{},inlineToolbarButton_active:{color:adaptedActionColor,fill:adaptedActionColor},inlineToolbarDropdownButton:{"&:hover svg":{fill:adaptedActionColor}}}}(colors,utils));return merge.apply(void 0,function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;var r=Array(s),k=0;for(i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r}([commonStyles(colors),appStyles],pluginThemes))},ThemeGenerator}(),defaultTheme={modalTheme:{content:{}}};function themeStrategy(isViewer,themeGeneratorFunctions,palette,cssOverride){var sheets=new SheetsRegistry;if(prevPalette!==palette||!rawCss)if(palette){prevPalette=palette;var themeGenerator=new ThemeGenerator(isViewer,palette,themeGeneratorFunctions),sheet=jss.createStyleSheet(themeGenerator.getStylesObject());sheets.add(sheet),paletteClasses=sheet.classes,rawCss=sheets.toString()}else paletteClasses={},rawCss="";return{theme:__assign(__assign(__assign({},defaultTheme),paletteClasses),cssOverride),rawCss:rawCss}}jss.setup(preset());function pluginsStrategy(isViewer,plugins,childProps,cssOverride,content){var strategy;if(void 0===plugins&&(plugins=[]),isViewer){var emptyStrategy={config:{},typeMappers:[],decorators:[],inlineStyleMappers:[]};strategy=plugins.reduce((function(prev,curr){return function(prev,curr,cssOverride,content){var _a,type=curr.type,config=curr.config,typeMapper=curr.typeMapper,decorator=curr.decorator,inlineStyleMapper=curr.inlineStyleMapper,finalConfig=__assign(__assign({},prev.config),((_a={})[type]=config,_a));return{config:finalConfig,typeMappers:typeMapper&&prev.typeMappers.concat([typeMapper])||prev.typeMappers,decorators:decorator&&prev.decorators.concat([decorator(cssOverride,config)])||prev.decorators,inlineStyleMappers:inlineStyleMapper&&content&&prev.inlineStyleMappers.concat([null==inlineStyleMapper?void 0:inlineStyleMapper(finalConfig,content)])||prev.inlineStyleMappers}}(prev,curr,cssOverride,content)}),emptyStrategy)}else{emptyStrategy={config:{},plugins:[],ModalsMap:{}};strategy=plugins.reduce((function(prev,curr){return function(prev,curr){var _a,type=curr.type,config=curr.config,createPlugin=curr.createPlugin,ModalsMap=curr.ModalsMap;return{config:__assign(__assign({},prev.config),(_a={},_a[type]=config,_a)),plugins:prev.plugins.concat(createPlugin),ModalsMap:__assign(__assign({},prev.ModalsMap),ModalsMap)}}(prev,curr)}),emptyStrategy)}var childPluginProps=function(isViewer,_a,content){var _b=_a.config,config=void 0===_b?{}:_b,_c=_a.plugins,plugins=void 0===_c?[]:_c,_d=_a.ModalsMap,ModalsMap=void 0===_d?{}:_d,_e=_a.typeMappers,typeMappers=void 0===_e?[]:_e,_f=_a.decorators,decorators=void 0===_f?[]:_f,_g=_a.inlineStyleMappers,inlineStyleMappers=void 0===_g?[]:_g,_h=_a.theme,theme=void 0===_h?{}:_h;return isViewer?{config:config,typeMappers:typeMappers,decorators:decorators.map((function(decorator){return decorator(theme,config)})),inlineStyleMappers:content?inlineStyleMappers.map((function(mapper){return mapper(config,content)})):[]}:{config:config,plugins:plugins,ModalsMap:ModalsMap}}(isViewer,childProps,content);return merge(strategy,childPluginProps)}function localeStrategy(locale){return void 0===locale&&(locale="en"),__awaiter(this,void 0,void 0,(function(){var localeResource,err_1;return __generator(this,(function(_a){switch(_a.label){case 0:if("en"===locale)return[2,{locale:locale}];_a.label=1;case 1:return _a.trys.push([1,3,,4]),[4,import("wix-rich-content-common/dist/statics/locale/messages_"+locale+".json").then((function(res){return res.default}))];case 2:return localeResource=_a.sent(),[2,{locale:locale,localeResource:localeResource}];case 3:throw err_1=_a.sent(),new Error("error while loading locale "+locale+":\n"+err_1);case 4:return[2]}}))}))}var module,x,lib=(function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.isPresent=function(t){return null!=t},exports.isDefined=function(t){return void 0!==t},exports.isFilled=function(t){return null!==t}}(module={exports:{}},module.exports),module.exports);(x=lib)&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")&&x.default;lib.isPresent;var lib_2=lib.isDefined,RicosEngine=(lib.isFilled,function(_super){function RicosEngine(props){var _this=_super.call(this,props)||this;return _this.updateLocale=function(){return __awaiter(_this,void 0,void 0,(function(){var _a,locale,children,_this=this;return __generator(this,(function(_b){switch(_b.label){case 0:return _a=this.props,locale=_a.locale,[4,localeStrategy((null==(children=_a.children)?void 0:children.props.locale)||locale).then((function(localeData){_this.setState({localeStrategy:localeData})}))];case 1:return _b.sent(),[2]}}))}))},_this.state={localeStrategy:{locale:props.locale}},_this}return function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(RicosEngine,_super),RicosEngine.prototype.componentDidMount=function(){this.updateLocale()},RicosEngine.prototype.componentWillReceiveProps=function(newProps){newProps.locale!==this.props.locale&&this.updateLocale()},RicosEngine.prototype.runStrategies=function(){var _a=this.props,cssOverride=_a.cssOverride,theme=_a.theme,_b=_a.plugins,plugins=void 0===_b?[]:_b,_c=_a.isViewer,isViewer=void 0!==_c&&_c,content=_a.content,children=_a.children,localeStrategy=this.state.localeStrategy,_d=themeStrategy(isViewer,plugins.map((function(plugin){return plugin.theme})).filter(lib_2),null==theme?void 0:theme.palette,cssOverride),themeStrategyResult=_d.theme,rawCss=_d.rawCss;return{strategyProps:merge({theme:themeStrategyResult},pluginsStrategy(isViewer,plugins,children.props,themeStrategyResult,content),localeStrategy),rawCss:rawCss}},RicosEngine.prototype.render=function(){var _a=this.props,_rcProps=_a._rcProps,children=_a.children,isMobile=_a.isMobile,toolbarSettings=_a.toolbarSettings,_b=_a.modalSettings,modalSettings=void 0===_b?{}:_b,placeholder=_a.placeholder,content=_a.content,RicosModal=_a.RicosModal,onError=_a.onError,_c=this.runStrategies(),strategyProps=_c.strategyProps,rawCss=_c.rawCss,_d=toolbarSettings||{},useStaticTextToolbar=_d.useStaticTextToolbar,textToolbarContainer=_d.textToolbarContainer,getToolbarSettings=_d.getToolbarSettings,openModal=modalSettings.openModal,closeModal=modalSettings.closeModal,ariaHiddenId=modalSettings.ariaHiddenId,mergedRCProps=merge(strategyProps,_rcProps,{isMobile:isMobile,textToolbarType:isMobile||!textToolbarContainer&&!useStaticTextToolbar?"inline":"static",config:{getToolbarSettings:getToolbarSettings},initialState:content,placeholder:placeholder,onError:onError,helpers:{openModal:openModal,closeModal:closeModal}},children.props);return[React.createElement("style",{type:"text/css",key:"styleElement"},rawCss),React.createElement(RicosModal,__assign({ariaHiddenId:ariaHiddenId},mergedRCProps,{key:"ricosElement"}),Children.only(React.cloneElement(children,__assign({},mergedRCProps))))]},RicosEngine.defaultProps={locale:"en",isMobile:!1},RicosEngine}(Component)),emptyState={blocks:[],entityMap:{}},shouldRenderChild=function(expectedChildName,children){var child=Children.only(children),childName=null==child?void 0:child.type.displayName;return!!children&&childName===expectedChildName};export{RicosEngine,emptyState,shouldRenderChild};
***************************************************************************** */var extendStatics=function(d,b){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b}||function(d,b){for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p])})(d,b)};var __assign=function(){return(__assign=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};function __awaiter(thisArg,_arguments,P,generator){return new(P||(P=Promise))((function(resolve,reject){function fulfilled(value){try{step(generator.next(value))}catch(e){reject(e)}}function rejected(value){try{step(generator.throw(value))}catch(e){reject(e)}}function step(result){var value;result.done?resolve(result.value):(value=result.value,value instanceof P?value:new P((function(resolve){resolve(value)}))).then(fulfilled,rejected)}step((generator=generator.apply(thisArg,_arguments||[])).next())}))}function __generator(thisArg,body){var f,y,t,g,_={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return g={next:verb(0),throw:verb(1),return:verb(2)},"function"==typeof Symbol&&(g[Symbol.iterator]=function(){return this}),g;function verb(n){return function(v){return function(op){if(f)throw new TypeError("Generator is already executing.");for(;_;)try{if(f=1,y&&(t=2&op[0]?y.return:op[0]?y.throw||((t=y.return)&&t.call(y),0):y.next)&&!(t=t.call(y,op[1])).done)return t;switch(y=0,t&&(op=[2&op[0],t.value]),op[0]){case 0:case 1:t=op;break;case 4:return _.label++,{value:op[1],done:!1};case 5:_.label++,y=op[1],op=[0];continue;case 7:op=_.ops.pop(),_.trys.pop();continue;default:if(!(t=_.trys,(t=t.length>0&&t[t.length-1])||6!==op[0]&&2!==op[0])){_=0;continue}if(3===op[0]&&(!t||op[1]>t[0]&&op[1]<t[3])){_.label=op[1];break}if(6===op[0]&&_.label<t[1]){_.label=t[1],t=op;break}if(t&&_.label<t[2]){_.label=t[2],_.ops.push(op);break}t[2]&&_.ops.pop(),_.trys.pop();continue}op=body.call(thisArg,_)}catch(e){op=[6,e],y=0}finally{f=t=0}if(5&op[0])throw op[1];return{value:op[0]?op[1]:void 0,done:!0}}([n,v])}}}function getBrightness(hexCode){var _hexCode=hexCode.replace("#","");return(299*parseInt(_hexCode.substr(0,2),16)+587*parseInt(_hexCode.substr(2,2),16)+114*parseInt(_hexCode.substr(4,2),16))/1e3}function adaptForeground(actionColor){return getBrightness(actionColor)<140?actionColor:"#000000"}function hexToRgbA(hexColor,opacity){var c;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(hexColor))return 3===(c=hexColor.substring(1).split("")).length&&(c=[c[0],c[0],c[1],c[1],c[2],c[2]]),"rgba("+[(c="0x"+c.join(""))>>16&255,c>>8&255,255&c].join(",")+","+(opacity||1)+")";throw new Error("Bad Hex")}var utils=Object.freeze({__proto__:null,fallbackColor:"#000000",fallbackColorBright:"#ffffff",isBright:function(hexColor){return getBrightness(hexColor)>140},adaptForeground:adaptForeground,hexToRgbA:hexToRgbA}),TemplateExample=[{name:"color_1",reference:"white/black"},{name:"color_2",reference:"black/white"},{name:"color_3",reference:"primery-1"},{name:"color_4",reference:"primery-2"},{name:"color_5",reference:"primery-3"},{name:"color_11",reference:"color-1"},{name:"color_12",reference:"color-2"},{name:"color_13",reference:"color-3"},{name:"color_14",reference:"color-4"},{name:"color_15",reference:"color-5"},{name:"color_16",reference:"color-6"},{name:"color_17",reference:"color-7"},{name:"color_18",reference:"color-8"},{name:"color_19",reference:"color-9"},{name:"color_20",reference:"color-10"},{name:"color_21",reference:"color-11"},{name:"color_22",reference:"color-12"},{name:"color_23",reference:"color-13"},{name:"color_24",reference:"color-14"},{name:"color_25",reference:"color-15"},{name:"color_26",reference:"color-16"},{name:"color_27",reference:"color-17"},{name:"color_28",reference:"color-18"},{name:"color_29",reference:"color-19"},{name:"color_30",reference:"color-20"},{name:"color_31",reference:"color-21"},{name:"color_32",reference:"color-22"},{name:"color_33",reference:"color-23"},{name:"color_34",reference:"color-24"},{name:"color_35",reference:"color-25"}],themes={darkTheme:["#FFFFFF","#000000","#ED1C24","#0088CB","#FFCB05","#000000","#616161","#8C8C8C","#F3F3F3","#FFFFFF","#074B54","#0E95A7","#15E0FB","#89EFFC","#D9FBFF","#071F4E","#0E3E9B","#155DE9","#83A8F0","#ADC6F8","#221333","#442565","#663898","#9C7FBA","#C4AEDD","#27331B","#4E6636","#749851","#9BCB6C","#CAE5AF"]};var palettes=Object.keys(themes).reduce((function(acc,curr){var _a;return __assign(__assign({},acc),((_a={})[curr]=function(preset){return preset.map((function(color,i){return __assign(__assign({},TemplateExample[i]),{value:color})}))}(themes[curr]),_a))}),{}),COLORS={BG_COLOR:11,SECONDARY_COLOR:13,COLOR4:14,TEXT_COLOR:15,COLOR7:17,ACTION_COLOR:18};function commonStyles(colors){return{editor:{background:colors.bgColor,color:colors.textColor}}}var PALETTE_PRESETS={darkTheme:palettes.darkTheme},getColorValue=function(palette,code){return function(palette,code){return palette[code<=5?code-1:code-6]}(palette,code).value},ThemeGenerator=function(){function ThemeGenerator(isViewer,palette,themeGeneratorFunctions){void 0===themeGeneratorFunctions&&(themeGeneratorFunctions=[]),this.setPalette(palette),this.themeGeneratorFunctions=themeGeneratorFunctions,this.isViewer=isViewer}return ThemeGenerator.prototype.setPalette=function(palette){if("string"==typeof palette){if(!(palette in PALETTE_PRESETS))throw Error("Palette "+palette+" is unknown. Supported themes: "+PALETTE_PRESETS.toString());this.palette=PALETTE_PRESETS[palette]}else!function(palette){if(palette){if(0===palette.length)throw Error("Received empty palette colors array");var receivedColors=palette.map((function(val){return val.name})),missingColors=difference(Object.values(COLORS).map((function(num){return"color_"+num})),receivedColors);if(missingColors.length>0){var error=[];throw error.push("Some palette colors were not supplied:","\n"+missingColors+"\n","Palette array must include the following colors:",Object.entries(COLORS).map((function(entry){return entry[1]+" - "+entry[0]})).toString().split(",").join("\n"),""),Error(error.join("\n"))}}}(palette),this.palette=palette},ThemeGenerator.prototype.getStylesObject=function(){if(!this.palette)return{};var colors={actionColor:getColorValue(this.palette,COLORS.ACTION_COLOR),bgColor:getColorValue(this.palette,COLORS.BG_COLOR),textColor:getColorValue(this.palette,COLORS.TEXT_COLOR),secondaryColor:getColorValue(this.palette,COLORS.SECONDARY_COLOR),color7:hexToRgbA(getColorValue(this.palette,COLORS.COLOR7),.7),color4:getColorValue(this.palette,COLORS.COLOR4)},pluginThemes=this.themeGeneratorFunctions.map((function(themeGen){return themeGen(colors,utils)})),appStyles=this.isViewer?function(colors){var actionColor=colors.actionColor;return{quote:{"border-left-color":actionColor,"border-right-color":actionColor}}}(colors):merge(function(colors){var actionColor=adaptForeground(colors.actionColor),blockActionColorSettings={cursor:"default",boxShadow:"0 0 0 3px "+colors.actionColor},toolbarButtonStyle={color:actionColor,fill:actionColor},sliderTrack={background:actionColor},thumb=__assign(__assign({},sliderTrack),{border:"4px solid "+actionColor}),buttonsFooterStyle={"& $button_primary":{backgroundColor:actionColor},"& $button_primary:hover:not([disabled])":{backgroundColor:hexToRgbA(actionColor,.8)},"& $button_primary:disabled":{backgroundColor:"rgba(0, 0, 0, 0.4)"},"& $button_secondary":{color:actionColor,borderColor:actionColor},"& $button_secondary:hover":{color:hexToRgbA(actionColor,.6),borderColor:hexToRgbA(actionColor,.6)},"& $button_secondary:disabled":{backgroundColor:"rgba(0, 0, 0, 0.4)"}};return{hasFocus:blockActionColorSettings,pluginContainer:{},pluginContainerWrapper:{"&$pluginContainer:hover":blockActionColorSettings,"&$pluginContainer&$hasFocus":blockActionColorSettings},selectionList:{"& $selectionListOption:hover":{backgroundColor:hexToRgbA(actionColor,.05)},"& $selectionListOption$selectionListOption_selected":{color:actionColor,backgroundColor:hexToRgbA(actionColor,.1)},"& $selectionListOption_selected$selectionListOption:hover":{backgroundColor:hexToRgbA(actionColor,.1)}},selectionListOption:{},selectionListOption_selected:{},checkbox_wrapper:{"& $checkbox_icon":{border:"solid 1px "+actionColor},"& $checkbox_icon:hover":{color:hexToRgbA(actionColor,.1)},"& $checkbox_infoIcon:hover":{color:actionColor},"& $checkbox_inputLabel:hover $checkbox_icon_unchecked":{backgroundColor:hexToRgbA(actionColor,.1)},"& $checkbox_icon_checked":{backgroundColor:actionColor}},checkbox_icon:{},checkbox_infoIcon:{},checkbox_icon_checked:{},checkbox_inputLabel:{},checkbox_icon_unchecked:{},tabs_panel:{},tabs:{"& $tabs_panel":{padding:"24px 24px 30px"}},tabs_headers_option_selected:{},tabs_headers:{"& $tabs_headers_option_selected":{borderBottom:"solid 3px "+actionColor}},button_primary:{},button_secondary:{},settingsPanel_footer_fixed:buttonsFooterStyle,button_inputModal_modal_footer:buttonsFooterStyle,video_modal_container_big:buttonsFooterStyle,video_modal_container_small:buttonsFooterStyle,sliderWithInput_content:{"& $slider::-webkit-slider-runnable-track":sliderTrack,"& $slider::-webkit-slider-thumb":thumb},slider:{},radioGroup_button:{},radioGroup_input:{},radioGroup:{"& $radioGroup_input:checked + $radioGroup_button::after":{backgroundColor:actionColor}},colorPicker_add_color_button:{"& $colorPicker_add_color_label":{color:actionColor}},colorPicker_add_color_label:{},colorPicker_reset_color_button:{"& $colorPicker_reset_color_label":{color:actionColor}},colorPicker_reset_color_label:{},buttonsWrapper:{"& $buttonWrapper:hover button:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:focus button:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:hover label:not([disabled]) svg":toolbarButtonStyle,"& $buttonWrapper:focus label:not([disabled]) svg":toolbarButtonStyle},buttonWrapper:{"& $pluginToolbarButton:not($pluginToolbarButton_disabled)$pluginToolbarButton_active":toolbarButtonStyle,"& $pluginToolbarButton:not($pluginToolbarButton_disabled):focus svg":toolbarButtonStyle,"& $pluginToolbarButton:not($pluginToolbarButton_disabled):hover":toolbarButtonStyle},inlineToolbarButton_active:{color:actionColor},inlineToolbarButton_icon:{"&:hover":{color:actionColor,"& svg":{fill:actionColor}}},inlineToolbarButton_wrapper:{"& $inlineToolbarButton_icon:hover":{color:actionColor},"& $inlineToolbarButton_icon:hover svg":{fill:actionColor}},pluginToolbarButton_disabled:{},pluginToolbarButton_active:{},pluginToolbarButton:{"&:not($pluginToolbarButton_disabled):hover >:not($Dropdown-root) svg":{fill:actionColor}},"Dropdown-control":{},"Dropdown-option":{},"Dropdown-root":{"& $Dropdown-control:hover":{color:actionColor},"& $Dropdown-option:hover":{color:actionColor},"& $Dropdown-option:hover svg":toolbarButtonStyle}}}(colors),function(colors,utils){var adaptedActionColor=utils.adaptForeground(colors.actionColor),bgColor=colors.bgColor,actionColor=colors.actionColor;return{quote:{"border-left-color":actionColor,"border-right-color":actionColor},sideToolbar_floatingContainer:{textAlign:"start"},sideToolbar_floatingIcon:{"&:hover":{fill:actionColor}},footerToolbar:{"&$staticToolbar":{background:bgColor}},staticToolbar:{},footerToolbarButton_icon:{color:colors.textColor},footerToolbarButton_wrapper:{"& $footerToolbarButton:hover:not([disabled]) $footerToolbarButton_icon":{color:actionColor}},footerToolbarButton:{},inlineToolbarButton_active:{color:adaptedActionColor,fill:adaptedActionColor},inlineToolbarDropdownButton:{"&:hover svg":{fill:adaptedActionColor}}}}(colors,utils));return merge.apply(void 0,function(){for(var s=0,i=0,il=arguments.length;i<il;i++)s+=arguments[i].length;var r=Array(s),k=0;for(i=0;i<il;i++)for(var a=arguments[i],j=0,jl=a.length;j<jl;j++,k++)r[k]=a[j];return r}([commonStyles(colors),appStyles],pluginThemes))},ThemeGenerator}(),defaultTheme={modalTheme:{content:{}}};function createThemeStrategy(){var themeState={};return function(args){return function(themeState,args){var isViewer=args.isViewer,themeGeneratorFunctions=args.themeGeneratorFunctions,palette=args.palette,cssOverride=args.cssOverride,sheets=new SheetsRegistry;if(themeState.prevPalette!==palette||!themeState.rawCss)if(palette){themeState.prevPalette=palette;var themeGenerator=new ThemeGenerator(isViewer,palette,themeGeneratorFunctions),sheet=jss.createStyleSheet(themeGenerator.getStylesObject());sheets.add(sheet),themeState.paletteClasses=sheet.classes,themeState.rawCss=sheets.toString()}else themeState.paletteClasses={},themeState.rawCss="";return{theme:__assign(__assign(__assign({},defaultTheme),themeState.paletteClasses),cssOverride),rawCss:themeState.rawCss}}(themeState,args)}}jss.setup(preset());function pluginsStrategy(isViewer,plugins,childProps,cssOverride,content){var strategy;if(void 0===plugins&&(plugins=[]),isViewer){var emptyStrategy={config:{},typeMappers:[],decorators:[],inlineStyleMappers:[]};strategy=plugins.reduce((function(prev,curr){return function(prev,curr,cssOverride,content){var _a,type=curr.type,config=curr.config,typeMapper=curr.typeMapper,decorator=curr.decorator,inlineStyleMapper=curr.inlineStyleMapper,finalConfig=__assign(__assign({},prev.config),((_a={})[type]=config,_a));return{config:finalConfig,typeMappers:typeMapper&&prev.typeMappers.concat([typeMapper])||prev.typeMappers,decorators:decorator&&prev.decorators.concat([decorator(cssOverride,config)])||prev.decorators,inlineStyleMappers:inlineStyleMapper&&content&&prev.inlineStyleMappers.concat([null==inlineStyleMapper?void 0:inlineStyleMapper(finalConfig,content)])||prev.inlineStyleMappers}}(prev,curr,cssOverride,content)}),emptyStrategy)}else{emptyStrategy={config:{},plugins:[],ModalsMap:{}};strategy=plugins.reduce((function(prev,curr){return function(prev,curr){var _a,type=curr.type,config=curr.config,createPlugin=curr.createPlugin,ModalsMap=curr.ModalsMap;return{config:__assign(__assign({},prev.config),(_a={},_a[type]=config,_a)),plugins:prev.plugins.concat(createPlugin),ModalsMap:__assign(__assign({},prev.ModalsMap),ModalsMap)}}(prev,curr)}),emptyStrategy)}var childPluginProps=function(isViewer,_a,content){var _b=_a.config,config=void 0===_b?{}:_b,_c=_a.plugins,plugins=void 0===_c?[]:_c,_d=_a.ModalsMap,ModalsMap=void 0===_d?{}:_d,_e=_a.typeMappers,typeMappers=void 0===_e?[]:_e,_f=_a.decorators,decorators=void 0===_f?[]:_f,_g=_a.inlineStyleMappers,inlineStyleMappers=void 0===_g?[]:_g,_h=_a.theme,theme=void 0===_h?{}:_h;return isViewer?{config:config,typeMappers:typeMappers,decorators:decorators.map((function(decorator){return decorator(theme,config)})),inlineStyleMappers:content?inlineStyleMappers.map((function(mapper){return mapper(config,content)})):[]}:{config:config,plugins:plugins,ModalsMap:ModalsMap}}(isViewer,childProps,content);return merge(strategy,childPluginProps)}function localeStrategy(locale){return void 0===locale&&(locale="en"),__awaiter(this,void 0,void 0,(function(){var localeResource,err_1;return __generator(this,(function(_a){switch(_a.label){case 0:if("en"===locale)return[2,{locale:locale}];_a.label=1;case 1:return _a.trys.push([1,3,,4]),[4,import("wix-rich-content-common/dist/statics/locale/messages_"+locale+".json").then((function(res){return res.default}))];case 2:return localeResource=_a.sent(),[2,{locale:locale,localeResource:localeResource}];case 3:throw err_1=_a.sent(),new Error("error while loading locale "+locale+":\n"+err_1);case 4:return[2]}}))}))}var module,x,lib=(function(module,exports){Object.defineProperty(exports,"__esModule",{value:!0}),exports.isPresent=function(t){return null!=t},exports.isDefined=function(t){return void 0!==t},exports.isFilled=function(t){return null!==t}}(module={exports:{}},module.exports),module.exports);(x=lib)&&x.__esModule&&Object.prototype.hasOwnProperty.call(x,"default")&&x.default;lib.isPresent;var lib_2=lib.isDefined,RicosEngine=(lib.isFilled,function(_super){function RicosEngine(props){var _this=_super.call(this,props)||this;return _this.updateLocale=function(){return __awaiter(_this,void 0,void 0,(function(){var _a,locale,children,_this=this;return __generator(this,(function(_b){switch(_b.label){case 0:return _a=this.props,locale=_a.locale,[4,localeStrategy((null==(children=_a.children)?void 0:children.props.locale)||locale).then((function(localeData){_this.setState({localeStrategy:localeData})}))];case 1:return _b.sent(),[2]}}))}))},_this.state={localeStrategy:{locale:props.locale}},_this.themeStrategy=createThemeStrategy(),_this}return function(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}(RicosEngine,_super),RicosEngine.prototype.componentDidMount=function(){this.updateLocale()},RicosEngine.prototype.componentWillReceiveProps=function(newProps){newProps.locale!==this.props.locale&&this.updateLocale()},RicosEngine.prototype.runStrategies=function(){var _a=this.props,cssOverride=_a.cssOverride,theme=_a.theme,_b=_a.plugins,plugins=void 0===_b?[]:_b,_c=_a.isViewer,isViewer=void 0!==_c&&_c,content=_a.content,children=_a.children,localeStrategy=this.state.localeStrategy,themeGeneratorFunctions=plugins.map((function(plugin){return plugin.theme})).filter(lib_2),_d=this.themeStrategy({isViewer:isViewer,themeGeneratorFunctions:themeGeneratorFunctions,palette:null==theme?void 0:theme.palette,cssOverride:cssOverride}),themeStrategyResult=_d.theme,rawCss=_d.rawCss;return{strategyProps:merge({theme:themeStrategyResult},pluginsStrategy(isViewer,plugins,children.props,themeStrategyResult,content),localeStrategy),rawCss:rawCss}},RicosEngine.prototype.render=function(){var _a=this.props,_rcProps=_a._rcProps,children=_a.children,isMobile=_a.isMobile,toolbarSettings=_a.toolbarSettings,_b=_a.modalSettings,modalSettings=void 0===_b?{}:_b,placeholder=_a.placeholder,content=_a.content,RicosModal=_a.RicosModal,onError=_a.onError,_c=this.runStrategies(),strategyProps=_c.strategyProps,rawCss=_c.rawCss,_d=toolbarSettings||{},useStaticTextToolbar=_d.useStaticTextToolbar,textToolbarContainer=_d.textToolbarContainer,getToolbarSettings=_d.getToolbarSettings,openModal=modalSettings.openModal,closeModal=modalSettings.closeModal,ariaHiddenId=modalSettings.ariaHiddenId,mergedRCProps=merge(strategyProps,_rcProps,{isMobile:isMobile,textToolbarType:isMobile||!textToolbarContainer&&!useStaticTextToolbar?"inline":"static",config:{getToolbarSettings:getToolbarSettings},initialState:content,placeholder:placeholder,onError:onError,helpers:{openModal:openModal,closeModal:closeModal}},children.props);return[React.createElement("style",{type:"text/css",key:"styleElement"},rawCss),React.createElement(RicosModal,__assign({ariaHiddenId:ariaHiddenId},mergedRCProps,{key:"ricosElement"}),Children.only(React.cloneElement(children,__assign({},mergedRCProps))))]},RicosEngine.defaultProps={locale:"en",isMobile:!1},RicosEngine}(Component)),emptyState={blocks:[],entityMap:{}},shouldRenderChild=function(expectedChildName,children){var child=Children.only(children),childName=null==child?void 0:child.type.displayName;return!!children&&childName===expectedChildName};export{RicosEngine,emptyState,shouldRenderChild};
//# sourceMappingURL=index.js.map
import { Component, FunctionComponent } from 'react';
import { ThemeStrategyFunction } from './themeStrategy/themeStrategy';
import { RicosEditorProps, RicosViewerProps, RichContentChild, RichContentProps } from './types';

@@ -12,2 +13,3 @@ interface EngineProps extends RicosEditorProps, RicosViewerProps {

export declare class RicosEngine extends Component<EngineProps, EngineState> {
themeStrategy: ThemeStrategyFunction;
constructor(props: EngineProps);

@@ -25,3 +27,3 @@ static defaultProps: {

} & import("./types").PluginsStrategy & RichContentProps;
rawCss: string;
rawCss: string | undefined;
};

@@ -28,0 +30,0 @@ render(): JSX.Element[];

@@ -1,7 +0,15 @@

import { PalettePreset, Palette, ThemeGeneratorFunction } from './themeTypes';
import { RicosCssOverride } from '../types';
export default function themeStrategy(isViewer: boolean, themeGeneratorFunctions?: ThemeGeneratorFunction[], palette?: Palette | PalettePreset, cssOverride?: RicosCssOverride): {
import { PalettePreset, Palette, ThemeGeneratorFunction, RicosCssOverride } from './themeTypes';
interface ThemeStrategyArgs {
isViewer: boolean;
themeGeneratorFunctions?: ThemeGeneratorFunction[];
palette?: Palette | PalettePreset;
cssOverride?: RicosCssOverride;
}
interface ThemeStrategyResult {
theme: RicosCssOverride;
rawCss: string;
};
rawCss?: string;
}
export declare type ThemeStrategyFunction = (args: ThemeStrategyArgs) => ThemeStrategyResult;
export default function createThemeStrategy(): ThemeStrategyFunction;
export {};
//# sourceMappingURL=themeStrategy.d.ts.map
{
"name": "ricos-common",
"version": "7.11.1-alpha.3",
"version": "7.11.1-alpha.4",
"author": {

@@ -62,3 +62,3 @@ "name": "Matan Harsat",

"jss-preset-default": "^10.1.1",
"wix-rich-content-common": "7.11.1-alpha.3"
"wix-rich-content-common": "7.11.1-alpha.4"
},

@@ -65,0 +65,0 @@ "jest": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc