From 5c4d7b0dcda7df2d60b20a312547ecb037e5df1c Mon Sep 17 00:00:00 2001 From: NullSablex <244216261+NullSablex@users.noreply.github.com> Date: Mon, 16 Feb 2026 07:03:41 -0300 Subject: [PATCH] =?UTF-8?q?chore:=20atualiza=20changelog=20para=20a=20vers?= =?UTF-8?q?=C3=A3o=200.1.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 13 +++++++++++++ README.md | 6 ++++++ dist/counterup.esm.js | 2 +- dist/counterup.esm.min.js | 2 +- dist/counterup.umd.js | 2 +- dist/counterup.umd.min.js | 2 +- package.json | 2 +- 7 files changed, 24 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6f3c17..aafe3df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,19 @@ All notable changes to this project are documented in this file. This project follows Semantic Versioning. +## [0.1.1] - 2026-02-16 + +### Added + +- GitHub Actions workflows for CI, release to npm, dependency review, CodeQL, and first-interaction welcome messages. +- Project governance files: `LICENSE`, `CONTRIBUTING.md`, and `CODE_OF_CONDUCT.md`. +- README badges and GitHub Pages demo link. + +### Changed + +- README structure and wording for a cleaner, more professional presentation. +- Build banner generation now reads metadata (including version) from `package.json`. + ## [0.1.0] - 2026-02-16 ### Added diff --git a/README.md b/README.md index 73f65c3..d0d1f84 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ contributions welcome CI CodeQL + demo stars

@@ -30,6 +31,11 @@ npm install counter-up O pacote já inclui os arquivos prontos de `dist/` (ESM, UMD e minificados). Para usar a biblioteca, não é necessário rodar build. +## Demo + +Acesse a demonstração online no GitHub Pages: +`https://nullsablex.github.io/counter-up/demo/` + ## Uso ### ESM (elemento único) diff --git a/dist/counterup.esm.js b/dist/counterup.esm.js index 21348ed..9619cfc 100644 --- a/dist/counterup.esm.js +++ b/dist/counterup.esm.js @@ -1,4 +1,4 @@ -/* counter-up v0.1.0 | Author: NullSablex | https://github.com/NullSablex/counter-up.git | MIT License */ +/* counter-up v0.1.1 | Author: NullSablex | https://github.com/NullSablex/counter-up.git | MIT License */ const easings = { linear: (t) => t, easeInOutQuad: (t) => (t < 0.5 ? 2 * t * t : 1 - Math.pow(-2 * t + 2, 2) / 2), diff --git a/dist/counterup.esm.min.js b/dist/counterup.esm.min.js index bf52a8e..0d50b0b 100644 --- a/dist/counterup.esm.min.js +++ b/dist/counterup.esm.min.js @@ -1,2 +1,2 @@ -/* counter-up v0.1.0 | Author: NullSablex | https://github.com/NullSablex/counter-up.git | MIT License */ +/* counter-up v0.1.1 | Author: NullSablex | https://github.com/NullSablex/counter-up.git | MIT License */ const easings={linear:(t)=>t,easeInOutQuad:(t)=>(t<0.5?2*t*t:1-Math.pow(-2*t+2,2)/2),easeOutCubic:(t)=>1-Math.pow(1-t,3),};const defaultOptions={start:0,end:100,duration:2000,decimals:0,prefix:"",suffix:"",locale:"pt-BR",useGrouping:true,easing:"easeOutCubic",formatter:null,autostart:true,onUpdate:null,onComplete:null,};function toNumber(value,fallback=0){const n=Number(value);return Number.isFinite(n)?n:fallback;}function normalizeOptions(options){const normalized={...options,start:toNumber(options.start,0),end:toNumber(options.end,100),duration:Math.max(0,toNumber(options.duration,2000)),decimals:Math.max(0,Math.floor(toNumber(options.decimals,0))),};normalized.easingFn=typeof normalized.easing==="function"?normalized.easing:easings[normalized.easing]||easings.easeOutCubic;return normalized;}function formatNumber(value,options){if(typeof options.formatter==="function"){return options.formatter(value,options.element,options.index);}const formatted=new Intl.NumberFormat(options.locale,{minimumFractionDigits:options.decimals,maximumFractionDigits:options.decimals,useGrouping:options.useGrouping,}).format(value);return`${options.prefix}${formatted}${options.suffix}`;}function isElement(target){return typeof Element!=="undefined"&&target instanceof Element;}function resolveElements(target){if(typeof target==="string"){return Array.from(document.querySelectorAll(target));}if(isElement(target)){return[target];}if(Array.isArray(target)){return target.filter(isElement);}if(typeof NodeList!=="undefined"&&(target instanceof NodeList||(typeof HTMLCollection!=="undefined"&&target instanceof HTMLCollection))){return Array.from(target).filter(isElement);}return[];}function createCounterInstance(element,userOptions={},index=0){if(!element){throw new Error("counterUp: target element not found.");}let options=normalizeOptions({...defaultOptions,...userOptions,element,index,});const state={value:options.start,from:options.start,to:options.end,elapsed:0,startTime:null,rafId:null,isRunning:false,isPaused:false,destroyed:false,};function render(value,notify=true){state.value=value;element.textContent=formatNumber(value,options);if(notify&&typeof options.onUpdate==="function"){options.onUpdate(value,element,index);}}function cancelFrame(){if(state.rafId!==null){cancelAnimationFrame(state.rafId);state.rafId=null;}}function animate(timestamp){if(!state.isRunning||state.destroyed)return;if(state.startTime===null){state.startTime=timestamp-state.elapsed;}state.elapsed=timestamp-state.startTime;const progress=options.duration===0?1:Math.min(state.elapsed/options.duration,1);const eased=options.easingFn(progress);const nextValue=state.from+(state.to-state.from)*eased;render(nextValue);if(progress<1){state.rafId=requestAnimationFrame(animate);return;}state.isRunning=false;state.isPaused=false;state.elapsed=0;state.startTime=null;render(state.to);if(typeof options.onComplete==="function"){options.onComplete(state.to,element,index);}}function play(from,to){if(state.destroyed)return api;cancelFrame();state.from=toNumber(from,state.value);state.to=toNumber(to,state.to);state.elapsed=0;state.startTime=null;state.isPaused=false;state.isRunning=true;state.rafId=requestAnimationFrame(animate);return api;}function stop(){cancelFrame();state.isRunning=false;state.isPaused=false;state.elapsed=0;state.startTime=null;return api;}function start(){return play(options.start,options.end);}function pause(){if(!state.isRunning)return api;cancelFrame();state.isRunning=false;state.isPaused=true;return api;}function resume(){if(!state.isPaused||state.destroyed)return api;state.isRunning=true;state.isPaused=false;state.rafId=requestAnimationFrame(animate);return api;}function reset(){stop();render(options.start,false);return api;}function set(value){const nextValue=toNumber(value,state.value);stop();state.from=nextValue;state.to=nextValue;render(nextValue);return api;}function update(nextEnd,nextOptions={}){if(state.destroyed)return api;options=normalizeOptions({...options,...nextOptions,element,index,start:nextOptions.start===undefined?state.value:toNumber(nextOptions.start),end:toNumber(nextEnd,options.end),});return play(options.start,options.end);}function destroy(){stop();state.destroyed=true;}const api={start,stop,pause,resume,reset,set,update,destroy,get value(){return state.value;},get running(){return state.isRunning;},get paused(){return state.isPaused;},};render(options.start,false);if(options.autostart){start();}return api;}function createGroupInstance(elements,userOptions){const instances=elements.map((element,index)=>createCounterInstance(element,userOptions,index));const api={start(){instances.forEach((instance)=>instance.start());return api;},stop(){instances.forEach((instance)=>instance.stop());return api;},pause(){instances.forEach((instance)=>instance.pause());return api;},resume(){instances.forEach((instance)=>instance.resume());return api;},reset(){instances.forEach((instance)=>instance.reset());return api;},set(value){if(Array.isArray(value)){instances.forEach((instance,index)=>{instance.set(value[index]??value[value.length-1]??0);});return api;}instances.forEach((instance)=>instance.set(value));return api;},update(nextEnd,nextOptions={}){if(Array.isArray(nextEnd)){instances.forEach((instance,index)=>{instance.update(nextEnd[index]??nextEnd[nextEnd.length-1]??0,nextOptions);});return api;}instances.forEach((instance)=>instance.update(nextEnd,nextOptions));return api;},destroy(){instances.forEach((instance)=>instance.destroy());return api;},get values(){return instances.map((instance)=>instance.value);},get running(){return instances.some((instance)=>instance.running);},get paused(){return instances.some((instance)=>instance.paused);},get count(){return instances.length;},};return api;}export function counterUp(target,userOptions={}){const elements=resolveElements(target);if(elements.length===0){throw new Error("counterUp: target element not found.");}if(elements.length===1){return createCounterInstance(elements[0],userOptions,0);}return createGroupInstance(elements,userOptions);}export default counterUp; \ No newline at end of file diff --git a/dist/counterup.umd.js b/dist/counterup.umd.js index 34b9c2f..c972d54 100644 --- a/dist/counterup.umd.js +++ b/dist/counterup.umd.js @@ -1,4 +1,4 @@ -/* counter-up v0.1.0 | Author: NullSablex | https://github.com/NullSablex/counter-up.git | MIT License */ +/* counter-up v0.1.1 | Author: NullSablex | https://github.com/NullSablex/counter-up.git | MIT License */ (function (global, factory) { if (typeof module === "object" && typeof module.exports === "object") { module.exports = factory(); diff --git a/dist/counterup.umd.min.js b/dist/counterup.umd.min.js index 7984ce7..adb2b73 100644 --- a/dist/counterup.umd.min.js +++ b/dist/counterup.umd.min.js @@ -1,2 +1,2 @@ -/* counter-up v0.1.0 | Author: NullSablex | https://github.com/NullSablex/counter-up.git | MIT License */ +/* counter-up v0.1.1 | Author: NullSablex | https://github.com/NullSablex/counter-up.git | MIT License */ (function(global,factory){if(typeof module==="object"&&typeof module.exports==="object"){module.exports=factory();}else{global.CounterUp=factory();}})(typeof window!=="undefined"?window:this,function(){"use strict";const easings={linear:(t)=>t,easeInOutQuad:(t)=>(t<0.5?2*t*t:1-Math.pow(-2*t+2,2)/2),easeOutCubic:(t)=>1-Math.pow(1-t,3),};const defaultOptions={start:0,end:100,duration:2000,decimals:0,prefix:"",suffix:"",locale:"pt-BR",useGrouping:true,easing:"easeOutCubic",formatter:null,autostart:true,onUpdate:null,onComplete:null,};function toNumber(value,fallback=0){const n=Number(value);return Number.isFinite(n)?n:fallback;}function normalizeOptions(options){const normalized={...options,start:toNumber(options.start,0),end:toNumber(options.end,100),duration:Math.max(0,toNumber(options.duration,2000)),decimals:Math.max(0,Math.floor(toNumber(options.decimals,0))),};normalized.easingFn=typeof normalized.easing==="function"?normalized.easing:easings[normalized.easing]||easings.easeOutCubic;return normalized;}function formatNumber(value,options){if(typeof options.formatter==="function"){return options.formatter(value,options.element,options.index);}const formatted=new Intl.NumberFormat(options.locale,{minimumFractionDigits:options.decimals,maximumFractionDigits:options.decimals,useGrouping:options.useGrouping,}).format(value);return`${options.prefix}${formatted}${options.suffix}`;}function isElement(target){return typeof Element!=="undefined"&&target instanceof Element;}function resolveElements(target){if(typeof target==="string"){return Array.from(document.querySelectorAll(target));}if(isElement(target)){return[target];}if(Array.isArray(target)){return target.filter(isElement);}if(typeof NodeList!=="undefined"&&(target instanceof NodeList||(typeof HTMLCollection!=="undefined"&&target instanceof HTMLCollection))){return Array.from(target).filter(isElement);}return[];}function createCounterInstance(element,userOptions={},index=0){if(!element){throw new Error("counterUp: target element not found.");}let options=normalizeOptions({...defaultOptions,...userOptions,element,index,});const state={value:options.start,from:options.start,to:options.end,elapsed:0,startTime:null,rafId:null,isRunning:false,isPaused:false,destroyed:false,};function render(value,notify=true){state.value=value;element.textContent=formatNumber(value,options);if(notify&&typeof options.onUpdate==="function"){options.onUpdate(value,element,index);}}function cancelFrame(){if(state.rafId!==null){cancelAnimationFrame(state.rafId);state.rafId=null;}}function animate(timestamp){if(!state.isRunning||state.destroyed)return;if(state.startTime===null){state.startTime=timestamp-state.elapsed;}state.elapsed=timestamp-state.startTime;const progress=options.duration===0?1:Math.min(state.elapsed/options.duration,1);const eased=options.easingFn(progress);const nextValue=state.from+(state.to-state.from)*eased;render(nextValue);if(progress<1){state.rafId=requestAnimationFrame(animate);return;}state.isRunning=false;state.isPaused=false;state.elapsed=0;state.startTime=null;render(state.to);if(typeof options.onComplete==="function"){options.onComplete(state.to,element,index);}}function play(from,to){if(state.destroyed)return api;cancelFrame();state.from=toNumber(from,state.value);state.to=toNumber(to,state.to);state.elapsed=0;state.startTime=null;state.isPaused=false;state.isRunning=true;state.rafId=requestAnimationFrame(animate);return api;}function stop(){cancelFrame();state.isRunning=false;state.isPaused=false;state.elapsed=0;state.startTime=null;return api;}function start(){return play(options.start,options.end);}function pause(){if(!state.isRunning)return api;cancelFrame();state.isRunning=false;state.isPaused=true;return api;}function resume(){if(!state.isPaused||state.destroyed)return api;state.isRunning=true;state.isPaused=false;state.rafId=requestAnimationFrame(animate);return api;}function reset(){stop();render(options.start,false);return api;}function set(value){const nextValue=toNumber(value,state.value);stop();state.from=nextValue;state.to=nextValue;render(nextValue);return api;}function update(nextEnd,nextOptions={}){if(state.destroyed)return api;options=normalizeOptions({...options,...nextOptions,element,index,start:nextOptions.start===undefined?state.value:toNumber(nextOptions.start),end:toNumber(nextEnd,options.end),});return play(options.start,options.end);}function destroy(){stop();state.destroyed=true;}const api={start,stop,pause,resume,reset,set,update,destroy,get value(){return state.value;},get running(){return state.isRunning;},get paused(){return state.isPaused;},};render(options.start,false);if(options.autostart){start();}return api;}function createGroupInstance(elements,userOptions){const instances=elements.map((element,index)=>createCounterInstance(element,userOptions,index));const api={start(){instances.forEach((instance)=>instance.start());return api;},stop(){instances.forEach((instance)=>instance.stop());return api;},pause(){instances.forEach((instance)=>instance.pause());return api;},resume(){instances.forEach((instance)=>instance.resume());return api;},reset(){instances.forEach((instance)=>instance.reset());return api;},set(value){if(Array.isArray(value)){instances.forEach((instance,index)=>{instance.set(value[index]??value[value.length-1]??0);});return api;}instances.forEach((instance)=>instance.set(value));return api;},update(nextEnd,nextOptions={}){if(Array.isArray(nextEnd)){instances.forEach((instance,index)=>{instance.update(nextEnd[index]??nextEnd[nextEnd.length-1]??0,nextOptions);});return api;}instances.forEach((instance)=>instance.update(nextEnd,nextOptions));return api;},destroy(){instances.forEach((instance)=>instance.destroy());return api;},get values(){return instances.map((instance)=>instance.value);},get running(){return instances.some((instance)=>instance.running);},get paused(){return instances.some((instance)=>instance.paused);},get count(){return instances.length;},};return api;}function counterUp(target,userOptions={}){const elements=resolveElements(target);if(elements.length===0){throw new Error("counterUp: target element not found.");}if(elements.length===1){return createCounterInstance(elements[0],userOptions,0);}return createGroupInstance(elements,userOptions);}return{counterUp:counterUp,default:counterUp};}); \ No newline at end of file diff --git a/package.json b/package.json index 4b4b366..f78a345 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "counter-up", - "version": "0.1.0", + "version": "0.1.1", "description": "Biblioteca JS pura para animação de contadores numéricos", "author": "NullSablex", "repository": {