@lisergia/utilities 3.0.0 → 5.0.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.
@@ -1,6 +1,6 @@
1
1
 
2
2
  
3
- > @lisergia/utilities@2.0.0 build
3
+ > @lisergia/utilities@4.0.0 build
4
4
  > tsup src/index.ts --format cjs,esm --dts
5
5
 
6
6
  CLI Building entry: src/index.ts
@@ -9,12 +9,12 @@
9
9
  CLI Target: node16
10
10
  CJS Build start
11
11
  ESM Build start
12
- ESM dist/index.js 4.21 KB
13
- ESM ⚡️ Build success in 16ms
14
- CJS dist/index.cjs 4.41 KB
15
- CJS ⚡️ Build success in 16ms
12
+ ESM dist/index.js 2.97 KB
13
+ ESM ⚡️ Build success in 18ms
14
+ CJS dist/index.cjs 4.10 KB
15
+ CJS ⚡️ Build success in 18ms
16
16
  DTS Build start
17
- DTS ⚡️ Build success in 1070ms
18
- DTS dist/index.d.cts 1.05 KB
19
- DTS dist/index.d.ts 1.05 KB
17
+ DTS ⚡️ Build success in 695ms
18
+ DTS dist/index.d.cts 1.02 KB
19
+ DTS dist/index.d.ts 1.02 KB
20
20
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @lisergia/utilities
2
2
 
3
+ ## 5.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - - Add Tempus utilities.
8
+ - Remove module type from packages.
9
+ - Add Prettier configuration as dependency.
10
+ - Move Front End and Back End packages to separate repositories.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+ - @lisergia/config-tsconfig@5.0.0
16
+
17
+ ## 4.0.0
18
+
19
+ ### Major Changes
20
+
21
+ - Update build.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+ - @lisergia/config-tsconfig@4.0.0
27
+
3
28
  ## 3.0.0
4
29
 
5
30
  ### Major Changes
package/dist/index.cjs CHANGED
@@ -15,7 +15,6 @@ var __copyProps = (to, from, except, desc) => {
15
15
  }
16
16
  return to;
17
17
  };
18
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
19
 
21
20
  // src/index.ts
@@ -25,7 +24,9 @@ __export(index_exports, {
25
24
  DOMUtils: () => DOMUtils,
26
25
  Detection: () => Detection,
27
26
  DetectionManager: () => DetectionManager,
28
- MathUtils: () => MathUtils
27
+ MathUtils: () => MathUtils,
28
+ TempusUtils: () => TempusUtils,
29
+ TempusUtilsManager: () => TempusUtilsManager
29
30
  });
30
31
  module.exports = __toCommonJS(index_exports);
31
32
 
@@ -146,17 +147,133 @@ var MathUtils = {
146
147
  random
147
148
  };
148
149
 
149
- // src/Text.ts
150
- var Text_exports = {};
151
- __reExport(Text_exports, require("gsap/src/SplitText"));
150
+ // ../../node_modules/tempus/dist/tempus.mjs
151
+ var index = 0;
152
+ function getUID() {
153
+ return index++;
154
+ }
155
+ var isClient = typeof window !== "undefined";
156
+ var originalRAF = isClient && window.requestAnimationFrame;
157
+ var originalCancelRAF = isClient && window.cancelAnimationFrame;
158
+ var Framerate = class {
159
+ callbacks;
160
+ fps;
161
+ time;
162
+ lastTickDate;
163
+ constructor(fps = Number.POSITIVE_INFINITY) {
164
+ this.callbacks = [];
165
+ this.fps = fps;
166
+ this.time = 0;
167
+ this.lastTickDate = performance.now();
168
+ }
169
+ get executionTime() {
170
+ return 1e3 / this.fps;
171
+ }
172
+ dispatch(time, deltaTime) {
173
+ var _a;
174
+ for (let i = 0; i < this.callbacks.length; i++) {
175
+ (_a = this.callbacks[i]) == null ? void 0 : _a.callback(time, deltaTime);
176
+ }
177
+ }
178
+ raf(time, deltaTime) {
179
+ this.time += deltaTime;
180
+ if (this.fps === Number.POSITIVE_INFINITY) {
181
+ this.dispatch(time, deltaTime);
182
+ } else if (this.time >= this.executionTime) {
183
+ this.time = this.time % this.executionTime;
184
+ const deltaTime2 = time - this.lastTickDate;
185
+ this.lastTickDate = time;
186
+ this.dispatch(time, deltaTime2);
187
+ }
188
+ }
189
+ add({ callback, priority }) {
190
+ if (typeof callback !== "function")
191
+ console.error("Tempus.add: callback is not a function");
192
+ const uid = getUID();
193
+ this.callbacks.push({ callback, priority, uid });
194
+ this.callbacks.sort((a, b) => a.priority - b.priority);
195
+ return () => this.remove(uid);
196
+ }
197
+ remove(uid) {
198
+ this.callbacks = this.callbacks.filter(({ uid: u }) => uid !== u);
199
+ }
200
+ };
201
+ var TempusImpl = class {
202
+ framerates;
203
+ time;
204
+ constructor() {
205
+ this.framerates = {};
206
+ this.time = isClient ? performance.now() : 0;
207
+ if (!isClient) return;
208
+ requestAnimationFrame(this.raf);
209
+ }
210
+ add(callback, { priority = 0, fps = Number.POSITIVE_INFINITY } = {}) {
211
+ if (!isClient) return;
212
+ if (typeof fps === "number") {
213
+ if (!this.framerates[fps]) this.framerates[fps] = new Framerate(fps);
214
+ return this.framerates[fps].add({ callback, priority });
215
+ }
216
+ }
217
+ raf = (time) => {
218
+ if (!isClient) return;
219
+ requestAnimationFrame(this.raf, true);
220
+ const deltaTime = time - this.time;
221
+ this.time = time;
222
+ for (const framerate of Object.values(this.framerates)) {
223
+ framerate.raf(time, deltaTime);
224
+ }
225
+ };
226
+ patch() {
227
+ if (!isClient) return;
228
+ window.requestAnimationFrame = (callback, { priority = 0, fps = Number.POSITIVE_INFINITY } = {}) => {
229
+ if (callback === this.raf || !callback.toString().includes("requestAnimationFrame(")) {
230
+ return originalRAF(callback);
231
+ }
232
+ if (!callback.__tempusPatched) {
233
+ callback.__tempusPatched = true;
234
+ callback.__tempusUnsubscribe = this.add(callback, { priority, fps });
235
+ }
236
+ return callback.__tempusUnsubscribe;
237
+ };
238
+ window.cancelAnimationFrame = (callback) => {
239
+ if (typeof callback === "function") {
240
+ callback == null ? void 0 : callback();
241
+ return;
242
+ }
243
+ return originalCancelRAF(callback);
244
+ };
245
+ }
246
+ unpatch() {
247
+ if (!isClient) return;
248
+ window.requestAnimationFrame = originalRAF;
249
+ window.cancelAnimationFrame = originalCancelRAF;
250
+ }
251
+ };
252
+ var Tempus = new TempusImpl();
152
253
 
153
- // src/index.ts
154
- __reExport(index_exports, Text_exports, module.exports);
254
+ // src/Tempus.ts
255
+ var TempusUtilsManager = class {
256
+ cache = /* @__PURE__ */ new Map();
257
+ add(callback, options) {
258
+ const cancel = Tempus.add(callback, options);
259
+ this.cache.set(callback, cancel);
260
+ }
261
+ remove(callback) {
262
+ const cancel = this.cache.get(callback);
263
+ if (cancel) {
264
+ cancel();
265
+ this.cache.delete(callback);
266
+ }
267
+ }
268
+ };
269
+ var TempusUtils = new TempusUtilsManager();
155
270
  // Annotate the CommonJS export names for ESM import in node:
156
271
  0 && (module.exports = {
157
272
  CanvasUtils,
158
273
  DOMUtils,
159
274
  Detection,
160
275
  DetectionManager,
161
- MathUtils
276
+ MathUtils,
277
+ TempusUtils,
278
+ TempusUtilsManager
162
279
  });
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export * from 'gsap/src/SplitText';
1
+ import { TempusCallback, TempusOptions } from 'tempus';
2
2
 
3
3
  declare function trim(canvas: HTMLCanvasElement): HTMLCanvasElement;
4
4
  declare const CanvasUtils: {
@@ -33,4 +33,11 @@ declare const MathUtils: {
33
33
  random: typeof random;
34
34
  };
35
35
 
36
- export { CanvasUtils, type DOMRectBounds, DOMUtils, Detection, DetectionManager, MathUtils };
36
+ declare class TempusUtilsManager {
37
+ cache: Map<any, any>;
38
+ add(callback: TempusCallback, options?: TempusOptions): void;
39
+ remove(callback: TempusCallback): void;
40
+ }
41
+ declare const TempusUtils: TempusUtilsManager;
42
+
43
+ export { CanvasUtils, type DOMRectBounds, DOMUtils, Detection, DetectionManager, MathUtils, TempusUtils, TempusUtilsManager };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from 'gsap/src/SplitText';
1
+ import { TempusCallback, TempusOptions } from 'tempus';
2
2
 
3
3
  declare function trim(canvas: HTMLCanvasElement): HTMLCanvasElement;
4
4
  declare const CanvasUtils: {
@@ -33,4 +33,11 @@ declare const MathUtils: {
33
33
  random: typeof random;
34
34
  };
35
35
 
36
- export { CanvasUtils, type DOMRectBounds, DOMUtils, Detection, DetectionManager, MathUtils };
36
+ declare class TempusUtilsManager {
37
+ cache: Map<any, any>;
38
+ add(callback: TempusCallback, options?: TempusOptions): void;
39
+ remove(callback: TempusCallback): void;
40
+ }
41
+ declare const TempusUtils: TempusUtilsManager;
42
+
43
+ export { CanvasUtils, type DOMRectBounds, DOMUtils, Detection, DetectionManager, MathUtils, TempusUtils, TempusUtilsManager };
package/dist/index.js CHANGED
@@ -1,31 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
-
19
- // src/index.ts
20
- var index_exports = {};
21
- __export(index_exports, {
22
- CanvasUtils: () => CanvasUtils,
23
- DOMUtils: () => DOMUtils,
24
- Detection: () => Detection,
25
- DetectionManager: () => DetectionManager,
26
- MathUtils: () => MathUtils
27
- });
28
-
29
1
  // src/Polyfill.ts
30
2
  var HTMLElementPrototype = HTMLElement.prototype;
31
3
  var NodeListPrototype = NodeList.prototype;
@@ -143,17 +115,132 @@ var MathUtils = {
143
115
  random
144
116
  };
145
117
 
146
- // src/Text.ts
147
- var Text_exports = {};
148
- __reExport(Text_exports, SplitText_star);
149
- import * as SplitText_star from "gsap/src/SplitText";
118
+ // ../../node_modules/tempus/dist/tempus.mjs
119
+ var index = 0;
120
+ function getUID() {
121
+ return index++;
122
+ }
123
+ var isClient = typeof window !== "undefined";
124
+ var originalRAF = isClient && window.requestAnimationFrame;
125
+ var originalCancelRAF = isClient && window.cancelAnimationFrame;
126
+ var Framerate = class {
127
+ callbacks;
128
+ fps;
129
+ time;
130
+ lastTickDate;
131
+ constructor(fps = Number.POSITIVE_INFINITY) {
132
+ this.callbacks = [];
133
+ this.fps = fps;
134
+ this.time = 0;
135
+ this.lastTickDate = performance.now();
136
+ }
137
+ get executionTime() {
138
+ return 1e3 / this.fps;
139
+ }
140
+ dispatch(time, deltaTime) {
141
+ var _a;
142
+ for (let i = 0; i < this.callbacks.length; i++) {
143
+ (_a = this.callbacks[i]) == null ? void 0 : _a.callback(time, deltaTime);
144
+ }
145
+ }
146
+ raf(time, deltaTime) {
147
+ this.time += deltaTime;
148
+ if (this.fps === Number.POSITIVE_INFINITY) {
149
+ this.dispatch(time, deltaTime);
150
+ } else if (this.time >= this.executionTime) {
151
+ this.time = this.time % this.executionTime;
152
+ const deltaTime2 = time - this.lastTickDate;
153
+ this.lastTickDate = time;
154
+ this.dispatch(time, deltaTime2);
155
+ }
156
+ }
157
+ add({ callback, priority }) {
158
+ if (typeof callback !== "function")
159
+ console.error("Tempus.add: callback is not a function");
160
+ const uid = getUID();
161
+ this.callbacks.push({ callback, priority, uid });
162
+ this.callbacks.sort((a, b) => a.priority - b.priority);
163
+ return () => this.remove(uid);
164
+ }
165
+ remove(uid) {
166
+ this.callbacks = this.callbacks.filter(({ uid: u }) => uid !== u);
167
+ }
168
+ };
169
+ var TempusImpl = class {
170
+ framerates;
171
+ time;
172
+ constructor() {
173
+ this.framerates = {};
174
+ this.time = isClient ? performance.now() : 0;
175
+ if (!isClient) return;
176
+ requestAnimationFrame(this.raf);
177
+ }
178
+ add(callback, { priority = 0, fps = Number.POSITIVE_INFINITY } = {}) {
179
+ if (!isClient) return;
180
+ if (typeof fps === "number") {
181
+ if (!this.framerates[fps]) this.framerates[fps] = new Framerate(fps);
182
+ return this.framerates[fps].add({ callback, priority });
183
+ }
184
+ }
185
+ raf = (time) => {
186
+ if (!isClient) return;
187
+ requestAnimationFrame(this.raf, true);
188
+ const deltaTime = time - this.time;
189
+ this.time = time;
190
+ for (const framerate of Object.values(this.framerates)) {
191
+ framerate.raf(time, deltaTime);
192
+ }
193
+ };
194
+ patch() {
195
+ if (!isClient) return;
196
+ window.requestAnimationFrame = (callback, { priority = 0, fps = Number.POSITIVE_INFINITY } = {}) => {
197
+ if (callback === this.raf || !callback.toString().includes("requestAnimationFrame(")) {
198
+ return originalRAF(callback);
199
+ }
200
+ if (!callback.__tempusPatched) {
201
+ callback.__tempusPatched = true;
202
+ callback.__tempusUnsubscribe = this.add(callback, { priority, fps });
203
+ }
204
+ return callback.__tempusUnsubscribe;
205
+ };
206
+ window.cancelAnimationFrame = (callback) => {
207
+ if (typeof callback === "function") {
208
+ callback == null ? void 0 : callback();
209
+ return;
210
+ }
211
+ return originalCancelRAF(callback);
212
+ };
213
+ }
214
+ unpatch() {
215
+ if (!isClient) return;
216
+ window.requestAnimationFrame = originalRAF;
217
+ window.cancelAnimationFrame = originalCancelRAF;
218
+ }
219
+ };
220
+ var Tempus = new TempusImpl();
150
221
 
151
- // src/index.ts
152
- __reExport(index_exports, Text_exports);
222
+ // src/Tempus.ts
223
+ var TempusUtilsManager = class {
224
+ cache = /* @__PURE__ */ new Map();
225
+ add(callback, options) {
226
+ const cancel = Tempus.add(callback, options);
227
+ this.cache.set(callback, cancel);
228
+ }
229
+ remove(callback) {
230
+ const cancel = this.cache.get(callback);
231
+ if (cancel) {
232
+ cancel();
233
+ this.cache.delete(callback);
234
+ }
235
+ }
236
+ };
237
+ var TempusUtils = new TempusUtilsManager();
153
238
  export {
154
239
  CanvasUtils,
155
240
  DOMUtils,
156
241
  Detection,
157
242
  DetectionManager,
158
- MathUtils
243
+ MathUtils,
244
+ TempusUtils,
245
+ TempusUtilsManager
159
246
  };
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@lisergia/utilities",
3
- "version": "3.0.0",
3
+ "version": "5.0.0",
4
4
  "main": "./dist/index.js",
5
- "module": "./dist/index.mjs",
6
5
  "types": "./dist/index.d.ts",
7
6
  "type": "module",
8
7
  "scripts": {
@@ -10,7 +9,8 @@
10
9
  "dev": "tsup src/index.ts --format cjs,esm --dts --watch"
11
10
  },
12
11
  "dependencies": {
13
- "@lisergia/config-tsconfig": "3.0.0",
14
- "gsap": "^3.13.0"
12
+ "@lisergia/config-tsconfig": "5.0.0",
13
+ "gsap": "^3.13.0",
14
+ "tsup": "^8.5.0"
15
15
  }
16
16
  }
package/src/Tempus.ts ADDED
@@ -0,0 +1,23 @@
1
+ import Tempus, { TempusCallback, TempusOptions } from 'tempus'
2
+
3
+ export class TempusUtilsManager {
4
+ cache = new Map()
5
+
6
+ add(callback: TempusCallback, options?: TempusOptions) {
7
+ const cancel = Tempus.add(callback, options)
8
+
9
+ this.cache.set(callback, cancel)
10
+ }
11
+
12
+ remove(callback: TempusCallback) {
13
+ const cancel = this.cache.get(callback)
14
+
15
+ if (cancel) {
16
+ cancel()
17
+
18
+ this.cache.delete(callback)
19
+ }
20
+ }
21
+ }
22
+
23
+ export const TempusUtils = new TempusUtilsManager()
package/src/index.ts CHANGED
@@ -4,4 +4,4 @@ export * from './Canvas'
4
4
  export * from './Detection'
5
5
  export * from './DOM'
6
6
  export * from './Math'
7
- export * from './Text'
7
+ export * from './Tempus'
package/dist/index.d.mts DELETED
@@ -1,36 +0,0 @@
1
- export * from 'gsap/src/SplitText';
2
-
3
- declare function trim(canvas: HTMLCanvasElement): HTMLCanvasElement;
4
- declare const CanvasUtils: {
5
- trim: typeof trim;
6
- };
7
-
8
- declare class DetectionManager {
9
- isMobile(): boolean;
10
- }
11
- declare const Detection: DetectionManager;
12
-
13
- interface DOMRectBounds {
14
- bottom: number;
15
- height: number;
16
- left: number;
17
- top: number;
18
- width: number;
19
- }
20
- declare function getBounds(element: HTMLElement, top?: number): DOMRectBounds;
21
- declare const DOMUtils: {
22
- getBounds: typeof getBounds;
23
- };
24
-
25
- declare function lerp(start: number, end: number, time: number): number;
26
- declare function clamp(value: number, min: number, max: number): number;
27
- declare function random(min: number, max: number): number;
28
- declare function map(value: number, inMin: number, inMax: number, outMin: number, outMax: number, clamp?: boolean): number;
29
- declare const MathUtils: {
30
- clamp: typeof clamp;
31
- lerp: typeof lerp;
32
- map: typeof map;
33
- random: typeof random;
34
- };
35
-
36
- export { CanvasUtils, type DOMRectBounds, DOMUtils, Detection, DetectionManager, MathUtils };
package/dist/index.mjs DELETED
@@ -1,159 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
-
19
- // src/index.ts
20
- var index_exports = {};
21
- __export(index_exports, {
22
- CanvasUtils: () => CanvasUtils,
23
- DOMUtils: () => DOMUtils,
24
- Detection: () => Detection,
25
- DetectionManager: () => DetectionManager,
26
- MathUtils: () => MathUtils
27
- });
28
-
29
- // src/Polyfill.ts
30
- var HTMLElementPrototype = HTMLElement.prototype;
31
- var NodeListPrototype = NodeList.prototype;
32
- if (!HTMLElementPrototype.forEach) {
33
- HTMLElementPrototype.forEach = function(callback, thisArg) {
34
- thisArg = thisArg || window;
35
- callback.call(thisArg, this, this, this);
36
- };
37
- }
38
- if (!NodeListPrototype.filter) {
39
- NodeListPrototype.filter = Array.prototype.filter;
40
- }
41
- if (!NodeListPrototype.find) {
42
- NodeListPrototype.find = Array.prototype.find;
43
- }
44
- if (!NodeListPrototype.map) {
45
- NodeListPrototype.map = Array.prototype.map;
46
- }
47
-
48
- // src/Canvas.ts
49
- function trim(canvas) {
50
- const context = canvas.getContext("2d");
51
- const copy = document.createElement("canvas").getContext("2d", { willReadFrequently: true });
52
- const pixels = context.getImageData(0, 0, canvas.width, canvas.height);
53
- const length = pixels.data.length;
54
- const bound = {
55
- bottom: null,
56
- left: null,
57
- right: null,
58
- top: null
59
- };
60
- let x;
61
- let y;
62
- for (let i = 0; i < length; i += 4) {
63
- if (pixels.data[i + 3] !== 0) {
64
- x = i / 4 % canvas.width;
65
- y = ~~(i / 4 / canvas.width);
66
- if (bound.top === null) {
67
- bound.top = y;
68
- }
69
- if (bound.left === null) {
70
- bound.left = x;
71
- } else if (x < bound.left) {
72
- bound.left = x;
73
- }
74
- if (bound.right === null) {
75
- bound.right = x;
76
- } else if (bound.right < x) {
77
- bound.right = x;
78
- }
79
- if (bound.bottom === null) {
80
- bound.bottom = y;
81
- } else if (bound.bottom < y) {
82
- bound.bottom = y;
83
- }
84
- }
85
- }
86
- const trimHeight = bound.bottom - bound.top;
87
- const trimWidth = bound.right - bound.left;
88
- const trimmed = context.getImageData(bound.left, bound.top, trimWidth, trimHeight);
89
- copy.canvas.width = trimWidth;
90
- copy.canvas.height = trimHeight;
91
- copy.putImageData(trimmed, 0, 0);
92
- return copy.canvas;
93
- }
94
- var CanvasUtils = {
95
- trim
96
- };
97
-
98
- // src/Detection.ts
99
- var DetectionManager = class {
100
- isMobile() {
101
- return !document.documentElement.classList.contains("desktop");
102
- }
103
- };
104
- var Detection = new DetectionManager();
105
-
106
- // src/DOM.ts
107
- function getBounds(element, top = 0) {
108
- const box = element.getBoundingClientRect();
109
- return {
110
- bottom: box.bottom,
111
- height: box.height,
112
- left: box.left,
113
- top: box.top + top,
114
- width: box.width
115
- };
116
- }
117
- var DOMUtils = {
118
- getBounds
119
- };
120
-
121
- // src/Math.ts
122
- function lerp(start, end, time) {
123
- return start + (end - start) * time;
124
- }
125
- function clamp(value, min, max) {
126
- return Math.min(Math.max(value, min), max);
127
- }
128
- function random(min, max) {
129
- return Math.random() * (max - min) + min;
130
- }
131
- function map(value, inMin, inMax, outMin, outMax, clamp2 = false) {
132
- let mapped = (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
133
- if (clamp2) {
134
- const [minOut, maxOut] = outMin < outMax ? [outMin, outMax] : [outMax, outMin];
135
- mapped = Math.min(Math.max(mapped, minOut), maxOut);
136
- }
137
- return mapped;
138
- }
139
- var MathUtils = {
140
- clamp,
141
- lerp,
142
- map,
143
- random
144
- };
145
-
146
- // src/Text.ts
147
- var Text_exports = {};
148
- __reExport(Text_exports, SplitText_star);
149
- import * as SplitText_star from "gsap/src/SplitText";
150
-
151
- // src/index.ts
152
- __reExport(index_exports, Text_exports);
153
- export {
154
- CanvasUtils,
155
- DOMUtils,
156
- Detection,
157
- DetectionManager,
158
- MathUtils
159
- };
package/src/Text.ts DELETED
@@ -1 +0,0 @@
1
- export * from 'gsap/src/SplitText'