@mpxjs/webpack-plugin 2.9.66 → 2.9.69-beta.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.
Files changed (158) hide show
  1. package/lib/dependencies/RecordGlobalComponentsDependency.js +11 -12
  2. package/lib/dependencies/RecordRuntimeInfoDependency.js +1 -1
  3. package/lib/index.js +29 -8
  4. package/lib/json-compiler/index.js +2 -11
  5. package/lib/loader.js +24 -45
  6. package/lib/native-loader.js +49 -64
  7. package/lib/platform/json/wx/index.js +24 -18
  8. package/lib/platform/style/wx/index.js +49 -47
  9. package/lib/platform/template/wx/component-config/canvas.js +8 -0
  10. package/lib/platform/template/wx/component-config/fix-component-name.js +15 -12
  11. package/lib/platform/template/wx/component-config/index.js +1 -1
  12. package/lib/platform/template/wx/component-config/input.js +1 -1
  13. package/lib/platform/template/wx/component-config/rich-text.js +8 -0
  14. package/lib/platform/template/wx/component-config/swiper.js +1 -1
  15. package/lib/platform/template/wx/component-config/textarea.js +1 -1
  16. package/lib/platform/template/wx/component-config/unsupported.js +1 -1
  17. package/lib/react/index.js +4 -3
  18. package/lib/react/processJSON.js +5 -13
  19. package/lib/react/processMainScript.js +7 -3
  20. package/lib/react/processScript.js +3 -4
  21. package/lib/react/processStyles.js +14 -4
  22. package/lib/react/processTemplate.js +5 -2
  23. package/lib/resolver/AddModePlugin.js +20 -7
  24. package/lib/runtime/components/react/context.ts +6 -0
  25. package/lib/runtime/components/react/dist/context.js +2 -0
  26. package/lib/runtime/components/react/dist/event.config.js +24 -24
  27. package/lib/runtime/components/react/dist/getInnerListeners.js +183 -174
  28. package/lib/runtime/components/react/dist/mpx-button.jsx +78 -50
  29. package/lib/runtime/components/react/dist/mpx-canvas/Bus.js +60 -0
  30. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.js +15 -0
  31. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.js +84 -0
  32. package/lib/runtime/components/react/dist/mpx-canvas/Image.js +87 -0
  33. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.js +15 -0
  34. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.js +28 -0
  35. package/lib/runtime/components/react/dist/mpx-canvas/html.js +343 -0
  36. package/lib/runtime/components/react/dist/mpx-canvas/index.jsx +232 -0
  37. package/lib/runtime/components/react/dist/mpx-canvas/utils.jsx +89 -0
  38. package/lib/runtime/components/react/dist/mpx-checkbox-group.jsx +41 -34
  39. package/lib/runtime/components/react/dist/mpx-checkbox.jsx +30 -39
  40. package/lib/runtime/components/react/dist/mpx-form.jsx +47 -41
  41. package/lib/runtime/components/react/dist/mpx-icon.jsx +9 -17
  42. package/lib/runtime/components/react/dist/mpx-image.jsx +291 -0
  43. package/lib/runtime/components/react/dist/mpx-input.jsx +95 -62
  44. package/lib/runtime/components/react/dist/mpx-label.jsx +24 -28
  45. package/lib/runtime/components/react/dist/mpx-movable-area.jsx +20 -30
  46. package/lib/runtime/components/react/dist/mpx-movable-view.jsx +377 -293
  47. package/lib/runtime/components/react/dist/mpx-navigator.jsx +3 -5
  48. package/lib/runtime/components/react/dist/mpx-picker/date.jsx +6 -2
  49. package/lib/runtime/components/react/dist/mpx-picker/index.jsx +5 -3
  50. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.jsx +6 -2
  51. package/lib/runtime/components/react/dist/mpx-picker/region.jsx +6 -2
  52. package/lib/runtime/components/react/dist/mpx-picker/selector.jsx +6 -2
  53. package/lib/runtime/components/react/dist/mpx-picker/time.jsx +10 -15
  54. package/lib/runtime/components/react/dist/mpx-picker-view-column-item.jsx +39 -0
  55. package/lib/runtime/components/react/dist/mpx-picker-view-column.jsx +160 -88
  56. package/lib/runtime/components/react/dist/mpx-picker-view.jsx +80 -121
  57. package/lib/runtime/components/react/dist/mpx-radio-group.jsx +39 -34
  58. package/lib/runtime/components/react/dist/mpx-radio.jsx +28 -43
  59. package/lib/runtime/components/react/dist/mpx-rich-text/html.js +39 -0
  60. package/lib/runtime/components/react/dist/mpx-rich-text/index.jsx +63 -0
  61. package/lib/runtime/components/react/dist/mpx-root-portal.jsx +7 -5
  62. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +77 -51
  63. package/lib/runtime/components/react/dist/mpx-simple-text.jsx +11 -0
  64. package/lib/runtime/components/react/dist/mpx-swiper-item.jsx +5 -3
  65. package/lib/runtime/components/react/dist/mpx-swiper.jsx +606 -0
  66. package/lib/runtime/components/react/dist/mpx-switch.jsx +28 -11
  67. package/lib/runtime/components/react/dist/mpx-text.jsx +12 -11
  68. package/lib/runtime/components/react/dist/mpx-textarea.jsx +9 -4
  69. package/lib/runtime/components/react/dist/mpx-view.jsx +66 -62
  70. package/lib/runtime/components/react/dist/mpx-web-view.jsx +113 -36
  71. package/lib/runtime/components/react/dist/pickerFaces.js +81 -0
  72. package/lib/runtime/components/react/dist/pickerVIewContext.js +9 -0
  73. package/lib/runtime/components/react/dist/pickerViewMask.jsx +18 -0
  74. package/lib/runtime/components/react/dist/pickerViewOverlay.jsx +23 -0
  75. package/lib/runtime/components/react/dist/useAnimationHooks.js +126 -12
  76. package/lib/runtime/components/react/dist/utils.jsx +80 -24
  77. package/lib/runtime/components/react/event.config.ts +25 -26
  78. package/lib/runtime/components/react/getInnerListeners.ts +237 -198
  79. package/lib/runtime/components/react/mpx-button.tsx +105 -58
  80. package/lib/runtime/components/react/mpx-canvas/Bus.ts +70 -0
  81. package/lib/runtime/components/react/mpx-canvas/CanvasGradient.ts +18 -0
  82. package/lib/runtime/components/react/mpx-canvas/CanvasRenderingContext2D.ts +87 -0
  83. package/lib/runtime/components/react/mpx-canvas/Image.ts +102 -0
  84. package/lib/runtime/components/react/mpx-canvas/ImageData.ts +23 -0
  85. package/lib/runtime/components/react/mpx-canvas/constructorsRegistry.ts +38 -0
  86. package/lib/runtime/components/react/mpx-canvas/html.ts +343 -0
  87. package/lib/runtime/components/react/mpx-canvas/index.tsx +296 -0
  88. package/lib/runtime/components/react/mpx-canvas/utils.tsx +150 -0
  89. package/lib/runtime/components/react/mpx-checkbox-group.tsx +77 -51
  90. package/lib/runtime/components/react/mpx-checkbox.tsx +49 -50
  91. package/lib/runtime/components/react/mpx-form.tsx +62 -57
  92. package/lib/runtime/components/react/mpx-icon.tsx +13 -18
  93. package/lib/runtime/components/react/mpx-image.tsx +436 -0
  94. package/lib/runtime/components/react/mpx-input.tsx +139 -117
  95. package/lib/runtime/components/react/mpx-label.tsx +36 -34
  96. package/lib/runtime/components/react/mpx-movable-area.tsx +26 -39
  97. package/lib/runtime/components/react/mpx-movable-view.tsx +455 -337
  98. package/lib/runtime/components/react/mpx-navigator.tsx +3 -9
  99. package/lib/runtime/components/react/mpx-picker/date.tsx +5 -2
  100. package/lib/runtime/components/react/mpx-picker/index.tsx +3 -2
  101. package/lib/runtime/components/react/mpx-picker/multiSelector.tsx +5 -2
  102. package/lib/runtime/components/react/mpx-picker/region.tsx +5 -2
  103. package/lib/runtime/components/react/mpx-picker/selector.tsx +5 -2
  104. package/lib/runtime/components/react/mpx-picker/time.tsx +10 -15
  105. package/lib/runtime/components/react/mpx-picker/type.ts +48 -43
  106. package/lib/runtime/components/react/mpx-picker-view-column.tsx +236 -104
  107. package/lib/runtime/components/react/mpx-picker-view.tsx +132 -122
  108. package/lib/runtime/components/react/mpx-radio-group.tsx +77 -54
  109. package/lib/runtime/components/react/mpx-radio.tsx +46 -55
  110. package/lib/runtime/components/react/mpx-rich-text/html.ts +40 -0
  111. package/lib/runtime/components/react/mpx-rich-text/index.tsx +121 -0
  112. package/lib/runtime/components/react/mpx-root-portal.tsx +4 -6
  113. package/lib/runtime/components/react/mpx-scroll-view.tsx +122 -76
  114. package/lib/runtime/components/react/mpx-simple-text.tsx +18 -0
  115. package/lib/runtime/components/react/mpx-swiper/carouse.tsx +6 -4
  116. package/lib/runtime/components/react/mpx-swiper/index.tsx +2 -1
  117. package/lib/runtime/components/react/mpx-swiper-item.tsx +4 -3
  118. package/lib/runtime/components/react/mpx-switch.tsx +39 -25
  119. package/lib/runtime/components/react/mpx-text.tsx +15 -19
  120. package/lib/runtime/components/react/mpx-textarea.tsx +12 -11
  121. package/lib/runtime/components/react/mpx-view.tsx +93 -77
  122. package/lib/runtime/components/react/mpx-web-view.tsx +117 -55
  123. package/lib/runtime/components/react/pickerFaces.ts +104 -0
  124. package/lib/runtime/components/react/pickerOverlay.tsx +32 -0
  125. package/lib/runtime/components/react/types/common.ts +2 -0
  126. package/lib/runtime/components/react/types/global.d.ts +5 -17
  127. package/lib/runtime/components/react/useAnimationHooks.ts +127 -18
  128. package/lib/runtime/components/react/useNodesRef.ts +1 -0
  129. package/lib/runtime/components/react/utils.tsx +113 -27
  130. package/lib/runtime/components/web/getInnerListeners.js +6 -6
  131. package/lib/runtime/components/web/mpx-movable-view.vue +334 -344
  132. package/lib/runtime/components/web/mpx-picker-view-column.vue +75 -75
  133. package/lib/runtime/components/web/mpx-picker.vue +382 -385
  134. package/lib/runtime/components/web/mpx-web-view.vue +175 -161
  135. package/lib/runtime/optionProcessor.js +7 -38
  136. package/lib/runtime/optionProcessorReact.js +0 -15
  137. package/lib/runtime/swanHelper.wxs +1 -1
  138. package/lib/runtime/utils.js +2 -0
  139. package/lib/style-compiler/index.js +1 -1
  140. package/lib/style-compiler/plugins/scope-id.js +31 -2
  141. package/lib/template-compiler/bind-this.js +7 -2
  142. package/lib/template-compiler/compiler.js +118 -56
  143. package/lib/template-compiler/gen-node-react.js +3 -3
  144. package/lib/template-compiler/index.js +4 -4
  145. package/lib/utils/pre-process-json.js +117 -0
  146. package/lib/web/index.js +5 -4
  147. package/lib/web/processJSON.js +5 -13
  148. package/lib/web/processTemplate.js +2 -2
  149. package/package.json +6 -4
  150. package/LICENSE +0 -433
  151. package/lib/runtime/components/react/dist/mpx-image/index.jsx +0 -226
  152. package/lib/runtime/components/react/dist/mpx-image/svg.jsx +0 -7
  153. package/lib/runtime/components/react/dist/mpx-swiper/carouse.jsx +0 -478
  154. package/lib/runtime/components/react/dist/mpx-swiper/index.jsx +0 -68
  155. package/lib/runtime/components/react/dist/mpx-swiper/type.js +0 -1
  156. package/lib/runtime/components/react/mpx-image/index.tsx +0 -346
  157. package/lib/runtime/components/react/mpx-image/svg.tsx +0 -22
  158. package/lib/runtime/components/web/event.js +0 -105
@@ -1,18 +1,20 @@
1
- import { useEffect, useRef, ReactNode, ReactElement, isValidElement, useContext, useState, Dispatch, SetStateAction, Children, cloneElement } from 'react'
2
- import { LayoutChangeEvent, TextStyle } from 'react-native'
3
- import { isObject, hasOwn, diffAndCloneA, error, warn, getFocusedNavigation } from '@mpxjs/utils'
1
+ import { useEffect, useCallback, useMemo, useRef, ReactNode, ReactElement, isValidElement, useContext, useState, Dispatch, SetStateAction, Children, cloneElement } from 'react'
2
+ import { LayoutChangeEvent, TextStyle, ImageProps, Image } from 'react-native'
3
+ import { isObject, isFunction, isNumber, hasOwn, diffAndCloneA, error, warn, getFocusedNavigation } from '@mpxjs/utils'
4
4
  import { VarContext } from './context'
5
5
  import { ExpressionParser, parseFunc, ReplaceSource } from './parser'
6
6
  import { initialWindowMetrics } from 'react-native-safe-area-context'
7
- import type { ExtendedFunctionComponent } from './types/common'
7
+ import FastImage, { FastImageProps } from '@d11/react-native-fast-image'
8
+ import type { AnyFunc, ExtendedFunctionComponent } from './types/common'
8
9
 
9
10
  export const TEXT_STYLE_REGEX = /color|font.*|text.*|letterSpacing|lineHeight|includeFontPadding|writingDirection/
10
11
  export const PERCENT_REGEX = /^\s*-?\d+(\.\d+)?%\s*$/
11
12
  export const URL_REGEX = /^\s*url\(["']?(.*?)["']?\)\s*$/
13
+ export const SVG_REGEXP = /https?:\/\/.*\.(?:svg)/i
12
14
  export const BACKGROUND_REGEX = /^background(Image|Size|Repeat|Position)$/
13
- export const TEXT_PROPS_REGEX = /ellipsizeMode|numberOfLines/
15
+ export const TEXT_PROPS_REGEX = /ellipsizeMode|numberOfLines|allowFontScaling/
14
16
  export const DEFAULT_FONT_SIZE = 16
15
- export const DEFAULT_UNLAY_STYLE = {
17
+ export const HIDDEN_STYLE = {
16
18
  opacity: 0
17
19
  }
18
20
 
@@ -30,10 +32,7 @@ const safeAreaInsetMap: Record<string, 'top' | 'right' | 'bottom' | 'left'> = {
30
32
 
31
33
  function getSafeAreaInset (name: string) {
32
34
  const navigation = getFocusedNavigation()
33
- const insets = {
34
- ...initialWindowMetrics?.insets,
35
- ...navigation?.insets
36
- }
35
+ const insets = extendObject({}, initialWindowMetrics?.insets, navigation?.insets)
37
36
  return insets[safeAreaInsetMap[name]]
38
37
  }
39
38
 
@@ -78,7 +77,7 @@ export const parseInlineStyle = (inlineStyle = ''): Record<string, string> => {
78
77
  const [k, v, ...rest] = style.split(':')
79
78
  if (rest.length || !v || !k) return styleObj
80
79
  const key = k.trim().replace(/-./g, c => c.substring(1).toUpperCase())
81
- return Object.assign(styleObj, { [key]: v.trim() })
80
+ return Object.assign(styleObj, { [key]: global.__formatValue(v.trim()) })
82
81
  }, {})
83
82
  }
84
83
 
@@ -89,25 +88,18 @@ export const parseUrl = (cssUrl = '') => {
89
88
  }
90
89
 
91
90
  export const getRestProps = (transferProps: any = {}, originProps: any = {}, deletePropsKey: any = []) => {
92
- return {
93
- ...transferProps,
94
- ...omit(originProps, deletePropsKey)
95
- }
91
+ return extendObject(
92
+ {},
93
+ transferProps,
94
+ omit(originProps, deletePropsKey)
95
+ )
96
96
  }
97
97
 
98
98
  export function isText (ele: ReactNode): ele is ReactElement {
99
99
  if (isValidElement(ele)) {
100
100
  const displayName = (ele.type as ExtendedFunctionComponent)?.displayName
101
101
  const isCustomText = (ele.type as ExtendedFunctionComponent)?.isCustomText
102
- return displayName === 'mpx-text' || displayName === 'Text' || !!isCustomText
103
- }
104
- return false
105
- }
106
-
107
- export function isEmbedded (ele: ReactNode): ele is ReactElement {
108
- if (isValidElement(ele)) {
109
- const displayName = (ele.type as ExtendedFunctionComponent)?.displayName || ''
110
- return ['mpx-checkbox', 'mpx-radio', 'mpx-switch'].includes(displayName)
102
+ return displayName === 'MpxText' || displayName === 'MpxSimpleText' || displayName === 'Text' || !!isCustomText
111
103
  }
112
104
  return false
113
105
  }
@@ -275,6 +267,15 @@ function transformCalc (styleObj: Record<string, any>, calcKeyPaths: Array<Array
275
267
  })
276
268
  }
277
269
 
270
+ const stringifyProps = ['fontWeight']
271
+ function transformStringify (styleObj: Record<string, any>) {
272
+ stringifyProps.forEach((prop) => {
273
+ if (isNumber(styleObj[prop])) {
274
+ styleObj[prop] = '' + styleObj[prop]
275
+ }
276
+ })
277
+ }
278
+
278
279
  interface TransformStyleConfig {
279
280
  enableVar?: boolean
280
281
  externalVarContext?: Record<string, any>
@@ -385,6 +386,8 @@ export function useTransformStyle (styleObj: Record<string, any> = {}, { enableV
385
386
  }
386
387
  }
387
388
  })
389
+ // transform number enum stringify
390
+ transformStringify(normalStyle)
388
391
 
389
392
  return {
390
393
  normalStyle,
@@ -474,7 +477,7 @@ interface LayoutConfig {
474
477
  export const useLayout = ({ props, hasSelfPercent, setWidth, setHeight, onLayout, nodeRef }: LayoutConfig) => {
475
478
  const layoutRef = useRef({})
476
479
  const hasLayoutRef = useRef(false)
477
- const layoutStyle: Record<string, any> = !hasLayoutRef.current && hasSelfPercent ? DEFAULT_UNLAY_STYLE : {}
480
+ const layoutStyle = useMemo(() => { return !hasLayoutRef.current && hasSelfPercent ? HIDDEN_STYLE : {} }, [hasLayoutRef.current])
478
481
  const layoutProps: Record<string, any> = {}
479
482
  const enableOffset = props['enable-offset']
480
483
  if (hasSelfPercent || onLayout || enableOffset) {
@@ -513,8 +516,8 @@ export function wrapChildren (props: Record<string, any> = {}, { hasVarDec, varC
513
516
  if (textStyle || textProps) {
514
517
  children = Children.map(children, (child) => {
515
518
  if (isText(child)) {
516
- const style = { ...textStyle, ...child.props.style }
517
- return cloneElement(child, { ...textProps, style })
519
+ const style = extendObject({}, textStyle, child.props.style)
520
+ return cloneElement(child, extendObject({}, textProps, { style }))
518
521
  }
519
522
  return child
520
523
  })
@@ -524,3 +527,86 @@ export function wrapChildren (props: Record<string, any> = {}, { hasVarDec, varC
524
527
  }
525
528
  return children
526
529
  }
530
+
531
+ export const debounce = <T extends AnyFunc> (
532
+ func: T,
533
+ delay: number
534
+ ): ((...args: Parameters<T>) => void) & { clear: () => void } => {
535
+ let timer: any
536
+ const wrapper = (...args: ReadonlyArray<any>) => {
537
+ clearTimeout(timer)
538
+ timer = setTimeout(() => {
539
+ func(...args)
540
+ }, delay)
541
+ }
542
+ wrapper.clear = () => {
543
+ clearTimeout(timer)
544
+ }
545
+ return wrapper
546
+ }
547
+
548
+ export const useDebounceCallback = <T extends AnyFunc> (
549
+ func: T,
550
+ delay: number
551
+ ): ((...args: Parameters<T>) => void) & { clear: () => void } => {
552
+ const debounced = useMemo(() => debounce(func, delay), [func])
553
+ return debounced
554
+ }
555
+
556
+ export const useStableCallback = <T extends AnyFunc | null | undefined> (
557
+ callback: T
558
+ ): T extends AnyFunc ? T : () => void => {
559
+ const ref = useRef<T>(callback)
560
+ ref.current = callback
561
+ return useCallback<any>(
562
+ (...args: any[]) => ref.current?.(...args),
563
+ []
564
+ )
565
+ }
566
+
567
+ export const usePrevious = <T, > (value: T): T | undefined => {
568
+ const ref = useRef<T | undefined>(undefined)
569
+ const prev = ref.current
570
+ ref.current = value
571
+ return prev
572
+ }
573
+
574
+ export interface GestureHandler {
575
+ nodeRefs?: Array<{ getNodeInstance: () => { nodeRef: unknown } }>
576
+ current?: unknown
577
+ }
578
+
579
+ export function flatGesture (gestures: Array<GestureHandler> = []) {
580
+ return (gestures && gestures.flatMap((gesture: GestureHandler) => {
581
+ if (gesture && gesture.nodeRefs) {
582
+ return gesture.nodeRefs
583
+ .map((item: { getNodeInstance: () => any }) => item.getNodeInstance()?.instance?.gestureRef || {})
584
+ }
585
+ return gesture?.current ? [gesture] : []
586
+ })) || []
587
+ }
588
+
589
+ export const extendObject = Object.assign
590
+
591
+ export function getCurrentPage (pageId: number | null) {
592
+ if (!global.getCurrentPages) return
593
+ const pages = global.getCurrentPages()
594
+ return pages.find((page: any) => isFunction(page.getPageId) && page.getPageId() === pageId)
595
+ }
596
+
597
+ export function renderImage (
598
+ imageProps: ImageProps | FastImageProps,
599
+ enableFastImage = false
600
+ ) {
601
+ const Component: React.ComponentType<ImageProps | FastImageProps> = enableFastImage ? FastImage : Image
602
+ return <Component {...imageProps} />
603
+ }
604
+
605
+ export function pickStyle (styleObj: Record<string, any> = {}, pickedKeys: Array<string>, callback?: (key: string, val: number | string) => number | string) {
606
+ return pickedKeys.reduce<Record<string, any>>((acc, key) => {
607
+ if (key in styleObj) {
608
+ acc[key] = callback ? callback(key, styleObj[key]) : styleObj[key]
609
+ }
610
+ return acc
611
+ }, {})
612
+ }
@@ -1,3 +1,4 @@
1
+ import { extend } from '../../utils'
1
2
  function processModel (listeners, context) {
2
3
  // 该函数只有wx:model的情况下才调用,而且默认e.detail.value有值
3
4
  // 该函数必须在产生merge前执行
@@ -53,7 +54,7 @@ export function extendEvent (e, extendObj = {}) {
53
54
  }
54
55
 
55
56
  export function inheritEvent (type, oe, detail = {}) {
56
- detail = Object.assign({}, oe.detail, detail)
57
+ detail = extend({}, oe.detail, detail)
57
58
  const ne = getCustomEvent(type, detail)
58
59
  extendEvent(ne, {
59
60
  timeStamp: oe.timeStamp,
@@ -68,12 +69,11 @@ export function inheritEvent (type, oe, detail = {}) {
68
69
  export function getCustomEvent (type, detail = {}, target = null) {
69
70
  const targetEl = (target && target.$el) || null
70
71
  const targetInfo = targetEl ? { target: targetEl, currentTarget: targetEl } : {}
71
- return {
72
+ return extend({
72
73
  type,
73
74
  detail,
74
- timeStamp: new Date().valueOf(),
75
- ...targetInfo
76
- }
75
+ timeStamp: new Date().valueOf()
76
+ }, targetInfo)
77
77
  }
78
78
 
79
79
  function noop () {
@@ -82,7 +82,7 @@ function noop () {
82
82
 
83
83
  export default function getInnerListeners (context, options = {}) {
84
84
  let { mergeBefore = {}, mergeAfter = {}, defaultListeners = [], ignoredListeners = [] } = options
85
- const listeners = Object.assign({}, context.$listeners)
85
+ const listeners = extend({}, context.$listeners)
86
86
  defaultListeners.forEach((key) => {
87
87
  if (!listeners[key]) listeners[key] = noop
88
88
  })