@startinblox/core 0.20.0-beta.3 → 1.0.0-beta.2

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.
@@ -1,6 +1,9 @@
1
+ var __defProp = Object.defineProperty;
1
2
  var __typeError = (msg) => {
2
3
  throw TypeError(msg);
3
4
  };
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
7
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
5
8
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
6
9
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
@@ -1313,26 +1316,24 @@ Fuse.config = Config;
1313
1316
  register(ExtendedSearch);
1314
1317
  }
1315
1318
  function uniqID() {
1316
- return "_" + (Math.random() * Math.pow(36, 20)).toString(36).slice(0, 10);
1319
+ return `_${(Math.random() * 36 ** 20).toString(36).slice(0, 10)}`;
1317
1320
  }
1318
1321
  function stringToDom(html) {
1319
1322
  const template = document.createElement("template");
1320
1323
  template.innerHTML = html;
1321
1324
  return template.content;
1322
1325
  }
1326
+ const AsyncFunction = Object.getPrototypeOf(async () => {
1327
+ }).constructor;
1323
1328
  async function evalTemplateString(str, variables = {}) {
1324
1329
  const keys = Object.keys(variables);
1325
1330
  const values = keys.map((key) => variables[key]);
1326
1331
  try {
1327
- const AsyncFunction = Object.getPrototypeOf(
1328
- async function() {
1329
- }
1330
- ).constructor;
1331
- const func = AsyncFunction.call(null, ...keys, "return `" + str + "`");
1332
+ const func = AsyncFunction.call(null, ...keys, `return \`${str}\``);
1332
1333
  return await func(...values);
1333
1334
  } catch (e) {
1334
1335
  console.log(e);
1335
- throw new SyntaxError("`" + str + "`");
1336
+ throw new SyntaxError(`\`${str}\``);
1336
1337
  }
1337
1338
  }
1338
1339
  function importCSS(...stylesheets) {
@@ -1388,7 +1389,7 @@ function relativeSource(source) {
1388
1389
  const e = new Error();
1389
1390
  if (!e.stack) return source;
1390
1391
  const f2 = e.stack.split("\n").filter((l) => l.includes(":"))[2];
1391
- let line = f2.match(/[a-z]+:.*$/);
1392
+ const line = f2.match(/[a-z]+:.*$/);
1392
1393
  if (!line) return source;
1393
1394
  const calledFile = line[0].replace(/(\:[0-9]+){2}\)?$/, "");
1394
1395
  source = new URL(source, calledFile).href;
@@ -1397,8 +1398,8 @@ function relativeSource(source) {
1397
1398
  function loadScript(source) {
1398
1399
  source = relativeSource(source);
1399
1400
  return new Promise((resolve) => {
1400
- var script = document.createElement("script");
1401
- var head = document.querySelector("head");
1401
+ const script = document.createElement("script");
1402
+ const head = document.querySelector("head");
1402
1403
  script.async = true;
1403
1404
  script.onload = () => setTimeout(resolve, 0);
1404
1405
  script.src = source;
@@ -1406,7 +1407,7 @@ function loadScript(source) {
1406
1407
  });
1407
1408
  }
1408
1409
  function domIsReady() {
1409
- return new Promise(function(resolve) {
1410
+ return new Promise((resolve) => {
1410
1411
  if (document.readyState === "complete") {
1411
1412
  resolve();
1412
1413
  } else {
@@ -1418,28 +1419,27 @@ function setDeepProperty(obj, path, value) {
1418
1419
  const name = path.shift();
1419
1420
  if (name) {
1420
1421
  if (!(name in obj)) obj[name] = {};
1421
- if (path.length) setDeepProperty(obj[name], path, value);
1422
+ if (path.length > 0) setDeepProperty(obj[name], path, value);
1422
1423
  else obj[name] = value;
1423
1424
  }
1424
1425
  }
1425
1426
  function parseFieldsString(fields) {
1426
1427
  if (!fields) return [];
1427
- let fieldsArray;
1428
1428
  while (fields.indexOf("(") > 0) {
1429
- let firstBracket = fields.indexOf("(");
1430
- let noset = fields.substring(
1429
+ const firstBracket = fields.indexOf("(");
1430
+ const noset = fields.substring(
1431
1431
  firstBracket,
1432
1432
  findClosingBracketMatchIndex(fields, firstBracket) + 1
1433
1433
  );
1434
1434
  fields = fields.replace(noset, "");
1435
1435
  }
1436
1436
  const re = /((^\s*|,)\s*)(("(\\"|[^"])*")|('(\\'|[^'])*')|[^,]*)/gm;
1437
- fieldsArray = fields.match(re) || [];
1437
+ const fieldsArray = fields.match(re) || [];
1438
1438
  if (!fieldsArray) return [];
1439
1439
  return fieldsArray.map((a) => a.replace(/^[\s,]+/, ""));
1440
1440
  }
1441
1441
  function findClosingBracketMatchIndex(str, pos) {
1442
- if (str[pos] != "(") throw new Error("No '(' at index " + pos);
1442
+ if (str[pos] !== "(") throw new Error(`No '(' at index ${pos}`);
1443
1443
  let depth = 1;
1444
1444
  for (let i = pos + 1; i < str.length; i++) {
1445
1445
  switch (str[i]) {
@@ -1447,7 +1447,7 @@ function findClosingBracketMatchIndex(str, pos) {
1447
1447
  depth++;
1448
1448
  break;
1449
1449
  case ")":
1450
- if (--depth == 0) return i;
1450
+ if (--depth === 0) return i;
1451
1451
  break;
1452
1452
  }
1453
1453
  }
@@ -1500,11 +1500,11 @@ function generalComparator(a, b, order = "asc") {
1500
1500
  let comparison = 0;
1501
1501
  if (typeof a === "boolean" && typeof b === "boolean") {
1502
1502
  comparison = a === b ? 0 : a ? 1 : -1;
1503
- } else if (!isNaN(a) && !isNaN(b)) {
1503
+ } else if (!Number.isNaN(+a) && !Number.isNaN(+b)) {
1504
1504
  comparison = Number(a) - Number(b);
1505
1505
  } else if (Array.isArray(a) && Array.isArray(b)) {
1506
1506
  comparison = a.length - b.length;
1507
- } else if (!isNaN(Date.parse(a)) && !isNaN(Date.parse(b))) {
1507
+ } else if (!Number.isNaN(Date.parse(a)) && !Number.isNaN(Date.parse(b))) {
1508
1508
  const dateA = new Date(a);
1509
1509
  const dateB = new Date(a);
1510
1510
  comparison = dateA.getTime() - dateB.getTime();
@@ -1524,7 +1524,7 @@ function generalComparator(a, b, order = "asc") {
1524
1524
  }
1525
1525
  function transformArrayToContainer(resource) {
1526
1526
  const newValue = { ...resource };
1527
- for (let predicate of Object.keys(newValue)) {
1527
+ for (const predicate of Object.keys(newValue)) {
1528
1528
  const predicateValue = newValue[predicate];
1529
1529
  if (!predicateValue || typeof predicateValue !== "object") continue;
1530
1530
  if (["permissions", "@context"].includes(predicate)) continue;
@@ -1550,6 +1550,8 @@ class AsyncIterableBuilder {
1550
1550
  __privateAdd(this, _AsyncIterableBuilder_instances);
1551
1551
  __privateAdd(this, _values, []);
1552
1552
  __privateAdd(this, _resolve);
1553
+ __publicField(this, "iterable");
1554
+ __publicField(this, "next");
1553
1555
  __privateMethod(this, _AsyncIterableBuilder_instances, nextPromise_fn).call(this);
1554
1556
  this.iterable = __privateMethod(this, _AsyncIterableBuilder_instances, createIterable_fn).call(this);
1555
1557
  this.next = __privateMethod(this, _AsyncIterableBuilder_instances, next_fn).bind(this);
@@ -1571,7 +1573,11 @@ next_fn = function(value, done = false) {
1571
1573
  __privateMethod(this, _AsyncIterableBuilder_instances, nextPromise_fn).call(this);
1572
1574
  };
1573
1575
  nextPromise_fn = function() {
1574
- __privateGet(this, _values).push(new Promise((resolve) => __privateSet(this, _resolve, resolve)));
1576
+ __privateGet(this, _values).push(
1577
+ new Promise((resolve) => {
1578
+ __privateSet(this, _resolve, resolve);
1579
+ })
1580
+ );
1575
1581
  };
1576
1582
  const asyncQuerySelector = (selector, parent = document) => new Promise((resolve) => {
1577
1583
  const element = parent.querySelector(selector);
@@ -1633,11 +1639,11 @@ const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
1633
1639
  export {
1634
1640
  AsyncIterableBuilder as A,
1635
1641
  asyncQuerySelector as a,
1636
- findClosingBracketMatchIndex as b,
1642
+ fuzzyCompare as b,
1637
1643
  compare as c,
1638
1644
  defineComponent as d,
1639
1645
  evalTemplateString as e,
1640
- fuzzyCompare as f,
1646
+ findClosingBracketMatchIndex as f,
1641
1647
  generalComparator as g,
1642
1648
  helpers as h,
1643
1649
  importInlineCSS as i,
package/dist/helpers.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A, a, o, c, A as A2, d, n, e, b, f, g, k, i, l, m, p, s, j, t, u } from "./helpers-B4P9rvjM.js";
1
+ import { A, a, o, c, A as A2, d, n, e, f, b, g, k, i, l, m, p, s, j, t, u } from "./helpers-Ei-jd7qG.js";
2
2
  export {
3
3
  A as AsyncIterableBuilder,
4
4
  a as asyncQuerySelector,
@@ -8,8 +8,8 @@ export {
8
8
  d as defineComponent,
9
9
  n as domIsReady,
10
10
  e as evalTemplateString,
11
- b as findClosingBracketMatchIndex,
12
- f as fuzzyCompare,
11
+ f as findClosingBracketMatchIndex,
12
+ b as fuzzyCompare,
13
13
  g as generalComparator,
14
14
  k as importCSS,
15
15
  i as importInlineCSS,