@ibiz-template/vue3-components 0.1.2 → 0.1.3

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 (116) hide show
  1. package/dist/{chart-efad8ee0.js → chart-0d4e59ff.js} +2 -2
  2. package/dist/chart-0d4e59ff.js.map +1 -0
  3. package/dist/ibiz-markdown-editor-3745dfd5.js.map +1 -1
  4. package/dist/index.min.css +1 -1
  5. package/dist/index.system.min.js +3 -3
  6. package/dist/index.system.min.js.map +1 -1
  7. package/dist/wang-editor-675011c6.js.map +1 -1
  8. package/dist/xlsx-util-fac1c045.js.map +1 -1
  9. package/es/common/icon/icon.d.ts +1 -3
  10. package/es/common/index.d.ts +0 -2
  11. package/es/common/index.mjs +1 -5
  12. package/es/common/router-view/router-view.d.ts +1 -3
  13. package/es/control/app-menu/app-menu.css +1 -1
  14. package/es/control/app-menu-icon-view/app-menu-icon-view.d.ts +3 -3
  15. package/es/control/app-menu-icon-view/index.d.ts +6 -2
  16. package/es/control/chart/generator/chart-options-generator.mjs +1 -1
  17. package/es/control/chart/generator/funnel-series-generator.d.ts +1 -1
  18. package/es/control/chart/generator/pie-series-generator.d.ts +1 -1
  19. package/es/control/dashboard/dashboard.css +1 -0
  20. package/es/control/dashboard/dashboard.d.ts +1 -0
  21. package/es/control/dashboard/dashboard.mjs +1 -0
  22. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.d.ts +1 -0
  23. package/es/control/dashboard/portlet/portlet-layout/portlet-layout.mjs +1 -0
  24. package/es/control/dashboard/portlet/portlet-part/portlet-part.controller.mjs +1 -1
  25. package/es/control/data-view/data-view.controller.mjs +0 -1
  26. package/es/control/data-view/data-view.css +1 -1
  27. package/es/control/drbar/drbar.controller.d.ts +2 -5
  28. package/es/control/drbar/drbar.d.ts +2 -2
  29. package/es/control/drbar/index.d.ts +3 -1
  30. package/es/control/drtab/drtab.controller.d.ts +2 -5
  31. package/es/control/exp-bar/tree-exp-bar/tree-exp-bar.controller.d.ts +8 -0
  32. package/es/control/exp-bar/tree-exp-bar/tree-exp-bar.controller.mjs +22 -9
  33. package/es/control/exp-bar/tree-exp-bar/tree-exp-bar.mjs +2 -1
  34. package/es/control/form/form/form.d.ts +1 -5
  35. package/es/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.mjs +4 -3
  36. package/es/control/form/form-detail/form-page/form-page.mjs +2 -2
  37. package/es/control/grid/grid/grid-control.util.d.ts +2 -1
  38. package/es/control/grid/grid/grid.controller.d.ts +73 -5
  39. package/es/control/grid/grid/grid.controller.mjs +201 -6
  40. package/es/control/grid/grid/grid.css +1 -1
  41. package/es/control/grid/grid/grid.d.ts +6 -1
  42. package/es/control/grid/grid/grid.mjs +62 -10
  43. package/es/control/grid/grid/index.d.ts +5 -1
  44. package/es/control/grid/grid-column/grid-field-column/grid-field-column.controller.d.ts +11 -2
  45. package/es/control/grid/grid-column/grid-field-column/grid-field-column.controller.mjs +53 -0
  46. package/es/control/grid/grid-column/grid-field-column/grid-field-column.css +1 -1
  47. package/es/control/grid/grid-column/grid-field-edit-column/grid-edit-item/grid-edit-item.css +1 -1
  48. package/es/control/toolbar/index.d.ts +6 -2
  49. package/es/control/toolbar/toolbar.d.ts +3 -3
  50. package/es/control/tree/index.d.ts +7 -1
  51. package/es/control/tree/tree.controller.d.ts +0 -10
  52. package/es/control/tree/tree.controller.mjs +4 -18
  53. package/es/control/tree/tree.d.ts +7 -1
  54. package/es/control/tree/tree.mjs +23 -8
  55. package/es/control/tree/tree.service.d.ts +9 -2
  56. package/es/control/tree/tree.service.mjs +20 -1
  57. package/es/editor/autocomplete/ibiz-autocomplete/ibiz-autocomplete.d.ts +1 -1
  58. package/es/editor/cascader/ibiz-cascader/ibiz-cascader.d.ts +1 -1
  59. package/es/editor/code/code-editor.controller.d.ts +2 -2
  60. package/es/editor/data-picker/ibiz-picker/ibiz-picker.d.ts +1 -1
  61. package/es/editor/html/wang-editor/wang-editor.d.ts +1 -1
  62. package/es/editor/upload/use/use-ibiz-upload.d.ts +2 -2
  63. package/es/editor/upload/use/use-iview-upload.d.ts +2 -2
  64. package/es/index.mjs +0 -1
  65. package/es/panel-component/nav-pos/nav-pos.mjs +6 -4
  66. package/es/panel-component/nav-pos-index/nav-pos-index.controller.mjs +1 -2
  67. package/es/panel-component/nav-pos-index/nav-pos-index.mjs +3 -2
  68. package/es/panel-component/nav-pos-index/nav-pos-index.state.mjs +1 -1
  69. package/es/panel-component/panel-app-title/panel-app-title.css +1 -1
  70. package/es/panel-component/panel-app-title/panel-app-title.mjs +1 -1
  71. package/es/panel-component/panel-field/panel-field.controller.d.ts +1 -1
  72. package/es/view/portal-view/portal-view.mjs +1 -18
  73. package/es/view-engine/grid-view.engine.mjs +1 -1
  74. package/es/view-engine/wf-dyna-action-view.engine.mjs +1 -1
  75. package/es/view-engine/wf-dyna-start-view.engine.mjs +1 -1
  76. package/lib/common/index.cjs +0 -13
  77. package/lib/control/app-menu/app-menu.css +1 -1
  78. package/lib/control/chart/generator/chart-options-generator.cjs +1 -1
  79. package/lib/control/dashboard/dashboard.cjs +1 -0
  80. package/lib/control/dashboard/dashboard.css +1 -0
  81. package/lib/control/dashboard/portlet/portlet-layout/portlet-layout.cjs +1 -0
  82. package/lib/control/dashboard/portlet/portlet-part/portlet-part.controller.cjs +1 -1
  83. package/lib/control/data-view/data-view.controller.cjs +0 -1
  84. package/lib/control/data-view/data-view.css +1 -1
  85. package/lib/control/exp-bar/tree-exp-bar/tree-exp-bar.cjs +2 -1
  86. package/lib/control/exp-bar/tree-exp-bar/tree-exp-bar.controller.cjs +22 -9
  87. package/lib/control/form/form-detail/form-mdctrl/form-mdctrl-form/form-mdctrl-form.cjs +4 -3
  88. package/lib/control/form/form-detail/form-page/form-page.cjs +2 -2
  89. package/lib/control/grid/grid/grid.cjs +62 -10
  90. package/lib/control/grid/grid/grid.controller.cjs +200 -5
  91. package/lib/control/grid/grid/grid.css +1 -1
  92. package/lib/control/grid/grid-column/grid-field-column/grid-field-column.controller.cjs +53 -0
  93. package/lib/control/grid/grid-column/grid-field-column/grid-field-column.css +1 -1
  94. package/lib/control/grid/grid-column/grid-field-edit-column/grid-edit-item/grid-edit-item.css +1 -1
  95. package/lib/control/tree/tree.cjs +23 -8
  96. package/lib/control/tree/tree.controller.cjs +4 -18
  97. package/lib/control/tree/tree.service.cjs +20 -1
  98. package/lib/index.cjs +0 -11
  99. package/lib/panel-component/nav-pos/nav-pos.cjs +6 -4
  100. package/lib/panel-component/nav-pos-index/nav-pos-index.cjs +3 -2
  101. package/lib/panel-component/nav-pos-index/nav-pos-index.controller.cjs +1 -2
  102. package/lib/panel-component/nav-pos-index/nav-pos-index.state.cjs +1 -1
  103. package/lib/panel-component/panel-app-title/panel-app-title.cjs +1 -1
  104. package/lib/panel-component/panel-app-title/panel-app-title.css +1 -1
  105. package/lib/view/portal-view/portal-view.cjs +1 -18
  106. package/lib/view-engine/grid-view.engine.cjs +1 -1
  107. package/lib/view-engine/wf-dyna-action-view.engine.cjs +1 -1
  108. package/lib/view-engine/wf-dyna-start-view.engine.cjs +1 -1
  109. package/package.json +10 -10
  110. package/dist/chart-efad8ee0.js.map +0 -1
  111. package/es/common/keep-alive/keep-alive.d.ts +0 -45
  112. package/es/common/keep-alive/keep-alive.mjs +0 -293
  113. package/es/common/keep-alive/scheduler.d.ts +0 -41
  114. package/es/common/keep-alive/scheduler.mjs +0 -168
  115. package/lib/common/keep-alive/keep-alive.cjs +0 -304
  116. package/lib/common/keep-alive/scheduler.cjs +0 -178
@@ -1,293 +0,0 @@
1
- import { getCurrentInstance, watch, onMounted, onUpdated, onBeforeUnmount, isVNode, cloneVNode, callWithAsyncErrorHandling } from 'vue';
2
- import { getComponentName, queuePostFlushCb } from './scheduler.mjs';
3
-
4
- const __DEV__ = true;
5
- var ShapeFlags = /* @__PURE__ */ ((ShapeFlags2) => {
6
- ShapeFlags2[ShapeFlags2["ELEMENT"] = 1] = "ELEMENT";
7
- ShapeFlags2[ShapeFlags2["FUNCTIONAL_COMPONENT"] = 2] = "FUNCTIONAL_COMPONENT";
8
- ShapeFlags2[ShapeFlags2["STATEFUL_COMPONENT"] = 4] = "STATEFUL_COMPONENT";
9
- ShapeFlags2[ShapeFlags2["TEXT_CHILDREN"] = 8] = "TEXT_CHILDREN";
10
- ShapeFlags2[ShapeFlags2["ARRAY_CHILDREN"] = 16] = "ARRAY_CHILDREN";
11
- ShapeFlags2[ShapeFlags2["SLOTS_CHILDREN"] = 32] = "SLOTS_CHILDREN";
12
- ShapeFlags2[ShapeFlags2["TELEPORT"] = 64] = "TELEPORT";
13
- ShapeFlags2[ShapeFlags2["SUSPENSE"] = 128] = "SUSPENSE";
14
- ShapeFlags2[ShapeFlags2["COMPONENT_SHOULD_KEEP_ALIVE"] = 256] = "COMPONENT_SHOULD_KEEP_ALIVE";
15
- ShapeFlags2[ShapeFlags2["COMPONENT_KEPT_ALIVE"] = 512] = "COMPONENT_KEPT_ALIVE";
16
- ShapeFlags2[ShapeFlags2["COMPONENT"] = 6] = "COMPONENT";
17
- return ShapeFlags2;
18
- })(ShapeFlags || {});
19
- var MoveType = /* @__PURE__ */ ((MoveType2) => {
20
- MoveType2[MoveType2["ENTER"] = 0] = "ENTER";
21
- MoveType2[MoveType2["LEAVE"] = 1] = "LEAVE";
22
- MoveType2[MoveType2["REORDER"] = 2] = "REORDER";
23
- return MoveType2;
24
- })(MoveType || {});
25
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
26
- const KeepAliveImpl = {
27
- name: `IBizKeepAlive`,
28
- // Marker for special handling inside the renderer. We are not using a ===
29
- // check directly on KeepAlive in the renderer, because importing it directly
30
- // would prevent it from being tree-shaken.
31
- __isKeepAlive: true,
32
- props: {
33
- include: [String, RegExp, Array],
34
- exclude: [String, RegExp, Array],
35
- max: [String, Number],
36
- keyList: [Array]
37
- },
38
- setup(props, { slots }) {
39
- const instance = getCurrentInstance();
40
- const sharedContext = instance.ctx;
41
- const cache = /* @__PURE__ */ new Map();
42
- const keys = /* @__PURE__ */ new Set();
43
- let current = null;
44
- if (__DEV__) {
45
- instance.__v_cache = cache;
46
- }
47
- const parentSuspense = instance.suspense;
48
- const {
49
- renderer: {
50
- p: patch,
51
- m: move,
52
- um: _unmount,
53
- o: { createElement }
54
- }
55
- } = sharedContext;
56
- const storageContainer = createElement("div");
57
- sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
58
- const instance2 = vnode.component;
59
- move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);
60
- patch(
61
- instance2.vnode,
62
- vnode,
63
- container,
64
- anchor,
65
- instance2,
66
- parentSuspense,
67
- isSVG,
68
- vnode.slotScopeIds,
69
- optimized
70
- );
71
- queuePostRenderEffect(() => {
72
- instance2.isDeactivated = false;
73
- if (instance2.a) {
74
- invokeArrayFns(instance2.a);
75
- }
76
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
77
- if (vnodeHook) {
78
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
79
- }
80
- });
81
- if (__DEV__) {
82
- devtoolsComponentAdded(instance2);
83
- }
84
- };
85
- sharedContext.deactivate = (vnode) => {
86
- const instance2 = vnode.component;
87
- move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);
88
- queuePostRenderEffect(() => {
89
- if (instance2.da) {
90
- invokeArrayFns(instance2.da);
91
- }
92
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
93
- if (vnodeHook) {
94
- invokeVNodeHook(vnodeHook, instance2.parent, vnode);
95
- }
96
- instance2.isDeactivated = true;
97
- });
98
- if (__DEV__) {
99
- devtoolsComponentAdded(instance2);
100
- }
101
- };
102
- function unmount(vnode) {
103
- resetShapeFlag(vnode);
104
- _unmount(vnode, instance, parentSuspense, true);
105
- }
106
- function pruneCache(filter) {
107
- cache.forEach((vnode, key) => {
108
- const name = getComponentName(vnode.type);
109
- if (name && (!filter || !filter(name))) {
110
- pruneCacheEntry(key);
111
- }
112
- });
113
- }
114
- function pruneCache2(filter) {
115
- cache.forEach((vnode, key) => {
116
- const name = vnode.key;
117
- if (name && (filter && filter(name))) {
118
- pruneCacheEntry(key);
119
- }
120
- });
121
- }
122
- function pruneCacheEntry(key) {
123
- const cached = cache.get(key);
124
- if (!current || cached.type !== current.type) {
125
- unmount(cached);
126
- } else if (current) {
127
- resetShapeFlag(current);
128
- }
129
- cache.delete(key);
130
- keys.delete(key);
131
- }
132
- watch(
133
- () => [props.include, props.exclude, props.keyList],
134
- ([include, exclude, keyList]) => {
135
- include && pruneCache((name) => matches(include, name));
136
- exclude && pruneCache((name) => !matches(exclude, name));
137
- keyList && pruneCache2((name) => !matches(keyList, name));
138
- },
139
- // prune post-render after `current` has been updated
140
- { flush: "post", deep: true }
141
- );
142
- let pendingCacheKey = null;
143
- const cacheSubtree = () => {
144
- if (pendingCacheKey != null) {
145
- cache.set(pendingCacheKey, getInnerChild(instance.subTree));
146
- }
147
- };
148
- onMounted(cacheSubtree);
149
- onUpdated(cacheSubtree);
150
- onBeforeUnmount(() => {
151
- for (const key in cache) {
152
- pruneCacheEntry(key);
153
- }
154
- });
155
- return () => {
156
- pendingCacheKey = null;
157
- if (!slots.default) {
158
- return null;
159
- }
160
- const children = slots.default();
161
- const rawVNode = children[0];
162
- if (children.length > 1) {
163
- console.log(`KeepAlive should contain exactly one component child.`);
164
- current = null;
165
- return children;
166
- }
167
- if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4 /* STATEFUL_COMPONENT */) && !(rawVNode.shapeFlag & 128 /* SUSPENSE */)) {
168
- current = null;
169
- return rawVNode;
170
- }
171
- let vnode = getInnerChild(rawVNode);
172
- const comp = vnode.type;
173
- const name = getComponentName(
174
- isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
175
- );
176
- const { include, exclude, max, keyList } = props;
177
- const slotKey = vnode.key;
178
- if (
179
- // 包括并且不匹配的
180
- include && (!name || !matches(include, name)) || // 排除并且匹配的
181
- exclude && name && matches(exclude, name) || // keyList中存在并且不匹配的
182
- keyList && !slotKey && !matches(keyList, slotKey)
183
- ) {
184
- current = vnode;
185
- return rawVNode;
186
- }
187
- const key = vnode.key == null ? comp : vnode.key;
188
- const cachedVNode = cache.get(key);
189
- if (vnode.el) {
190
- vnode = cloneVNode(vnode);
191
- if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {
192
- rawVNode.ssContent = vnode;
193
- }
194
- }
195
- pendingCacheKey = key;
196
- if (cachedVNode) {
197
- vnode.el = cachedVNode.el;
198
- vnode.component = cachedVNode.component;
199
- if (vnode.transition) {
200
- setTransitionHooks(vnode, vnode.transition);
201
- }
202
- vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */;
203
- keys.delete(key);
204
- keys.add(key);
205
- } else {
206
- keys.add(key);
207
- if (max && keys.size > parseInt(max, 10)) {
208
- pruneCacheEntry(keys.values().next().value);
209
- }
210
- }
211
- vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
212
- current = vnode;
213
- vnode.keepAlive = true;
214
- vnode.curPath = slotKey;
215
- return vnode;
216
- };
217
- }
218
- };
219
- const IBizKeepAlive = KeepAliveImpl;
220
- function matches(pattern, name) {
221
- if (Array.isArray(pattern)) {
222
- return pattern.indexOf(name) > -1;
223
- }
224
- if (typeof pattern === "string") {
225
- return pattern.split(",").includes(name);
226
- }
227
- if (isRegExp(pattern)) {
228
- return pattern.test(name);
229
- }
230
- return false;
231
- }
232
- function resetShapeFlag(vnode) {
233
- vnode.shapeFlag &= ~256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
234
- vnode.shapeFlag &= ~512 /* COMPONENT_KEPT_ALIVE */;
235
- }
236
- function getInnerChild(vnode) {
237
- return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode;
238
- }
239
- function isRegExp(v) {
240
- return Object.prototype.toString.call(v) === "[object RegExp]";
241
- }
242
- const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
243
- function setTransitionHooks(vnode, hooks) {
244
- if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
245
- setTransitionHooks(vnode.component.subTree, hooks);
246
- } else {
247
- vnode.transition = hooks;
248
- }
249
- }
250
- const invokeArrayFns = (fns, arg) => {
251
- for (let i = 0; i < fns.length; i++) {
252
- fns[i](arg);
253
- }
254
- };
255
- const queuePostRenderEffect = queuePostFlushCb;
256
- function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
257
- callWithAsyncErrorHandling(hook, instance, 7, [
258
- vnode,
259
- prevVNode
260
- ]);
261
- }
262
- var DevtoolsHooks = /* @__PURE__ */ ((DevtoolsHooks2) => {
263
- DevtoolsHooks2["APP_INIT"] = "app:init";
264
- DevtoolsHooks2["APP_UNMOUNT"] = "app:unmount";
265
- DevtoolsHooks2["COMPONENT_UPDATED"] = "component:updated";
266
- DevtoolsHooks2["COMPONENT_ADDED"] = "component:added";
267
- DevtoolsHooks2["COMPONENT_REMOVED"] = "component:removed";
268
- DevtoolsHooks2["COMPONENT_EMIT"] = "component:emit";
269
- DevtoolsHooks2["PERFORMANCE_START"] = "perf:start";
270
- DevtoolsHooks2["PERFORMANCE_END"] = "perf:end";
271
- return DevtoolsHooks2;
272
- })(DevtoolsHooks || {});
273
- const devtoolsComponentAdded = /* @__PURE__ */ createDevtoolsComponentHook(
274
- "component:added" /* COMPONENT_ADDED */
275
- );
276
- function createDevtoolsComponentHook(hook) {
277
- return (component) => {
278
- emit(
279
- hook,
280
- component.appContext.app,
281
- component.uid,
282
- component.parent ? component.parent.uid : void 0,
283
- component
284
- );
285
- };
286
- }
287
- function emit(event, ...args) {
288
- if (window.__VUE_DEVTOOLS_GLOBAL_HOOK__) {
289
- window.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit(event, ...args);
290
- }
291
- }
292
-
293
- export { IBizKeepAlive, MoveType, ShapeFlags, devtoolsComponentAdded, invokeArrayFns, invokeVNodeHook, isAsyncWrapper, isKeepAlive, queuePostRenderEffect, setTransitionHooks };
@@ -1,41 +0,0 @@
1
- import { ComponentInternalInstance, ConcreteComponent } from 'vue';
2
- export declare const NOOP: () => void;
3
- export interface SchedulerJob extends Function {
4
- id?: number;
5
- pre?: boolean;
6
- active?: boolean;
7
- computed?: boolean;
8
- /**
9
- * Indicates whether the effect is allowed to recursively trigger itself
10
- * when managed by the scheduler.
11
- *
12
- * By default, a job cannot trigger itself because some built-in method calls,
13
- * e.g. Array.prototype.push actually performs reads as well (#1740) which
14
- * can lead to confusing infinite loops.
15
- * The allowed cases are component update functions and watch callbacks.
16
- * Component update functions may update child component props, which in turn
17
- * trigger flush: "pre" watch callbacks that mutates state that the parent
18
- * relies on (#1801). Watch callbacks doesn't track its dependencies so if it
19
- * triggers itself again, it's likely intentional and it is the user's
20
- * responsibility to perform recursive state mutation that eventually
21
- * stabilizes (#1727).
22
- */
23
- allowRecurse?: boolean;
24
- /**
25
- * Attached by renderer.ts when setting up a component's render effect
26
- * Used to obtain component information when reporting max recursive updates.
27
- * dev only.
28
- */
29
- ownerInstance?: ComponentInternalInstance;
30
- }
31
- export type SchedulerJobs = SchedulerJob | SchedulerJob[];
32
- type CountMap = Map<SchedulerJob, number>;
33
- export declare function nextTick<T = void>(this: T, fn?: () => void): Promise<void>;
34
- export declare function queueJob(job: SchedulerJob): void;
35
- export declare function invalidateJob(job: SchedulerJob): void;
36
- export declare function queuePostFlushCb(cb: SchedulerJobs): void;
37
- export declare function flushPreFlushCbs(seen?: CountMap, i?: number): void;
38
- export declare function flushPostFlushCbs(seen?: CountMap): void;
39
- export declare const isFunction: (val: unknown) => val is Function;
40
- export declare const getComponentName: (Component: ConcreteComponent, includeInferred?: boolean) => string | false | undefined;
41
- export {};
@@ -1,168 +0,0 @@
1
- import { callWithErrorHandling } from 'vue';
2
-
3
- const __DEV__ = true;
4
- const NOOP = () => {
5
- };
6
- let isFlushing = false;
7
- let isFlushPending = false;
8
- const queue = [];
9
- let flushIndex = 0;
10
- const pendingPostFlushCbs = [];
11
- let activePostFlushCbs = null;
12
- let postFlushIndex = 0;
13
- const resolvedPromise = /* @__PURE__ */ Promise.resolve();
14
- let currentFlushPromise = null;
15
- const RECURSION_LIMIT = 100;
16
- function nextTick(fn) {
17
- const p = currentFlushPromise || resolvedPromise;
18
- return fn ? p.then(this ? fn.bind(this) : fn) : p;
19
- }
20
- function findInsertionIndex(id) {
21
- let start = flushIndex + 1;
22
- let end = queue.length;
23
- while (start < end) {
24
- const middle = start + end >>> 1;
25
- const middleJobId = getId(queue[middle]);
26
- middleJobId < id ? start = middle + 1 : end = middle;
27
- }
28
- return start;
29
- }
30
- function queueJob(job) {
31
- if (!queue.length || !queue.includes(
32
- job,
33
- isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
34
- )) {
35
- if (job.id == null) {
36
- queue.push(job);
37
- } else {
38
- queue.splice(findInsertionIndex(job.id), 0, job);
39
- }
40
- queueFlush();
41
- }
42
- }
43
- function queueFlush() {
44
- if (!isFlushing && !isFlushPending) {
45
- isFlushPending = true;
46
- currentFlushPromise = resolvedPromise.then(flushJobs);
47
- }
48
- }
49
- function invalidateJob(job) {
50
- const i = queue.indexOf(job);
51
- if (i > flushIndex) {
52
- queue.splice(i, 1);
53
- }
54
- }
55
- function queuePostFlushCb(cb) {
56
- if (!Array.isArray(cb)) {
57
- if (!activePostFlushCbs || !activePostFlushCbs.includes(
58
- cb,
59
- cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
60
- )) {
61
- pendingPostFlushCbs.push(cb);
62
- }
63
- } else {
64
- pendingPostFlushCbs.push(...cb);
65
- }
66
- queueFlush();
67
- }
68
- function flushPreFlushCbs(seen, i = isFlushing ? flushIndex + 1 : 0) {
69
- if (__DEV__) {
70
- seen = seen || /* @__PURE__ */ new Map();
71
- }
72
- for (; i < queue.length; i++) {
73
- const cb = queue[i];
74
- if (cb && cb.pre) {
75
- if (__DEV__ && checkRecursiveUpdates(seen, cb)) {
76
- continue;
77
- }
78
- queue.splice(i, 1);
79
- i--;
80
- cb();
81
- }
82
- }
83
- }
84
- function flushPostFlushCbs(seen) {
85
- if (pendingPostFlushCbs.length) {
86
- const deduped = [...new Set(pendingPostFlushCbs)];
87
- pendingPostFlushCbs.length = 0;
88
- if (activePostFlushCbs) {
89
- activePostFlushCbs.push(...deduped);
90
- return;
91
- }
92
- activePostFlushCbs = deduped;
93
- if (__DEV__) {
94
- seen = seen || /* @__PURE__ */ new Map();
95
- }
96
- activePostFlushCbs.sort((a, b) => getId(a) - getId(b));
97
- for (postFlushIndex = 0; postFlushIndex < activePostFlushCbs.length; postFlushIndex++) {
98
- if (__DEV__ && checkRecursiveUpdates(seen, activePostFlushCbs[postFlushIndex])) {
99
- continue;
100
- }
101
- activePostFlushCbs[postFlushIndex]();
102
- }
103
- activePostFlushCbs = null;
104
- postFlushIndex = 0;
105
- }
106
- }
107
- const getId = (job) => job.id == null ? Infinity : job.id;
108
- const comparator = (a, b) => {
109
- const diff = getId(a) - getId(b);
110
- if (diff === 0) {
111
- if (a.pre && !b.pre)
112
- return -1;
113
- if (b.pre && !a.pre)
114
- return 1;
115
- }
116
- return diff;
117
- };
118
- function flushJobs(seen) {
119
- isFlushPending = false;
120
- isFlushing = true;
121
- if (__DEV__) {
122
- seen = seen || /* @__PURE__ */ new Map();
123
- }
124
- queue.sort(comparator);
125
- const check = __DEV__ ? (job) => checkRecursiveUpdates(seen, job) : NOOP;
126
- try {
127
- for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
128
- const job = queue[flushIndex];
129
- if (job && job.active !== false) {
130
- if (__DEV__ && check(job)) {
131
- continue;
132
- }
133
- callWithErrorHandling(job, null, 14);
134
- }
135
- }
136
- } finally {
137
- flushIndex = 0;
138
- queue.length = 0;
139
- flushPostFlushCbs(seen);
140
- isFlushing = false;
141
- currentFlushPromise = null;
142
- if (queue.length || pendingPostFlushCbs.length) {
143
- flushJobs(seen);
144
- }
145
- }
146
- }
147
- const isFunction = (val) => typeof val === "function";
148
- const getComponentName = (Component, includeInferred = true) => {
149
- return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
150
- };
151
- function checkRecursiveUpdates(seen, fn) {
152
- if (!seen.has(fn)) {
153
- seen.set(fn, 1);
154
- } else {
155
- const count = seen.get(fn);
156
- if (count > RECURSION_LIMIT) {
157
- const instance = fn.ownerInstance;
158
- const componentName = instance && getComponentName(instance.type);
159
- console.warn(
160
- `Maximum recursive updates exceeded${componentName ? ` in component <${componentName}>` : ``}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`
161
- );
162
- return true;
163
- }
164
- seen.set(fn, count + 1);
165
- }
166
- }
167
-
168
- export { NOOP, flushPostFlushCbs, flushPreFlushCbs, getComponentName, invalidateJob, isFunction, nextTick, queueJob, queuePostFlushCb };