wiki.techinc.nl/tests/phpunit/data/resourceloader/codex/modules/Icon.js
Roan Kattouw fe62ebafd2 CodexModule: Remove CODEX_MODULE_DIR, instead use CODEX_LIBRARY_DIR
CODEX_MODULE_DIR is always the /modules subdirectory of
CODEX_LIBRARY_DIR, so remove it and derive it that way instead.

- Update tests accordingly
- Rename test data files accordingly
- Use CODEX_LIBRARY_DIR in one place where we had neglected to use a
  constant

Change-Id: Ieb347c2d128f3addfb11f6aca79d63969434f342
2024-05-15 17:12:20 -04:00

1 line
4.1 KiB
JavaScript

"use strict";const t=require("vue"),d=require("./constants.js"),h=require("./_plugin-vue_export-helper.js"),m='<path d="M11.53 2.3A1.85 1.85 0 0010 1.21 1.85 1.85 0 008.48 2.3L.36 16.36C-.48 17.81.21 19 1.88 19h16.24c1.67 0 2.36-1.19 1.52-2.64zM11 16H9v-2h2zm0-4H9V6h2z"/>',v='<path d="M12.43 14.34A5 5 0 0110 15a5 5 0 113.95-2L17 16.09V3a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h10a2 2 0 001.45-.63z"/><circle cx="10" cy="10" r="3"/>',g='<path d="M10 0a10 10 0 1010 10A10 10 0 0010 0zm5.66 14.24-1.41 1.41L10 11.41l-4.24 4.25-1.42-1.42L8.59 10 4.34 5.76l1.42-1.42L10 8.59l4.24-4.24 1.41 1.41L11.41 10z"/>',f='<path d="m4.34 2.93 12.73 12.73-1.41 1.41L2.93 4.35z"/><path d="M17.07 4.34 4.34 17.07l-1.41-1.41L15.66 2.93z"/>',z='<path d="M13.728 1H6.272L1 6.272v7.456L6.272 19h7.456L19 13.728V6.272zM11 15H9v-2h2zm0-4H9V5h2z"/>',M='<path d="m17.5 4.75-7.5 7.5-7.5-7.5L1 6.25l9 9 9-9z"/>',L='<path d="M19 3H1v14h18zM3 14l3.5-4.5 2.5 3L12.5 8l4.5 6z"/><path d="M19 5H1V3h18zm0 12H1v-2h18z"/>',y='<path d="M8 19a1 1 0 001 1h2a1 1 0 001-1v-1H8zm9-12a7 7 0 10-12 4.9S7 14 7 15v1a1 1 0 001 1h4a1 1 0 001-1v-1c0-1 2-3.1 2-3.1A7 7 0 0017 7z"/>',C='<path d="M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0zM9 5h2v2H9zm0 4h2v6H9z"/>',k='<path d="M7 1 5.6 2.5 13 10l-7.4 7.5L7 19l9-9z"/>',_='<path d="m4 10 9 9 1.4-1.5L7 10l7.4-7.5L13 1z"/>',H='<path d="M12.2 13.6a7 7 0 111.4-1.4l5.4 5.4-1.4 1.4zM3 8a5 5 0 1010 0A5 5 0 003 8z"/>',S='<path d="M10 20a10 10 0 010-20 10 10 0 110 20Zm-2-5 9-8.5L15.5 5 8 12 4.5 8.5 3 10l5 5Z"/>',w=m,x=v,B=g,E=f,V=z,D=M,F=L,A={langCodeMap:{ar:y},default:C},I={ltr:k,shouldFlip:!0},$={ltr:_,shouldFlip:!0},b=H,K=S;function q(e,o,n){if(typeof e=="string"||"path"in e)return e;if("shouldFlip"in e)return e.ltr;if("rtl"in e)return n==="rtl"?e.rtl:e.ltr;const l=o in e.langCodeMap?e.langCodeMap[o]:e.default;return typeof l=="string"||"path"in l?l:l.ltr}function T(e,o){if(typeof e=="string")return!1;if("langCodeMap"in e){const n=o in e.langCodeMap?e.langCodeMap[o]:e.default;if(typeof n=="string")return!1;e=n}if("shouldFlipExceptions"in e&&Array.isArray(e.shouldFlipExceptions)){const n=e.shouldFlipExceptions.indexOf(o);return n===void 0||n===-1}return"shouldFlip"in e?e.shouldFlip:!1}function u(e){const o=t.ref(null);return t.onMounted(()=>{const n=window.getComputedStyle(e.value).direction;o.value=n==="ltr"||n==="rtl"?n:null}),o}function Z(e){const o=t.ref("");return t.onMounted(()=>{let n=e.value;for(;n&&n.lang==="";)n=n.parentElement;o.value=n?n.lang:null}),o}const J=d.makeStringTypeValidator(d.IconSizes),O=t.defineComponent({name:"CdxIcon",props:{icon:{type:[String,Object],required:!0},iconLabel:{type:String,default:""},lang:{type:String,default:null},dir:{type:String,default:null},size:{type:String,default:"medium",validator:J}},setup(e){const o=t.ref(),n=u(o),l=Z(o),r=t.computed(()=>e.dir||n.value),i=t.computed(()=>e.lang||l.value),s=t.computed(()=>({"cdx-icon--flipped":r.value==="rtl"&&i.value!==null&&T(e.icon,i.value),["cdx-icon--".concat(e.size)]:!0})),a=t.computed(()=>q(e.icon,i.value||"",r.value||"ltr")),c=t.computed(()=>typeof a.value=="string"?a.value:""),p=t.computed(()=>typeof a.value!="string"?a.value.path:"");return{rootElement:o,rootClasses:s,iconSvg:c,iconPath:p}}});const P=["aria-hidden"],Q={key:0},j=["innerHTML"],N=["d"];function R(e,o,n,l,r,i){return t.openBlock(),t.createElementBlock("span",{ref:"rootElement",class:t.normalizeClass(["cdx-icon",e.rootClasses])},[(t.openBlock(),t.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",width:"20",height:"20",viewBox:"0 0 20 20","aria-hidden":e.iconLabel?void 0:!0},[e.iconLabel?(t.openBlock(),t.createElementBlock("title",Q,t.toDisplayString(e.iconLabel),1)):t.createCommentVNode("",!0),e.iconSvg?(t.openBlock(),t.createElementBlock("g",{key:1,innerHTML:e.iconSvg},null,8,j)):(t.openBlock(),t.createElementBlock("path",{key:2,d:e.iconPath},null,8,N))],8,P))],2)}const U=h._export_sfc(O,[["render",R]]);exports.CdxIcon=U;exports.D3=F;exports.D7=K;exports.J6=I;exports.K3=A;exports.K5=B;exports.Q5=E;exports.V7=b;exports.e3=V;exports.k5=x;exports.m5=w;exports.s7=$;exports.useComputedDirection=u;exports.z3=D;