@miso.ai/client-sdk-ui 1.10.0 → 1.10.1-beta.1
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/dist/cjs/layout/affiliation/affiliation.js +13 -11
- package/dist/cjs/layout/progressive.js +3 -3
- package/dist/cjs/layout/raf.js +5 -6
- package/dist/cjs/version.js +1 -1
- package/package.json +2 -2
- package/src/layout/affiliation/affiliation.js +11 -13
- package/src/layout/progressive.js +2 -2
- package/src/layout/raf.js +4 -5
- package/src/version.js +1 -1
|
@@ -26,7 +26,10 @@ function root(layout, state) {
|
|
|
26
26
|
const roleAttr = role ? ` data-role="${role}"` : '';
|
|
27
27
|
const data = state.value || {};
|
|
28
28
|
const channelAttr = data.channel ? ` data-channel="${data.channel}"` : '';
|
|
29
|
-
|
|
29
|
+
const items = layout._getItems(state);
|
|
30
|
+
const itemCount = items ? items.length : undefined;
|
|
31
|
+
const itemCountAttr = itemCount !== undefined ? ` data-item-count="${itemCount}"` : '';
|
|
32
|
+
return `<div class="${className} ${status}"${roleAttr}${channelAttr}${itemCountAttr}>${status === _constants.STATUS.READY ? templates[status](layout, state) : ''}</div>`;
|
|
30
33
|
}
|
|
31
34
|
function ready(layout, state) {
|
|
32
35
|
const {
|
|
@@ -104,7 +107,7 @@ function itemHeaderRightText(layout, state, value, meta) {
|
|
|
104
107
|
} = layout;
|
|
105
108
|
const logoText = _templates.helpers.asFunction(templates.logoText)(layout, state, value, meta) || '';
|
|
106
109
|
const logoImg = _templates.helpers.asFunction(templates.logoImg)(layout, state, value, meta);
|
|
107
|
-
return logoImg ? `<span class="${className}__item-header-logo-
|
|
110
|
+
return logoImg ? `<span class="${className}__item-header-logo-text">${logoText}</span>${logoImg}` : '';
|
|
108
111
|
}
|
|
109
112
|
function logoImg(layout, state, value, meta) {
|
|
110
113
|
const {
|
|
@@ -261,14 +264,9 @@ class AffiliationLayout extends _collection.default {
|
|
|
261
264
|
}
|
|
262
265
|
_render(element, states, controls) {
|
|
263
266
|
super._render(element, states, controls);
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this._itemCount = items ? items.length : undefined;
|
|
268
|
-
(0, _commons.requestAnimationFrame)(() => {
|
|
269
|
-
this._syncItemCount();
|
|
270
|
-
this._syncItemIndex();
|
|
271
|
-
});
|
|
267
|
+
// sync again for incremental item rendering
|
|
268
|
+
this._syncItemCount(states);
|
|
269
|
+
this._syncItemIndex();
|
|
272
270
|
}
|
|
273
271
|
_syncElement(element) {
|
|
274
272
|
const oldElement = this._element;
|
|
@@ -283,7 +281,11 @@ class AffiliationLayout extends _collection.default {
|
|
|
283
281
|
newElement && this._viewable.observe(newElement);
|
|
284
282
|
}
|
|
285
283
|
_syncItemCount() {
|
|
286
|
-
|
|
284
|
+
let {
|
|
285
|
+
state
|
|
286
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
287
|
+
const items = this._getItems(state);
|
|
288
|
+
const itemCount = this._itemCount = items ? items.length : undefined;
|
|
287
289
|
if (itemCount === this._displayedCount) {
|
|
288
290
|
return;
|
|
289
291
|
}
|
|
@@ -14,10 +14,10 @@ class ProgressiveLayout extends _raf.default {
|
|
|
14
14
|
_takePending() {
|
|
15
15
|
return this._pending;
|
|
16
16
|
}
|
|
17
|
-
_applyRender() {
|
|
18
|
-
let extraControls = arguments.length >
|
|
17
|
+
_applyRender(timestamp) {
|
|
18
|
+
let extraControls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
19
19
|
const loop = (0, _commons.capture)(false);
|
|
20
|
-
super._applyRender(Object.assign({}, extraControls, {
|
|
20
|
+
super._applyRender(timestamp, Object.assign({}, extraControls, {
|
|
21
21
|
loop: loop.t
|
|
22
22
|
}));
|
|
23
23
|
if (loop.value) {
|
package/dist/cjs/layout/raf.js
CHANGED
|
@@ -79,21 +79,20 @@ class RafLayout {
|
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
81
|
this._requested = true;
|
|
82
|
-
(0, _commons.requestAnimationFrame)(
|
|
82
|
+
(0, _commons.requestAnimationFrame)(timestamp => this._doRaf(timestamp));
|
|
83
83
|
}
|
|
84
|
-
_doRaf() {
|
|
84
|
+
_doRaf(timestamp) {
|
|
85
85
|
if (!this._requested) {
|
|
86
86
|
return; // just in case
|
|
87
87
|
}
|
|
88
88
|
this._requested = false;
|
|
89
|
-
this._applyRender();
|
|
89
|
+
this._applyRender(timestamp);
|
|
90
90
|
}
|
|
91
|
-
_applyRender() {
|
|
92
|
-
let extraControls = arguments.length >
|
|
91
|
+
_applyRender(timestamp) {
|
|
92
|
+
let extraControls = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
93
93
|
if (!this._pending) {
|
|
94
94
|
return; // just in case
|
|
95
95
|
}
|
|
96
|
-
const timestamp = Date.now();
|
|
97
96
|
let [state, {
|
|
98
97
|
notifyUpdate
|
|
99
98
|
}] = this._takePending();
|
package/dist/cjs/version.js
CHANGED
package/package.json
CHANGED
|
@@ -13,7 +13,10 @@ function root(layout, state) {
|
|
|
13
13
|
const roleAttr = role ? ` data-role="${role}"` : '';
|
|
14
14
|
const data = state.value || {};
|
|
15
15
|
const channelAttr = data.channel ? ` data-channel="${data.channel}"` : '';
|
|
16
|
-
|
|
16
|
+
const items = layout._getItems(state);
|
|
17
|
+
const itemCount = items ? items.length : undefined;
|
|
18
|
+
const itemCountAttr = itemCount !== undefined ? ` data-item-count="${itemCount}"` : '';
|
|
19
|
+
return `<div class="${className} ${status}"${roleAttr}${channelAttr}${itemCountAttr}>${status === STATUS.READY ? templates[status](layout, state) : ''}</div>`;
|
|
17
20
|
}
|
|
18
21
|
|
|
19
22
|
function ready(layout, state) {
|
|
@@ -70,7 +73,7 @@ function itemHeaderRightText(layout, state, value, meta) {
|
|
|
70
73
|
const { className, templates } = layout;
|
|
71
74
|
const logoText = helpers.asFunction(templates.logoText)(layout, state, value, meta) || '';
|
|
72
75
|
const logoImg = helpers.asFunction(templates.logoImg)(layout, state, value, meta);
|
|
73
|
-
return logoImg ? `<span class="${className}__item-header-logo-
|
|
76
|
+
return logoImg ? `<span class="${className}__item-header-logo-text">${logoText}</span>${logoImg}` : '';
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
function logoImg(layout, state, value, meta) {
|
|
@@ -227,15 +230,9 @@ export default class AffiliationLayout extends CollectionLayout {
|
|
|
227
230
|
|
|
228
231
|
_render(element, states, controls) {
|
|
229
232
|
super._render(element, states, controls);
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
this._itemCount = items ? items.length : undefined;
|
|
234
|
-
|
|
235
|
-
raf(() => {
|
|
236
|
-
this._syncItemCount();
|
|
237
|
-
this._syncItemIndex();
|
|
238
|
-
});
|
|
233
|
+
// sync again for incremental item rendering
|
|
234
|
+
this._syncItemCount(states);
|
|
235
|
+
this._syncItemIndex();
|
|
239
236
|
}
|
|
240
237
|
|
|
241
238
|
_syncElement(element) {
|
|
@@ -252,8 +249,9 @@ export default class AffiliationLayout extends CollectionLayout {
|
|
|
252
249
|
newElement && this._viewable.observe(newElement);
|
|
253
250
|
}
|
|
254
251
|
|
|
255
|
-
_syncItemCount() {
|
|
256
|
-
const
|
|
252
|
+
_syncItemCount({ state } = {}) {
|
|
253
|
+
const items = this._getItems(state);
|
|
254
|
+
const itemCount = this._itemCount = items ? items.length : undefined;
|
|
257
255
|
if (itemCount === this._displayedCount) {
|
|
258
256
|
return;
|
|
259
257
|
}
|
|
@@ -11,9 +11,9 @@ export default class ProgressiveLayout extends RafLayout {
|
|
|
11
11
|
return this._pending;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
_applyRender(extraControls = {}) {
|
|
14
|
+
_applyRender(timestamp, extraControls = {}) {
|
|
15
15
|
const loop = capture(false);
|
|
16
|
-
super._applyRender({ ...extraControls, loop: loop.t });
|
|
16
|
+
super._applyRender(timestamp, { ...extraControls, loop: loop.t });
|
|
17
17
|
if (loop.value) {
|
|
18
18
|
this._requestRaf();
|
|
19
19
|
}
|
package/src/layout/raf.js
CHANGED
|
@@ -59,22 +59,21 @@ export default class RafLayout {
|
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
this._requested = true;
|
|
62
|
-
raf(
|
|
62
|
+
raf(timestamp => this._doRaf(timestamp));
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
_doRaf() {
|
|
65
|
+
_doRaf(timestamp) {
|
|
66
66
|
if (!this._requested) {
|
|
67
67
|
return; // just in case
|
|
68
68
|
}
|
|
69
69
|
this._requested = false;
|
|
70
|
-
this._applyRender();
|
|
70
|
+
this._applyRender(timestamp);
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
_applyRender(extraControls = {}) {
|
|
73
|
+
_applyRender(timestamp, extraControls = {}) {
|
|
74
74
|
if (!this._pending) {
|
|
75
75
|
return; // just in case
|
|
76
76
|
}
|
|
77
|
-
const timestamp = Date.now();
|
|
78
77
|
let [state, { notifyUpdate }] = this._takePending();
|
|
79
78
|
state = Object.freeze({ ...state, timestamp });
|
|
80
79
|
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default '1.10.
|
|
1
|
+
export default '1.10.1-beta.1';
|