@nmorph/nmorph-ui-kit 1.1.6 → 1.1.7

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
@@ -217,7 +217,7 @@ const Tt = (t) => {
217
217
  });
218
218
  };
219
219
  return { placement: c, placementCoords: d };
220
- }, V0 = "@nmorph/nmorph-ui-kit", B0 = "module", C0 = "1.1.6", S0 = "MIT", I0 = {
220
+ }, V0 = "@nmorph/nmorph-ui-kit", B0 = "module", C0 = "1.1.7", S0 = "MIT", I0 = {
221
221
  node: ">=18.13.0",
222
222
  npm: ">=8.19.3"
223
223
  }, N0 = "./dist/index.d.ts", L0 = "./dist/index.umd.js", A0 = "./dist/index.es.js", j0 = "./dist/style.css", T0 = [
@@ -252,7 +252,7 @@ const Tt = (t) => {
252
252
  "lint:check": "npm run lint:es:check && npm run lint:style:check",
253
253
  lint: "npm run lint:es && npm run lint:style",
254
254
  "dev:type": "vue-tsc -p ./tsconfig.json",
255
- prepare: "cd .. && husky install ./library/.husky",
255
+ prepare: "command -v husky >/dev/null 2>&1 && cd .. && husky install ./library/.husky || true",
256
256
  "validate-branch-name": "node .husky/validate-branch-name.cjs",
257
257
  "validate-commit-msg": "node .husky/validate-commit-msg.cjs",
258
258
  "build:types": "vue-tsc --declaration --emitDeclarationOnly --outDir dist"
package/dist/index.umd.js CHANGED
@@ -63,7 +63,7 @@
63
63
  text-overflow: ellipsis;
64
64
  `,Pe=()=>`
65
65
  outline: 2px solid var(--nmorph-accent-color);
66
- `,Ur=(n,t=!1)=>{const o=e.reactive({}),r=e.reactive({}),l=e.reactive(fn(n)),c=e.ref(!1),i=e.ref(!1),s=()=>{Object.entries(n).forEach(([f,b])=>{r[f]=gt({inputValue:b.value,rules:b.rules}),r[f].validate()}),c.value=Object.entries(r).every(([f,b])=>b.valid)},d=()=>{Object.entries(n).forEach(([f,b])=>{o[f]=gt({inputValue:b.value,rules:b.rules}),o[f].validate()})},m=(f,b)=>Object.keys(b).filter(p=>{const k=f[p]?JSON.stringify(f[p]):null,B=JSON.stringify(b[p]);return k!==B}),g=f=>{m(l,f).forEach(u=>{const p=f[u];o[u]=gt({inputValue:p.value,rules:p.rules}),o[u].validate()}),Object.assign(l,fn(f)),s(),i.value=!0};return e.watch(n,g,{deep:!0}),t&&d(),{fields:o,isFormValid:e.readonly(c),isAnyTouched:e.readonly(i)}},_n=n=>{const{initialPlacement:t,relativeElement:o,contentDOMElement:r,yOffset:l=0,xOffset:c=0}=n,i=e.ref(t),s=e.ref({x:"0px",y:"0px"}),d=e.inject("nmorph"),m=e.ref(null);e.watch(()=>d.browser,()=>{k()},{deep:!0}),e.onMounted(()=>{k(),b(),u(),f.observe(document.body,{childList:!0,subtree:!0}),g()}),e.onUnmounted(()=>{p(),f.disconnect()});const g=()=>{e.nextTick(()=>{r.value&&k()})},f=new MutationObserver(()=>{g()}),b=()=>{let B=r.value;for(;B;){const h=window.getComputedStyle(B);if(h.overflowY==="auto"||h.overflowY==="scroll"){m.value=B;break}B=B.parentElement}},u=()=>{m.value?m.value.addEventListener("scroll",k,{passive:!0}):window.addEventListener("scroll",k,{passive:!0})},p=()=>{m.value?m.value.removeEventListener("scroll",k):window.removeEventListener("scroll",k)},k=()=>{e.nextTick(()=>{if(!r.value||!o){console.warn("There is no relative element or content DOM element");return}const B=r.value.getBoundingClientRect(),h=B.width,w=B.height,_="value"in o?o.value:o;if(!_){console.warn("Relative element is not an HTMLElement");return}const x=_.getBoundingClientRect(),{x:y,y:V}=x,$=x.width,E=x.height,T=window.innerWidth,v=window.innerHeight;i.value==="top"&&V-w<0&&(i.value="bottom"),i.value==="bottom"&&V+E+w>v&&(i.value="top"),i.value==="left"&&y-h<0&&(i.value="right"),i.value==="right"&&y+$+h>T&&(i.value="left"),i.value==="top"&&(s.value={x:`${y+c}px`,y:`${V-w+l}px`}),i.value==="bottom"&&(s.value={x:`${y+c}px`,y:`${V+E+l}px`}),i.value==="right"&&(s.value={x:`${y+$+c}px`,y:`${V+l}px`}),i.value==="left"&&(s.value={x:`${y-h+c}px`,y:`${V+l}px`})})};return{placement:i,placementCoords:s}},Yr={name:"@nmorph/nmorph-ui-kit",type:"module",private:!1,version:"1.1.6",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",watch:"vite build --watch","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.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-styled-components/core":"^1.9.0",vue:"^3.5.13","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":"^15.11.7",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.0.4","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.1.6",vite:"^4.5.0","vite-plugin-dts":"^4.3.0","vite-plugin-static-copy":"^0.17.1","vite-svg-loader":"^5.1.0","vue-eslint-parser":"^9.4.0","vue-tsc":"^1.6.5"}},bn={error:{bg:"#000000",text:"red"},success:{bg:"#000000",text:"green"},warn:{bg:"#000000",text:"orange"},info:{bg:"#000000",text:"blue"}},kn=(n,t)=>{console.log(`%c ${t} `,`background: ${bn[n].bg}; color: ${bn[n].text}`)},Bn={info:"#d4e5edbb",infoText:"#506c80",success:"#67C23A",successText:"#0b5b1d",error:"#F56C6C",errorText:"#8d3333",warn:"#E6A21C",warnText:"#7a6712",gray:"#c9d2dee6",white:"#ffffff",black:"#000000",overlay:"#00000095"},Gr={darkShade:"#c8c9ca",main:"#e9ecec",lightShade:"#fdfdfd",text:"#687b9e",accent:"#4a90e2",focusText:"#ffffff",placeholderText:"#c1c9cf",semiContrastText:"#8a9dc0",contrastText:"#b4c4de"},Xr={darkShade:"#0f1112",main:"#1c1f21",lightShade:"#292d30",text:"#778288",accent:"#006cb6",focusText:"#ffffff",placeholderText:"#575757",semiContrastText:"#9caab0",contrastText:"#c3cdd1"},_e="nmorph-data-theme",Kr={themes:{common:Bn,light:Gr,dark:Xr},defaultTheme:"dark",saveCurrentThemeToLS:!0,darkShadeGeneratorCoefficient:-45,lightShadeGeneratorCoefficient:45,other:{baseShadowWidth:"3.5px",baseShadowBlurCoefficient:"2"}},Qr=n=>/^#[0-9A-Fa-f]{6}$/.test(n),Zr=n=>{if(!Qr(n))throw new Error(`Invalid hex color: ${n}`);return n},Jr=(n,t)=>{const o={};return n.forEach(({name:r,color:l})=>{o[r]=l}),t.forEach(({name:r,color:l})=>{o[r]=l}),Object.entries(o).map(([r,l])=>({name:r,color:l}))},xn=(n,t)=>{let o=parseInt(n.substring(1,3),16),r=parseInt(n.substring(3,5),16),l=parseInt(n.substring(5,7),16);o=Math.round(o*(1+t/100)),r=Math.round(r*(1+t/100)),l=Math.round(l*(1+t/100)),o=Math.min(255,Math.max(0,o)),r=Math.min(255,Math.max(0,r)),l=Math.min(255,Math.max(0,l));const c=o.toString(16).padStart(2,"0"),i=r.toString(16).padStart(2,"0"),s=l.toString(16).padStart(2,"0");return`#${c}${i}${s}`},yn=n=>{kn("warn",`NMORPH(v${Yr.version})`);const t={...Kr,...n},o=u=>{try{const p=Zr(u),k=xn(p,t.darkShadeGeneratorCoefficient),B=xn(p,t.lightShadeGeneratorCoefficient);return[{name:"--nmorph-dark-shade-color",color:k},{name:"--nmorph-light-shade-color",color:B}]}catch(p){console.error(p.message)}},r=u=>Object.entries(u).map(([p,k])=>({name:`--nmorph-${hn(p)}-color`,color:k})),l=(u,p)=>{const k=w=>w.map(_=>`${_.name}: ${_.color};`).join(" "),B=Object.entries(p).map(([w,_])=>`--${hn(w)}: ${_};`).join(" "),h=[];return Object.entries(u).forEach(([w,_])=>{const x=r(Bn);if(w==="common")h.push(k(Jr(x,_)));else{const y=`
66
+ `,Ur=(n,t=!1)=>{const o=e.reactive({}),r=e.reactive({}),l=e.reactive(fn(n)),c=e.ref(!1),i=e.ref(!1),s=()=>{Object.entries(n).forEach(([f,b])=>{r[f]=gt({inputValue:b.value,rules:b.rules}),r[f].validate()}),c.value=Object.entries(r).every(([f,b])=>b.valid)},d=()=>{Object.entries(n).forEach(([f,b])=>{o[f]=gt({inputValue:b.value,rules:b.rules}),o[f].validate()})},m=(f,b)=>Object.keys(b).filter(p=>{const k=f[p]?JSON.stringify(f[p]):null,B=JSON.stringify(b[p]);return k!==B}),g=f=>{m(l,f).forEach(u=>{const p=f[u];o[u]=gt({inputValue:p.value,rules:p.rules}),o[u].validate()}),Object.assign(l,fn(f)),s(),i.value=!0};return e.watch(n,g,{deep:!0}),t&&d(),{fields:o,isFormValid:e.readonly(c),isAnyTouched:e.readonly(i)}},_n=n=>{const{initialPlacement:t,relativeElement:o,contentDOMElement:r,yOffset:l=0,xOffset:c=0}=n,i=e.ref(t),s=e.ref({x:"0px",y:"0px"}),d=e.inject("nmorph"),m=e.ref(null);e.watch(()=>d.browser,()=>{k()},{deep:!0}),e.onMounted(()=>{k(),b(),u(),f.observe(document.body,{childList:!0,subtree:!0}),g()}),e.onUnmounted(()=>{p(),f.disconnect()});const g=()=>{e.nextTick(()=>{r.value&&k()})},f=new MutationObserver(()=>{g()}),b=()=>{let B=r.value;for(;B;){const h=window.getComputedStyle(B);if(h.overflowY==="auto"||h.overflowY==="scroll"){m.value=B;break}B=B.parentElement}},u=()=>{m.value?m.value.addEventListener("scroll",k,{passive:!0}):window.addEventListener("scroll",k,{passive:!0})},p=()=>{m.value?m.value.removeEventListener("scroll",k):window.removeEventListener("scroll",k)},k=()=>{e.nextTick(()=>{if(!r.value||!o){console.warn("There is no relative element or content DOM element");return}const B=r.value.getBoundingClientRect(),h=B.width,w=B.height,_="value"in o?o.value:o;if(!_){console.warn("Relative element is not an HTMLElement");return}const x=_.getBoundingClientRect(),{x:y,y:V}=x,$=x.width,E=x.height,T=window.innerWidth,v=window.innerHeight;i.value==="top"&&V-w<0&&(i.value="bottom"),i.value==="bottom"&&V+E+w>v&&(i.value="top"),i.value==="left"&&y-h<0&&(i.value="right"),i.value==="right"&&y+$+h>T&&(i.value="left"),i.value==="top"&&(s.value={x:`${y+c}px`,y:`${V-w+l}px`}),i.value==="bottom"&&(s.value={x:`${y+c}px`,y:`${V+E+l}px`}),i.value==="right"&&(s.value={x:`${y+$+c}px`,y:`${V+l}px`}),i.value==="left"&&(s.value={x:`${y-h+c}px`,y:`${V+l}px`})})};return{placement:i,placementCoords:s}},Yr={name:"@nmorph/nmorph-ui-kit",type:"module",private:!1,version:"1.1.7",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",watch:"vite build --watch","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.json",prepare:"command -v husky >/dev/null 2>&1 && cd .. && husky install ./library/.husky || true","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-styled-components/core":"^1.9.0",vue:"^3.5.13","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":"^15.11.7",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.0.4","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.1.6",vite:"^4.5.0","vite-plugin-dts":"^4.3.0","vite-plugin-static-copy":"^0.17.1","vite-svg-loader":"^5.1.0","vue-eslint-parser":"^9.4.0","vue-tsc":"^1.6.5"}},bn={error:{bg:"#000000",text:"red"},success:{bg:"#000000",text:"green"},warn:{bg:"#000000",text:"orange"},info:{bg:"#000000",text:"blue"}},kn=(n,t)=>{console.log(`%c ${t} `,`background: ${bn[n].bg}; color: ${bn[n].text}`)},Bn={info:"#d4e5edbb",infoText:"#506c80",success:"#67C23A",successText:"#0b5b1d",error:"#F56C6C",errorText:"#8d3333",warn:"#E6A21C",warnText:"#7a6712",gray:"#c9d2dee6",white:"#ffffff",black:"#000000",overlay:"#00000095"},Gr={darkShade:"#c8c9ca",main:"#e9ecec",lightShade:"#fdfdfd",text:"#687b9e",accent:"#4a90e2",focusText:"#ffffff",placeholderText:"#c1c9cf",semiContrastText:"#8a9dc0",contrastText:"#b4c4de"},Xr={darkShade:"#0f1112",main:"#1c1f21",lightShade:"#292d30",text:"#778288",accent:"#006cb6",focusText:"#ffffff",placeholderText:"#575757",semiContrastText:"#9caab0",contrastText:"#c3cdd1"},_e="nmorph-data-theme",Kr={themes:{common:Bn,light:Gr,dark:Xr},defaultTheme:"dark",saveCurrentThemeToLS:!0,darkShadeGeneratorCoefficient:-45,lightShadeGeneratorCoefficient:45,other:{baseShadowWidth:"3.5px",baseShadowBlurCoefficient:"2"}},Qr=n=>/^#[0-9A-Fa-f]{6}$/.test(n),Zr=n=>{if(!Qr(n))throw new Error(`Invalid hex color: ${n}`);return n},Jr=(n,t)=>{const o={};return n.forEach(({name:r,color:l})=>{o[r]=l}),t.forEach(({name:r,color:l})=>{o[r]=l}),Object.entries(o).map(([r,l])=>({name:r,color:l}))},xn=(n,t)=>{let o=parseInt(n.substring(1,3),16),r=parseInt(n.substring(3,5),16),l=parseInt(n.substring(5,7),16);o=Math.round(o*(1+t/100)),r=Math.round(r*(1+t/100)),l=Math.round(l*(1+t/100)),o=Math.min(255,Math.max(0,o)),r=Math.min(255,Math.max(0,r)),l=Math.min(255,Math.max(0,l));const c=o.toString(16).padStart(2,"0"),i=r.toString(16).padStart(2,"0"),s=l.toString(16).padStart(2,"0");return`#${c}${i}${s}`},yn=n=>{kn("warn",`NMORPH(v${Yr.version})`);const t={...Kr,...n},o=u=>{try{const p=Zr(u),k=xn(p,t.darkShadeGeneratorCoefficient),B=xn(p,t.lightShadeGeneratorCoefficient);return[{name:"--nmorph-dark-shade-color",color:k},{name:"--nmorph-light-shade-color",color:B}]}catch(p){console.error(p.message)}},r=u=>Object.entries(u).map(([p,k])=>({name:`--nmorph-${hn(p)}-color`,color:k})),l=(u,p)=>{const k=w=>w.map(_=>`${_.name}: ${_.color};`).join(" "),B=Object.entries(p).map(([w,_])=>`--${hn(w)}: ${_};`).join(" "),h=[];return Object.entries(u).forEach(([w,_])=>{const x=r(Bn);if(w==="common")h.push(k(Jr(x,_)));else{const y=`
67
67
  &[${_e}='${w}'] {
68
68
  ${k(_)}
69
69
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@nmorph/nmorph-ui-kit",
3
3
  "type": "module",
4
4
  "private": false,
5
- "version": "1.1.6",
5
+ "version": "1.1.7",
6
6
  "license": "MIT",
7
7
  "engines": {
8
8
  "node": ">=18.13.0",
@@ -47,7 +47,7 @@
47
47
  "lint:check": "npm run lint:es:check && npm run lint:style:check",
48
48
  "lint": "npm run lint:es && npm run lint:style",
49
49
  "dev:type": "vue-tsc -p ./tsconfig.json",
50
- "prepare": "cd .. && husky install ./library/.husky",
50
+ "prepare": "command -v husky >/dev/null 2>&1 && cd .. && husky install ./library/.husky || true",
51
51
  "validate-branch-name": "node .husky/validate-branch-name.cjs",
52
52
  "validate-commit-msg": "node .husky/validate-commit-msg.cjs",
53
53
  "build:types": "vue-tsc --declaration --emitDeclarationOnly --outDir dist"