@builder.io/sdk 3.0.2-2 → 3.0.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 (42) hide show
  1. package/.yarnrc.yml +1 -0
  2. package/CHANGELOG.md +13 -0
  3. package/dist/index.browser.js +71 -18
  4. package/dist/index.browser.js.map +1 -1
  5. package/dist/index.cjs.js +71 -18
  6. package/dist/index.cjs.js.map +1 -1
  7. package/dist/index.esm.js +71 -18
  8. package/dist/index.esm.js.map +1 -1
  9. package/dist/index.js +13 -49
  10. package/dist/index.umd.js +71 -18
  11. package/dist/index.umd.js.map +1 -1
  12. package/dist/package.json +1 -3
  13. package/dist/src/builder.class.d.ts +7 -0
  14. package/dist/src/builder.class.js +70 -17
  15. package/dist/src/builder.class.js.map +1 -1
  16. package/dist/src/builder.class.test.js +757 -170
  17. package/dist/src/builder.class.test.js.map +1 -1
  18. package/dist/src/classes/animator.class.js +195 -218
  19. package/dist/src/classes/observable.class.js +97 -102
  20. package/dist/src/classes/promise.class.js +154 -150
  21. package/dist/src/classes/query-string.class.js +74 -73
  22. package/dist/src/classes/query-string.class.test.js +20 -20
  23. package/dist/src/constants/builder.js +4 -4
  24. package/dist/src/functions/assign.function.js +19 -19
  25. package/dist/src/functions/fetch.function.js +75 -97
  26. package/dist/src/functions/finder.function.js +274 -389
  27. package/dist/src/functions/next-tick.function.js +23 -26
  28. package/dist/src/functions/omit.function.js +13 -13
  29. package/dist/src/functions/server-only-require.function.js +9 -10
  30. package/dist/src/functions/throttle.function.js +37 -35
  31. package/dist/src/functions/to-error.js +6 -5
  32. package/dist/src/functions/uuid.js +8 -9
  33. package/dist/src/types/api-version.js +3 -3
  34. package/dist/src/types/content.js +3 -3
  35. package/dist/src/types/element.js +3 -3
  36. package/dist/src/url.js +42 -41
  37. package/dist/src/url.test.js +118 -222
  38. package/dist/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +3 -6
  40. package/dist/src/functions/get-top-level-domain.d.ts +0 -6
  41. package/dist/src/functions/get-top-level-domain.js +0 -17
  42. package/dist/src/functions/get-top-level-domain.js.map +0 -1
@@ -1,32 +1,29 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.nextTick = void 0;
4
- var isSafari =
5
- typeof window !== 'undefined' &&
6
- /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
4
+ var isSafari = typeof window !== 'undefined' &&
5
+ /^((?!chrome|android).)*safari/i.test(window.navigator.userAgent);
7
6
  var isClient = typeof window !== 'undefined';
8
7
  // TODO: queue all of these in a debounceNextTick
9
8
  function nextTick(fn) {
10
- // if (typeof process !== 'undefined' && process.nextTick) {
11
- // console.log('process.nextTick?');
12
- // process.nextTick(fn);
13
- // return;
14
- // }
15
- // FIXME: fix the real safari issue of this randomly not working
16
- if (!isClient || isSafari || typeof MutationObserver === 'undefined') {
17
- setTimeout(fn);
18
- return;
19
- }
20
- var called = 0;
21
- var observer = new MutationObserver(function () {
22
- return fn();
23
- });
24
- var element = document.createTextNode('');
25
- observer.observe(element, {
26
- characterData: true,
27
- });
28
- // tslint:disable-next-line
29
- element.data = String((called = ++called));
9
+ // if (typeof process !== 'undefined' && process.nextTick) {
10
+ // console.log('process.nextTick?');
11
+ // process.nextTick(fn);
12
+ // return;
13
+ // }
14
+ // FIXME: fix the real safari issue of this randomly not working
15
+ if (!isClient || isSafari || typeof MutationObserver === 'undefined') {
16
+ setTimeout(fn);
17
+ return;
18
+ }
19
+ var called = 0;
20
+ var observer = new MutationObserver(function () { return fn(); });
21
+ var element = document.createTextNode('');
22
+ observer.observe(element, {
23
+ characterData: true,
24
+ });
25
+ // tslint:disable-next-line
26
+ element.data = String((called = ++called));
30
27
  }
31
28
  exports.nextTick = nextTick;
32
- //# sourceMappingURL=next-tick.function.js.map
29
+ //# sourceMappingURL=next-tick.function.js.map
@@ -1,17 +1,17 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.omit = void 0;
4
4
  function omit(obj) {
5
- var values = [];
6
- for (var _i = 1; _i < arguments.length; _i++) {
7
- values[_i - 1] = arguments[_i];
8
- }
9
- var newObject = Object.assign({}, obj);
10
- for (var _a = 0, values_1 = values; _a < values_1.length; _a++) {
11
- var key = values_1[_a];
12
- delete newObject[key];
13
- }
14
- return newObject;
5
+ var values = [];
6
+ for (var _i = 1; _i < arguments.length; _i++) {
7
+ values[_i - 1] = arguments[_i];
8
+ }
9
+ var newObject = Object.assign({}, obj);
10
+ for (var _a = 0, values_1 = values; _a < values_1.length; _a++) {
11
+ var key = values_1[_a];
12
+ delete newObject[key];
13
+ }
14
+ return newObject;
15
15
  }
16
16
  exports.omit = omit;
17
- //# sourceMappingURL=omit.function.js.map
17
+ //# sourceMappingURL=omit.function.js.map
@@ -1,16 +1,15 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  // Webpack workaround to conditionally require certain external modules
4
4
  // only on the server and not bundle them on the client
5
5
  var serverOnlyRequire;
6
6
  try {
7
- // tslint:disable-next-line:no-eval
8
- serverOnlyRequire = eval('require');
9
- } catch (err) {
10
- // all good
11
- serverOnlyRequire = function () {
12
- return null;
13
- };
7
+ // tslint:disable-next-line:no-eval
8
+ serverOnlyRequire = eval('require');
9
+ }
10
+ catch (err) {
11
+ // all good
12
+ serverOnlyRequire = (function () { return null; });
14
13
  }
15
14
  exports.default = serverOnlyRequire;
16
- //# sourceMappingURL=server-only-require.function.js.map
15
+ //# sourceMappingURL=server-only-require.function.js.map
@@ -1,40 +1,42 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.throttle = void 0;
4
4
  function throttle(func, wait, options) {
5
- if (options === void 0) {
6
- options = {};
7
- }
8
- var context;
9
- var args;
10
- var result;
11
- var timeout = null;
12
- var previous = 0;
13
- var later = function () {
14
- previous = options.leading === false ? 0 : Date.now();
15
- timeout = null;
16
- result = func.apply(context, args);
17
- if (!timeout) context = args = null;
18
- };
19
- return function () {
20
- var now = Date.now();
21
- if (!previous && options.leading === false) previous = now;
22
- var remaining = wait - (now - previous);
23
- context = this;
24
- args = arguments;
25
- if (remaining <= 0 || remaining > wait) {
26
- if (timeout) {
27
- clearTimeout(timeout);
5
+ if (options === void 0) { options = {}; }
6
+ var context;
7
+ var args;
8
+ var result;
9
+ var timeout = null;
10
+ var previous = 0;
11
+ var later = function () {
12
+ previous = options.leading === false ? 0 : Date.now();
28
13
  timeout = null;
29
- }
30
- previous = now;
31
- result = func.apply(context, args);
32
- if (!timeout) context = args = null;
33
- } else if (!timeout && options.trailing !== false) {
34
- timeout = setTimeout(later, remaining);
35
- }
36
- return result;
37
- };
14
+ result = func.apply(context, args);
15
+ if (!timeout)
16
+ context = args = null;
17
+ };
18
+ return function () {
19
+ var now = Date.now();
20
+ if (!previous && options.leading === false)
21
+ previous = now;
22
+ var remaining = wait - (now - previous);
23
+ context = this;
24
+ args = arguments;
25
+ if (remaining <= 0 || remaining > wait) {
26
+ if (timeout) {
27
+ clearTimeout(timeout);
28
+ timeout = null;
29
+ }
30
+ previous = now;
31
+ result = func.apply(context, args);
32
+ if (!timeout)
33
+ context = args = null;
34
+ }
35
+ else if (!timeout && options.trailing !== false) {
36
+ timeout = setTimeout(later, remaining);
37
+ }
38
+ return result;
39
+ };
38
40
  }
39
41
  exports.throttle = throttle;
40
- //# sourceMappingURL=throttle.function.js.map
42
+ //# sourceMappingURL=throttle.function.js.map
@@ -1,5 +1,5 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.toError = void 0;
4
4
  /**
5
5
  * Safe conversion to error type. Intended to be used in catch blocks where the
@@ -14,8 +14,9 @@ exports.toError = void 0;
14
14
  * }
15
15
  */
16
16
  function toError(err) {
17
- if (err instanceof Error) return err;
18
- return new Error(String(err));
17
+ if (err instanceof Error)
18
+ return err;
19
+ return new Error(String(err));
19
20
  }
20
21
  exports.toError = toError;
21
- //# sourceMappingURL=to-error.js.map
22
+ //# sourceMappingURL=to-error.js.map
@@ -1,22 +1,21 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uuid = exports.uuidv4 = void 0;
4
4
  /**
5
5
  * @credit https://stackoverflow.com/a/2117523
6
6
  */
7
7
  function uuidv4() {
8
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
9
- var r = (Math.random() * 16) | 0,
10
- v = c == 'x' ? r : (r & 0x3) | 0x8;
11
- return v.toString(16);
12
- });
8
+ return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
9
+ var r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;
10
+ return v.toString(16);
11
+ });
13
12
  }
14
13
  exports.uuidv4 = uuidv4;
15
14
  /**
16
15
  * Slightly cleaner and smaller UUIDs
17
16
  */
18
17
  function uuid() {
19
- return uuidv4().replace(/-/g, '');
18
+ return uuidv4().replace(/-/g, '');
20
19
  }
21
20
  exports.uuid = uuid;
22
- //# sourceMappingURL=uuid.js.map
21
+ //# sourceMappingURL=uuid.js.map
@@ -1,5 +1,5 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DEFAULT_API_VERSION = void 0;
4
4
  exports.DEFAULT_API_VERSION = 'v3';
5
- //# sourceMappingURL=api-version.js.map
5
+ //# sourceMappingURL=api-version.js.map
@@ -1,3 +1,3 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
3
- //# sourceMappingURL=content.js.map
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=content.js.map
@@ -1,3 +1,3 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
3
- //# sourceMappingURL=element.js.map
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=element.js.map
package/dist/src/url.js CHANGED
@@ -1,51 +1,52 @@
1
- 'use strict';
2
- Object.defineProperty(exports, '__esModule', { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parse = exports.emptyUrl = void 0;
4
4
  function emptyUrl() {
5
- return {
6
- query: null,
7
- port: null,
8
- auth: null,
9
- hash: null,
10
- host: null,
11
- hostname: null,
12
- href: null,
13
- path: null,
14
- pathname: null,
15
- protocol: null,
16
- search: null,
17
- slashes: null,
18
- };
5
+ return {
6
+ query: null,
7
+ port: null,
8
+ auth: null,
9
+ hash: null,
10
+ host: null,
11
+ hostname: null,
12
+ href: null,
13
+ path: null,
14
+ pathname: null,
15
+ protocol: null,
16
+ search: null,
17
+ slashes: null,
18
+ };
19
19
  }
20
20
  exports.emptyUrl = emptyUrl;
21
21
  // Replacement for `url.parse` using `URL` global object that works with relative paths.
22
22
  // Assumptions: this function operates in a NodeJS environment.
23
23
  function parse(url) {
24
- var _a;
25
- var out = emptyUrl();
26
- var u;
27
- var pathOnly = url === '' || url[0] === '/';
28
- if (pathOnly) {
29
- u = new URL(url, 'http://0.0.0.0/');
30
- out.href = u.href;
31
- out.href = (_a = out.href) === null || _a === void 0 ? void 0 : _a.slice(14); // remove 'http://0.0.0.0/'
32
- } else {
33
- u = new URL(url);
34
- out.href = u.href;
35
- out.port = u.port === '' ? null : u.port;
36
- out.hash = u.hash === '' ? null : u.hash;
37
- out.host = u.host;
38
- out.hostname = u.hostname;
39
- out.href = u.href;
24
+ var _a;
25
+ var out = emptyUrl();
26
+ var u;
27
+ var pathOnly = url === '' || url[0] === '/';
28
+ if (pathOnly) {
29
+ u = new URL(url, 'http://0.0.0.0/');
30
+ out.href = u.href;
31
+ out.href = (_a = out.href) === null || _a === void 0 ? void 0 : _a.slice(14); // remove 'http://0.0.0.0/'
32
+ }
33
+ else {
34
+ u = new URL(url);
35
+ out.href = u.href;
36
+ out.port = u.port === '' ? null : u.port;
37
+ out.hash = u.hash === '' ? null : u.hash;
38
+ out.host = u.host;
39
+ out.hostname = u.hostname;
40
+ out.href = u.href;
41
+ out.pathname = u.pathname;
42
+ out.protocol = u.protocol;
43
+ out.slashes = url[u.protocol.length] === '/'; // check if the mimetype is proceeded by a slash
44
+ }
45
+ out.search = u.search;
46
+ out.query = u.search.slice(1); // remove '?'
47
+ out.path = "".concat(u.pathname).concat(u.search);
40
48
  out.pathname = u.pathname;
41
- out.protocol = u.protocol;
42
- out.slashes = url[u.protocol.length] === '/'; // check if the mimetype is proceeded by a slash
43
- }
44
- out.search = u.search;
45
- out.query = u.search.slice(1); // remove '?'
46
- out.path = ''.concat(u.pathname).concat(u.search);
47
- out.pathname = u.pathname;
48
- return out;
49
+ return out;
49
50
  }
50
51
  exports.parse = parse;
51
- //# sourceMappingURL=url.js.map
52
+ //# sourceMappingURL=url.js.map