@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
4 lines • 1.64 kB
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
;const index=require("./index-8b802221.js"),mapCustomIcon=(t,o,e)=>{index.isObject(e)?t[o]=e:index.isString(e,1)&&(t[o]={icon:e})},mapIconProp2State=t=>{let o={};return index.isString(t,1)?o={left:{icon:t}}:"object"==typeof t&&null!==t&&(mapCustomIcon(o,"top",t.top),mapCustomIcon(o,"right",t.right),mapCustomIcon(o,"bottom",t.bottom),mapCustomIcon(o,"left",t.left)),o},beforePatchIcon=t=>{var o,e,n;if(null===(o=t.nextState)||void 0===o?void 0:o.has("_icons")){const o=null===(e=t.nextState)||void 0===e?void 0:e.get("_icons");null===(n=t.nextState)||void 0===n||n.set("_icons",mapIconProp2State(o))}},isIcon=t=>"object"==typeof t&&null!==t&&(void 0===t.style||index.isStyle(t.style))&&(void 0===t.label||index.isString(t.label))&&index.isString(t.icon,1),validateIcons=(t,o,e={})=>{index.objectObjectHandler(o,(()=>{var n;try{o=index.parseJson(o)}catch(t){}index.watchValidator(t,"_icons",(t=>{const o="object"==typeof t&&null!==t&&0===Object.keys(t).length;return null===t||o||index.isString(t,1)||"object"==typeof t&&null!==t&&(index.isString(t.left,1)||isIcon(t.left)||index.isString(t.right,1)||isIcon(t.right)||index.isString(t.top,1)||isIcon(t.top)||index.isString(t.bottom,1)||isIcon(t.bottom))}),new Set(["KoliBriIcon"]),o,Object.assign(Object.assign({},e),{defaultValue:{},hooks:{afterPatch:null===(n=e.hooks)||void 0===n?void 0:n.afterPatch,beforePatch:(t,o,n,i)=>{var c,s;"function"==typeof(null===(c=e.hooks)||void 0===c?void 0:c.beforePatch)&&(null===(s=e.hooks)||void 0===s||s.beforePatch(t,o,n,i)),beforePatchIcon(n)}}}))}))};exports.validateIcons=validateIcons;