@mekari/pixel3-utils 0.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.
- package/dist/array.d.mts +9 -0
- package/dist/array.d.ts +9 -0
- package/dist/array.js +39 -0
- package/dist/array.mjs +7 -0
- package/dist/chunk-2UGMOMBN.mjs +43 -0
- package/dist/chunk-555RL46T.mjs +18 -0
- package/dist/chunk-65WDFMBW.mjs +71 -0
- package/dist/chunk-HXLTBFWE.mjs +16 -0
- package/dist/chunk-PLTSXP5P.mjs +35 -0
- package/dist/chunk-QZ7VFGWC.mjs +6 -0
- package/dist/chunk-TJIIVYQV.mjs +31 -0
- package/dist/chunk-VSOR555U.mjs +31 -0
- package/dist/chunk-WBQAMGXK.mjs +0 -0
- package/dist/context.d.mts +4 -0
- package/dist/context.d.ts +4 -0
- package/dist/context.js +37 -0
- package/dist/context.mjs +7 -0
- package/dist/dom.d.mts +14 -0
- package/dist/dom.d.ts +14 -0
- package/dist/dom.js +53 -0
- package/dist/dom.mjs +9 -0
- package/dist/generators.d.mts +7 -0
- package/dist/generators.d.ts +7 -0
- package/dist/generators.js +54 -0
- package/dist/generators.mjs +11 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +263 -0
- package/dist/index.mjs +58 -0
- package/dist/metafile-cjs.json +1 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/object.d.mts +15 -0
- package/dist/object.d.ts +15 -0
- package/dist/object.js +59 -0
- package/dist/object.mjs +13 -0
- package/dist/performance.d.mts +3 -0
- package/dist/performance.d.ts +3 -0
- package/dist/performance.js +92 -0
- package/dist/performance.mjs +7 -0
- package/dist/types.d.mts +17 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.js +18 -0
- package/dist/types.mjs +1 -0
- package/dist/validators.d.mts +15 -0
- package/dist/validators.d.ts +15 -0
- package/dist/validators.js +66 -0
- package/dist/validators.mjs +11 -0
- package/package.json +42 -0
package/dist/array.d.mts
ADDED
package/dist/array.d.ts
ADDED
package/dist/array.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/array.ts
|
|
22
|
+
var array_exports = {};
|
|
23
|
+
__export(array_exports, {
|
|
24
|
+
groupBy: () => groupBy
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(array_exports);
|
|
27
|
+
function groupBy(arr, key) {
|
|
28
|
+
const initialValue = {};
|
|
29
|
+
return arr.reduce((acc, cval) => {
|
|
30
|
+
const myAttribute = cval[key];
|
|
31
|
+
acc[myAttribute] = [...acc[myAttribute] || [], cval];
|
|
32
|
+
return acc;
|
|
33
|
+
}, initialValue);
|
|
34
|
+
}
|
|
35
|
+
__name(groupBy, "groupBy");
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
groupBy
|
|
39
|
+
});
|
package/dist/array.mjs
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/validators.ts
|
|
6
|
+
function isUndef(v) {
|
|
7
|
+
return v === void 0 || v === null;
|
|
8
|
+
}
|
|
9
|
+
__name(isUndef, "isUndef");
|
|
10
|
+
function isDef(v) {
|
|
11
|
+
return v !== void 0 && v !== null;
|
|
12
|
+
}
|
|
13
|
+
__name(isDef, "isDef");
|
|
14
|
+
var isEqual = /* @__PURE__ */ __name((x, y) => {
|
|
15
|
+
if (Object.is(x, y))
|
|
16
|
+
return true;
|
|
17
|
+
if (x instanceof Date && y instanceof Date) {
|
|
18
|
+
return x.getTime() === y.getTime();
|
|
19
|
+
}
|
|
20
|
+
if (x instanceof RegExp && y instanceof RegExp) {
|
|
21
|
+
return x.toString() === y.toString();
|
|
22
|
+
}
|
|
23
|
+
if (typeof x !== "object" || x === null || typeof y !== "object" || y === null) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
const keysX = Reflect.ownKeys(x);
|
|
27
|
+
const keysY = Reflect.ownKeys(y);
|
|
28
|
+
if (keysX.length !== keysY.length)
|
|
29
|
+
return false;
|
|
30
|
+
for (let i = 0; i < keysX.length; i++) {
|
|
31
|
+
if (!Reflect.has(y, keysX[i]))
|
|
32
|
+
return false;
|
|
33
|
+
if (!isEqual(x[keysX[i]], y[keysX[i]]))
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
}, "isEqual");
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
isUndef,
|
|
41
|
+
isDef,
|
|
42
|
+
isEqual
|
|
43
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/array.ts
|
|
6
|
+
function groupBy(arr, key) {
|
|
7
|
+
const initialValue = {};
|
|
8
|
+
return arr.reduce((acc, cval) => {
|
|
9
|
+
const myAttribute = cval[key];
|
|
10
|
+
acc[myAttribute] = [...acc[myAttribute] || [], cval];
|
|
11
|
+
return acc;
|
|
12
|
+
}, initialValue);
|
|
13
|
+
}
|
|
14
|
+
__name(groupBy, "groupBy");
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
groupBy
|
|
18
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/performance.ts
|
|
6
|
+
import { ref, onBeforeMount, onBeforeUpdate, onMounted, onUpdated, nextTick } from "vue";
|
|
7
|
+
var usePerformanceObserver = /* @__PURE__ */ __name((label) => {
|
|
8
|
+
const startTime = ref(performance.now());
|
|
9
|
+
const state = ref({
|
|
10
|
+
timeToRender: 0,
|
|
11
|
+
firstInputDelay: 0,
|
|
12
|
+
timeToUpdate: 0,
|
|
13
|
+
numberOfData: 0,
|
|
14
|
+
startBenchmark: 0,
|
|
15
|
+
lifecycle: 0
|
|
16
|
+
});
|
|
17
|
+
onBeforeMount(() => {
|
|
18
|
+
});
|
|
19
|
+
onBeforeUpdate(() => {
|
|
20
|
+
state.value.startBenchmark = window.performance.now();
|
|
21
|
+
});
|
|
22
|
+
onMounted(() => {
|
|
23
|
+
perfObserver();
|
|
24
|
+
nextTick(() => {
|
|
25
|
+
state.value.lifecycle = performance.now() - startTime.value;
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
onUpdated(() => {
|
|
29
|
+
domBenchmark();
|
|
30
|
+
});
|
|
31
|
+
function perfObserver() {
|
|
32
|
+
new PerformanceObserver((entryList) => {
|
|
33
|
+
for (const entry of entryList.getEntries()) {
|
|
34
|
+
state.value.timeToRender = entry.loadEventEnd - entry.responseEnd;
|
|
35
|
+
showConsole();
|
|
36
|
+
}
|
|
37
|
+
}).observe({
|
|
38
|
+
type: "navigation",
|
|
39
|
+
buffered: true
|
|
40
|
+
});
|
|
41
|
+
new PerformanceObserver((entryList) => {
|
|
42
|
+
for (const entry of entryList.getEntries()) {
|
|
43
|
+
state.value.firstInputDelay = entry.processingStart - entry.startTime;
|
|
44
|
+
showConsole();
|
|
45
|
+
}
|
|
46
|
+
}).observe({
|
|
47
|
+
type: "first-input",
|
|
48
|
+
buffered: true
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
__name(perfObserver, "perfObserver");
|
|
52
|
+
function domBenchmark() {
|
|
53
|
+
const end = window.performance.now();
|
|
54
|
+
state.value.timeToUpdate = end - state.value.startBenchmark;
|
|
55
|
+
showConsole();
|
|
56
|
+
}
|
|
57
|
+
__name(domBenchmark, "domBenchmark");
|
|
58
|
+
function showConsole() {
|
|
59
|
+
console.group(label);
|
|
60
|
+
console.log("LIFECYCLE", state.value.lifecycle);
|
|
61
|
+
console.log("TIME TO RENDER", state.value.timeToRender);
|
|
62
|
+
console.log("TIME TO INTERACTIVE", state.value.firstInputDelay);
|
|
63
|
+
console.log("TIME TO UPDATE", state.value.timeToUpdate);
|
|
64
|
+
console.groupEnd();
|
|
65
|
+
}
|
|
66
|
+
__name(showConsole, "showConsole");
|
|
67
|
+
}, "usePerformanceObserver");
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
usePerformanceObserver
|
|
71
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/context.ts
|
|
6
|
+
import { inject, provide } from "vue";
|
|
7
|
+
var usePixelCreateContext = /* @__PURE__ */ __name((id) => {
|
|
8
|
+
const contextId = Symbol(id);
|
|
9
|
+
const provider = /* @__PURE__ */ __name((value) => provide(contextId, value), "provider");
|
|
10
|
+
const consumer = /* @__PURE__ */ __name((fallback) => inject(contextId, fallback), "consumer");
|
|
11
|
+
return [provider, consumer, contextId];
|
|
12
|
+
}, "usePixelCreateContext");
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
usePixelCreateContext
|
|
16
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/object.ts
|
|
6
|
+
import { isVNode } from "vue";
|
|
7
|
+
function isObject(obj) {
|
|
8
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
9
|
+
}
|
|
10
|
+
__name(isObject, "isObject");
|
|
11
|
+
function objectFilter(object, fn) {
|
|
12
|
+
const result = {};
|
|
13
|
+
Object.keys(object).forEach((key) => {
|
|
14
|
+
const value = object[key];
|
|
15
|
+
const shouldPass = fn(value, key, object);
|
|
16
|
+
if (shouldPass)
|
|
17
|
+
result[key] = value;
|
|
18
|
+
});
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
__name(objectFilter, "objectFilter");
|
|
22
|
+
var objectFilterUndefined = /* @__PURE__ */ __name((object) => objectFilter(object, (value) => value !== null && value !== void 0), "objectFilterUndefined");
|
|
23
|
+
function getChildren(slots) {
|
|
24
|
+
var _a;
|
|
25
|
+
const slot = ((_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) || [];
|
|
26
|
+
return slot.filter((value) => isVNode(value));
|
|
27
|
+
}
|
|
28
|
+
__name(getChildren, "getChildren");
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
isObject,
|
|
32
|
+
objectFilter,
|
|
33
|
+
objectFilterUndefined,
|
|
34
|
+
getChildren
|
|
35
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/generators.ts
|
|
6
|
+
import { ref, computed } from "vue";
|
|
7
|
+
var increment = 0;
|
|
8
|
+
var getUniqueId = /* @__PURE__ */ __name((id, prefix) => {
|
|
9
|
+
const initial = id || ++increment;
|
|
10
|
+
const unique = ref(initial);
|
|
11
|
+
return computed(() => {
|
|
12
|
+
const result = unique.value !== null ? unique.value.toString() : void 0;
|
|
13
|
+
return prefix ? `mpx-${prefix}-${result}` : result;
|
|
14
|
+
});
|
|
15
|
+
}, "getUniqueId");
|
|
16
|
+
function useId(size = 3) {
|
|
17
|
+
let uuid = "";
|
|
18
|
+
const dictionary = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
19
|
+
for (let i = 0; i < size; i++) {
|
|
20
|
+
uuid += dictionary.charAt(Math.floor(Math.random() * dictionary.length));
|
|
21
|
+
}
|
|
22
|
+
return uuid;
|
|
23
|
+
}
|
|
24
|
+
__name(useId, "useId");
|
|
25
|
+
var declareEmit = /* @__PURE__ */ __name((value) => value, "declareEmit");
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
getUniqueId,
|
|
29
|
+
useId,
|
|
30
|
+
declareEmit
|
|
31
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__name
|
|
3
|
+
} from "./chunk-QZ7VFGWC.mjs";
|
|
4
|
+
|
|
5
|
+
// src/dom.ts
|
|
6
|
+
function isElementVisible(domElement) {
|
|
7
|
+
return new Promise((resolve) => {
|
|
8
|
+
const o = new IntersectionObserver(([entry]) => {
|
|
9
|
+
resolve(entry.intersectionRatio === 1);
|
|
10
|
+
o.disconnect();
|
|
11
|
+
});
|
|
12
|
+
o.observe(domElement);
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
__name(isElementVisible, "isElementVisible");
|
|
16
|
+
function scrollToTargetElement(target, containerEl, position) {
|
|
17
|
+
const isElement = target && target.nodeType === 1;
|
|
18
|
+
if (isElement && !position) {
|
|
19
|
+
containerEl.scrollTop = target.offsetTop;
|
|
20
|
+
} else if (position === "bottom") {
|
|
21
|
+
containerEl.scrollTop = containerEl.scrollHeight - containerEl.offsetHeight;
|
|
22
|
+
} else if (position === "top") {
|
|
23
|
+
containerEl.scrollTop = 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
__name(scrollToTargetElement, "scrollToTargetElement");
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
isElementVisible,
|
|
30
|
+
scrollToTargetElement
|
|
31
|
+
};
|
|
File without changes
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/context.ts
|
|
22
|
+
var context_exports = {};
|
|
23
|
+
__export(context_exports, {
|
|
24
|
+
usePixelCreateContext: () => usePixelCreateContext
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(context_exports);
|
|
27
|
+
var import_vue = require("vue");
|
|
28
|
+
var usePixelCreateContext = /* @__PURE__ */ __name((id) => {
|
|
29
|
+
const contextId = Symbol(id);
|
|
30
|
+
const provider = /* @__PURE__ */ __name((value) => (0, import_vue.provide)(contextId, value), "provider");
|
|
31
|
+
const consumer = /* @__PURE__ */ __name((fallback) => (0, import_vue.inject)(contextId, fallback), "consumer");
|
|
32
|
+
return [provider, consumer, contextId];
|
|
33
|
+
}, "usePixelCreateContext");
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
usePixelCreateContext
|
|
37
|
+
});
|
package/dist/context.mjs
ADDED
package/dist/dom.d.mts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* isElementVisible
|
|
3
|
+
* @param {DOM} domElement
|
|
4
|
+
* @returns {Boolean}
|
|
5
|
+
*/
|
|
6
|
+
declare function isElementVisible(domElement: Element): Promise<unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* scrollToTarget
|
|
9
|
+
* @param {DOM} target
|
|
10
|
+
* @param {DOM} containerEl
|
|
11
|
+
*/
|
|
12
|
+
declare function scrollToTargetElement(target: Element, containerEl: Element, position?: 'top' | 'bottom'): void;
|
|
13
|
+
|
|
14
|
+
export { isElementVisible, scrollToTargetElement };
|
package/dist/dom.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* isElementVisible
|
|
3
|
+
* @param {DOM} domElement
|
|
4
|
+
* @returns {Boolean}
|
|
5
|
+
*/
|
|
6
|
+
declare function isElementVisible(domElement: Element): Promise<unknown>;
|
|
7
|
+
/**
|
|
8
|
+
* scrollToTarget
|
|
9
|
+
* @param {DOM} target
|
|
10
|
+
* @param {DOM} containerEl
|
|
11
|
+
*/
|
|
12
|
+
declare function scrollToTargetElement(target: Element, containerEl: Element, position?: 'top' | 'bottom'): void;
|
|
13
|
+
|
|
14
|
+
export { isElementVisible, scrollToTargetElement };
|
package/dist/dom.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/dom.ts
|
|
22
|
+
var dom_exports = {};
|
|
23
|
+
__export(dom_exports, {
|
|
24
|
+
isElementVisible: () => isElementVisible,
|
|
25
|
+
scrollToTargetElement: () => scrollToTargetElement
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(dom_exports);
|
|
28
|
+
function isElementVisible(domElement) {
|
|
29
|
+
return new Promise((resolve) => {
|
|
30
|
+
const o = new IntersectionObserver(([entry]) => {
|
|
31
|
+
resolve(entry.intersectionRatio === 1);
|
|
32
|
+
o.disconnect();
|
|
33
|
+
});
|
|
34
|
+
o.observe(domElement);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
__name(isElementVisible, "isElementVisible");
|
|
38
|
+
function scrollToTargetElement(target, containerEl, position) {
|
|
39
|
+
const isElement = target && target.nodeType === 1;
|
|
40
|
+
if (isElement && !position) {
|
|
41
|
+
containerEl.scrollTop = target.offsetTop;
|
|
42
|
+
} else if (position === "bottom") {
|
|
43
|
+
containerEl.scrollTop = containerEl.scrollHeight - containerEl.offsetHeight;
|
|
44
|
+
} else if (position === "top") {
|
|
45
|
+
containerEl.scrollTop = 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
__name(scrollToTargetElement, "scrollToTargetElement");
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
isElementVisible,
|
|
52
|
+
scrollToTargetElement
|
|
53
|
+
});
|
package/dist/dom.mjs
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
|
|
3
|
+
declare const getUniqueId: (id?: string, prefix?: string) => vue.ComputedRef<string | undefined>;
|
|
4
|
+
declare function useId(size?: number): string;
|
|
5
|
+
declare const declareEmit: <T extends string>(value: T[]) => T[];
|
|
6
|
+
|
|
7
|
+
export { declareEmit, getUniqueId, useId };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as vue from 'vue';
|
|
2
|
+
|
|
3
|
+
declare const getUniqueId: (id?: string, prefix?: string) => vue.ComputedRef<string | undefined>;
|
|
4
|
+
declare function useId(size?: number): string;
|
|
5
|
+
declare const declareEmit: <T extends string>(value: T[]) => T[];
|
|
6
|
+
|
|
7
|
+
export { declareEmit, getUniqueId, useId };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
|
|
21
|
+
// src/generators.ts
|
|
22
|
+
var generators_exports = {};
|
|
23
|
+
__export(generators_exports, {
|
|
24
|
+
declareEmit: () => declareEmit,
|
|
25
|
+
getUniqueId: () => getUniqueId,
|
|
26
|
+
useId: () => useId
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(generators_exports);
|
|
29
|
+
var import_vue = require("vue");
|
|
30
|
+
var increment = 0;
|
|
31
|
+
var getUniqueId = /* @__PURE__ */ __name((id, prefix) => {
|
|
32
|
+
const initial = id || ++increment;
|
|
33
|
+
const unique = (0, import_vue.ref)(initial);
|
|
34
|
+
return (0, import_vue.computed)(() => {
|
|
35
|
+
const result = unique.value !== null ? unique.value.toString() : void 0;
|
|
36
|
+
return prefix ? `mpx-${prefix}-${result}` : result;
|
|
37
|
+
});
|
|
38
|
+
}, "getUniqueId");
|
|
39
|
+
function useId(size = 3) {
|
|
40
|
+
let uuid = "";
|
|
41
|
+
const dictionary = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
42
|
+
for (let i = 0; i < size; i++) {
|
|
43
|
+
uuid += dictionary.charAt(Math.floor(Math.random() * dictionary.length));
|
|
44
|
+
}
|
|
45
|
+
return uuid;
|
|
46
|
+
}
|
|
47
|
+
__name(useId, "useId");
|
|
48
|
+
var declareEmit = /* @__PURE__ */ __name((value) => value, "declareEmit");
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
declareEmit,
|
|
52
|
+
getUniqueId,
|
|
53
|
+
useId
|
|
54
|
+
});
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { usePerformanceObserver } from './performance.mjs';
|
|
2
|
+
export { isDef, isEqual, isUndef } from './validators.mjs';
|
|
3
|
+
export { declareEmit, getUniqueId, useId } from './generators.mjs';
|
|
4
|
+
export { getChildren, isObject, objectFilter, objectFilterUndefined } from './object.mjs';
|
|
5
|
+
export { usePixelCreateContext } from './context.mjs';
|
|
6
|
+
export { isElementVisible, scrollToTargetElement } from './dom.mjs';
|
|
7
|
+
export { ComponentWithProps, Dict, FilterFn, Optional, PropTypes } from './types.mjs';
|
|
8
|
+
export { groupBy } from './array.mjs';
|
|
9
|
+
export { onClickOutside, onKeyStroke, unrefElement, useInfiniteScroll, useIntersectionObserver, useStorage, useVirtualList } from '@vueuse/core';
|
|
10
|
+
import 'vue';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { usePerformanceObserver } from './performance.js';
|
|
2
|
+
export { isDef, isEqual, isUndef } from './validators.js';
|
|
3
|
+
export { declareEmit, getUniqueId, useId } from './generators.js';
|
|
4
|
+
export { getChildren, isObject, objectFilter, objectFilterUndefined } from './object.js';
|
|
5
|
+
export { usePixelCreateContext } from './context.js';
|
|
6
|
+
export { isElementVisible, scrollToTargetElement } from './dom.js';
|
|
7
|
+
export { ComponentWithProps, Dict, FilterFn, Optional, PropTypes } from './types.js';
|
|
8
|
+
export { groupBy } from './array.js';
|
|
9
|
+
export { onClickOutside, onKeyStroke, unrefElement, useInfiniteScroll, useIntersectionObserver, useStorage, useVirtualList } from '@vueuse/core';
|
|
10
|
+
import 'vue';
|