@lvce-editor/virtual-dom 1.13.0 → 1.14.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/index.js CHANGED
@@ -318,9 +318,19 @@ var getWrappedListener = (listener, returnValue) => {
318
318
  };
319
319
 
320
320
  // src/parts/AttachEvent/AttachEvent.ts
321
+ var getOptions = (fn) => {
322
+ if (fn.passive) {
323
+ return {
324
+ passive: true
325
+ };
326
+ }
327
+ return void 0;
328
+ };
321
329
  var attachEvent = ($Node, eventMap, key, value, newEventMap) => {
322
330
  if (newEventMap && newEventMap[value]) {
323
- $Node.addEventListener(key, newEventMap[value]);
331
+ const fn = newEventMap[value];
332
+ const options2 = getOptions(fn);
333
+ $Node.addEventListener(key, newEventMap[value], options2);
324
334
  return;
325
335
  }
326
336
  const listener = eventMap[value];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/virtual-dom",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "keywords": [],
@@ -1,6 +1,15 @@
1
1
  import * as GetEventListenerOptions from '../GetEventListenerOptions/GetEventListenerOptions.ts'
2
2
  import * as GetWrappedListener from '../GetWrappedListener/GetWrappedListener.ts'
3
3
 
4
+ const getOptions = (fn: any) => {
5
+ if (fn.passive) {
6
+ return {
7
+ passive: true,
8
+ }
9
+ }
10
+ return undefined
11
+ }
12
+
4
13
  export const attachEvent = (
5
14
  $Node: HTMLElement,
6
15
  eventMap: any,
@@ -9,8 +18,10 @@ export const attachEvent = (
9
18
  newEventMap?: any,
10
19
  ) => {
11
20
  if (newEventMap && newEventMap[value]) {
21
+ const fn = newEventMap[value]
22
+ const options: any = getOptions(fn)
12
23
  // TODO support event listener options
13
- $Node.addEventListener(key, newEventMap[value])
24
+ $Node.addEventListener(key, newEventMap[value], options)
14
25
  return
15
26
  }
16
27
  const listener = eventMap[value]