efront 4.22.14 → 4.22.17

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.
@@ -441,18 +441,29 @@ var fixBase = function (b, a) {
441
441
  return splitParams(a).map(a => {
442
442
  if (presets.test(a)) a = `@{${a}}`;
443
443
  var replaced = false;
444
+ var rootindex = 0;
445
+ a.replace(/\:root/g, function (match, index) {
446
+ rootindex = match.length + index;
447
+ return '';
448
+ })
449
+ if (rootindex > 0) a = a.slice(rootindex);
444
450
  return splitParams(b).map(b => {
445
- b = b.replace(/^(&|\:scope|\:root)\s*/g, "");
446
- if (!b) return a;
447
- var a1 = a.replace(/&|\:scope|\:root/g, function (match) {
451
+ var b1 = b.replace(/^\:root\s*/g, '');
452
+ var rindex = rootindex;
453
+ if (b1.length !== b.length) rindex = true;;
454
+ b = b1;
455
+ b = b.replace(/^(&|\:scope)\s*/g, "");
456
+ var a1 = a.replace(/&|\:scope/g, function () {
448
457
  replaced = true;
449
- return b;
458
+ if (!rindex) return b;
459
+ return '';
450
460
  });
461
+ if (!b && !replaced) return a1;
451
462
  if (!replaced) {
452
463
  if (/^[\>~\+]/.test(a) || /[\>~\+]$/.test(b)) {
453
- a1 = b + a;
464
+ a1 = b + a1;
454
465
  }
455
- else a1 = b + " " + a;
466
+ else if (!rindex) a1 = b + " " + a;
456
467
  }
457
468
  return a1;
458
469
  }).join(",");
@@ -494,7 +505,7 @@ var Method = function () {
494
505
  vlist.pop();
495
506
  return body;
496
507
  }
497
- var vlist = [], mlist = [macros], clist = [], base = '';
508
+ var vlist = [], mlist = [macros], clist = [], base = "";
498
509
  var killneg = function (v, n) {
499
510
  if (n === "-") {
500
511
  if (/^\-/.test(v)) {
@@ -529,7 +540,7 @@ var initvars = function (vars) {
529
540
  };
530
541
  var evalthis = function (p) {
531
542
  var temp = base;
532
- base = p.base;
543
+ base = p.base || "&";
533
544
  var res = eval2(p.used);
534
545
  base = temp;
535
546
  return res;
@@ -62,10 +62,10 @@ test(`.type(@type,@media) {.@{type} {&:before{content:"@{media}";}}}.type(videoi
62
62
  assert(素馨(`:not(a):not(b){c:d}`, 'abc'), `abc :not(a):not(b){c:d;}`);
63
63
  assert(素馨(`&:not(a):not(b){c:d}`, 'abc'), `abc:not(a):not(b){c:d;}`);
64
64
  assert(素馨(`:scope{&:not(a):not(b){c:d}}`, 'abc'), `abc:not(a):not(b){c:d;}`);
65
- assert(素馨(`:root{&:not(a):not(b){c:d}}`, 'abc'), `abc:not(a):not(b){c:d;}`);
65
+ assert(素馨(`:root{&:not(a):not(b){c:d}}`, 'abc1'), `:not(a):not(b){c:d;}`);
66
66
  assert(素馨(`&{&:not(a):not(b){c:d}}`, 'abc'), `abc:not(a):not(b){c:d;}`);
67
67
  assert(素馨(`:root>a{&:not(a):not(b){c:d}}`, '.abc-'), `.abc->a:not(a):not(b){c:d;}`);
68
- assert(素馨(`a>:root{&:not(a):not(b){c:d}}`, '.abc-'), `a>.abc-:not(a):not(b){c:d;}`);
68
+ assert(素馨(`a>:root{&:not(a):not(b){c:d}}`, '.abc-'), `:not(a):not(b){c:d;}`);
69
69
 
70
70
  assert(素馨(`.a (){ &:after{abc:1}} .b{.a();}`, '.abc-'), `.abc- .b:after{abc:1;}`);
71
71
  assert(素馨(`@a:1px;@margin-x:@a+10px; a{m:-@margin-x}`), `a{m:-11px;}`);
@@ -307,4 +307,5 @@ if (typeof i18n !== 'undefined') {
307
307
  colored.warn.tip = i18n`注意`;
308
308
  colored.error.tip = i18n`错误`;
309
309
  }
310
+ colored.render = renderColor;
310
311
  module.exports = colored;
@@ -16,20 +16,27 @@ css(container, 'top:0;height:0;left:0;right:0;transition:all 0.2s ease-out;posit
16
16
  var _text = function (elem, bgcolor, parameters) {
17
17
  var box = elem || document.createElement('div');
18
18
  css(box, `background-color:${bgcolor};color:${color.pair(bgcolor, 1)};`);
19
- box.innerHTML = [].slice.call(parameters, 0).join(", ");
19
+ remove(box.childNodes);
20
+ appendChild(box, parameters);
20
21
  box.initialStyle = `margin-top:-${fromPixel(singleHeight)};`;
21
22
  return box;
22
23
  };
23
24
  function alert() {
24
25
  var clr = String(isString(this) && this || styles.default), text, autoclose = true, onclose;
26
+ var fade = [];
25
27
  var setArg = function (args) {
26
28
  text = '';
29
+ fade = [];
27
30
  autoclose = true;
28
31
  for (var arg of args) switch (typeof arg) {
29
- case "string":
30
32
  case "object":
33
+ if (isNode(arg)) {
34
+ fade.push(arg);
35
+ continue;
36
+ }
37
+ case "string":
31
38
  arg = String(arg);
32
- if (!text) {
39
+ if (!text && !fade.length) {
33
40
  text = arg;
34
41
  } else if (color.isColor(text)) {
35
42
  clr = text;
@@ -42,6 +49,9 @@ function alert() {
42
49
  } else if (color.isColor(arg)) {
43
50
  clr = arg;
44
51
  }
52
+ else {
53
+ fade.push(arg);
54
+ }
45
55
  break;
46
56
  case "boolean":
47
57
  case "number":
@@ -66,10 +76,12 @@ function alert() {
66
76
  }
67
77
  };
68
78
  var setContent = function (elem) {
79
+ var t = [text];
80
+ if (fade.length) t.push(...fade);
69
81
  if (color.isColor(clr)) {
70
- elem = _text(elem, clr, [text]);
82
+ elem = _text(elem, clr, t);
71
83
  } else {
72
- elem = _text(elem, styles.log, [text]);
84
+ elem = _text(elem, styles.log, t);
73
85
  }
74
86
  if (!isMounted(container)) popup(container);
75
87
  if (!isMounted(elem)) appendChild(container, elem);
@@ -149,7 +149,7 @@ function ylist(container, generator, $Y) {
149
149
  saved_itemIndex = itemIndex;
150
150
  return;
151
151
  }
152
- var cache_height = list.offsetHeight;
152
+ var cache_height = Math.min(list.offsetHeight, screen.height >> 1);
153
153
  var index = itemIndex | 0;
154
154
  if (itemIndex < 0) index--;
155
155
  var ratio = itemIndex - index || 0;
@@ -162,7 +162,10 @@ function ylist(container, generator, $Y) {
162
162
  if (last_item) last_item = getNodeTarget(last_item);
163
163
  var count = 0, delta = 1, bottom_item, offsett = offset, offsetb = offset, top_item;
164
164
  var indexed_item;
165
- while (offsetBottom - ratioTop <= list.clientHeight + cache_height || indexed_item && top_item && indexed_item.offsetTop - top_item.offsetTop < cache_height) {
165
+ var limitHeight = screen.height;
166
+ while (
167
+ offsetBottom - ratioTop <= limitHeight + cache_height
168
+ || delta < 0 && indexed_item && top_item && indexed_item.offsetTop - top_item.offsetTop < cache_height) {
166
169
  var item = childrenMap[offset];
167
170
  if (!item) {
168
171
  item = createItem(offset);
@@ -200,7 +203,15 @@ function ylist(container, generator, $Y) {
200
203
  }
201
204
  offsetBottom = bottom_item.offsetTop + bottom_item.offsetHeight;
202
205
  ratioTop = top_item.offsetTop + top_item.offsetHeight * ratio;
203
- if (count++ > 600) throw new Error(i18n`多于600个元素需要绘制!`);
206
+ if (count++ > 600) throw console.log(
207
+ `头部下标`, index,
208
+ `当前下标`, offset,
209
+ `缓冲尺寸`, cache_height,
210
+ '限制尺寸', limitHeight,
211
+ '框架尺寸', list.offsetHeight,
212
+ '当前绘制到', ratioTop,
213
+ `当前元素到顶部元素占用`, offsetBottom - ratioTop
214
+ ), new Error(i18n`多于600个元素需要绘制!`);
204
215
  }
205
216
  for (var k in childrenMap) {
206
217
  remove(childrenMap[k]);
@@ -251,7 +262,8 @@ function ylist(container, generator, $Y) {
251
262
  if (elem.with) for (var w of elem.with) list.insertBefore(w, flag);
252
263
  };
253
264
  var patchBottom = function (deltaY = 0) {
254
- var cache_height = list.offsetHeight;
265
+ var cache_height = Math.min(list.offsetHeight, screen.height >> 1);
266
+ var limitHeight = screen.height + cache_height;
255
267
  var childrenMap = getChildrenMap();
256
268
  var last_element = getLastElement(1);
257
269
  if (!last_element || !last_element.offsetHeight) return;
@@ -260,7 +272,7 @@ function ylist(container, generator, $Y) {
260
272
  var offsetBottom = getOffsetHeight(last_element) + last_element.offsetTop;
261
273
  var offset = last_element.index || 0;
262
274
  //追加元素到底部
263
- while (offsetBottom <= scrollTop + list.clientHeight + cache_height) {
275
+ while (offsetBottom <= scrollTop + limitHeight) {
264
276
  offset++;
265
277
  var item = childrenMap[offset];
266
278
  if (!item) {
@@ -284,7 +296,7 @@ function ylist(container, generator, $Y) {
284
296
  var collection = [];
285
297
  for (var k in childrenMap) {
286
298
  let item = childrenMap[k];
287
- if (getNodeTarget(item).offsetTop + getOffsetHeight(item) + cache_height < scrollTop) {
299
+ if (getNodeTarget(item).offsetTop + getOffsetHeight(item) + limitHeight < scrollTop) {
288
300
  collection.push(item);
289
301
  }
290
302
  }
@@ -312,7 +324,7 @@ function ylist(container, generator, $Y) {
312
324
  return scrollTop - list.scrollTop;
313
325
  };
314
326
  var patchTop = function (deltaY = 0) {
315
- var cache_height = list.offsetHeight;
327
+ var cache_height = Math.min(list.offsetHeight, screen.height >> 1);
316
328
 
317
329
  var childrenMap = getChildrenMap();
318
330
  var first_element, flag_element = first_element = getFirstElement(1);
@@ -322,7 +334,7 @@ function ylist(container, generator, $Y) {
322
334
  var { scrollTop } = list;
323
335
  scrollTop += deltaY;
324
336
  //追加元素到顶部
325
- var targetHeight = cache_height + first_element.offsetTop;
337
+ var targetHeight = screen.height + cache_height + first_element.offsetTop;
326
338
  var { paddingCount, paddingMax } = list;
327
339
  if (!(paddingCount > 0 && paddingMax > 0 && paddingCount < paddingMax) || !(scrollTop < targetHeight)) {
328
340
  paddingCount = 0;
@@ -68,13 +68,16 @@ var popup_path = function (path = "", parameters, target) {
68
68
  }
69
69
  else if (target instanceof Event) {
70
70
  popup_to_event(element, target);
71
- } else if (target instanceof Array) {
71
+ }
72
+ else if (target instanceof Array) {
72
73
  popup_to_point(element, target);
73
- } else if (target) {
74
+ }
75
+ else if (target < 0 || target === true) {
74
76
  popup_with_mask(element);
75
- } else {
77
+ }
78
+ else {
76
79
  if (parameters !== false && target !== false) setInitialStyle(element);
77
- popup_as_single(element);
80
+ popup_as_single(element, target);
78
81
  }
79
82
  };
80
83
  }
@@ -85,7 +88,7 @@ var popup_path = function (path = "", parameters, target) {
85
88
  if (!element) return;
86
89
  load();
87
90
  element.$reload = fullfill;
88
- if (!target && target !== false && parameters !== false) {
91
+ if (target == null && parameters !== false) {
89
92
  element.style.opacity = 0;
90
93
  oncemount(element, function () {
91
94
  move.bindPosition(element, [.5, .5]);
@@ -114,14 +117,17 @@ var popup_view = function (element, target, style) {
114
117
  }
115
118
  if (target instanceof Event) {
116
119
  popup_to_event(element, target);
117
- } else if (target instanceof Array) {
120
+ }
121
+ else if (target instanceof Array) {
118
122
  if (isNode(style) && style.$mask) addMask(element, style);
119
123
  else if (typeof style === 'boolean') addMask(element);
120
124
  popup_to_point(element, target);
121
- } else if (target) {
125
+ }
126
+ else if (target === true || target < 0) {
122
127
  popup_with_mask(element);
123
- } else {
124
- popup_as_single(element);
128
+ }
129
+ else {
130
+ popup_as_single(element, target);
125
131
  }
126
132
  return element;
127
133
  };
@@ -337,8 +343,8 @@ var _as_yextra = function (global, innerWidth, innerHeight, element, target, poi
337
343
  global(element, false);
338
344
  };
339
345
  var _as_xextra = arriswise(_as_yextra, arguments);
340
- var popup_as_single = function (element) {
341
- if (!isMounted(element)) css(element, `z-index:${zIndex()};`);
346
+ var popup_as_single = function (element, z) {
347
+ if (!isMounted(element)) css(element, `z-index:${Number.isFinite(z) ? z : zIndex()};`);
342
348
  global(element, false);
343
349
  };
344
350
  var popup_to_point = function (element, [x, y]) {
@@ -113,7 +113,7 @@ function getWatchData(element) {
113
113
  var props = {};
114
114
  for (var key in $watches) {
115
115
  var data = element[key];
116
- props[key] = isObject(data) && !isFunction(data) && !isDate(data) && !isNode(data) ? extend(data instanceof Array ? [] : {}, data) : data;
116
+ props[key] = data;
117
117
  }
118
118
  return props;
119
119
  }
@@ -130,7 +130,7 @@ function rebuild(element, isFirstRender) {
130
130
  for (var k in props) {
131
131
  var current = element[k];
132
132
  var previous = props[k];
133
- if (shallowEqual(current, previous)) continue;
133
+ if (isSame(current, previous)) continue;
134
134
  if (!capture) capture = {};
135
135
  capture[k] = { current, previous };
136
136
  }
@@ -143,14 +143,39 @@ var getScopeList = function (element) {
143
143
  if (element.$scope) scopes.push(element.$scope);
144
144
  return scopes;
145
145
  };
146
+ var toNull = () => null;
147
+ var toUndefined = () => { };
148
+ var toResult = function (c) {
149
+ if (typeof c === 'function') return c();
150
+ return c;
151
+ };
152
+ var toObject = function (object) {
153
+ if (isArray(object)) return function (object) {
154
+ return object.map(toResult);
155
+ }
156
+ return function () {
157
+ var result = {};
158
+ for (var k in object) result[k] = toResult(object[k]);
159
+ return result;
160
+ }
161
+ };
146
162
  var createGetter = function (target, search, isprop = true) {
147
- if (!search) return function () { };
148
- if (/^\{/.test(search)) search = `(${search})`;
149
- search = renderExpress(search);
150
- if (isprop) var getter = $$eval.bind(target, search, getScopeList(target));
151
- else if (variableOnlyReg.test(search)) getter = $$eval.bind(target, search + "(event)");
152
- else getter = $$eval.bind(target, search);
153
- return getter;
163
+ switch (typeof search) {
164
+ case "function":
165
+ return search;
166
+ case "string":
167
+ if (!search) return toUndefined;
168
+ if (/^\{/.test(search)) search = `(${search})`;
169
+ search = renderExpress(search);
170
+ if (isprop) var getter = $$eval.bind(target, search, getScopeList(target));
171
+ else if (variableOnlyReg.test(search)) getter = $$eval.bind(target, search + "(event)");
172
+ else getter = $$eval.bind(target, search);
173
+ return getter;
174
+ case "object":
175
+ if (!isprop) throw new Error('绑定错误');
176
+ return toObject(search);
177
+ }
178
+ return toUndefined;
154
179
  };
155
180
  var createComment = function (renders, type, expression) {
156
181
  var comment = document.createComment(`${type} ${expression}`);
@@ -560,17 +585,34 @@ var createBinder2 = function (write, read) {
560
585
 
561
586
  var src2 = function (search) {
562
587
  var getter = createGetter(this, search);
563
- var savedValue;
588
+ var checkArrayProperties = /^\[[^\]]+\]$/.test(search);
589
+ var savedValue, savedLength;
590
+ // 非直传数组的数据源变动后,不再检查其所有属性是否相同,直接同步到组件,
591
+ // 直传数组的数据源以数组中的子项是否变动为准,
592
+ // 直传数组的判别标准为表达式以“[”开头以“]”结尾,且表达式中间不含“]”
564
593
  this.$renders.push(function () {
565
594
  var origin = getter(this);
566
- var temp = shallowClone(origin);
567
- if (isHandled(savedValue)) {
568
- if (shallowEqual(temp, savedValue, 1)) return;
595
+ if (isArray(origin)) {
596
+ if (isArray(savedValue)) {
597
+ if (isSame(origin, savedValue)) {
598
+ if (origin.length === savedLength) return;
599
+ }
600
+ else {
601
+ a: if (checkArrayProperties && origin.length === savedLength) {
602
+ for (var cx = 0, dx = savedLength; cx < dx; cx++) {
603
+ if (savedValue[cx] !== origin[cx]) break a;
604
+ }
605
+ return;
606
+ }
607
+ }
608
+ }
609
+ savedLength = origin.length;
610
+ savedValue = origin;
569
611
  }
570
612
  else {
571
- if (isSame(savedValue, temp)) return;
613
+ if (isSame(savedValue, origin)) return;
614
+ savedValue = origin;
572
615
  }
573
- savedValue = temp;
574
616
  if (!isHandled(origin) && !isHandled(this.src));
575
617
  else this.src = origin;
576
618
  cast(this, origin);
@@ -841,8 +883,7 @@ function renderBinds(element, binds) {
841
883
  h.call(element);
842
884
  }
843
885
  }
844
-
845
- function renderRest(element, struct, replacer = element) {
886
+ function renderDynamics(element, replacer, binds, attrs) {
846
887
  var renders = element.$renders;
847
888
  if (element.renders) {
848
889
  if (!renders) renders = [];
@@ -850,7 +891,6 @@ function renderRest(element, struct, replacer = element) {
850
891
  delete element.renders;
851
892
  }
852
893
  element.$renders = [];
853
- var { attrs, binds } = struct;
854
894
  var bindWatch = !!element.$needchanges;
855
895
  for (var k in binds) {
856
896
  if (k in directives) {
@@ -865,13 +905,23 @@ function renderRest(element, struct, replacer = element) {
865
905
  }
866
906
  }
867
907
  }
868
- for (var k in struct.attrs) {
908
+ for (var k in attrs) {
869
909
  binders[""].call(element, k, attrs[k]);
870
910
  }
871
911
  if (renders && renders.length) element.$renders.push.apply(element.$renders, renders);
872
912
  if (binds.src) directives.src.call(element, binds.src);
913
+ }
914
+
915
+ function renderEmits(replacer, emits, on) {
916
+ for (var k in emits) on.call(this, replacer, k, emits[k]);
917
+ }
918
+
919
+ function renderRest(element, struct, replacer = element) {
920
+ var { attrs, binds, emits, waits } = struct;
921
+ renderDynamics(element, replacer, binds, attrs);
873
922
  if (!isElement(replacer)) replacer = element;
874
- struct.ons.forEach(([on, key, value]) => on.call(element, replacer, key, value));
923
+ renderEmits.call(element, replacer, emits, emiters.on);
924
+ renderEmits.call(element, replacer, waits, emiters.once);
875
925
  }
876
926
  function renderArray(children, scope, parentScopes, once) {
877
927
  if (!children) return;
@@ -1051,8 +1101,9 @@ var mergeStruct = function (struct1, struct2) {
1051
1101
  }
1052
1102
 
1053
1103
  class Struct {
1054
- constructor(ons, types, copys, binds, attrs, props, ids, once) {
1055
- this.ons = ons;
1104
+ constructor(emits, onceEmits, types, copys, binds, attrs, props, ids, once) {
1105
+ this.emits = emits;
1106
+ this.waits = onceEmits;
1056
1107
  this.if = types.if;
1057
1108
  this.repeat = types.repeat;
1058
1109
  this.copys = copys;
@@ -1083,7 +1134,8 @@ function createStructure(element, useExists) {
1083
1134
  }
1084
1135
  var types = {};
1085
1136
  var emiter_reg = /^(?:(v|ng|on|once)?\-|v\-on\:|@|once|on)/i;
1086
- var ons = [];
1137
+ var emits = {};
1138
+ var waits = {};
1087
1139
  var copys = [];
1088
1140
  var binds = {};
1089
1141
  var once;
@@ -1169,9 +1221,17 @@ function createStructure(element, useExists) {
1169
1221
  // ng-click on-click v-click @click @mousedown ...
1170
1222
  else if (emiter_reg.test(name)) {
1171
1223
  var match = emiter_reg.exec(name);
1172
- var ngon = (match[1] || match[0]).toLowerCase() === 'once' ? 'once' : 'on';
1224
+ var isOnce = (match[1] || match[0]).toLowerCase() === 'once';
1173
1225
  element.removeAttribute(name);
1174
- if (value) ons.push([emiters[ngon], name.replace(emiter_reg, ''), value]);
1226
+ if (value) {
1227
+ var key = name.replace(emiter_reg, '');
1228
+ if (isOnce) {
1229
+ waits[key] = value;
1230
+ }
1231
+ else {
1232
+ emits[key] = value;
1233
+ }
1234
+ }
1175
1235
  }
1176
1236
  // placeholder_ href_ checked_ ...
1177
1237
  else if (/[_@\:\.&\?\*\+\#]$/.test(name)) {
@@ -1220,12 +1280,13 @@ function createStructure(element, useExists) {
1220
1280
  if (props["zimoli"] || props["fresh"] || props["once"]) once = true;
1221
1281
  else if (props["refresh"] || props["digest"] || props["mount"]) once = false;
1222
1282
  element.$eval = $eval;
1223
- return element.$struct = new Struct(ons, types, copys, binds, attr1, props, ids, once);
1283
+ return element.$struct = new Struct(emits, waits, types, copys, binds, attr1, props, ids, once);
1224
1284
  }
1225
1285
  function unlock(element) {
1226
1286
  if (!element) return;
1227
- if (element.$renderid !== 9) {
1228
- element.$renderid = ++renderidOffset;
1287
+ var { $renderid = 0 } = element;
1288
+ if ($renderid !== 9) {
1289
+ if ($renderid < 10) element.$renderid = ++renderidOffset;
1229
1290
  on("append")(element, addRenderElement);
1230
1291
  onremove(element, removeRenderElement);
1231
1292
  if (element.nodeType === 8);
@@ -1296,4 +1357,29 @@ render.getFromScopes = getFromScopes;
1296
1357
  render.struct = createStructure;
1297
1358
  render.mergeStruct = mergeStruct;
1298
1359
  render.Binder = Binder;
1299
- render.Model = Model;
1360
+ render.Model = Model;
1361
+ render.attribute = function (target, attrs) {
1362
+ return renderDynamics(target, target, null, attrs);
1363
+ };
1364
+ render.dynamic = function (target, binds, attrs) {
1365
+ renderBinds(target, binds);
1366
+ renderDynamics(target, target, binds, attrs);
1367
+ };
1368
+ var initRenders = function (target) {
1369
+ if (!target.$renders) target.$renders = [];
1370
+ };
1371
+ render.class = function (target, map) {
1372
+ initRenders(target);
1373
+ directives.class.call(target, map);
1374
+ };
1375
+ render.style = function (target, map) {
1376
+ initRenders(target);
1377
+ directives.style.call(target, map);
1378
+ };
1379
+ render.on = function (target, map) {
1380
+ return renderEmits.call(this, target, map, emiters.on);
1381
+ };
1382
+ render.once = function (target, map) {
1383
+ return renderEmits.call(this, target, map, emiters.once);
1384
+ };
1385
+ render.mount = unlock;
@@ -182,7 +182,6 @@ function transition(target, _isLeave, _initialStyle) {
182
182
  else if (isLeave) {
183
183
  transitionTimerStart = setTimeout(function () {
184
184
  extend(target.style, initialStyle);
185
- delete target.recoverStyle;
186
185
  delete target.captureStyle;
187
186
  });
188
187
  transitionTimerEnd = setTimeout(function () {
@@ -198,7 +197,6 @@ function transition(target, _isLeave, _initialStyle) {
198
197
  if (transitionKey) target.style[transitionKey] = initialStyle[transitionKey];
199
198
  target.transitionTimerStart = setTimeout(function () {
200
199
  extend(target.style, recoverStyle);
201
- delete target.recoverStyle;
202
200
  delete target.captureStyle;
203
201
  }, waitPaint);
204
202
  });
@@ -269,34 +269,25 @@ function tree() {
269
269
  }
270
270
  var stickys = [];
271
271
  var setSticky = function () {
272
- var p = stickys[stickys.length - 1];
273
- var f = banner.getFirstVisibleElement(stickys.top);
272
+ var top = stickys.top || 0;
273
+ var f = banner.getFirstVisibleElement(top);
274
274
  if (!f) return;
275
- var limitHeight = f.offsetTop - banner.scrollTop - parseFloat(getComputedStyle(banner).paddingTop);
276
- var c = dom[f.$index];
277
- var useLimit = false;
278
- if (p) {
279
- var d = dom[p.$index];
280
- if (d.tab == c.tab) {
281
- var { top, height } = getOffset(p);
282
- if (top + height >= limitHeight) {
283
- var ic = c.parent.indexOf(c);
284
- useLimit = c.parent[ic - 1] === d;
285
- if (useLimit) c = d;
286
- }
287
- }
288
- else {
289
- useLimit = true;
290
- limitHeight += getOffset(f).height;
291
- }
292
- }
275
+ var i = f.$index;
276
+ if (top > 0 && dom[i - 1]?.tab > dom[i].tab) i--;
277
+ var c = dom[i++];
278
+ while (i < dom.length && c.tab <= dom[i].tab) i++;
279
+ var n = dom[i]?.$target;
280
+ var limitHeight = n && n.offsetTop ? n.offsetTop - banner.scrollTop - parseFloat(getComputedStyle(banner).paddingTop) : Infinity;
293
281
  var parents = [];
294
282
  if (c.isClosed() || !c.length) c = c.parent;
295
283
  while (c.parent) {
296
284
  var p = c.parent;
297
285
  if (!p?.joined) {
298
- if (!c.$target) return;
299
- parents.push(c);
286
+ var ct = c.$target;
287
+ if (!ct) break;
288
+ var pt = p.$target;
289
+ if (pt && ct.offsetTop > pt.offsetTop + pt.offsetHeight);
290
+ else parents.push(c);
300
291
  }
301
292
  c = p;
302
293
  }
@@ -319,11 +310,11 @@ function tree() {
319
310
  var top = 0;
320
311
  stickys.forEach(p => {
321
312
  var h = getOffset(p).height;
322
- var limit = useLimit && top + h > limitHeight;
313
+ var limit = top + h > limitHeight;
323
314
  css(p, {
324
315
  position: 'sticky',
325
- zIndex: 2,
326
- top: limit ? limitHeight - h : top, zIndex: 3 - limit
316
+ top: limit ? limitHeight - h : top,
317
+ zIndex: 3 - limit
327
318
  });
328
319
  top += h;
329
320
  });
@@ -4,3 +4,4 @@ function zIndex(inc = 1) {
4
4
  if (inc > 0) count += inc;
5
5
  return count;
6
6
  };
7
+ zIndex.start = count;