sygnal 2.2.0 → 2.5.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.
package/package.json CHANGED
@@ -1,17 +1,28 @@
1
1
  {
2
2
  "name": "sygnal",
3
- "version": "2.2.0",
3
+ "version": "2.5.0",
4
4
  "description": "An intuitive framework for building fast and small components or applications based on Cycle.js",
5
- "main": "./dist/index.js",
5
+ "main": "./dist/index.cjs.js",
6
+ "module": "./dist/index.esm.js",
7
+ "browser": "./dist/sygnal.min.js",
6
8
  "exports": {
7
- ".": "./dist/index.js",
8
- "./jsx": "./dist/jsx.js"
9
+ ".": {
10
+ "browser": "./dist/sygnal.min.js",
11
+ "import": "./dist/index.esm.js",
12
+ "require": "./dist/index.cjs.js"
13
+ },
14
+ "./jsx": {
15
+ "import": "./dist/jsx.esm.js",
16
+ "require": "./dist/jsx.cjs.js"
17
+ }
9
18
  },
19
+ "files": [
20
+ "dist"
21
+ ],
10
22
  "scripts": {
11
23
  "test": "echo \"Tests to come...\"",
12
- "build": "npx babel src --out-dir dist",
13
- "build-min": "npx babel src --presets minify --no-comments --out-file dist/sygnal.min.js",
14
- "start": "npx babel src --out-dir dist --watch"
24
+ "build": "npx rollup -c",
25
+ "start": "npx rollup -c -w"
15
26
  },
16
27
  "repository": {
17
28
  "type": "git",
@@ -40,10 +51,9 @@
40
51
  "xstream": "^11.14.0"
41
52
  },
42
53
  "devDependencies": {
43
- "@babel/cli": "^7.17.10",
44
- "@babel/core": "^7.17.10",
45
- "@babel/preset-env": "^7.17.10",
46
- "babel-loader": "^8.2.5",
47
- "babel-preset-minify": "^0.5.2"
54
+ "@rollup/plugin-commonjs": "^22.0.0",
55
+ "@rollup/plugin-node-resolve": "^13.3.0",
56
+ "rollup": "^2.75.6",
57
+ "rollup-plugin-terser": "^7.0.2"
48
58
  }
49
59
  }
package/.babelrc DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "presets": ["@babel/preset-env"]
3
- }
@@ -1,114 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = collection;
7
-
8
- var _isolate = _interopRequireDefault(require("@cycle/isolate"));
9
-
10
- var _state = require("@cycle/state");
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
-
16
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
17
-
18
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
-
20
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
21
-
22
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
23
-
24
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
25
-
26
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
27
-
28
- function collection(component, stateLense) {
29
- var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
30
- var _opts$combineList = opts.combineList,
31
- combineList = _opts$combineList === void 0 ? ['DOM'] : _opts$combineList,
32
- _opts$globalList = opts.globalList,
33
- globalList = _opts$globalList === void 0 ? ['EVENTS'] : _opts$globalList,
34
- _opts$stateSourceName = opts.stateSourceName,
35
- stateSourceName = _opts$stateSourceName === void 0 ? 'STATE' : _opts$stateSourceName,
36
- _opts$domSourceName = opts.domSourceName,
37
- domSourceName = _opts$domSourceName === void 0 ? 'DOM' : _opts$domSourceName,
38
- _opts$container = opts.container,
39
- container = _opts$container === void 0 ? 'div' : _opts$container,
40
- _opts$containerClass = opts.containerClass,
41
- containerClass = _opts$containerClass === void 0 ? '' : _opts$containerClass;
42
- return function (sources) {
43
- var key = Date.now();
44
- var collectionOpts = {
45
- item: component,
46
- itemKey: function itemKey(state, ind) {
47
- return typeof state.id !== 'undefined' ? state.id : ind;
48
- },
49
- itemScope: function itemScope(key) {
50
- return key;
51
- },
52
- channel: stateSourceName,
53
- collectSinks: function collectSinks(instances) {
54
- return Object.entries(sources).reduce(function (acc, _ref) {
55
- var _ref2 = _slicedToArray(_ref, 2),
56
- name = _ref2[0],
57
- stream = _ref2[1];
58
-
59
- if (combineList.includes(name)) {
60
- var combined = instances.pickCombine(name);
61
-
62
- if (name === domSourceName && container) {
63
- acc.DOM = combined.map(function (children) {
64
- return {
65
- sel: container,
66
- data: {
67
- props: {
68
- className: containerClass
69
- }
70
- },
71
- children: children,
72
- key: key,
73
- text: undefined,
74
- elm: undefined
75
- };
76
- });
77
- } else {
78
- console.warn('Collections without wrapping containers will fail in unpredictable ways when used inside JSX fragments');
79
- acc[name] = combined;
80
- }
81
- } else {
82
- acc[name] = instances.pickMerge(name);
83
- }
84
-
85
- return acc;
86
- }, {});
87
- }
88
- };
89
-
90
- var isolateOpts = _defineProperty({}, stateSourceName, stateLense);
91
-
92
- globalList.forEach(function (global) {
93
- return isolateOpts[global] = null;
94
- });
95
- combineList.forEach(function (combine) {
96
- return isolateOpts[combine] = null;
97
- });
98
- return makeIsolatedCollection(collectionOpts, isolateOpts, sources);
99
- };
100
- }
101
- /**
102
- * instantiate a cycle collection and isolate
103
- * (makes the code for doing isolated collections more readable)
104
- *
105
- * @param {Object} collectionOpts options for the makeCollection function (see cycle/state documentation)
106
- * @param {String|Object} isolateOpts options for the isolate function (see cycle/isolate documentation)
107
- * @param {Object} sources object of cycle style sources to use for the created collection
108
- * @return {Object} collection of component sinks
109
- */
110
-
111
-
112
- function makeIsolatedCollection(collectionOpts, isolateOpts, sources) {
113
- return (0, _isolate["default"])((0, _state.makeCollection)(collectionOpts), isolateOpts)(sources);
114
- }