@domql/router 3.7.0 → 3.7.4
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/iife/index.js +25 -0
- package/package.json +3 -3
package/dist/iife/index.js
CHANGED
|
@@ -163,8 +163,30 @@ var DomqlRouter = (() => {
|
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
// ../../packages/utils/dist/esm/function.js
|
|
166
|
+
var resolveHandler, runPluginHook;
|
|
166
167
|
var init_function = __esm({
|
|
167
168
|
"../../packages/utils/dist/esm/function.js"() {
|
|
169
|
+
resolveHandler = (handler, element) => {
|
|
170
|
+
if (typeof handler === "function") return handler;
|
|
171
|
+
const plugins = element?.context?.plugins;
|
|
172
|
+
if (!plugins) return handler;
|
|
173
|
+
for (const plugin of plugins) {
|
|
174
|
+
if (plugin.resolveHandler) {
|
|
175
|
+
const resolved = plugin.resolveHandler(handler, element);
|
|
176
|
+
if (typeof resolved === "function") return resolved;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return handler;
|
|
180
|
+
};
|
|
181
|
+
runPluginHook = (hookName, element, ...args) => {
|
|
182
|
+
const plugins = element?.context?.plugins;
|
|
183
|
+
if (!plugins) return;
|
|
184
|
+
for (const plugin of plugins) {
|
|
185
|
+
if (typeof plugin[hookName] === "function") {
|
|
186
|
+
plugin[hookName](element, ...args);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
168
190
|
}
|
|
169
191
|
});
|
|
170
192
|
|
|
@@ -235,6 +257,7 @@ var DomqlRouter = (() => {
|
|
|
235
257
|
var init_triggerEvent = __esm({
|
|
236
258
|
"../../packages/utils/dist/esm/triggerEvent.js"() {
|
|
237
259
|
init_types();
|
|
260
|
+
init_function();
|
|
238
261
|
getOnOrPropsEvent = (param, element) => {
|
|
239
262
|
const onEvent = element.on?.[param];
|
|
240
263
|
if (onEvent) return onEvent;
|
|
@@ -244,6 +267,7 @@ var DomqlRouter = (() => {
|
|
|
244
267
|
return props[propKey];
|
|
245
268
|
};
|
|
246
269
|
applyEvent = (param, element, state, context, options) => {
|
|
270
|
+
param = resolveHandler(param, element);
|
|
247
271
|
if (!isFunction(param)) return;
|
|
248
272
|
try {
|
|
249
273
|
const result = param.call(
|
|
@@ -270,6 +294,7 @@ var DomqlRouter = (() => {
|
|
|
270
294
|
if (!element) {
|
|
271
295
|
throw new Error("Element is required");
|
|
272
296
|
}
|
|
297
|
+
runPluginHook(param, element, options);
|
|
273
298
|
const appliedFunction = getOnOrPropsEvent(param, element);
|
|
274
299
|
if (appliedFunction) {
|
|
275
300
|
const { state, context } = element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@domql/router",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.4",
|
|
4
4
|
"license": "CC-BY-NC-4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"prepublish": "npm run build && npm run copy:package:cjs"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@domql/element": "^3.7.
|
|
31
|
-
"@domql/utils": "^3.7.
|
|
30
|
+
"@domql/element": "^3.7.4",
|
|
31
|
+
"@domql/utils": "^3.7.4"
|
|
32
32
|
},
|
|
33
33
|
"gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
|
|
34
34
|
"devDependencies": {
|