vevet 2.8.0 → 2.9.0

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.
@@ -72,7 +72,7 @@ var Callbacks = /** @class */ (function () {
72
72
  */
73
73
  Callbacks.prototype.add = function (target, func, data) {
74
74
  if (data === void 0) { data = {}; }
75
- var id = (0, common_1.randID)('callback');
75
+ var id = (0, common_1.id)('callback');
76
76
  var obj = {
77
77
  id: id,
78
78
  on: true,
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var index = 0;
4
+ /**
5
+ * Generate an ID
6
+ */
7
+ function id(prefix) {
8
+ if (prefix === void 0) { prefix = 'id'; }
9
+ index += 1;
10
+ return "".concat(prefix, "_").concat(index);
11
+ }
12
+ exports.default = id;
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.timeoutCallback = exports.mergeWithoutArrays = exports.randID = void 0;
7
- var randID_1 = __importDefault(require("./randID"));
8
- exports.randID = randID_1.default;
6
+ exports.timeoutCallback = exports.mergeWithoutArrays = exports.id = void 0;
7
+ var id_1 = __importDefault(require("./id"));
8
+ exports.id = id_1.default;
9
9
  var mergeWithoutArrays_1 = __importDefault(require("./mergeWithoutArrays"));
10
10
  exports.mergeWithoutArrays = mergeWithoutArrays_1.default;
11
11
  var timeoutCallback_1 = __importDefault(require("./timeoutCallback"));
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var index = 0;
4
+ /**
5
+ * Generate a random ID
6
+ */
7
+ function orderId(prefix) {
8
+ if (prefix === void 0) { prefix = 'id'; }
9
+ index += 1;
10
+ return "".concat(prefix, "_").concat(index);
11
+ }
12
+ exports.default = orderId;
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  */
6
6
  function randID(prefix) {
7
7
  if (prefix === void 0) { prefix = 'id'; }
8
- var id = "".concat(+new Date(), "_").concat(Math.round(Math.random() * 1000));
8
+ var id = "".concat(+new Date(), "_").concat(Math.round(Math.random() * 1));
9
9
  return "".concat(prefix, "_").concat(id);
10
10
  }
11
11
  exports.default = randID;
@@ -11,7 +11,7 @@ function onScroll(_a) {
11
11
  var container = _a.container, callback = _a.callback, _b = _a.isPassive, isPassive = _b === void 0 ? false : _b;
12
12
  // check if listeners for this element already exist
13
13
  var instance = instances.find(function (data) { return (data.container === container && data.isPassive === isPassive); });
14
- var callbackId = (0, common_1.randID)('scroll-event');
14
+ var callbackId = (0, common_1.id)('scroll-event');
15
15
  // if a listener exists, we just add a new callback to its stack
16
16
  if (instance) {
17
17
  instance.callbacks.push({
@@ -22,7 +22,7 @@ function onScroll(_a) {
22
22
  else {
23
23
  // otherwise we create a new instance
24
24
  instance = {
25
- id: (0, common_1.randID)('scroll-event-instance'),
25
+ id: (0, common_1.id)('scroll-event-instance'),
26
26
  container: container,
27
27
  callbacks: [{
28
28
  id: callbackId,
@@ -1,4 +1,4 @@
1
- import { timeoutCallback, randID } from '../utils/common';
1
+ import { timeoutCallback, id as orderId } from '../utils/common';
2
2
  /**
3
3
  * A class for callbacks' manipulation.
4
4
  */
@@ -52,7 +52,7 @@ export class Callbacks {
52
52
  * });
53
53
  */
54
54
  add(target, func, data = {}) {
55
- const id = randID('callback');
55
+ const id = orderId('callback');
56
56
  const obj = {
57
57
  id,
58
58
  on: true,
@@ -0,0 +1,8 @@
1
+ let index = 0;
2
+ /**
3
+ * Generate an ID
4
+ */
5
+ export default function id(prefix = 'id') {
6
+ index += 1;
7
+ return `${prefix}_${index}`;
8
+ }
@@ -1,4 +1,4 @@
1
- import randID from './randID';
1
+ import id from './id';
2
2
  import mergeWithoutArrays from './mergeWithoutArrays';
3
3
  import timeoutCallback from './timeoutCallback';
4
- export { randID, mergeWithoutArrays, timeoutCallback, };
4
+ export { id, mergeWithoutArrays, timeoutCallback, };
@@ -0,0 +1,8 @@
1
+ let index = 0;
2
+ /**
3
+ * Generate a random ID
4
+ */
5
+ export default function orderId(prefix = 'id') {
6
+ index += 1;
7
+ return `${prefix}_${index}`;
8
+ }
@@ -2,6 +2,6 @@
2
2
  * Generate a random ID
3
3
  */
4
4
  export default function randID(prefix = 'id') {
5
- const id = `${+new Date()}_${Math.round(Math.random() * 1000)}`;
5
+ const id = `${+new Date()}_${Math.round(Math.random() * 1)}`;
6
6
  return `${prefix}_${id}`;
7
7
  }
@@ -1,6 +1,6 @@
1
1
  import { addEventListener, selectOne } from 'vevet-dom';
2
2
  import { SmoothScroll } from '../../components/scroll/smooth-scroll/SmoothScroll';
3
- import { randID } from '../common';
3
+ import { id as orderId } from '../common';
4
4
  let instances = [];
5
5
  /**
6
6
  * Add OnScroll event
@@ -8,7 +8,7 @@ let instances = [];
8
8
  export default function onScroll({ container, callback, isPassive = false, }) {
9
9
  // check if listeners for this element already exist
10
10
  let instance = instances.find((data) => (data.container === container && data.isPassive === isPassive));
11
- const callbackId = randID('scroll-event');
11
+ const callbackId = orderId('scroll-event');
12
12
  // if a listener exists, we just add a new callback to its stack
13
13
  if (instance) {
14
14
  instance.callbacks.push({
@@ -19,7 +19,7 @@ export default function onScroll({ container, callback, isPassive = false, }) {
19
19
  else {
20
20
  // otherwise we create a new instance
21
21
  instance = {
22
- id: randID('scroll-event-instance'),
22
+ id: orderId('scroll-event-instance'),
23
23
  container,
24
24
  callbacks: [{
25
25
  id: callbackId,
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generate an ID
3
+ */
4
+ export default function id(prefix?: string): string;
5
+ //# sourceMappingURL=id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/common/id.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,EAAE,CACtB,MAAM,SAAO,UAIhB"}
@@ -1,5 +1,5 @@
1
- import randID from './randID';
1
+ import id from './id';
2
2
  import mergeWithoutArrays from './mergeWithoutArrays';
3
3
  import timeoutCallback from './timeoutCallback';
4
- export { randID, mergeWithoutArrays, timeoutCallback, };
4
+ export { id, mergeWithoutArrays, timeoutCallback, };
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACH,MAAM,EACN,kBAAkB,EAClB,eAAe,GAClB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/common/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,MAAM,CAAC;AACtB,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACH,EAAE,EACF,kBAAkB,EAClB,eAAe,GAClB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generate a random ID
3
+ */
4
+ export default function orderId(prefix?: string): string;
5
+ //# sourceMappingURL=orderId.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orderId.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/common/orderId.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,OAAO,CAC3B,MAAM,SAAO,UAIhB"}
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "vevet",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "VEVET - A JavaScript library",
5
5
  "browserslist": [
6
6
  "since 2015"
7
7
  ],
8
8
  "scripts": {
9
- "pages-build": "node ./examples-src/compiler/index.js && webpack --config ./examples-src/webpack/prod.js",
9
+ "pages-build": "node ./examples-src/compiler/index.js && NODE_ENV=production webpack --config ./examples-src/webpack/prod.js",
10
10
  "pages-dev": "npm-run-all --parallel pages-dev:pug pages-dev:webpack",
11
11
  "pages-dev:pug": "nodemon --watch ./examples-src/pages --watch ./examples-src/compiler --ext pug,json,ts,js,html,css ./examples-src/compiler/index.js",
12
- "pages-dev:webpack": "webpack serve --config ./examples-src/webpack/dev.js",
12
+ "pages-dev:webpack": "NODE_ENV=development webpack serve --config ./examples-src/webpack/dev.js",
13
13
  "prepare:all": "npm run prepare:es && npm run prepare:cjs && npm run prepare:cdn",
14
14
  "prepare:es": "tsc ./src/ts/index.ts --outDir ./build/es --target es6 --module es6 --moduleResolution node --esModuleInterop true --allowSyntheticDefaultImports true --declaration true --declarationDir ./build/types --declarationMap true",
15
15
  "prepare:cjs": "tsc ./src/ts/index.ts --outDir ./build/cjs --target es5 --module commonjs --moduleResolution node --esModuleInterop true --allowSyntheticDefaultImports true",
@@ -73,7 +73,8 @@
73
73
  "@typescript-eslint/eslint-plugin": "^4.28.1",
74
74
  "@typescript-eslint/parser": "^4.28.1",
75
75
  "babel-loader": "^8.2.2",
76
- "bootstrap": "^5.0.2",
76
+ "base-href-webpack-plugin": "^3.0.1",
77
+ "bootstrap": "^5.1.3",
77
78
  "clean-webpack-plugin": "^4.0.0-alpha.0",
78
79
  "copy-webpack-plugin": "^9.0.1",
79
80
  "css-loader": "^6.2.0",
@@ -1,5 +1,5 @@
1
1
  import { Application } from '../app/Application';
2
- import { timeoutCallback, randID } from '../utils/common';
2
+ import { timeoutCallback, id as orderId } from '../utils/common';
3
3
 
4
4
 
5
5
 
@@ -174,7 +174,7 @@ export class Callbacks<
174
174
  func: NCallbacks.CallbackSettings<Types, Target>['do'],
175
175
  data: NCallbacks.CallbackBaseSettings = {},
176
176
  ): NCallbacks.AddedCallback {
177
- const id = randID('callback');
177
+ const id = orderId('callback');
178
178
  const obj: NCallbacks.CallbacksData<Types> = {
179
179
  id,
180
180
  on: true,
@@ -0,0 +1,11 @@
1
+ let index = 0;
2
+
3
+ /**
4
+ * Generate an ID
5
+ */
6
+ export default function id (
7
+ prefix = 'id',
8
+ ) {
9
+ index += 1;
10
+ return `${prefix}_${index}`;
11
+ }
@@ -1,9 +1,9 @@
1
- import randID from './randID';
1
+ import id from './id';
2
2
  import mergeWithoutArrays from './mergeWithoutArrays';
3
3
  import timeoutCallback from './timeoutCallback';
4
4
 
5
5
  export {
6
- randID,
6
+ id,
7
7
  mergeWithoutArrays,
8
8
  timeoutCallback,
9
9
  };
@@ -1,7 +1,7 @@
1
1
  import { addEventListener, selectOne } from 'vevet-dom';
2
2
  import { IRemovable } from '../types/general';
3
3
  import { SmoothScroll } from '../../components/scroll/smooth-scroll/SmoothScroll';
4
- import { randID } from '../common';
4
+ import { id as orderId } from '../common';
5
5
 
6
6
  type Container = string | Element | SmoothScroll | Window;
7
7
 
@@ -43,7 +43,7 @@ export default function onScroll ({
43
43
  let instance = instances.find((data) => (
44
44
  data.container === container && data.isPassive === isPassive
45
45
  ))!;
46
- const callbackId = randID('scroll-event');
46
+ const callbackId = orderId('scroll-event');
47
47
 
48
48
  // if a listener exists, we just add a new callback to its stack
49
49
  if (instance) {
@@ -54,7 +54,7 @@ export default function onScroll ({
54
54
  } else {
55
55
  // otherwise we create a new instance
56
56
  instance = {
57
- id: randID('scroll-event-instance'),
57
+ id: orderId('scroll-event-instance'),
58
58
  container,
59
59
  callbacks: [{
60
60
  id: callbackId,
@@ -1,9 +0,0 @@
1
- /**
2
- * Generate a random ID
3
- */
4
- export default function randID (
5
- prefix = 'id',
6
- ) {
7
- const id = `${+new Date()}_${Math.round(Math.random() * 1000)}`;
8
- return `${prefix}_${id}`;
9
- }