@mpxjs/webpack-plugin 2.10.17 → 2.10.18-beta.10

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 (275) hide show
  1. package/lib/config.js +60 -0
  2. package/lib/file-loader.js +4 -1
  3. package/lib/global.d.ts +231 -0
  4. package/lib/index.js +71 -74
  5. package/lib/init.js +3 -0
  6. package/lib/json-compiler/index.js +13 -4
  7. package/lib/loader.js +4 -0
  8. package/lib/platform/json/wx/index.js +6 -0
  9. package/lib/platform/style/wx/index.js +102 -72
  10. package/lib/platform/template/wx/component-config/ad.js +5 -0
  11. package/lib/platform/template/wx/component-config/button.js +10 -3
  12. package/lib/platform/template/wx/component-config/camera.js +25 -3
  13. package/lib/platform/template/wx/component-config/canvas.js +8 -1
  14. package/lib/platform/template/wx/component-config/cover-image.js +7 -2
  15. package/lib/platform/template/wx/component-config/cover-view.js +3 -1
  16. package/lib/platform/template/wx/component-config/form.js +27 -2
  17. package/lib/platform/template/wx/component-config/image.js +5 -0
  18. package/lib/platform/template/wx/component-config/input.js +10 -0
  19. package/lib/platform/template/wx/component-config/label.js +10 -2
  20. package/lib/platform/template/wx/component-config/map.js +11 -0
  21. package/lib/platform/template/wx/component-config/movable-area.js +4 -1
  22. package/lib/platform/template/wx/component-config/movable-view.js +17 -2
  23. package/lib/platform/template/wx/component-config/navigator.js +26 -0
  24. package/lib/platform/template/wx/component-config/picker-view.js +12 -0
  25. package/lib/platform/template/wx/component-config/picker.js +3 -1
  26. package/lib/platform/template/wx/component-config/progress.js +11 -1
  27. package/lib/platform/template/wx/component-config/rich-text.js +5 -0
  28. package/lib/platform/template/wx/component-config/scroll-view.js +12 -1
  29. package/lib/platform/template/wx/component-config/slider.js +8 -0
  30. package/lib/platform/template/wx/component-config/swiper-item.js +5 -2
  31. package/lib/platform/template/wx/component-config/swiper.js +10 -0
  32. package/lib/platform/template/wx/component-config/text.js +5 -0
  33. package/lib/platform/template/wx/component-config/textarea.js +19 -2
  34. package/lib/platform/template/wx/component-config/titlebar.js +12 -0
  35. package/lib/platform/template/wx/component-config/unsupported.js +10 -1
  36. package/lib/platform/template/wx/component-config/video.js +10 -0
  37. package/lib/platform/template/wx/index.js +21 -1
  38. package/lib/react/LoadAsyncChunkModule.js +3 -6
  39. package/lib/react/processStyles.js +21 -9
  40. package/lib/react/script-helper.js +2 -2
  41. package/lib/react/style-helper.js +76 -13
  42. package/lib/resolver/AddModePlugin.js +17 -7
  43. package/lib/resolver/ExtendComponentsPlugin.js +60 -0
  44. package/lib/runtime/components/ali/mpx-section-list.mpx +566 -0
  45. package/lib/runtime/components/ali/mpx-sticky-header.mpx +212 -0
  46. package/lib/runtime/components/ali/mpx-sticky-section.mpx +17 -0
  47. package/lib/runtime/components/react/animationHooks/index.ts +75 -0
  48. package/lib/runtime/components/react/animationHooks/useAnimationAPIHooks.ts +197 -0
  49. package/lib/runtime/components/react/animationHooks/useTransitionHooks.ts +301 -0
  50. package/lib/runtime/components/react/animationHooks/utils.ts +197 -0
  51. package/lib/runtime/components/react/context.ts +12 -3
  52. package/lib/runtime/components/react/dist/animationHooks/index.d.ts +15 -0
  53. package/lib/runtime/components/react/dist/animationHooks/index.js +67 -0
  54. package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.d.ts +3 -0
  55. package/lib/runtime/components/react/dist/animationHooks/useAnimationAPIHooks.js +181 -0
  56. package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.d.ts +3 -0
  57. package/lib/runtime/components/react/dist/animationHooks/useTransitionHooks.js +279 -0
  58. package/lib/runtime/components/react/dist/animationHooks/utils.d.ts +109 -0
  59. package/lib/runtime/components/react/dist/animationHooks/utils.js +151 -0
  60. package/lib/runtime/components/react/dist/context.d.ts +10 -3
  61. package/lib/runtime/components/react/dist/context.js +1 -2
  62. package/lib/runtime/components/react/dist/event.config.d.ts +0 -1
  63. package/lib/runtime/components/react/dist/getInnerListeners.d.ts +0 -1
  64. package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts +0 -1
  65. package/lib/runtime/components/react/dist/mpx-async-suspense.jsx +3 -1
  66. package/lib/runtime/components/react/dist/mpx-button.d.ts +0 -1
  67. package/lib/runtime/components/react/dist/mpx-camera.d.ts +31 -0
  68. package/lib/runtime/components/react/dist/mpx-camera.jsx +236 -0
  69. package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts +0 -1
  70. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts +0 -1
  71. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts +0 -1
  72. package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts +0 -1
  73. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts +0 -1
  74. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts +0 -1
  75. package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts +0 -1
  76. package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts +0 -1
  77. package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts +0 -1
  78. package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts +0 -1
  79. package/lib/runtime/components/react/dist/mpx-checkbox.d.ts +0 -1
  80. package/lib/runtime/components/react/dist/mpx-form.d.ts +0 -1
  81. package/lib/runtime/components/react/dist/mpx-icon/index.d.ts +0 -1
  82. package/lib/runtime/components/react/dist/mpx-image.d.ts +0 -1
  83. package/lib/runtime/components/react/dist/mpx-image.jsx +2 -2
  84. package/lib/runtime/components/react/dist/mpx-inline-text.d.ts +0 -1
  85. package/lib/runtime/components/react/dist/mpx-input.d.ts +2 -1
  86. package/lib/runtime/components/react/dist/mpx-input.jsx +69 -50
  87. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts +0 -1
  88. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.jsx +35 -6
  89. package/lib/runtime/components/react/dist/mpx-label.d.ts +0 -1
  90. package/lib/runtime/components/react/dist/mpx-movable-area.d.ts +0 -1
  91. package/lib/runtime/components/react/dist/mpx-movable-view.d.ts +0 -1
  92. package/lib/runtime/components/react/dist/mpx-nav.d.ts +0 -1
  93. package/lib/runtime/components/react/dist/mpx-navigator.d.ts +0 -1
  94. package/lib/runtime/components/react/dist/mpx-picker/date.d.ts +0 -1
  95. package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts +0 -1
  96. package/lib/runtime/components/react/dist/mpx-picker/index.d.ts +0 -1
  97. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts +0 -1
  98. package/lib/runtime/components/react/dist/mpx-picker/region.d.ts +0 -1
  99. package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts +0 -1
  100. package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts +0 -1
  101. package/lib/runtime/components/react/dist/mpx-picker/time.d.ts +0 -1
  102. package/lib/runtime/components/react/dist/mpx-picker/type.d.ts +0 -1
  103. package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts +0 -1
  104. package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts +0 -1
  105. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts +0 -1
  106. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts +0 -1
  107. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts +0 -1
  108. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts +0 -1
  109. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts +0 -1
  110. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts +0 -1
  111. package/lib/runtime/components/react/dist/mpx-popup/index.d.ts +0 -1
  112. package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts +0 -1
  113. package/lib/runtime/components/react/dist/mpx-portal/index.d.ts +0 -1
  114. package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts +0 -1
  115. package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts +0 -1
  116. package/lib/runtime/components/react/dist/mpx-portal/portal-manager.jsx +2 -2
  117. package/lib/runtime/components/react/dist/mpx-progress.d.ts +0 -1
  118. package/lib/runtime/components/react/dist/mpx-radio-group.d.ts +0 -1
  119. package/lib/runtime/components/react/dist/mpx-radio.d.ts +0 -1
  120. package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts +0 -1
  121. package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts +0 -1
  122. package/lib/runtime/components/react/dist/mpx-root-portal.d.ts +0 -1
  123. package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts +0 -1
  124. package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +84 -78
  125. package/lib/runtime/components/react/dist/mpx-section-list.d.ts +48 -0
  126. package/lib/runtime/components/react/dist/mpx-section-list.jsx +292 -0
  127. package/lib/runtime/components/react/dist/mpx-simple-text.d.ts +0 -1
  128. package/lib/runtime/components/react/dist/mpx-simple-view.d.ts +0 -1
  129. package/lib/runtime/components/react/dist/mpx-slider.d.ts +0 -1
  130. package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts +0 -1
  131. package/lib/runtime/components/react/dist/mpx-sticky-header.jsx +20 -20
  132. package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts +0 -1
  133. package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts +0 -1
  134. package/lib/runtime/components/react/dist/mpx-swiper.d.ts +11 -1
  135. package/lib/runtime/components/react/dist/mpx-swiper.jsx +136 -83
  136. package/lib/runtime/components/react/dist/mpx-switch.d.ts +0 -1
  137. package/lib/runtime/components/react/dist/mpx-text.d.ts +0 -1
  138. package/lib/runtime/components/react/dist/mpx-textarea.d.ts +0 -1
  139. package/lib/runtime/components/react/dist/mpx-textarea.jsx +1 -0
  140. package/lib/runtime/components/react/dist/mpx-video.d.ts +0 -1
  141. package/lib/runtime/components/react/dist/mpx-view.d.ts +3 -3
  142. package/lib/runtime/components/react/dist/mpx-view.jsx +22 -8
  143. package/lib/runtime/components/react/dist/mpx-web-view.d.ts +0 -1
  144. package/lib/runtime/components/react/dist/mpx-web-view.jsx +1 -1
  145. package/lib/runtime/components/react/dist/parser.d.ts +0 -1
  146. package/lib/runtime/components/react/dist/useNodesRef.d.ts +0 -1
  147. package/lib/runtime/components/react/dist/utils.d.ts +10 -9
  148. package/lib/runtime/components/react/dist/utils.jsx +47 -24
  149. package/lib/runtime/components/react/mpx-async-suspense.tsx +3 -1
  150. package/lib/runtime/components/react/mpx-camera.tsx +327 -0
  151. package/lib/runtime/components/react/mpx-image.tsx +2 -2
  152. package/lib/runtime/components/react/mpx-input.tsx +71 -52
  153. package/lib/runtime/components/react/mpx-keyboard-avoiding-view.tsx +35 -6
  154. package/lib/runtime/components/react/mpx-picker-view-column/index.tsx +10 -0
  155. package/lib/runtime/components/react/mpx-portal/portal-manager.tsx +2 -2
  156. package/lib/runtime/components/react/mpx-scroll-view.tsx +110 -114
  157. package/lib/runtime/components/react/mpx-section-list.tsx +439 -0
  158. package/lib/runtime/components/react/mpx-sticky-header.tsx +24 -24
  159. package/lib/runtime/components/react/mpx-swiper.tsx +174 -84
  160. package/lib/runtime/components/react/mpx-textarea.tsx +1 -0
  161. package/lib/runtime/components/react/mpx-view.tsx +27 -12
  162. package/lib/runtime/components/react/mpx-web-view.tsx +1 -1
  163. package/lib/runtime/components/react/tsconfig.json +26 -0
  164. package/lib/runtime/components/react/types/global.d.ts +1 -0
  165. package/lib/runtime/components/react/utils.tsx +51 -27
  166. package/lib/runtime/components/web/mpx-scroll-view.vue +5 -2
  167. package/lib/runtime/components/web/mpx-section-list.vue +551 -0
  168. package/lib/runtime/components/web/mpx-titlebar.vue +244 -0
  169. package/lib/runtime/components/wx/mpx-section-list-default/list-footer.mpx +26 -0
  170. package/lib/runtime/components/wx/mpx-section-list-default/list-header.mpx +26 -0
  171. package/lib/runtime/components/wx/mpx-section-list-default/list-item.mpx +26 -0
  172. package/lib/runtime/components/wx/mpx-section-list-default/section-header.mpx +26 -0
  173. package/lib/runtime/components/wx/mpx-section-list.mpx +209 -0
  174. package/lib/runtime/components/wx/mpx-sticky-header.mpx +40 -0
  175. package/lib/runtime/components/wx/mpx-sticky-section.mpx +31 -0
  176. package/lib/runtime/optionProcessor.js +5 -0
  177. package/lib/runtime/optionProcessorReact.js +7 -0
  178. package/lib/runtime/stringify.wxs +2 -2
  179. package/lib/script-setup-compiler/index.js +1 -2
  180. package/lib/style-compiler/strip-conditional.js +244 -0
  181. package/lib/template-compiler/compiler.js +89 -9
  182. package/lib/utils/const.js +29 -0
  183. package/lib/utils/dom-tag-config.js +1 -1
  184. package/lib/utils/string.js +25 -1
  185. package/lib/web/processMainScript.js +3 -1
  186. package/lib/wxss/loader.js +4 -1
  187. package/lib/wxss/utils.js +7 -2
  188. package/package.json +7 -14
  189. package/LICENSE +0 -433
  190. package/lib/runtime/components/react/dist/context.d.ts.map +0 -1
  191. package/lib/runtime/components/react/dist/event.config.d.ts.map +0 -1
  192. package/lib/runtime/components/react/dist/getInnerListeners.d.ts.map +0 -1
  193. package/lib/runtime/components/react/dist/mpx-async-suspense.d.ts.map +0 -1
  194. package/lib/runtime/components/react/dist/mpx-button.d.ts.map +0 -1
  195. package/lib/runtime/components/react/dist/mpx-canvas/Bus.d.ts.map +0 -1
  196. package/lib/runtime/components/react/dist/mpx-canvas/CanvasGradient.d.ts.map +0 -1
  197. package/lib/runtime/components/react/dist/mpx-canvas/CanvasRenderingContext2D.d.ts.map +0 -1
  198. package/lib/runtime/components/react/dist/mpx-canvas/Image.d.ts.map +0 -1
  199. package/lib/runtime/components/react/dist/mpx-canvas/ImageData.d.ts.map +0 -1
  200. package/lib/runtime/components/react/dist/mpx-canvas/constructorsRegistry.d.ts.map +0 -1
  201. package/lib/runtime/components/react/dist/mpx-canvas/html.d.ts.map +0 -1
  202. package/lib/runtime/components/react/dist/mpx-canvas/index.d.ts.map +0 -1
  203. package/lib/runtime/components/react/dist/mpx-canvas/utils.d.ts.map +0 -1
  204. package/lib/runtime/components/react/dist/mpx-checkbox-group.d.ts.map +0 -1
  205. package/lib/runtime/components/react/dist/mpx-checkbox.d.ts.map +0 -1
  206. package/lib/runtime/components/react/dist/mpx-form.d.ts.map +0 -1
  207. package/lib/runtime/components/react/dist/mpx-icon/icons/cancel.png +0 -0
  208. package/lib/runtime/components/react/dist/mpx-icon/icons/clear.png +0 -0
  209. package/lib/runtime/components/react/dist/mpx-icon/icons/download.png +0 -0
  210. package/lib/runtime/components/react/dist/mpx-icon/icons/info.png +0 -0
  211. package/lib/runtime/components/react/dist/mpx-icon/icons/search.png +0 -0
  212. package/lib/runtime/components/react/dist/mpx-icon/icons/success.png +0 -0
  213. package/lib/runtime/components/react/dist/mpx-icon/icons/success_no_circle.png +0 -0
  214. package/lib/runtime/components/react/dist/mpx-icon/icons/waiting.png +0 -0
  215. package/lib/runtime/components/react/dist/mpx-icon/icons/warn.png +0 -0
  216. package/lib/runtime/components/react/dist/mpx-icon/index.d.ts.map +0 -1
  217. package/lib/runtime/components/react/dist/mpx-image.d.ts.map +0 -1
  218. package/lib/runtime/components/react/dist/mpx-inline-text.d.ts.map +0 -1
  219. package/lib/runtime/components/react/dist/mpx-input.d.ts.map +0 -1
  220. package/lib/runtime/components/react/dist/mpx-keyboard-avoiding-view.d.ts.map +0 -1
  221. package/lib/runtime/components/react/dist/mpx-label.d.ts.map +0 -1
  222. package/lib/runtime/components/react/dist/mpx-movable-area.d.ts.map +0 -1
  223. package/lib/runtime/components/react/dist/mpx-movable-view.d.ts.map +0 -1
  224. package/lib/runtime/components/react/dist/mpx-nav.d.ts.map +0 -1
  225. package/lib/runtime/components/react/dist/mpx-navigator.d.ts.map +0 -1
  226. package/lib/runtime/components/react/dist/mpx-picker/date.d.ts.map +0 -1
  227. package/lib/runtime/components/react/dist/mpx-picker/dateData.d.ts.map +0 -1
  228. package/lib/runtime/components/react/dist/mpx-picker/index.d.ts.map +0 -1
  229. package/lib/runtime/components/react/dist/mpx-picker/multiSelector.d.ts.map +0 -1
  230. package/lib/runtime/components/react/dist/mpx-picker/region.d.ts.map +0 -1
  231. package/lib/runtime/components/react/dist/mpx-picker/regionData.d.ts.map +0 -1
  232. package/lib/runtime/components/react/dist/mpx-picker/selector.d.ts.map +0 -1
  233. package/lib/runtime/components/react/dist/mpx-picker/time.d.ts.map +0 -1
  234. package/lib/runtime/components/react/dist/mpx-picker/type.d.ts.map +0 -1
  235. package/lib/runtime/components/react/dist/mpx-picker-view/index.d.ts.map +0 -1
  236. package/lib/runtime/components/react/dist/mpx-picker-view/pickerVIewContext.d.ts.map +0 -1
  237. package/lib/runtime/components/react/dist/mpx-picker-view-column/index.d.ts.map +0 -1
  238. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItem.d.ts.map +0 -1
  239. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewColumnItemLite.d.ts.map +0 -1
  240. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewFaces.d.ts.map +0 -1
  241. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewIndicator.d.ts.map +0 -1
  242. package/lib/runtime/components/react/dist/mpx-picker-view-column/pickerViewMask.d.ts.map +0 -1
  243. package/lib/runtime/components/react/dist/mpx-popup/index.d.ts.map +0 -1
  244. package/lib/runtime/components/react/dist/mpx-popup/popupBase.d.ts.map +0 -1
  245. package/lib/runtime/components/react/dist/mpx-portal/index.d.ts.map +0 -1
  246. package/lib/runtime/components/react/dist/mpx-portal/portal-host.d.ts.map +0 -1
  247. package/lib/runtime/components/react/dist/mpx-portal/portal-manager.d.ts.map +0 -1
  248. package/lib/runtime/components/react/dist/mpx-progress.d.ts.map +0 -1
  249. package/lib/runtime/components/react/dist/mpx-radio-group.d.ts.map +0 -1
  250. package/lib/runtime/components/react/dist/mpx-radio.d.ts.map +0 -1
  251. package/lib/runtime/components/react/dist/mpx-rich-text/html.d.ts.map +0 -1
  252. package/lib/runtime/components/react/dist/mpx-rich-text/index.d.ts.map +0 -1
  253. package/lib/runtime/components/react/dist/mpx-root-portal.d.ts.map +0 -1
  254. package/lib/runtime/components/react/dist/mpx-scroll-view.d.ts.map +0 -1
  255. package/lib/runtime/components/react/dist/mpx-simple-text.d.ts.map +0 -1
  256. package/lib/runtime/components/react/dist/mpx-simple-view.d.ts.map +0 -1
  257. package/lib/runtime/components/react/dist/mpx-slider.d.ts.map +0 -1
  258. package/lib/runtime/components/react/dist/mpx-sticky-header.d.ts.map +0 -1
  259. package/lib/runtime/components/react/dist/mpx-sticky-section.d.ts.map +0 -1
  260. package/lib/runtime/components/react/dist/mpx-swiper-item.d.ts.map +0 -1
  261. package/lib/runtime/components/react/dist/mpx-swiper.d.ts.map +0 -1
  262. package/lib/runtime/components/react/dist/mpx-switch.d.ts.map +0 -1
  263. package/lib/runtime/components/react/dist/mpx-text.d.ts.map +0 -1
  264. package/lib/runtime/components/react/dist/mpx-textarea.d.ts.map +0 -1
  265. package/lib/runtime/components/react/dist/mpx-video.d.ts.map +0 -1
  266. package/lib/runtime/components/react/dist/mpx-view.d.ts.map +0 -1
  267. package/lib/runtime/components/react/dist/mpx-web-view.d.ts.map +0 -1
  268. package/lib/runtime/components/react/dist/parser.d.ts.map +0 -1
  269. package/lib/runtime/components/react/dist/useAnimationHooks.d.ts +0 -33
  270. package/lib/runtime/components/react/dist/useAnimationHooks.d.ts.map +0 -1
  271. package/lib/runtime/components/react/dist/useAnimationHooks.js +0 -289
  272. package/lib/runtime/components/react/dist/useNodesRef.d.ts.map +0 -1
  273. package/lib/runtime/components/react/dist/utils.d.ts.map +0 -1
  274. package/lib/runtime/components/react/useAnimationHooks.ts +0 -320
  275. package/lib/style-compiler/strip-conditional-loader.js +0 -289
@@ -0,0 +1,244 @@
1
+ <script>
2
+ import mpx from '@mpxjs/core'
3
+ export default {
4
+ name: 'mpx-titlebar',
5
+ props: {
6
+ // 来自 app.json 中 window 的 titlebar 相关配置
7
+ windowConfig: {
8
+ type: Object,
9
+ default: () => global.__mpxPageConfig
10
+ },
11
+ // 来自 页面 json 中的 titlebar 相关配置,会覆盖 windowConfig
12
+ pageConfig: {
13
+ type: Object,
14
+ default: () => ({})
15
+ }
16
+ },
17
+ computed: {
18
+ // 合并全局 window 配置与页面配置(页面配置覆盖全局配置)
19
+ cfg () {
20
+ return Object.assign({}, this.windowConfig || {}, this.pageConfig || {})
21
+ },
22
+ // 标题文本(兼容常见字段名)
23
+ titleText () {
24
+ return this.cfg.navigationBarTitleText || this.cfg.title || ''
25
+ },
26
+ // 背景色(兼容常见字段)
27
+ backgroundColor () {
28
+ return this.cfg.navigationBarBackgroundColor || '#ffffff'
29
+ },
30
+ // 文本颜色,微信小程序中 navigationBarTextStyle 为 white 或 black
31
+ textColor () {
32
+ const style = this.cfg.navigationBarTextStyle || 'black'
33
+ return style === 'white' ? '#ffffff' : '#000000'
34
+ },
35
+ // navigationStyle: 'default' | 'custom',custom 表示需要自定义绘制
36
+ navigationStyle () {
37
+ return this.cfg.navigationStyle || 'default'
38
+ },
39
+ // 是否隐藏(navigationStyle 为 'custom' 时也应隐藏)
40
+ hidden () {
41
+ return mpx.config?.webConfig?.enableTitleBar !== true || this.navigationStyle === 'custom'
42
+ },
43
+ // 是否展示返回按钮:根据浏览器历史判断(不依赖额外 page 配置)
44
+ showBack () {
45
+ console.log('showBack', this.$router.stack.length)
46
+ try {
47
+ return this.$router.stack.length > 1
48
+ } catch (e) {
49
+ return false
50
+ }
51
+ },
52
+ // safe area 顶部 padding,使用 env(safe-area-inset-top)
53
+ safeStyle () {
54
+ // 多数浏览器支持 env(), 为兼容也使用 constant() 备选(旧 iOS Safari)
55
+ return {
56
+ paddingTop: 'env(safe-area-inset-top, 0px)'
57
+ }
58
+ },
59
+ // 内部标题栏高度(遵循小程序常见平台差异)
60
+ innerHeight () {
61
+ const isIOS = /iP(hone|od|ad)/.test(navigator.userAgent)
62
+ return (isIOS ? 44 : 48) + 'px'
63
+ },
64
+ rootStyle () {
65
+ return {
66
+ background: this.backgroundColor,
67
+ color: this.textColor
68
+ }
69
+ },
70
+ innerStyle () {
71
+ return {
72
+ height: this.innerHeight
73
+ }
74
+ }
75
+ ,
76
+ // content wrapper style: padding-top to avoid being covered by fixed titlebar
77
+ contentStyle () {
78
+ // use calc to combine innerHeight and safe-area inset
79
+ return {
80
+ paddingTop: this.hidden ? '0px' : `calc(${this.innerHeight} + env(safe-area-inset-top, 0px))`,
81
+ // create its own layer to avoid overlapping issues
82
+ transform: 'translateZ(0)',
83
+ willChange: 'transform'
84
+ }
85
+ }
86
+ },
87
+ methods: {
88
+ // 左侧点击:派发事件并在可回退时回退
89
+ onLeftClick (e) {
90
+ this.$emit('click-left', e)
91
+ if (this.showBack) {
92
+ try { window.history.back() } catch (err) {}
93
+ }
94
+ }
95
+ },
96
+ render (h) {
97
+ console.log('render mpx-titlebar', this.cfg, 'windowConfig', this.windowConfig, 'pageConfig', this.pageConfig)
98
+ const leftChildren = []
99
+
100
+ // default back button (SVG) — no left slot support
101
+ if (this.showBack) {
102
+ leftChildren.push(
103
+ h('button', {
104
+ class: 'mpx-titlebar__back',
105
+ attrs: { 'aria-label': 'back', type: 'button' }
106
+ }, [
107
+ h('svg', {
108
+ attrs: {
109
+ viewBox: '0 0 24 24',
110
+ width: '20',
111
+ height: '20',
112
+ fill: 'none',
113
+ xmlns: 'http://www.w3.org/2000/svg',
114
+ focusable: 'false',
115
+ 'aria-hidden': 'true'
116
+ }
117
+ }, [
118
+ h('path', {
119
+ attrs: {
120
+ d: 'M15 18l-6-6 6-6',
121
+ stroke: 'currentColor',
122
+ 'stroke-width': '2',
123
+ 'stroke-linecap': 'round',
124
+ 'stroke-linejoin': 'round'
125
+ }
126
+ })
127
+ ])
128
+ ])
129
+ )
130
+ }
131
+
132
+ // center shows title; only default slot (page content) is supported
133
+ const centerChildren = [
134
+ h('div', { class: 'mpx-titlebar__title', style: { color: this.textColor } }, [this.titleText])
135
+ ]
136
+
137
+ // top-level wrapper: contains fixed titlebar and page content wrapper
138
+ return h('page', { class: 'mpx-titlebar-wrapper' }, [
139
+ // fixed titlebar
140
+ h('div', {
141
+ class: ['mpx-titlebar', { 'mpx-titlebar--hidden': this.hidden }],
142
+ style: this.rootStyle
143
+ }, [
144
+ h('div', { class: 'mpx-titlebar__safe', style: this.safeStyle }, [
145
+ h('div', { class: 'mpx-titlebar__inner', style: this.innerStyle }, [
146
+ h('div', { class: 'mpx-titlebar__left', on: { click: this.onLeftClick } }, leftChildren),
147
+ h('div', { class: 'mpx-titlebar__center' }, centerChildren),
148
+ h('div', { class: 'mpx-titlebar__right' }, [])
149
+ ])
150
+ ])
151
+ ]),
152
+
153
+ // page content wrapper: default slot is page content
154
+ h('div', { class: 'mpx-titlebar__content', style: this.contentStyle }, this.$slots.default || [])
155
+ ])
156
+ }
157
+ }
158
+ </script>
159
+
160
+ <style scoped>
161
+ .mpx-titlebar {
162
+ width: 100%;
163
+ box-sizing: border-box;
164
+ -webkit-font-smoothing: antialiased;
165
+ }
166
+ .mpx-titlebar--hidden {
167
+ display: none;
168
+ }
169
+ .mpx-titlebar__safe {
170
+ /* safe area handled by padding-top; include both env and constant for broader iOS support */
171
+ padding-top: env(safe-area-inset-top, 0px);
172
+ padding-top: constant(safe-area-inset-top, 0px);
173
+ }
174
+ .mpx-titlebar__inner {
175
+ display: flex;
176
+ align-items: center;
177
+ justify-content: space-between;
178
+ padding: 0 12px;
179
+ box-sizing: border-box;
180
+ }
181
+ .mpx-titlebar__left,
182
+ .mpx-titlebar__right {
183
+ flex: 0 0 auto;
184
+ min-width: 44px;
185
+ display: flex;
186
+ align-items: center;
187
+ }
188
+ .mpx-titlebar__center {
189
+ flex: 1 1 auto;
190
+ display: flex;
191
+ align-items: center;
192
+ justify-content: center;
193
+ overflow: hidden;
194
+ padding: 0 8px;
195
+ }
196
+ .mpx-titlebar__title {
197
+ font-size: 17px;
198
+ white-space: nowrap;
199
+ text-overflow: ellipsis;
200
+ overflow: hidden;
201
+ font-weight: 500;
202
+ }
203
+ .mpx-titlebar__back {
204
+ background: none;
205
+ border: none;
206
+ font-size: 20px;
207
+ color: inherit;
208
+ padding: 6px;
209
+ cursor: pointer;
210
+ }
211
+
212
+ /* wrapper and content layout */
213
+ .mpx-titlebar-wrapper {
214
+ position: relative;
215
+ width: 100%;
216
+ height: 100%;
217
+ }
218
+
219
+ .mpx-titlebar {
220
+ position: fixed;
221
+ top: 0;
222
+ left: 0;
223
+ right: 0;
224
+ z-index: 1000; /* ensure above page content */
225
+ }
226
+
227
+ .mpx-titlebar__content {
228
+ position: relative;
229
+ width: 100%;
230
+ min-height: 100%;
231
+ box-sizing: border-box;
232
+ background: transparent;
233
+ }
234
+
235
+ /* SVG icon sizing and inherit color */
236
+ .mpx-titlebar__back svg {
237
+ display: block;
238
+ width: 20px;
239
+ height: 20px;
240
+ }
241
+ .mpx-titlebar__back path {
242
+ stroke: currentColor;
243
+ }
244
+ </style>
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <view class="mpx-list-footer-default">
3
+ <view class="mpx-default-content">list-footer-default</view>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ import { createComponent } from '@mpxjs/core'
9
+ createComponent({})
10
+ </script>
11
+
12
+ <style lang="stylus" scoped>
13
+ .mpx-list-footer-default
14
+ margin 4px 16px
15
+ padding 16px
16
+ background #fff
17
+ border-radius 8px
18
+ box-shadow 0 2px 4px rgba(0,0,0,0.1)
19
+
20
+ .mpx-default-content
21
+ display flex
22
+ flex-direction column
23
+ font-size 14px
24
+ color #666
25
+
26
+ </style>
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <view class="mpx-list-header-default">
3
+ <view class="mpx-default-content">list-header-default</view>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ import { createComponent } from '@mpxjs/core'
9
+ createComponent({})
10
+ </script>
11
+
12
+ <style lang="stylus" scoped>
13
+ .mpx-list-header-default
14
+ margin 4px 16px
15
+ padding 16px
16
+ background #fff
17
+ border-radius 8px
18
+ box-shadow 0 2px 4px rgba(0,0,0,0.1)
19
+
20
+ .mpx-default-content
21
+ display flex
22
+ flex-direction column
23
+ font-size 14px
24
+ color #666
25
+
26
+ </style>
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <view class="mpx-recycle-item-default">
3
+ <view class="mpx-default-content">recycle-item-default</view>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ import { createComponent } from '@mpxjs/core'
9
+ createComponent({})
10
+ </script>
11
+
12
+ <style lang="stylus" scoped>
13
+ .mpx-recycle-item-default
14
+ margin 4px 16px
15
+ padding 16px
16
+ background #fff
17
+ border-radius 8px
18
+ box-shadow 0 2px 4px rgba(0,0,0,0.1)
19
+
20
+ .mpx-default-content
21
+ display flex
22
+ flex-direction column
23
+ font-size 14px
24
+ color #666
25
+
26
+ </style>
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <view class="mpx-section-header-default">
3
+ <view class="mpx-default-content">section-header-default</view>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ import { createComponent } from '@mpxjs/core'
9
+ createComponent({})
10
+ </script>
11
+
12
+ <style lang="stylus" scoped>
13
+ .mpx-section-header-default
14
+ margin 4px 16px
15
+ padding 16px
16
+ background #fff
17
+ border-radius 8px
18
+ box-shadow 0 2px 4px rgba(0,0,0,0.1)
19
+
20
+ .mpx-default-content
21
+ display flex
22
+ flex-direction column
23
+ font-size 14px
24
+ color #666
25
+
26
+ </style>
@@ -0,0 +1,209 @@
1
+ <template>
2
+ <scroll-view wx:ref="recycleViewRef" class="mpx-section-list" scroll-y wx:style="{{ scrollViewStyle }}" type="custom"
3
+ enhanced="{{ enhanced }}" scroll-with-animation="{{ scrollWithAnimation }}" bounces="{{ bounces }}"
4
+ show-scrollbar="{{ showScrollbar }}" refresher-enabled="{{ refresherEnabled }}"
5
+ refresher-triggered="{{ refresherTriggered }}" bindscroll="onScroll" bindrefresherrefresh="onRefresh" scroll-into-view-offset="{{ scrollIntoViewOffset }}"
6
+ scroll-into-view="{{ scrollIntoViewId }}" scroll-into-view-alignment="{{ viewPosition }}">
7
+ <block wx:if="{{ useListHeader }}">
8
+ <list-header listHeaderData="{{ listHeaderData }}"></list-header>
9
+ </block>
10
+ <block wx:for="{{ convertedListData }}" wx:key="index">
11
+ <sticky-section>
12
+ <!-- section header -->
13
+ <block wx:if="{{ item.hasSectionHeader }}">
14
+ <block wx:if="{{ enableSticky }}">
15
+ <sticky-header>
16
+ <section-header itemData="{{ item.headerData }}" id="{{ item._domId }}"></section-header>
17
+ </sticky-header>
18
+ </block>
19
+ <block wx:else>
20
+ <section-header itemData="{{ item.headerData }}" id="{{ item._domId }}"></section-header>
21
+ </block>
22
+
23
+ </block>
24
+ <block wx:for="{{ item.data }}" wx:for-item="subItem" wx:key="subIndex">
25
+ <!-- section items -->
26
+ <recycle-item itemData="{{ subItem.itemData }}" id="{{ subItem._domId }}"></recycle-item>
27
+ </block>
28
+ </sticky-section>
29
+ </block>
30
+ <block wx:if="{{ useListFooter }}">
31
+ <list-footer listFooterData="{{ listFooterData }}"></list-footer>
32
+ </block>
33
+ </scroll-view>
34
+ </template>
35
+
36
+ <script>
37
+ import { createComponent } from '@mpxjs/core'
38
+
39
+ createComponent({
40
+ properties: {
41
+ height: {
42
+ type: Number,
43
+ value: null
44
+ },
45
+ width: {
46
+ type: Number,
47
+ value: null
48
+ },
49
+ listData: {
50
+ type: Array,
51
+ value: []
52
+ },
53
+ enableSticky: {
54
+ type: Boolean,
55
+ value: false
56
+ },
57
+ showScrollbar: {
58
+ type: Boolean,
59
+ value: false
60
+ },
61
+ enhanced: {
62
+ type: Boolean,
63
+ value: false
64
+ },
65
+ bounces: {
66
+ type: Boolean,
67
+ value: false
68
+ },
69
+ refresherEnabled: {
70
+ type: Boolean,
71
+ value: false
72
+ },
73
+ refresherTriggered: {
74
+ type: Boolean,
75
+ value: false
76
+ },
77
+ listHeaderData: {
78
+ type: Object,
79
+ value: null
80
+ },
81
+ scrollWithAnimation: {
82
+ type: Boolean,
83
+ value: false
84
+ },
85
+ useListHeader: {
86
+ type: Boolean,
87
+ value: false
88
+ },
89
+ listFooterData: {
90
+ type: Object,
91
+ value: null
92
+ },
93
+ useListFooter: {
94
+ type: Boolean,
95
+ value: false
96
+ }
97
+ },
98
+ data: {
99
+ convertedListData: [],
100
+ scrollIntoViewId: '',
101
+ scrollIntoViewOffset: 0,
102
+ viewPosition: 'start'
103
+ },
104
+ computed: {
105
+ scrollViewStyle() {
106
+ return `height: ${this.formatDimension(this.height)};width: ${this.formatDimension(this.width)}`
107
+ }
108
+ },
109
+ watch: {
110
+ listData: {
111
+ handler(newVal) {
112
+ this.convertedListData = this.convertToSectionListData(newVal)
113
+ },
114
+ immediate: true
115
+ }
116
+ },
117
+ methods: {
118
+ formatDimension(value) {
119
+ return typeof value === 'number' ? `${value}px` : value || '100%'
120
+ },
121
+ onScroll(e) {
122
+ this.triggerEvent('scroll', e)
123
+ },
124
+ onRefresh(e) {
125
+ this.triggerEvent('refresh', e)
126
+ },
127
+ scrollToIndex({ index, viewPosition = 0, viewOffset = 0 }) {
128
+ if (index >= 0) {
129
+ this.scrollIntoViewId = `mpx-recycle-item-${index}`
130
+ switch (viewPosition) {
131
+ case 0:
132
+ this.viewPosition = 'start'
133
+ break
134
+ case 0.5:
135
+ this.viewPosition = 'center'
136
+ break
137
+ case 1:
138
+ this.viewPosition = 'end'
139
+ break
140
+ default:
141
+ this.viewPosition = 'start'
142
+ }
143
+ this.scrollIntoViewOffset = -viewOffset || 0
144
+ }
145
+ },
146
+ convertToSectionListData(data) {
147
+ const sections = []
148
+ let currentSection = null
149
+
150
+ data && data.forEach((item, index) => {
151
+ if (item.isSectionHeader) {
152
+ // 如果已经存在一个 section,先把它添加到 sections 中
153
+ if (currentSection) {
154
+ sections.push(currentSection)
155
+ }
156
+ // 创建新的 section
157
+ currentSection = {
158
+ headerData: item,
159
+ data: [],
160
+ hasSectionHeader: true,
161
+ _domId: `mpx-recycle-item-${index}`
162
+ }
163
+ } else {
164
+ // 如果没有当前 section,创建一个默认的
165
+ if (!currentSection) {
166
+ // 创建默认section (无header的section)
167
+ currentSection = {
168
+ headerData: null,
169
+ data: [],
170
+ hasSectionHeader: false
171
+ }
172
+ }
173
+ currentSection.data.push({
174
+ itemData: item,
175
+ _domId: `mpx-recycle-item-${index}`
176
+ })
177
+ }
178
+ })
179
+
180
+ // 添加最后一个 section
181
+ if (currentSection) {
182
+ sections.push(currentSection)
183
+ }
184
+
185
+ return sections
186
+ }
187
+ }
188
+ })
189
+ </script>
190
+
191
+ <script type="application/json">
192
+ {
193
+ "component": true,
194
+ "componentGenerics": {
195
+ "recycle-item": {
196
+ "default": "./mpx-section-list-default/list-item.mpx"
197
+ },
198
+ "section-header": {
199
+ "default": "./mpx-section-list-default/section-header.mpx"
200
+ },
201
+ "list-header": {
202
+ "default": "./mpx-section-list-default/list-header.mpx"
203
+ },
204
+ "list-footer": {
205
+ "default": "./mpx-section-list-default/list-footer.mpx"
206
+ }
207
+ }
208
+ }
209
+ </script>
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <sticky-header offset-top="{{offsetTop}}" padding="{{padding}}" allow-overlapping="{{allowOverlapping}}" bindstickontopchange="handleStickyChange">
3
+ <slot></slot>
4
+ </sticky-header>
5
+ </template>
6
+
7
+ <script>
8
+ import { createComponent } from '@mpxjs/core'
9
+
10
+ createComponent({
11
+ options: {
12
+ virtualHost: true
13
+ },
14
+ properties: {
15
+ offsetTop: {
16
+ type: Number,
17
+ value: 0
18
+ },
19
+ padding: {
20
+ type: Array,
21
+ value: [0, 0, 0, 0]
22
+ },
23
+ allowOverlapping: {
24
+ type: Boolean,
25
+ value: false
26
+ }
27
+ },
28
+ methods: {
29
+ handleStickyChange(e) {
30
+ this.triggerEvent('stickontopchange', e.detail)
31
+ }
32
+ }
33
+ })
34
+ </script>
35
+
36
+ <script type="application/json">
37
+ {
38
+ "component": true
39
+ }
40
+ </script>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <sticky-section padding="{{ padding }}" push-pinned-header="{{ pushPinnedHeader }}">
3
+ <slot></slot>
4
+ </sticky-section>
5
+ </template>
6
+
7
+ <script>
8
+ import { createComponent } from '@mpxjs/core'
9
+
10
+ createComponent({
11
+ options: {
12
+ virtualHost: true
13
+ },
14
+ properties: {
15
+ padding: {
16
+ type: Array,
17
+ value: [0, 0, 0, 0]
18
+ },
19
+ pushPinnedHeader: {
20
+ type: Boolean,
21
+ value: true
22
+ }
23
+ }
24
+ })
25
+ </script>
26
+
27
+ <script type="application/json">
28
+ {
29
+ "component": true
30
+ }
31
+ </script>
@@ -2,6 +2,7 @@ import { hasOwn, isEmptyObject, extend } from './utils'
2
2
  import { isBrowser } from './env'
3
3
  import transRpxStyle from './transRpxStyle'
4
4
  import animation from './animation'
5
+ import { error } from '@mpxjs/utils'
5
6
  const dash2hump = require('../utils/hump-dash').dash2hump
6
7
 
7
8
  export function processComponentOption (
@@ -107,6 +108,10 @@ registered in parent context!`)
107
108
 
108
109
  export function getComponent (component, extendOptions) {
109
110
  component = component.__esModule ? component.default : component
111
+ if (!component) {
112
+ error('getComponent() expected component options as the first argument, but got undefined.')
113
+ return null
114
+ }
110
115
  // eslint-disable-next-line
111
116
  if (extendOptions && !component.__mpxExtended) {
112
117
  extend(component, extendOptions, { __mpxExtended: true })
@@ -1,9 +1,16 @@
1
1
  import AsyncSuspense from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/mpx-async-suspense'
2
2
  import { memo, forwardRef, createElement } from 'react'
3
+ import { error } from '@mpxjs/utils'
3
4
  import { extend } from './utils'
4
5
 
5
6
  export function getComponent (component, extendOptions) {
6
7
  component = component.__esModule ? component.default : component
8
+ if (!component) {
9
+ error(
10
+ `getComponent expecting function/class component ${extendOptions?.displayName ? `[${extendOptions.displayName}] ` : ''}as the first argument, but got undefined.`
11
+ )
12
+ return null
13
+ }
7
14
  // eslint-disable-next-line
8
15
  if (extendOptions && !component.__mpxExtended) {
9
16
  extend(component, extendOptions, { __mpxExtended: true })
@@ -45,7 +45,7 @@ function objectKeys (obj) {
45
45
  }
46
46
 
47
47
  function genRegExp (str, flags) {
48
- if (!__mpx_wxs__) {
48
+ if (!__mpx_wxs__ || __mpx_mode__ === 'ks') {
49
49
  return new RegExp(str, flags)
50
50
  } else {
51
51
  return getRegExp(str, flags)
@@ -234,4 +234,4 @@ module.exports = {
234
234
  var parsedStaticStyle = typeof staticStyle === 'string' ? parseStyleText(staticStyle) : {}
235
235
  return genStyleText(extend(parsedStaticStyle, normalizedDynamicStyle))
236
236
  }
237
- }
237
+ }
@@ -605,8 +605,7 @@ function compileScriptSetup (
605
605
  if (node.key.name === 'properties' && hasDefinePropsCall) {
606
606
  console.warn(`${DEFINE_PROPS} has been called, ${DEFINE_OPTIONS} set properties will be ignored`)
607
607
  } else {
608
- const declCode = content.slice(node.value.start, node.value.end).trim()
609
- runtimeOptions += `\n ${node.key.name}: ${declCode},`
608
+ runtimeOptions += `\n ${content.slice(node.start, node.end).trim()},`
610
609
  }
611
610
  }
612
611
  }