Skip to content

Commit

Permalink
Merge branch 'release/2.2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
titouanmathis committed Jun 23, 2022
2 parents c2d5758 + b0ffa40 commit c8ee987
Show file tree
Hide file tree
Showing 32 changed files with 771 additions and 1,299 deletions.
32 changes: 6 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit-workspace",
"version": "2.2.2",
"version": "2.2.3",
"private": true,
"workspaces": [
"packages/*"
Expand Down
2 changes: 1 addition & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit-demo",
"version": "2.2.2",
"version": "2.2.3",
"private": true,
"type": "commonjs",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit-docs",
"version": "2.2.2",
"version": "2.2.3",
"type": "module",
"private": true,
"scripts": {
Expand Down
15 changes: 7 additions & 8 deletions packages/docs/utils/math/ease.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,12 @@ Select an easing function below to see how it will transform the given progress
const name = ref('linear');
const linear = (progress) => progress;
const fn = computed(() => (name.value === 'linear' ? linear : easingFunctions.value[name.value]));
const count = 100;
const count = 90;

onMounted(() => {
import('@studiometa/js-toolkit/utils').then((mod) => {
for (const [key, value] of Object.entries(mod)) {
if (key.startsWith('ease')) {
easingFunctions.value[key] = value;
}
for (const [key, value] of Object.entries(mod.ease)) {
easingFunctions.value[key] = value;
}
});
})
Expand Down Expand Up @@ -106,9 +104,10 @@ Select an easing function below to see how it will transform the given progress
</div>
<div
v-for="i in count"
:key="i"
class="absolute top-full h-full -mt-1 -ml-1 transform transition"
:style="{ left: (i / count) * 100 + '%', '--tw-translate-y': fn(i / count) * -100 + '%' }"
:key="`${i}`"
:data-key="i"
class="absolute bottom-0 flex items-end h-full transition"
:style="{ left: `${((i - 1) / count) * 100}%`, transform: `translateY(${fn((i - 1) / count) * -192}px` }"
>
<div class="w-0.5 h-0.5 bg-black rounded-full" />
</div>
Expand Down
7 changes: 1 addition & 6 deletions packages/js-toolkit/Base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ import RefsManager from './managers/RefsManager.js';
import ServicesManager from './managers/ServicesManager.js';
import EventsManager from './managers/EventsManager.js';
import OptionsManager from './managers/OptionsManager.js';
import { noop } from '../utils/noop.js';

let id = 0;

// eslint-disable-next-line no-undef
const isDev = typeof __DEV__ !== 'undefined' && __DEV__;

/**
* No operation function.
* @returns {void}
*/
function noop() {}

/**
* Test if the managers' instances implement the default manager.
*
Expand Down
8 changes: 4 additions & 4 deletions packages/js-toolkit/Base/managers/ServicesManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useScroll from '../../services/scroll.js';
import useKey from '../../services/key.js';
import useLoad from '../../services/load.js';
import AbstractManager from './AbstractManager.js';
import { hasMethod } from '../utils.js';
import { noop, isFunction } from '../../utils/index.js';

/**
* @typedef {import('../index').default} Base
Expand Down Expand Up @@ -59,7 +59,7 @@ export default class ServicesManager extends AbstractManager {
has(service) {
if (
!(
(hasMethod(this.__base, service) ||
(isFunction(this.__base[service]) ||
// @ts-ignore
this.__base.__hasEvent(service)) &&
this.__services[service]
Expand Down Expand Up @@ -94,10 +94,10 @@ export default class ServicesManager extends AbstractManager {

if (
// @ts-ignore
!(hasMethod(this.__base, service) || this.__base.__hasEvent(service)) ||
!(isFunction(this.__base[service]) || this.__base.__hasEvent(service)) ||
!this.__services[service]
) {
return function noop() {};
return noop;
}
const { add } = this.__services[service]();
const self = this;
Expand Down
11 changes: 0 additions & 11 deletions packages/js-toolkit/Base/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@
* @typedef {import('./index.js').default} Base
*/

/**
* Test if an object has a method.
*
* @param {Object} obj The object to test
* @param {string} name The method's name
* @returns {boolean}
*/
export function hasMethod(obj, name) {
return typeof obj[name] === 'function';
}

/**
* Get a list of elements based on the name of a component.
*
Expand Down
2 changes: 1 addition & 1 deletion packages/js-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@studiometa/js-toolkit",
"version": "2.2.2",
"version": "2.2.3",
"description": "A set of useful little bits of JavaScript to boost your project! 🚀",
"publishConfig": {
"access": "public"
Expand Down
124 changes: 0 additions & 124 deletions packages/js-toolkit/services/Service.js

This file was deleted.

Loading

0 comments on commit c8ee987

Please sign in to comment.