@miso.ai/client-sdk-ui 1.13.0 → 1.13.1-beta.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.
@@ -12,6 +12,8 @@ const _excluded = ["value", "error", "status", "meta"];
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
14
14
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
15
+ // TODO: browser dependency on syncSize
16
+
15
17
  function statesEqual(a, b) {
16
18
  return a === b || a && b && a.status === b.status && a.error === b.error && a.value === b.value &&
17
19
  // skip deep equals
@@ -33,9 +33,7 @@ class ViewsActor {
33
33
  (0, _commons.defineValues)(this, {
34
34
  interface: new Views(this)
35
35
  });
36
- const syncSize = () => this.syncSize();
37
- window.addEventListener('resize', syncSize);
38
- this._unsubscribes = [() => window.removeEventListener('resize', syncSize), hub.on(fields.data(), data => this.refresh({
36
+ this._unsubscribes = [onResize(this.syncSize.bind(this)), hub.on(fields.data(), data => this.refresh({
39
37
  data
40
38
  })), options.on('layouts', () => this._syncLayouts())];
41
39
  this._syncLayouts();
@@ -201,4 +199,11 @@ class Views {
201
199
  get all() {
202
200
  return this._actor.views.map(view => view.interface);
203
201
  }
202
+ }
203
+ function onResize(callback) {
204
+ if (typeof window === 'undefined') {
205
+ return () => {};
206
+ }
207
+ window.addEventListener('resize', callback);
208
+ return () => window.removeEventListener('resize', callback);
204
209
  }
@@ -34,7 +34,7 @@ function facets(layout, state) {
34
34
  return Object.keys(facet_fields).map(field => templates.facet(layout, {
35
35
  field,
36
36
  entries: facet_fields[field]
37
- }, state));
37
+ }, state)).join('');
38
38
  }
39
39
  function facet(layout, facet, state) {
40
40
  const {
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = exports.default = '1.13.0';
7
+ var _default = exports.default = '1.13.1-beta.0';
@@ -11,6 +11,8 @@ var _commons = require("@miso.ai/commons");
11
11
  var _constants = require("../../constants.js");
12
12
  const _excluded = ["setValue", "focus", "updateUrl", "param", "sourceParam"];
13
13
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
14
+ // TODO: eliminate browser dependency?
15
+
14
16
  const DEFAULT_AUTO_QUERY_PARAM = exports.DEFAULT_AUTO_QUERY_PARAM = 'q';
15
17
  const DEFAULT_AUTO_QUERY_SOURCE_PARAM = exports.DEFAULT_AUTO_QUERY_SOURCE_PARAM = 'qs';
16
18
  function normalizeAutoQueryOptions(_ref = {}) {
@@ -8,6 +8,8 @@ exports.enableUseLink = enableUseLink;
8
8
  var _commons = require("@miso.ai/commons");
9
9
  const _excluded = ["q"];
10
10
  function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
11
+ // TODO: eliminate browser dependency
12
+
11
13
  function enableUseLink(prototype) {
12
14
  (0, _commons.mixin)(prototype, UseLinkMixin.prototype);
13
15
  }
package/package.json CHANGED
@@ -30,7 +30,7 @@
30
30
  "url": "https://github.com/MisoAI/miso-client-js-sdk/issues"
31
31
  },
32
32
  "dependencies": {
33
- "@miso.ai/commons": "1.13.0"
33
+ "@miso.ai/commons": "1.13.1-beta.0"
34
34
  },
35
- "version": "1.13.0"
35
+ "version": "1.13.1-beta.0"
36
36
  }
package/src/actor/view.js CHANGED
@@ -3,6 +3,8 @@ import { STATUS, ROLE, isDataRole } from '../constants.js';
3
3
  import * as fields from './fields.js';
4
4
  import ProxyElement from '../util/proxy.js';
5
5
 
6
+ // TODO: browser dependency on syncSize
7
+
6
8
  function statesEqual(a, b) {
7
9
  return a === b || (a && b &&
8
10
  a.status === b.status &&
@@ -29,11 +29,8 @@ export default class ViewsActor {
29
29
  interface: new Views(this),
30
30
  });
31
31
 
32
- const syncSize = () => this.syncSize();
33
- window.addEventListener('resize', syncSize);
34
-
35
32
  this._unsubscribes = [
36
- () => window.removeEventListener('resize', syncSize),
33
+ onResize(this.syncSize.bind(this)),
37
34
  hub.on(fields.data(), data => this.refresh({ data })),
38
35
  options.on('layouts', () => this._syncLayouts()),
39
36
  ];
@@ -217,3 +214,11 @@ class Views {
217
214
  }
218
215
 
219
216
  }
217
+
218
+ function onResize(callback) {
219
+ if (typeof window === 'undefined') {
220
+ return () => {};
221
+ }
222
+ window.addEventListener('resize', callback);
223
+ return () => window.removeEventListener('resize', callback);
224
+ }
@@ -17,7 +17,7 @@ function root(layout, state) {
17
17
  function facets(layout, state) {
18
18
  const { templates } = layout;
19
19
  const { facet_fields = {} } = state.value || {};
20
- return Object.keys(facet_fields).map(field => templates.facet(layout, { field, entries: facet_fields[field] }, state));
20
+ return Object.keys(facet_fields).map(field => templates.facet(layout, { field, entries: facet_fields[field] }, state)).join('');
21
21
  }
22
22
 
23
23
  function facet(layout, facet, state) {
package/src/version.js CHANGED
@@ -1 +1 @@
1
- export default '1.13.0';
1
+ export default '1.13.1-beta.0';
@@ -1,6 +1,8 @@
1
1
  import { trimObj } from '@miso.ai/commons';
2
2
  import { ROLE, QUESTION_SOURCE } from '../../constants.js';
3
3
 
4
+ // TODO: eliminate browser dependency?
5
+
4
6
  export const DEFAULT_AUTO_QUERY_PARAM = 'q';
5
7
  export const DEFAULT_AUTO_QUERY_SOURCE_PARAM = 'qs';
6
8
 
@@ -1,5 +1,7 @@
1
1
  import { mixin } from '@miso.ai/commons';
2
2
 
3
+ // TODO: eliminate browser dependency
4
+
3
5
  export function enableUseLink(prototype) {
4
6
  mixin(prototype, UseLinkMixin.prototype);
5
7
  }