@nmorph/nmorph-ui-kit 1.0.41 → 1.0.42
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.
package/dist/index.es.js
CHANGED
|
@@ -159,7 +159,7 @@ const V2 = (t) => {
|
|
|
159
159
|
});
|
|
160
160
|
};
|
|
161
161
|
return { placement: d, placementCoords: c };
|
|
162
|
-
}, _e = "@nmorph/nmorph-ui-kit", fe = "module", we = "1.0.
|
|
162
|
+
}, _e = "@nmorph/nmorph-ui-kit", fe = "module", we = "1.0.42", ge = "MIT", xe = {
|
|
163
163
|
node: "18.13.0",
|
|
164
164
|
npm: "8.19.3"
|
|
165
165
|
}, $e = "./dist/index.d.ts", ye = "./dist/index.umd.js", be = "./dist/index.es.js", Me = "./dist/style.css", He = [
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(l,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("vue-i18n"),require("vue")):typeof define=="function"&&define.amd?define(["exports","vue-i18n","vue"],O):(l=typeof globalThis<"u"?globalThis:l||self,O(l.library={},l.vueI18n,l.vue))})(this,function(l,O,e){"use strict";const ae=n=>{const{inputValue:t,rules:o}=n,a=e.ref([]),r=e.ref(!1),c=e.ref(!1);return{touched:c,valid:r,errors:a,validate:()=>{const s=o?.length>0;if(!s){r.value=!0;return}if(t===null)return;const i=t,m=_=>s&&_ in o[0],V=typeof i=="string"&&m("pattern"),B=typeof i=="number"&&m("numberCompareType"),h=(typeof i=="string"||typeof i=="boolean")&&m("booleanCompareType"),u=Array.isArray(i)&&m("arrayCompareType");if(!B&&!V&&!h&&!u){console.warn("The input value and the provided rules do not match");return}if(c.value||(c.value=!0),V){const _=o;a.value=_.reduce((k,p)=>(i.match(p.pattern)||k.push(p.error),k),[])}if(B){const _=(p,w,N)=>{switch(N){case"eq":return p===w;case"gt":return p>w;case"lt":return p<w;case"lte":return p<=w;case"gte":return p>=w}},k=o;a.value=k.reduce((p,w)=>(_(i,w.compareValue,w.numberCompareType)&&p.push(w.error),p),[])}if(h){const _=o;a.value=_.reduce((k,p)=>{let w=!1;const{compareValue:N,booleanCompareType:M}=p;return M==="not-eq"&&(w=i===N),M==="eq"&&(w=i!==N),w||k.push(p.error),k},[])}if(u){const _=o,k=(p,w,N)=>{switch(N){case"contains-one":return p.some(g=>w.includes(g));case"full-eq":if(p.length!==w.length)return!1;const M=[...p].sort(),x=[...w].sort();return M.every((g,y)=>g===x[y]);case"not-contains":return!p.some(g=>w.includes(g))}};a.value=_.reduce((p,w)=>(k(i.map(M=>String(M)),w.compareValue,w.arrayCompareType)||p.push(w.error),p),[])}r.value=a.value.length===0}}},Ct=n=>n.charAt(0).toUpperCase()+n.slice(1),re=n=>JSON.parse(JSON.stringify(n)),P=()=>{const n=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return`${n()}${n()}-${n()}-4${n().substr(0,3)}-${n().substr(0,1)}${n().substr(1,3)}-${n()}${n()}${n()}`},Be={error:{bg:"#000000",text:"red"},success:{bg:"#000000",text:"green"},warn:{bg:"#000000",text:"orange"},info:{bg:"#000000",text:"blue"}},Ve=(n,t)=>{console.log(`%c ${t} `,`background: ${Be[n].bg}; color: ${Be[n].text}`)},vt=(n,t=!1)=>{const o=e.reactive({}),a=e.reactive({}),r=e.reactive(re(n)),c=e.ref(!1),d=e.ref(!1),s=()=>{Object.entries(n).forEach(([B,h])=>{a[B]=ae({inputValue:h.value,rules:h.rules}),a[B].validate()}),c.value=Object.entries(a).every(([B,h])=>h.valid)},i=()=>{Object.entries(n).forEach(([B,h])=>{o[B]=ae({inputValue:h.value,rules:h.rules}),o[B].validate()})},m=(B,h)=>Object.keys(h).filter(f=>{const _=B[f]?JSON.stringify(B[f]):null,k=JSON.stringify(h[f]);return _!==k}),V=B=>{m(r,B).forEach(u=>{const f=B[u];o[u]=ae({inputValue:f.value,rules:f.rules}),o[u].validate()}),Object.assign(r,re(B)),s(),d.value=!0};return e.watch(n,V,{deep:!0}),t&&i(),{fields:o,isFormValid:e.readonly(c),isAnyTouched:e.readonly(d)}},Ne=n=>{const{initialPlacement:t,relativeElement:o,contentDOMElement:a,yOffset:r=0,xOffset:c=0}=n,d=e.ref(t),s=e.ref({x:"0px",y:"0px"}),i=e.inject("nmorph"),m=e.ref(null);e.watch(()=>i.browser,()=>{u()},{deep:!0}),e.onMounted(()=>{u(),V(),B()}),e.onUnmounted(()=>{h()});const V=()=>{let f=a.value;for(;f;){const _=window.getComputedStyle(f);if(_.overflowY==="auto"||_.overflowY==="scroll"){m.value=f;break}f=f.parentElement}},B=()=>{m.value?m.value.addEventListener("scroll",u,{passive:!0}):window.addEventListener("scroll",u,{passive:!0})},h=()=>{m.value?m.value.removeEventListener("scroll",u):window.removeEventListener("scroll",u)},u=()=>{e.nextTick(()=>{if(!a.value||!o){console.warn("There is no relative element or content DOM element");return}const f=a.value.getBoundingClientRect(),_=f.width,k=f.height,p="value"in o?o.value:o;if(!p){console.warn("Relative element is not an HTMLElement");return}const w=p.getBoundingClientRect(),{x:N,y:M}=w,x=w.width,g=w.height,y=window.innerWidth,E=window.innerHeight;d.value==="top"&&M-k<0&&(d.value="bottom"),d.value==="bottom"&&M+g+k>E&&(d.value="top"),d.value==="left"&&N-_<0&&(d.value="right"),d.value==="right"&&N+x+_>y&&(d.value="left"),d.value==="top"&&(s.value={x:`${N+c}px`,y:`${M-k+r}px`}),d.value==="bottom"&&(s.value={x:`${N+c}px`,y:`${M+g+r}px`}),d.value==="right"&&(s.value={x:`${N+x+c}px`,y:`${M+r}px`}),d.value==="left"&&(s.value={x:`${N-_+c}px`,y:`${M+r}px`})})};return{placement:d,placementCoords:s}},Ht={name:"@nmorph/nmorph-ui-kit",type:"module",private:!1,version:"1.0.
|
|
1
|
+
(function(l,O){typeof exports=="object"&&typeof module<"u"?O(exports,require("vue-i18n"),require("vue")):typeof define=="function"&&define.amd?define(["exports","vue-i18n","vue"],O):(l=typeof globalThis<"u"?globalThis:l||self,O(l.library={},l.vueI18n,l.vue))})(this,function(l,O,e){"use strict";const ae=n=>{const{inputValue:t,rules:o}=n,a=e.ref([]),r=e.ref(!1),c=e.ref(!1);return{touched:c,valid:r,errors:a,validate:()=>{const s=o?.length>0;if(!s){r.value=!0;return}if(t===null)return;const i=t,m=_=>s&&_ in o[0],V=typeof i=="string"&&m("pattern"),B=typeof i=="number"&&m("numberCompareType"),h=(typeof i=="string"||typeof i=="boolean")&&m("booleanCompareType"),u=Array.isArray(i)&&m("arrayCompareType");if(!B&&!V&&!h&&!u){console.warn("The input value and the provided rules do not match");return}if(c.value||(c.value=!0),V){const _=o;a.value=_.reduce((k,p)=>(i.match(p.pattern)||k.push(p.error),k),[])}if(B){const _=(p,w,N)=>{switch(N){case"eq":return p===w;case"gt":return p>w;case"lt":return p<w;case"lte":return p<=w;case"gte":return p>=w}},k=o;a.value=k.reduce((p,w)=>(_(i,w.compareValue,w.numberCompareType)&&p.push(w.error),p),[])}if(h){const _=o;a.value=_.reduce((k,p)=>{let w=!1;const{compareValue:N,booleanCompareType:M}=p;return M==="not-eq"&&(w=i===N),M==="eq"&&(w=i!==N),w||k.push(p.error),k},[])}if(u){const _=o,k=(p,w,N)=>{switch(N){case"contains-one":return p.some(g=>w.includes(g));case"full-eq":if(p.length!==w.length)return!1;const M=[...p].sort(),x=[...w].sort();return M.every((g,y)=>g===x[y]);case"not-contains":return!p.some(g=>w.includes(g))}};a.value=_.reduce((p,w)=>(k(i.map(M=>String(M)),w.compareValue,w.arrayCompareType)||p.push(w.error),p),[])}r.value=a.value.length===0}}},Ct=n=>n.charAt(0).toUpperCase()+n.slice(1),re=n=>JSON.parse(JSON.stringify(n)),P=()=>{const n=()=>Math.floor((1+Math.random())*65536).toString(16).substring(1);return`${n()}${n()}-${n()}-4${n().substr(0,3)}-${n().substr(0,1)}${n().substr(1,3)}-${n()}${n()}${n()}`},Be={error:{bg:"#000000",text:"red"},success:{bg:"#000000",text:"green"},warn:{bg:"#000000",text:"orange"},info:{bg:"#000000",text:"blue"}},Ve=(n,t)=>{console.log(`%c ${t} `,`background: ${Be[n].bg}; color: ${Be[n].text}`)},vt=(n,t=!1)=>{const o=e.reactive({}),a=e.reactive({}),r=e.reactive(re(n)),c=e.ref(!1),d=e.ref(!1),s=()=>{Object.entries(n).forEach(([B,h])=>{a[B]=ae({inputValue:h.value,rules:h.rules}),a[B].validate()}),c.value=Object.entries(a).every(([B,h])=>h.valid)},i=()=>{Object.entries(n).forEach(([B,h])=>{o[B]=ae({inputValue:h.value,rules:h.rules}),o[B].validate()})},m=(B,h)=>Object.keys(h).filter(f=>{const _=B[f]?JSON.stringify(B[f]):null,k=JSON.stringify(h[f]);return _!==k}),V=B=>{m(r,B).forEach(u=>{const f=B[u];o[u]=ae({inputValue:f.value,rules:f.rules}),o[u].validate()}),Object.assign(r,re(B)),s(),d.value=!0};return e.watch(n,V,{deep:!0}),t&&i(),{fields:o,isFormValid:e.readonly(c),isAnyTouched:e.readonly(d)}},Ne=n=>{const{initialPlacement:t,relativeElement:o,contentDOMElement:a,yOffset:r=0,xOffset:c=0}=n,d=e.ref(t),s=e.ref({x:"0px",y:"0px"}),i=e.inject("nmorph"),m=e.ref(null);e.watch(()=>i.browser,()=>{u()},{deep:!0}),e.onMounted(()=>{u(),V(),B()}),e.onUnmounted(()=>{h()});const V=()=>{let f=a.value;for(;f;){const _=window.getComputedStyle(f);if(_.overflowY==="auto"||_.overflowY==="scroll"){m.value=f;break}f=f.parentElement}},B=()=>{m.value?m.value.addEventListener("scroll",u,{passive:!0}):window.addEventListener("scroll",u,{passive:!0})},h=()=>{m.value?m.value.removeEventListener("scroll",u):window.removeEventListener("scroll",u)},u=()=>{e.nextTick(()=>{if(!a.value||!o){console.warn("There is no relative element or content DOM element");return}const f=a.value.getBoundingClientRect(),_=f.width,k=f.height,p="value"in o?o.value:o;if(!p){console.warn("Relative element is not an HTMLElement");return}const w=p.getBoundingClientRect(),{x:N,y:M}=w,x=w.width,g=w.height,y=window.innerWidth,E=window.innerHeight;d.value==="top"&&M-k<0&&(d.value="bottom"),d.value==="bottom"&&M+g+k>E&&(d.value="top"),d.value==="left"&&N-_<0&&(d.value="right"),d.value==="right"&&N+x+_>y&&(d.value="left"),d.value==="top"&&(s.value={x:`${N+c}px`,y:`${M-k+r}px`}),d.value==="bottom"&&(s.value={x:`${N+c}px`,y:`${M+g+r}px`}),d.value==="right"&&(s.value={x:`${N+x+c}px`,y:`${M+r}px`}),d.value==="left"&&(s.value={x:`${N-_+c}px`,y:`${M+r}px`})})};return{placement:d,placementCoords:s}},Ht={name:"@nmorph/nmorph-ui-kit",type:"module",private:!1,version:"1.0.42",license:"MIT",engines:{node:"18.13.0",npm:"8.19.3"},types:"./dist/index.d.ts",main:"./dist/index.umd.js",module:"./dist/index.es.js",style:"./dist/style.css",sideEffects:["*.css"],files:["dist","tsconfig.base.json",".eslintrc.base.cjs",".stylelintrc.base.cjs",".prettierrc.base.cjs"],exports:{".":{import:{types:"./dist/index.d.ts",default:"./dist/index.es.js"},require:"./dist/index.umd.js"},"./dist/index.d.ts":"./dist/index.d.ts","./dist/style.css":"./dist/style.css","./dist/styles/abstracts/_variables.scss":"./dist/styles/abstracts/_variables.scss","./dist/styles/abstracts/_mixins.scss":"./dist/styles/abstracts/_mixins.scss","./dist/styles/abstracts/_functions.scss":"./dist/styles/abstracts/_functions.scss","./dist/styles/main.scss":"./dist/styles/main.scss"},scripts:{build:"npm run build:types && vite build","lint:es:check":"eslint --ext .js,.ts,.vue --ignore-path .gitignore src/","lint:es":"eslint --ext .js,.ts,.vue --ignore-path .gitignore --fix src/","lint:style:check":"stylelint ./src/**/*.{scss,vue}","lint:style":"stylelint ./src/**/*.{scss,vue} --fix","lint:check":"npm run lint:es:check && npm run lint:style:check",lint:"npm run lint:es && npm run lint:style","dev:type":"vue-tsc -p ./tsconfig.vue.json",prepare:"cd .. && husky install ./library/.husky","validate-branch-name":"node .husky/validate-branch-name.cjs","validate-commit-msg":"node .husky/validate-commit-msg.cjs","build:types":"vue-tsc --declaration --emitDeclarationOnly --outDir dist"},dependencies:{vue:"^3.4.7","vue-i18n":"^9.9.0"},devDependencies:{"@types/node":"^20.10.8","@types/vue":"^2.0.0","@types/vue-router":"^2.0.0","@typescript-eslint/eslint-plugin":"^6.18.1","@typescript-eslint/parser":"^6.18.1","@vitejs/plugin-vue":"^4.4.0",eslint:"^8.56.0","eslint-config-prettier":"^9.1.0","eslint-plugin-prettier":"^5.1.3","eslint-plugin-storybook":"^0.6.15","eslint-plugin-vue":"^9.19.2","happy-dom":"^13.1.0",husky:"^8.0.3",prettier:"^3.1.1","rollup-plugin-ignore":"^1.0.10",sass:"^1.69.7",stylelint:"^16.1.0","stylelint-config-idiomatic-order":"^10.0.0","stylelint-config-rational-order":"^0.1.2","stylelint-config-recommended-scss":"^14.0.0","stylelint-config-recommended-vue":"^1.5.0","stylelint-config-standard":"^36.0.0","stylelint-config-standard-scss":"^13.0.0","stylelint-order":"^6.0.4","stylelint-prettier":"^5.0.0","stylelint-scss":"^6.0.0",typescript:"^5.3.3",vite:"^4.5.0","vite-plugin-dts":"^3.7.0","vite-plugin-static-copy":"^0.17.1","vite-svg-loader":"^5.1.0","vue-eslint-parser":"^9.4.0","vue-tsc":"^2.0.22"}},It=(n,t)=>{const o=t.filter(a=>a!=="false"&&a&&a!=="undefined").map(a=>`${n}--${a}`);return o.push(n),o.join(" ").trim().replace(/\s+/g," ")},$=n=>Object.entries(n).map(([t,o])=>It(t,o)).join(" ").trim().replace(/\s+/g," "),Ee=n=>n.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),ye=[{name:"--nmorph-info-color",color:"#d4e5edbb"},{name:"--nmorph-info-text-color",color:"#506c80"},{name:"--nmorph-success-color",color:"#67C23A"},{name:"--nmorph-success-text-color",color:"#0b5b1d"},{name:"--nmorph-error-color",color:"#F56C6C"},{name:"--nmorph-error-text-color",color:"#8d3333"},{name:"--nmorph-warn-color",color:"#E6A21C"},{name:"--nmorph-warn-text-color",color:"#7a6712"},{name:"--nmorph-white-color",color:"#ffffff"},{name:"--nmorph-gray-color",color:"#c9d2dee6"},{name:"--nmorph-black-color",color:"#000000"},{name:"--nmorph-overlay-color",color:"#00000095"}],St={darkShade:"#c8c9ca",main:"#eaf2f9",lightShade:"#ffffff",text:"#687b9e",accent:"#4a90e2",focusText:"#ffffff",placeholderText:"#c1c9cf"},Lt={darkShade:"#0f1112",main:"#1c1f21",lightShade:"#292d30",text:"#778288",accent:"#006cb6",focusText:"#ffffff",placeholderText:"#575757"},q="nmorph-data-theme",Tt={themes:{common:ye,light:St,dark:Lt},defaultTheme:"dark",saveCurrentThemeToLS:!0,darkShadeGeneratorCoefficient:-45,lightShadeGeneratorCoefficient:45,other:{baseShadowWidth:"2px",baseShadowBlurCoefficient:"3"}},At=n=>/^#[0-9A-Fa-f]{6}$/.test(n),Dt=n=>{if(!At(n))throw new Error(`Invalid hex color: ${n}`);return n},Ot=(n,t)=>{const o={};return n.forEach(({name:a,color:r})=>{o[a]=r}),t.forEach(({name:a,color:r})=>{o[a]=r}),Object.entries(o).map(([a,r])=>({name:a,color:r}))},$e=(n,t)=>{let o=parseInt(n.substring(1,3),16),a=parseInt(n.substring(3,5),16),r=parseInt(n.substring(5,7),16);o=Math.round(o*(1+t/100)),a=Math.round(a*(1+t/100)),r=Math.round(r*(1+t/100)),o=Math.min(255,Math.max(0,o)),a=Math.min(255,Math.max(0,a)),r=Math.min(255,Math.max(0,r));const c=o.toString(16).padStart(2,"0"),d=a.toString(16).padStart(2,"0"),s=r.toString(16).padStart(2,"0");return`#${c}${d}${s}`},xe=n=>{Ve("warn",`NMORPH(v${Ht.version})`);const t={...Tt,...n},o=u=>{try{const f=Dt(u),_=$e(f,t.darkShadeGeneratorCoefficient),k=$e(f,t.lightShadeGeneratorCoefficient);return[{name:"--nmorph-dark-shade-color",color:_},{name:"--nmorph-light-shade-color",color:k}]}catch(f){console.error(f.message)}},a=u=>Object.entries(u).map(([f,_])=>({name:`--nmorph-${Ee(f)}-color`,color:_})),r=(u,f)=>{const _=w=>w.map(N=>`${N.name}: ${N.color};`).join(" "),k=Object.entries(f).map(([w,N])=>`--${Ee(w)}: ${N};`).join(" "),p=[];return Object.entries(u).forEach(([w,N])=>{if(w==="common")p.push(_(Ot(ye,N)));else{const M=`
|
|
2
2
|
&[${q}='${w}'] {
|
|
3
3
|
${_(N)}
|
|
4
4
|
}
|
|
@@ -2,7 +2,32 @@ import { INmorphApplyTranslation, Locale, TranslateMessages } from '../types';
|
|
|
2
2
|
import { I18n } from 'vue-i18n';
|
|
3
3
|
|
|
4
4
|
export declare const useNmorphTranslation: (data: INmorphApplyTranslation) => I18n<{
|
|
5
|
-
en:
|
|
5
|
+
en: {
|
|
6
|
+
sun: string;
|
|
7
|
+
mon: string;
|
|
8
|
+
tue: string;
|
|
9
|
+
wed: string;
|
|
10
|
+
thu: string;
|
|
11
|
+
fri: string;
|
|
12
|
+
sat: string;
|
|
13
|
+
jan: string;
|
|
14
|
+
feb: string;
|
|
15
|
+
mar: string;
|
|
16
|
+
apr: string;
|
|
17
|
+
may: string;
|
|
18
|
+
jun: string;
|
|
19
|
+
jul: string;
|
|
20
|
+
aug: string;
|
|
21
|
+
sep: string;
|
|
22
|
+
oct: string;
|
|
23
|
+
nov: string;
|
|
24
|
+
dec: string;
|
|
25
|
+
pickADate: string;
|
|
26
|
+
loadingText: string;
|
|
27
|
+
loadFailedText: string;
|
|
28
|
+
noElementPlaceholder: string;
|
|
29
|
+
selectFile: string;
|
|
30
|
+
};
|
|
6
31
|
ru?: TranslateMessages;
|
|
7
32
|
zh?: TranslateMessages;
|
|
8
33
|
}, {}, {}, Locale | "en" | "ru" | "zh", true>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
sun: string;
|
|
3
|
+
mon: string;
|
|
4
|
+
tue: string;
|
|
5
|
+
wed: string;
|
|
6
|
+
thu: string;
|
|
7
|
+
fri: string;
|
|
8
|
+
sat: string;
|
|
9
|
+
jan: string;
|
|
10
|
+
feb: string;
|
|
11
|
+
mar: string;
|
|
12
|
+
apr: string;
|
|
13
|
+
may: string;
|
|
14
|
+
jun: string;
|
|
15
|
+
jul: string;
|
|
16
|
+
aug: string;
|
|
17
|
+
sep: string;
|
|
18
|
+
oct: string;
|
|
19
|
+
nov: string;
|
|
20
|
+
dec: string;
|
|
21
|
+
pickADate: string;
|
|
22
|
+
loadingText: string;
|
|
23
|
+
loadFailedText: string;
|
|
24
|
+
noElementPlaceholder: string;
|
|
25
|
+
selectFile: string;
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|