directix 2.0.0 → 2.1.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/README.md +38 -12
- package/dist/index.cjs +49 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +124 -0
- package/dist/index.iife.js +49 -2
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +2 -2
- package/dist/index.mjs +49 -2
- package/dist/index.mjs.map +1 -1
- package/dist/nuxt/index.cjs +1 -1
- package/dist/nuxt/index.d.ts +1 -1
- package/dist/nuxt/index.mjs +1 -1
- package/dist/nuxt/runtime/plugin.mjs +1 -1
- package/package.json +14 -14
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* directix v2.
|
|
2
|
+
* directix v2.1.0
|
|
3
3
|
* A comprehensive, easy-to-use, and high-performance Vue custom directives library supporting both Vue 2 and Vue 3, with Web Components support
|
|
4
4
|
* (c) 2021-present saqqdy <https://github.com/saqqdy>
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -58,7 +58,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
60
|
/*!
|
|
61
|
-
* directix v2.
|
|
61
|
+
* directix v2.1.0
|
|
62
62
|
* A comprehensive, easy-to-use, and high-performance Vue custom directives library supporting both Vue 2 and Vue 3, with Web Components support
|
|
63
63
|
* (c) 2021-present saqqdy <https://github.com/saqqdy>
|
|
64
64
|
* Released under the MIT License.
|
|
@@ -22065,6 +22065,48 @@ function registerDirectiveElements(elements) {
|
|
|
22065
22065
|
customElements.define(elementName, elementClass);
|
|
22066
22066
|
});
|
|
22067
22067
|
}
|
|
22068
|
+
function isCustomElementDefined(name) {
|
|
22069
|
+
return customElements.get(name) !== void 0;
|
|
22070
|
+
}
|
|
22071
|
+
function whenCustomElementDefined(name) {
|
|
22072
|
+
return __async(this, null, function* () {
|
|
22073
|
+
yield customElements.whenDefined(name);
|
|
22074
|
+
});
|
|
22075
|
+
}
|
|
22076
|
+
function getRegisteredCustomElements() {
|
|
22077
|
+
const registry = customElements.__registry;
|
|
22078
|
+
if (registry && typeof registry.keys === "function") {
|
|
22079
|
+
return Array.from(registry.keys());
|
|
22080
|
+
}
|
|
22081
|
+
return [];
|
|
22082
|
+
}
|
|
22083
|
+
function hydrateCustomElements(root = document.body) {
|
|
22084
|
+
const customElementsList = root.querySelectorAll("*");
|
|
22085
|
+
customElementsList.forEach((el) => {
|
|
22086
|
+
var _a2;
|
|
22087
|
+
if (isCustomElement(el)) {
|
|
22088
|
+
const clone = el.cloneNode(true);
|
|
22089
|
+
(_a2 = el.parentNode) == null ? void 0 : _a2.replaceChild(clone, el);
|
|
22090
|
+
}
|
|
22091
|
+
});
|
|
22092
|
+
}
|
|
22093
|
+
function createSSRSafeCustomElement(name, directive, options) {
|
|
22094
|
+
const { styles, shadow = false } = options || {};
|
|
22095
|
+
const ssrRender = (attrs = {}) => {
|
|
22096
|
+
const attrString = Object.entries(attrs).map(([key, value]) => `${key}="${value}"`).join(" ");
|
|
22097
|
+
if (shadow) {
|
|
22098
|
+
const stylesString = styles ? `<style>${Array.isArray(styles) ? styles.join("") : styles}</style>` : "";
|
|
22099
|
+
return `<${name} ${attrString}><template shadowroot="open">${stylesString}<slot></slot></template></${name}>`;
|
|
22100
|
+
}
|
|
22101
|
+
return `<${name} ${attrString}></${name}>`;
|
|
22102
|
+
};
|
|
22103
|
+
const elementClass = typeof window === "undefined" ? class extends HTMLElement {
|
|
22104
|
+
} : createDirectiveElement(name, directive, options);
|
|
22105
|
+
return {
|
|
22106
|
+
elementClass,
|
|
22107
|
+
ssrRender
|
|
22108
|
+
};
|
|
22109
|
+
}
|
|
22068
22110
|
const zhCN = {
|
|
22069
22111
|
directives: {
|
|
22070
22112
|
debounce: {
|
|
@@ -24239,6 +24281,7 @@ export {
|
|
|
24239
24281
|
createPerformanceBudget,
|
|
24240
24282
|
createPermissionCheck,
|
|
24241
24283
|
createPermissionChecker,
|
|
24284
|
+
createSSRSafeCustomElement,
|
|
24242
24285
|
createSafeContentHandler,
|
|
24243
24286
|
createSafeDirectiveWrapper,
|
|
24244
24287
|
createStyleDirective,
|
|
@@ -24359,6 +24402,7 @@ export {
|
|
|
24359
24402
|
getPluginManager,
|
|
24360
24403
|
getPluginRegistry,
|
|
24361
24404
|
getPolyfillStatus,
|
|
24405
|
+
getRegisteredCustomElements,
|
|
24362
24406
|
getSlowestDirectives,
|
|
24363
24407
|
getSupportedRegions,
|
|
24364
24408
|
getTimezoneInfo,
|
|
@@ -24369,6 +24413,7 @@ export {
|
|
|
24369
24413
|
handleTouchConflict,
|
|
24370
24414
|
hasPermission$2 as hasPermission,
|
|
24371
24415
|
hasPermissionSync,
|
|
24416
|
+
hydrateCustomElements,
|
|
24372
24417
|
importConfig,
|
|
24373
24418
|
incrementCounter,
|
|
24374
24419
|
info,
|
|
@@ -24383,6 +24428,7 @@ export {
|
|
|
24383
24428
|
isBrowser,
|
|
24384
24429
|
isBrowserSupported,
|
|
24385
24430
|
isCustomElement,
|
|
24431
|
+
isCustomElementDefined,
|
|
24386
24432
|
isDOMReady,
|
|
24387
24433
|
isDevtoolsAvailable,
|
|
24388
24434
|
isEmpty,
|
|
@@ -24620,6 +24666,7 @@ export {
|
|
|
24620
24666
|
warnUnsupportedFeatures,
|
|
24621
24667
|
watchConfig,
|
|
24622
24668
|
watchEffectBinding,
|
|
24669
|
+
whenCustomElementDefined,
|
|
24623
24670
|
withAuditLog,
|
|
24624
24671
|
withErrorRecovery,
|
|
24625
24672
|
withPerformanceMonitoring,
|