@t007/utils 0.0.1 → 0.0.3

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.cjs CHANGED
@@ -56,17 +56,23 @@ function isSameURL(src1, src2) {
56
56
  }
57
57
 
58
58
  // src/core/dom.ts
59
- function createEl(tag, props = {}, dataset = {}, styles = {}) {
60
- return assignEl(tag ? document?.createElement(tag) : void 0, props, dataset, styles) ?? null;
59
+ function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
60
+ return assignEl(el, props, dataset, styles), el;
61
61
  }
62
- function assignEl(el, props = {}, dataset = {}, styles = {}) {
62
+ function assignEl(el, props, dataset, styles) {
63
63
  if (!el) return;
64
- for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
65
- for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
66
- for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
64
+ if (props) {
65
+ for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
66
+ }
67
+ if (dataset) {
68
+ for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
69
+ }
70
+ if (styles) {
71
+ for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
72
+ }
67
73
  }
68
74
  function loadResource(src, type = "style", { module: module2, media, crossOrigin, integrity, referrerPolicy, nonce, fetchPriority, attempts = 3, retryKey = false } = {}, w = window) {
69
- w.t007 ??= {}, w.t007._resourceCache ??= {};
75
+ w.t007._resourceCache ??= {};
70
76
  if (w.t007._resourceCache[src]) return w.t007._resourceCache[src];
71
77
  const existing = type === "script" ? Array.prototype.find.call(w.document.scripts, (s) => isSameURL(s.src, src)) : type === "style" ? Array.prototype.find.call(w.document.styleSheets, (s) => isSameURL(s.href, src)) : null;
72
78
  if (existing) return w.t007._resourceCache[src] = Promise.resolve(existing);
@@ -139,20 +145,20 @@ function initVScrollerator({ baseSpeed = 3, maxSpeed = 10, stepDelay = 2e3, base
139
145
  const reset = () => (accelId && clearTimeout(accelId), accelId = null, linesPerSec = baseSpeed, lastTime = null);
140
146
  return { drive, reset };
141
147
  }
142
- var _SCROLLERS = /* @__PURE__ */ new WeakMap();
143
- var _SCROLLER_R_OBSERVER = typeof window !== "undefined" ? new ResizeObserver((entries) => entries.forEach(({ target }) => _SCROLLERS.get(target)?.update())) : null;
144
- var _SCROLLER_M_OBSERVER = typeof window !== "undefined" ? new MutationObserver((entries) => {
145
- const els = /* @__PURE__ */ new Set();
146
- for (const entry of entries) {
147
- let node = entry.target instanceof Element ? entry.target : null;
148
- while (node && !_SCROLLERS.has(node)) node = node.parentElement;
149
- if (node) els.add(node);
150
- }
151
- for (const el of els) _SCROLLERS.get(el)?.update();
152
- }) : null;
153
148
  function initScrollAssist(el, { pxPerSecond = 80, assistClassName = "tmg-video-controls-scroll-assist", vertical = true, horizontal = true } = {}) {
149
+ t007._scrollers ??= /* @__PURE__ */ new WeakMap();
150
+ t007._scroller_r_observer ??= new ResizeObserver((entries) => entries.forEach(({ target }) => t007._scrollers.get(target)?.update()));
151
+ t007._scroller_m_observer ??= new MutationObserver((entries) => {
152
+ const els = /* @__PURE__ */ new Set();
153
+ for (const entry of entries) {
154
+ let node = entry.target instanceof Element ? entry.target : null;
155
+ while (node && !t007._scrollers.has(node)) node = node.parentElement;
156
+ if (node) els.add(node);
157
+ }
158
+ for (const el2 of els) t007._scrollers.get(el2)?.update();
159
+ });
154
160
  const parent = el?.parentElement;
155
- if (!parent || _SCROLLERS.has(el)) return;
161
+ if (!parent || t007._scrollers.has(el)) return;
156
162
  const assist = {};
157
163
  let scrollId = null, last = performance.now(), assistWidth = 20, assistHeight = 20;
158
164
  const update = () => {
@@ -196,22 +202,32 @@ function initScrollAssist(el, { pxPerSecond = 80, assistClassName = "tmg-video-c
196
202
  if (horizontal) ["left", "right"].forEach(addAssist);
197
203
  if (vertical) ["up", "down"].forEach(addAssist);
198
204
  el.addEventListener("scroll", update);
199
- _SCROLLER_R_OBSERVER.observe(el);
200
- _SCROLLER_M_OBSERVER.observe(el, { childList: true, subtree: true, characterData: true });
201
- _SCROLLERS.set(el, {
205
+ t007._scroller_r_observer.observe(el);
206
+ t007._scroller_m_observer.observe(el, { childList: true, subtree: true, characterData: true });
207
+ t007._scrollers.set(el, {
202
208
  update,
203
209
  destroy() {
204
210
  stop();
205
211
  el.removeEventListener("scroll", update);
206
- _SCROLLER_R_OBSERVER.unobserve(el);
207
- _SCROLLERS.delete(el);
212
+ t007._scroller_r_observer.unobserve(el);
213
+ t007._scrollers.delete(el);
208
214
  Object.values(assist).forEach((a) => a.remove());
209
215
  }
210
216
  });
211
- update();
212
- return _SCROLLERS.get(el);
217
+ return update(), t007._scrollers.get(el);
218
+ }
219
+ var removeScrollAssist = (el) => t007._scrollers.get(el)?.destroy();
220
+
221
+ // src/index.ts
222
+ if (typeof window !== "undefined") {
223
+ window.t007 ??= {};
224
+ window.T007_TOAST_JS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/toast@latest`;
225
+ window.T007_INPUT_JS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/input@latest`;
226
+ window.T007_DIALOG_JS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/dialog@latest`;
227
+ window.T007_TOAST_CSS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/toast@latest/dist/style.css`;
228
+ window.T007_INPUT_CSS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/input@latest/dist/style.css`;
229
+ window.T007_DIALOG_CSS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/dialog@latest/dist/style.css`;
213
230
  }
214
- var removeScrollAssist = (el) => _SCROLLERS.get(el)?.destroy();
215
231
  // Annotate the CommonJS export names for ESM import in node:
216
232
  0 && (module.exports = {
217
233
  assignEl,
package/dist/index.d.cts CHANGED
@@ -1,11 +1,51 @@
1
+ interface ScrolleratorOptions {
2
+ baseSpeed?: number;
3
+ maxSpeed?: number;
4
+ stepDelay?: number;
5
+ baseRate?: number;
6
+ lineHeight?: number;
7
+ margin?: number;
8
+ car?: Window | HTMLElement;
9
+ }
10
+ interface Scrollerator {
11
+ drive: (clientY: number, brake?: boolean, offsetY?: number) => number;
12
+ reset: () => void;
13
+ }
14
+ declare function initVScrollerator({ baseSpeed, maxSpeed, stepDelay, baseRate, lineHeight, margin, car }?: ScrolleratorOptions): Scrollerator;
15
+ interface ScrollAssistControl {
16
+ update: () => void;
17
+ destroy: () => void;
18
+ }
19
+ interface ScrollAssistOptions {
20
+ pxPerSecond?: number;
21
+ assistClassName?: string;
22
+ vertical?: boolean;
23
+ horizontal?: boolean;
24
+ }
25
+ declare function initScrollAssist(el: HTMLElement, { pxPerSecond, assistClassName, vertical, horizontal }?: ScrollAssistOptions): ScrollAssistControl | void;
26
+ declare const removeScrollAssist: (el: HTMLElement) => void | undefined;
27
+
1
28
  declare global {
2
- interface T007Namespace {
3
- _resourceCache: Partial<Record<string, Promise<HTMLElement | void>>>;
4
- }
5
- interface Window {
6
- t007: T007Namespace;
7
- }
8
- var t007: T007Namespace;
29
+ interface T007Namespace {
30
+ _resourceCache: Partial<Record<string, Promise<HTMLElement | void>>>;
31
+ _scrollers?: WeakMap<HTMLElement, ScrollAssistControl>;
32
+ _scroller_r_observer?: ResizeObserver;
33
+ _scroller_m_observer?: MutationObserver;
34
+ }
35
+
36
+ interface Window {
37
+ t007: T007Namespace;
38
+
39
+ T007_TOAST_JS_SRC?: string;
40
+ T007_INPUT_JS_SRC?: string;
41
+ T007_DIALOG_JS_SRC?: string;
42
+
43
+ T007_TOAST_CSS_SRC?: string;
44
+ T007_INPUT_CSS_SRC?: string;
45
+ T007_DIALOG_CSS_SRC?: string;
46
+ }
47
+
48
+ var t007: T007Namespace;
9
49
  }
10
50
 
11
51
  declare function clamp(min: number | undefined, val: number, max?: number): number;
@@ -30,7 +70,7 @@ type LoadResourceOptions = Partial<{
30
70
  declare function createEl<K extends keyof HTMLElementTagNameMap>(tag: K, props?: Partial<HTMLElementTagNameMap[K]>, dataset?: Dataset, styles?: Style): HTMLElementTagNameMap[K];
31
71
  declare function createEl(tag: string, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): HTMLElement | null;
32
72
  declare function assignEl<K extends keyof HTMLElementTagNameMap>(el?: HTMLElementTagNameMap[K], props?: Partial<HTMLElementTagNameMap[K]>, dataset?: Dataset, styles?: Style): void;
33
- declare function assignEl(el?: HTMLElement, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): void;
73
+ declare function assignEl(el?: HTMLElement | null, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): void;
34
74
  declare function loadResource(src: string, type?: ResourceType, { module, media, crossOrigin, integrity, referrerPolicy, nonce, fetchPriority, attempts, retryKey }?: LoadResourceOptions, w?: Window & typeof globalThis): Promise<HTMLElement | void>;
35
75
 
36
76
  declare function onAllMethods(owner: any, callback: (method: string, owner: any) => void): void;
@@ -38,31 +78,4 @@ declare function bindAllMethods(owner: any): void;
38
78
  declare function guardAllMethods(owner: any, guardFn?: (fn: Function) => Function, bound?: boolean): void;
39
79
  declare function guardMethod<T extends Function>(fn: T, onError?: (e: any) => void): T;
40
80
 
41
- interface ScrolleratorOptions {
42
- baseSpeed?: number;
43
- maxSpeed?: number;
44
- stepDelay?: number;
45
- baseRate?: number;
46
- lineHeight?: number;
47
- margin?: number;
48
- car?: Window | HTMLElement;
49
- }
50
- interface Scrollerator {
51
- drive: (clientY: number, brake?: boolean, offsetY?: number) => number;
52
- reset: () => void;
53
- }
54
- declare function initVScrollerator({ baseSpeed, maxSpeed, stepDelay, baseRate, lineHeight, margin, car }?: ScrolleratorOptions): Scrollerator;
55
- interface ScrollAssistControl {
56
- update: () => void;
57
- destroy: () => void;
58
- }
59
- interface ScrollAssistOptions {
60
- pxPerSecond?: number;
61
- assistClassName?: string;
62
- vertical?: boolean;
63
- horizontal?: boolean;
64
- }
65
- declare function initScrollAssist(el: HTMLElement, { pxPerSecond, assistClassName, vertical, horizontal }?: ScrollAssistOptions): ScrollAssistControl | void;
66
- declare const removeScrollAssist: (el: HTMLElement) => void | undefined;
67
-
68
- export { type Dataset, type LoadResourceOptions, type ResourceType, type Style, assignEl, bindAllMethods, clamp, createEl, guardAllMethods, guardMethod, initScrollAssist, initVScrollerator, isSameURL, loadResource, onAllMethods, removeScrollAssist, uid };
81
+ export { type Dataset, type LoadResourceOptions, type ResourceType, type ScrollAssistControl, type Style, assignEl, bindAllMethods, clamp, createEl, guardAllMethods, guardMethod, initScrollAssist, initVScrollerator, isSameURL, loadResource, onAllMethods, removeScrollAssist, uid };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,51 @@
1
+ interface ScrolleratorOptions {
2
+ baseSpeed?: number;
3
+ maxSpeed?: number;
4
+ stepDelay?: number;
5
+ baseRate?: number;
6
+ lineHeight?: number;
7
+ margin?: number;
8
+ car?: Window | HTMLElement;
9
+ }
10
+ interface Scrollerator {
11
+ drive: (clientY: number, brake?: boolean, offsetY?: number) => number;
12
+ reset: () => void;
13
+ }
14
+ declare function initVScrollerator({ baseSpeed, maxSpeed, stepDelay, baseRate, lineHeight, margin, car }?: ScrolleratorOptions): Scrollerator;
15
+ interface ScrollAssistControl {
16
+ update: () => void;
17
+ destroy: () => void;
18
+ }
19
+ interface ScrollAssistOptions {
20
+ pxPerSecond?: number;
21
+ assistClassName?: string;
22
+ vertical?: boolean;
23
+ horizontal?: boolean;
24
+ }
25
+ declare function initScrollAssist(el: HTMLElement, { pxPerSecond, assistClassName, vertical, horizontal }?: ScrollAssistOptions): ScrollAssistControl | void;
26
+ declare const removeScrollAssist: (el: HTMLElement) => void | undefined;
27
+
1
28
  declare global {
2
- interface T007Namespace {
3
- _resourceCache: Partial<Record<string, Promise<HTMLElement | void>>>;
4
- }
5
- interface Window {
6
- t007: T007Namespace;
7
- }
8
- var t007: T007Namespace;
29
+ interface T007Namespace {
30
+ _resourceCache: Partial<Record<string, Promise<HTMLElement | void>>>;
31
+ _scrollers?: WeakMap<HTMLElement, ScrollAssistControl>;
32
+ _scroller_r_observer?: ResizeObserver;
33
+ _scroller_m_observer?: MutationObserver;
34
+ }
35
+
36
+ interface Window {
37
+ t007: T007Namespace;
38
+
39
+ T007_TOAST_JS_SRC?: string;
40
+ T007_INPUT_JS_SRC?: string;
41
+ T007_DIALOG_JS_SRC?: string;
42
+
43
+ T007_TOAST_CSS_SRC?: string;
44
+ T007_INPUT_CSS_SRC?: string;
45
+ T007_DIALOG_CSS_SRC?: string;
46
+ }
47
+
48
+ var t007: T007Namespace;
9
49
  }
10
50
 
11
51
  declare function clamp(min: number | undefined, val: number, max?: number): number;
@@ -30,7 +70,7 @@ type LoadResourceOptions = Partial<{
30
70
  declare function createEl<K extends keyof HTMLElementTagNameMap>(tag: K, props?: Partial<HTMLElementTagNameMap[K]>, dataset?: Dataset, styles?: Style): HTMLElementTagNameMap[K];
31
71
  declare function createEl(tag: string, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): HTMLElement | null;
32
72
  declare function assignEl<K extends keyof HTMLElementTagNameMap>(el?: HTMLElementTagNameMap[K], props?: Partial<HTMLElementTagNameMap[K]>, dataset?: Dataset, styles?: Style): void;
33
- declare function assignEl(el?: HTMLElement, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): void;
73
+ declare function assignEl(el?: HTMLElement | null, props?: Partial<HTMLElement>, dataset?: Dataset, styles?: Style): void;
34
74
  declare function loadResource(src: string, type?: ResourceType, { module, media, crossOrigin, integrity, referrerPolicy, nonce, fetchPriority, attempts, retryKey }?: LoadResourceOptions, w?: Window & typeof globalThis): Promise<HTMLElement | void>;
35
75
 
36
76
  declare function onAllMethods(owner: any, callback: (method: string, owner: any) => void): void;
@@ -38,31 +78,4 @@ declare function bindAllMethods(owner: any): void;
38
78
  declare function guardAllMethods(owner: any, guardFn?: (fn: Function) => Function, bound?: boolean): void;
39
79
  declare function guardMethod<T extends Function>(fn: T, onError?: (e: any) => void): T;
40
80
 
41
- interface ScrolleratorOptions {
42
- baseSpeed?: number;
43
- maxSpeed?: number;
44
- stepDelay?: number;
45
- baseRate?: number;
46
- lineHeight?: number;
47
- margin?: number;
48
- car?: Window | HTMLElement;
49
- }
50
- interface Scrollerator {
51
- drive: (clientY: number, brake?: boolean, offsetY?: number) => number;
52
- reset: () => void;
53
- }
54
- declare function initVScrollerator({ baseSpeed, maxSpeed, stepDelay, baseRate, lineHeight, margin, car }?: ScrolleratorOptions): Scrollerator;
55
- interface ScrollAssistControl {
56
- update: () => void;
57
- destroy: () => void;
58
- }
59
- interface ScrollAssistOptions {
60
- pxPerSecond?: number;
61
- assistClassName?: string;
62
- vertical?: boolean;
63
- horizontal?: boolean;
64
- }
65
- declare function initScrollAssist(el: HTMLElement, { pxPerSecond, assistClassName, vertical, horizontal }?: ScrollAssistOptions): ScrollAssistControl | void;
66
- declare const removeScrollAssist: (el: HTMLElement) => void | undefined;
67
-
68
- export { type Dataset, type LoadResourceOptions, type ResourceType, type Style, assignEl, bindAllMethods, clamp, createEl, guardAllMethods, guardMethod, initScrollAssist, initVScrollerator, isSameURL, loadResource, onAllMethods, removeScrollAssist, uid };
81
+ export { type Dataset, type LoadResourceOptions, type ResourceType, type ScrollAssistControl, type Style, assignEl, bindAllMethods, clamp, createEl, guardAllMethods, guardMethod, initScrollAssist, initVScrollerator, isSameURL, loadResource, onAllMethods, removeScrollAssist, uid };
package/dist/index.js CHANGED
@@ -18,17 +18,23 @@ function isSameURL(src1, src2) {
18
18
  }
19
19
 
20
20
  // src/core/dom.ts
21
- function createEl(tag, props = {}, dataset = {}, styles = {}) {
22
- return assignEl(tag ? document?.createElement(tag) : void 0, props, dataset, styles) ?? null;
21
+ function createEl(tag, props, dataset, styles, el = tag ? document?.createElement(tag) : null) {
22
+ return assignEl(el, props, dataset, styles), el;
23
23
  }
24
- function assignEl(el, props = {}, dataset = {}, styles = {}) {
24
+ function assignEl(el, props, dataset, styles) {
25
25
  if (!el) return;
26
- for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
27
- for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
28
- for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
26
+ if (props) {
27
+ for (const k of Object.keys(props)) if (props[k] !== void 0) el[k] = props[k];
28
+ }
29
+ if (dataset) {
30
+ for (const k of Object.keys(dataset)) if (dataset[k] !== void 0) el.dataset[k] = String(dataset[k]);
31
+ }
32
+ if (styles) {
33
+ for (const k of Object.keys(styles)) if (styles[k] !== void 0) el.style[k] = styles[k];
34
+ }
29
35
  }
30
36
  function loadResource(src, type = "style", { module, media, crossOrigin, integrity, referrerPolicy, nonce, fetchPriority, attempts = 3, retryKey = false } = {}, w = window) {
31
- w.t007 ??= {}, w.t007._resourceCache ??= {};
37
+ w.t007._resourceCache ??= {};
32
38
  if (w.t007._resourceCache[src]) return w.t007._resourceCache[src];
33
39
  const existing = type === "script" ? Array.prototype.find.call(w.document.scripts, (s) => isSameURL(s.src, src)) : type === "style" ? Array.prototype.find.call(w.document.styleSheets, (s) => isSameURL(s.href, src)) : null;
34
40
  if (existing) return w.t007._resourceCache[src] = Promise.resolve(existing);
@@ -101,20 +107,20 @@ function initVScrollerator({ baseSpeed = 3, maxSpeed = 10, stepDelay = 2e3, base
101
107
  const reset = () => (accelId && clearTimeout(accelId), accelId = null, linesPerSec = baseSpeed, lastTime = null);
102
108
  return { drive, reset };
103
109
  }
104
- var _SCROLLERS = /* @__PURE__ */ new WeakMap();
105
- var _SCROLLER_R_OBSERVER = typeof window !== "undefined" ? new ResizeObserver((entries) => entries.forEach(({ target }) => _SCROLLERS.get(target)?.update())) : null;
106
- var _SCROLLER_M_OBSERVER = typeof window !== "undefined" ? new MutationObserver((entries) => {
107
- const els = /* @__PURE__ */ new Set();
108
- for (const entry of entries) {
109
- let node = entry.target instanceof Element ? entry.target : null;
110
- while (node && !_SCROLLERS.has(node)) node = node.parentElement;
111
- if (node) els.add(node);
112
- }
113
- for (const el of els) _SCROLLERS.get(el)?.update();
114
- }) : null;
115
110
  function initScrollAssist(el, { pxPerSecond = 80, assistClassName = "tmg-video-controls-scroll-assist", vertical = true, horizontal = true } = {}) {
111
+ t007._scrollers ??= /* @__PURE__ */ new WeakMap();
112
+ t007._scroller_r_observer ??= new ResizeObserver((entries) => entries.forEach(({ target }) => t007._scrollers.get(target)?.update()));
113
+ t007._scroller_m_observer ??= new MutationObserver((entries) => {
114
+ const els = /* @__PURE__ */ new Set();
115
+ for (const entry of entries) {
116
+ let node = entry.target instanceof Element ? entry.target : null;
117
+ while (node && !t007._scrollers.has(node)) node = node.parentElement;
118
+ if (node) els.add(node);
119
+ }
120
+ for (const el2 of els) t007._scrollers.get(el2)?.update();
121
+ });
116
122
  const parent = el?.parentElement;
117
- if (!parent || _SCROLLERS.has(el)) return;
123
+ if (!parent || t007._scrollers.has(el)) return;
118
124
  const assist = {};
119
125
  let scrollId = null, last = performance.now(), assistWidth = 20, assistHeight = 20;
120
126
  const update = () => {
@@ -158,22 +164,32 @@ function initScrollAssist(el, { pxPerSecond = 80, assistClassName = "tmg-video-c
158
164
  if (horizontal) ["left", "right"].forEach(addAssist);
159
165
  if (vertical) ["up", "down"].forEach(addAssist);
160
166
  el.addEventListener("scroll", update);
161
- _SCROLLER_R_OBSERVER.observe(el);
162
- _SCROLLER_M_OBSERVER.observe(el, { childList: true, subtree: true, characterData: true });
163
- _SCROLLERS.set(el, {
167
+ t007._scroller_r_observer.observe(el);
168
+ t007._scroller_m_observer.observe(el, { childList: true, subtree: true, characterData: true });
169
+ t007._scrollers.set(el, {
164
170
  update,
165
171
  destroy() {
166
172
  stop();
167
173
  el.removeEventListener("scroll", update);
168
- _SCROLLER_R_OBSERVER.unobserve(el);
169
- _SCROLLERS.delete(el);
174
+ t007._scroller_r_observer.unobserve(el);
175
+ t007._scrollers.delete(el);
170
176
  Object.values(assist).forEach((a) => a.remove());
171
177
  }
172
178
  });
173
- update();
174
- return _SCROLLERS.get(el);
179
+ return update(), t007._scrollers.get(el);
180
+ }
181
+ var removeScrollAssist = (el) => t007._scrollers.get(el)?.destroy();
182
+
183
+ // src/index.ts
184
+ if (typeof window !== "undefined") {
185
+ window.t007 ??= {};
186
+ window.T007_TOAST_JS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/toast@latest`;
187
+ window.T007_INPUT_JS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/input@latest`;
188
+ window.T007_DIALOG_JS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/dialog@latest`;
189
+ window.T007_TOAST_CSS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/toast@latest/dist/style.css`;
190
+ window.T007_INPUT_CSS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/input@latest/dist/style.css`;
191
+ window.T007_DIALOG_CSS_SRC ??= `https://cdn.jsdelivr.net/npm/@t007/dialog@latest/dist/style.css`;
175
192
  }
176
- var removeScrollAssist = (el) => _SCROLLERS.get(el)?.destroy();
177
193
  export {
178
194
  assignEl,
179
195
  bindAllMethods,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t007/utils",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "High-performance, zero-dependency utility functions for the t007 ecosystem.",
5
5
  "author": "Oketade Oluwatobiloba <tobioketade007@gmail.com>",
6
6
  "license": "MIT",
@@ -13,6 +13,7 @@
13
13
  "type": "module",
14
14
  "main": "./dist/index.cjs",
15
15
  "module": "./dist/index.js",
16
+ "browser": "./dist/index.js",
16
17
  "types": "./dist/index.d.ts",
17
18
  "sideEffects": false,
18
19
  "exports": {