@mpxjs/core 2.9.9 → 2.9.11-test.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/core",
3
- "version": "2.9.9",
3
+ "version": "2.9.11-test.0",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
@@ -19,7 +19,7 @@
19
19
  ],
20
20
  "main": "src/index.js",
21
21
  "dependencies": {
22
- "@mpxjs/utils": "^2.9.1",
22
+ "@mpxjs/utils": "^2.8.40-test.2",
23
23
  "lodash": "^4.1.1",
24
24
  "miniprogram-api-typings": "^3.10.0"
25
25
  },
@@ -47,5 +47,5 @@
47
47
  "url": "https://github.com/didi/mpx/issues"
48
48
  },
49
49
  "sideEffects": false,
50
- "gitHead": "7ec6526f024c00f9c6b935c631bfdc61be27b69b"
50
+ "gitHead": "d244d661acb081b709fc99ca8f6add541f793877"
51
51
  }
@@ -69,10 +69,11 @@ export function queueJob (job) {
69
69
  // if the job is a watch() callback, the search will start with a +1 index to
70
70
  // allow it recursively trigger itself - it is the user's responsibility to
71
71
  // ensure it doesn't end up in an infinite loop.
72
- if ((!queue.length ||
73
- !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) &&
74
- job !== currentPreFlushParentJob
75
- ) {
72
+ if ((
73
+ !queue.length ||
74
+ !queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)
75
+ ) &&
76
+ job !== currentPreFlushParentJob) {
76
77
  if (job.id == null) {
77
78
  queue.push(job)
78
79
  } else {
@@ -93,11 +94,17 @@ function queueFlush () {
93
94
  }
94
95
  }
95
96
 
97
+ // todo follow vue
96
98
  export function flushPreFlushCbs (seen, parentJob = null) {
97
99
  if (pendingPreFlushCbs.length) {
98
- currentPreFlushParentJob = parentJob
99
- activePreFlushCbs = [...new Set(pendingPreFlushCbs)]
100
+ const deduped = [...new Set(pendingPreFlushCbs)]
100
101
  pendingPreFlushCbs.length = 0
102
+ if (activePreFlushCbs) {
103
+ activePreFlushCbs.push(...deduped)
104
+ return
105
+ }
106
+ currentPreFlushParentJob = parentJob
107
+ activePreFlushCbs = deduped
101
108
  if (isDev) seen = seen || new Map()
102
109
  for (
103
110
  preFlushIndex = 0;
@@ -117,10 +124,14 @@ export function flushPreFlushCbs (seen, parentJob = null) {
117
124
 
118
125
  export function flushPostFlushCbs (seen) {
119
126
  if (pendingPostFlushCbs.length) {
120
- activePostFlushCbs = [...new Set(pendingPostFlushCbs)]
127
+ const deduped = [...new Set(pendingPostFlushCbs)]
121
128
  pendingPostFlushCbs.length = 0
129
+ if (activePostFlushCbs) {
130
+ activePostFlushCbs.push(...deduped)
131
+ return
132
+ }
133
+ activePostFlushCbs = deduped
122
134
  if (isDev) seen = seen || new Map()
123
-
124
135
  // activePostFlushCbs.sort((a, b) => getId(a) - getId(b))
125
136
  for (
126
137
  postFlushIndex = 0;
@@ -1,5 +1,5 @@
1
1
  import { BEFOREMOUNT, UPDATED } from '../../core/innerLifecycle'
2
- import * as webApi from '@mpxjs/api-proxy/src/web/api'
2
+ import { createSelectorQuery } from '@mpxjs/api-proxy'
3
3
 
4
4
  function getEl (ref) {
5
5
  if (ref && ref.nodeType === 1) return ref
@@ -14,13 +14,13 @@ function processRefs (refs) {
14
14
  const ref = refs[key]
15
15
  if (Array.isArray(ref)) {
16
16
  if (getEl(ref[0])) {
17
- refs[rKey] = webApi.createSelectorQuery().in(this).selectAll(ref.map(getEl))
17
+ refs[rKey] = createSelectorQuery().in(this).selectAll(ref.map(getEl))
18
18
  } else {
19
19
  refs[rKey] = ref
20
20
  }
21
21
  } else {
22
22
  if (getEl(ref)) {
23
- refs[rKey] = webApi.createSelectorQuery().in(this).select(getEl(ref))
23
+ refs[rKey] = createSelectorQuery().in(this).select(getEl(ref))
24
24
  } else {
25
25
  refs[rKey] = ref
26
26
  }
package/src/vuePlugin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { walkChildren, parseSelector, error, hasOwn } from '@mpxjs/utils'
2
- import * as webApi from '@mpxjs/api-proxy/src/web/api'
2
+ import { createSelectorQuery, createIntersectionObserver } from '@mpxjs/api-proxy'
3
3
  const datasetReg = /^data-(.+)$/
4
4
 
5
5
  function collectDataset (attrs) {
@@ -50,9 +50,9 @@ export default function install (Vue) {
50
50
  return this.selectComponent(selector, true)
51
51
  }
52
52
  Vue.prototype.createSelectorQuery = function () {
53
- return webApi.createSelectorQuery().in(this)
53
+ return createSelectorQuery().in(this)
54
54
  }
55
- Vue.prototype.createIntersectionObserver = function (options) {
56
- return webApi.createIntersectionObserver(this, options)
55
+ Vue.prototype.createIntersectionObserver = function (component, options) {
56
+ return createIntersectionObserver(this, options)
57
57
  }
58
58
  }