sygnal 2.0.0 → 2.1.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/README.md +17 -2
- package/dist/collection.js +1 -1
- package/dist/extra/run.js +12 -1
- package/dist/index.js +47 -2
- package/dist/jsx.js +9 -1
- package/dist/pragma/index.js +8 -4
- package/package.json +2 -1
- package/sygnal-2.1.0.tgz +0 -0
- package/sygnal-1.2.1.tgz +0 -0
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ Sygnal provides a structured way to create Cycle.js components that accomplishes
|
|
|
24
24
|
- Handle all stream plumbing between components
|
|
25
25
|
- Support arbitrarily complex applications with deep component hierarchies
|
|
26
26
|
- Reuse the best patterns from popular frameworks like React and Vue while avoiding the pitfalls
|
|
27
|
-
- Support pure Javascript, Typescript, and JSX
|
|
27
|
+
- Support pure Javascript, Typescript, and JSX (including fragments)
|
|
28
28
|
- Provide application state out of the box, and make it easy to use
|
|
29
29
|
- Use reasonable defaults while providing access to low-level Cycle.js functionality wherever possible
|
|
30
30
|
- Provide automatic debugging information
|
|
@@ -106,7 +106,22 @@ The results will be in the 'dist' folder, and you can serve it locally by runnin
|
|
|
106
106
|
npm preview
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
Alternatively, you can use any other bundler of your choice (Webpack, Babel, Rollup, etc.). To use JSX in your components while using alternative bundlers, you will need to
|
|
109
|
+
Alternatively, you can use any other bundler of your choice (Webpack, Babel, Rollup, etc.). To use JSX in your components while using alternative bundlers, you will need to configure your bundler to use Sygnal's JSX pragma. This is slightly different for each bundler, but looks generally like:
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
// this example is for Vite or esbuild, but most bundlers have options similar to this for handling JSX transpiling
|
|
113
|
+
{
|
|
114
|
+
...,
|
|
115
|
+
esbuild: {
|
|
116
|
+
// add the import for Sygnal's JSX and Fragment handler to the top of each .jsx and .tsx page automatically
|
|
117
|
+
jsxInject: `import { jsx, Fragment } from 'sygnal/jsx'`
|
|
118
|
+
// tell the transpiler to use Sygnal's 'jsx' funtion to render JSX elements
|
|
119
|
+
jsxFactory: `jsx`,
|
|
120
|
+
// tell the transpiler to use Sygnal's 'Fragment' funtion to render JSX fragments (<>...</>)
|
|
121
|
+
jsxFragment: 'Fragment',
|
|
122
|
+
},
|
|
123
|
+
}
|
|
124
|
+
```
|
|
110
125
|
|
|
111
126
|
|
|
112
127
|
## Initialization
|
package/dist/collection.js
CHANGED
|
@@ -33,7 +33,7 @@ function collection(component, stateLense) {
|
|
|
33
33
|
var collectionOpts = {
|
|
34
34
|
item: component,
|
|
35
35
|
itemKey: function itemKey(state, ind) {
|
|
36
|
-
return state.id
|
|
36
|
+
return typeof state.id !== 'undefined' ? state.id : ind;
|
|
37
37
|
},
|
|
38
38
|
itemScope: function itemScope(key) {
|
|
39
39
|
return key;
|
package/dist/extra/run.js
CHANGED
|
@@ -25,10 +25,21 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
25
25
|
|
|
26
26
|
function run(app) {
|
|
27
27
|
var drivers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
28
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
29
|
+
var _options$mountPoint = options.mountPoint,
|
|
30
|
+
mountPoint = _options$mountPoint === void 0 ? '#root' : _options$mountPoint,
|
|
31
|
+
_options$fragments = options.fragments,
|
|
32
|
+
fragments = _options$fragments === void 0 ? true : _options$fragments;
|
|
28
33
|
var wrapped = (0, _state.withState)(app, 'STATE');
|
|
29
34
|
var baseDrivers = {
|
|
30
35
|
EVENTS: _eventDriver["default"],
|
|
31
|
-
DOM: (0, _dom.makeDOMDriver)(
|
|
36
|
+
DOM: (0, _dom.makeDOMDriver)(mountPoint, {
|
|
37
|
+
snabbdomOptions: {
|
|
38
|
+
experimental: {
|
|
39
|
+
fragments: fragments
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}),
|
|
32
43
|
LOG: _logDriver["default"]
|
|
33
44
|
};
|
|
34
45
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict'; // export sygnal core functions
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
4
|
|
|
@@ -13,7 +13,12 @@ var _exportNames = {
|
|
|
13
13
|
processForm: true,
|
|
14
14
|
run: true,
|
|
15
15
|
classes: true,
|
|
16
|
-
xs: true
|
|
16
|
+
xs: true,
|
|
17
|
+
debounce: true,
|
|
18
|
+
throttle: true,
|
|
19
|
+
delay: true,
|
|
20
|
+
dropRepeats: true,
|
|
21
|
+
sampleCombine: true
|
|
17
22
|
};
|
|
18
23
|
Object.defineProperty(exports, "ABORT", {
|
|
19
24
|
enumerable: true,
|
|
@@ -39,6 +44,24 @@ Object.defineProperty(exports, "component", {
|
|
|
39
44
|
return _component["default"];
|
|
40
45
|
}
|
|
41
46
|
});
|
|
47
|
+
Object.defineProperty(exports, "debounce", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function get() {
|
|
50
|
+
return _debounce["default"];
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
Object.defineProperty(exports, "delay", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function get() {
|
|
56
|
+
return _delay["default"];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
Object.defineProperty(exports, "dropRepeats", {
|
|
60
|
+
enumerable: true,
|
|
61
|
+
get: function get() {
|
|
62
|
+
return _dropRepeats["default"];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
42
65
|
Object.defineProperty(exports, "processForm", {
|
|
43
66
|
enumerable: true,
|
|
44
67
|
get: function get() {
|
|
@@ -51,12 +74,24 @@ Object.defineProperty(exports, "run", {
|
|
|
51
74
|
return _run["default"];
|
|
52
75
|
}
|
|
53
76
|
});
|
|
77
|
+
Object.defineProperty(exports, "sampleCombine", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
get: function get() {
|
|
80
|
+
return _sampleCombine["default"];
|
|
81
|
+
}
|
|
82
|
+
});
|
|
54
83
|
Object.defineProperty(exports, "switchable", {
|
|
55
84
|
enumerable: true,
|
|
56
85
|
get: function get() {
|
|
57
86
|
return _switchable["default"];
|
|
58
87
|
}
|
|
59
88
|
});
|
|
89
|
+
Object.defineProperty(exports, "throttle", {
|
|
90
|
+
enumerable: true,
|
|
91
|
+
get: function get() {
|
|
92
|
+
return _throttle["default"];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
60
95
|
Object.defineProperty(exports, "xs", {
|
|
61
96
|
enumerable: true,
|
|
62
97
|
get: function get() {
|
|
@@ -92,6 +127,16 @@ Object.keys(_dom).forEach(function (key) {
|
|
|
92
127
|
|
|
93
128
|
var _xstream = _interopRequireDefault(require("xstream"));
|
|
94
129
|
|
|
130
|
+
var _debounce = _interopRequireDefault(require("xstream/extra/debounce"));
|
|
131
|
+
|
|
132
|
+
var _throttle = _interopRequireDefault(require("xstream/extra/throttle"));
|
|
133
|
+
|
|
134
|
+
var _delay = _interopRequireDefault(require("xstream/extra/delay"));
|
|
135
|
+
|
|
136
|
+
var _dropRepeats = _interopRequireDefault(require("xstream/extra/dropRepeats"));
|
|
137
|
+
|
|
138
|
+
var _sampleCombine = _interopRequireDefault(require("xstream/extra/sampleCombine"));
|
|
139
|
+
|
|
95
140
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
96
141
|
|
|
97
142
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
package/dist/jsx.js
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "Fragment", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _snabbdom.Fragment;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
6
12
|
Object.defineProperty(exports, "jsx", {
|
|
7
13
|
enumerable: true,
|
|
8
14
|
get: function get() {
|
|
@@ -10,4 +16,6 @@ Object.defineProperty(exports, "jsx", {
|
|
|
10
16
|
}
|
|
11
17
|
});
|
|
12
18
|
|
|
13
|
-
var _index = require("./pragma/index");
|
|
19
|
+
var _index = require("./pragma/index");
|
|
20
|
+
|
|
21
|
+
var _snabbdom = require("snabbdom");
|
package/dist/pragma/index.js
CHANGED
|
@@ -121,17 +121,21 @@ var createElementWithModules = function createElementWithModules(modules) {
|
|
|
121
121
|
cnosole.error('JSX Error: Capitalized HTML element without corresponding Sygnal factory. Components with names where the first letter is capital MUST be defined or included at the parent component\'s file scope.');
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
125
|
+
children[_key - 2] = arguments[_key];
|
|
126
|
+
}
|
|
127
|
+
|
|
124
128
|
if (is.fun(sel)) {
|
|
129
|
+
if (sel.name === 'Fragment') {
|
|
130
|
+
return sel(data || {}, children);
|
|
131
|
+
}
|
|
132
|
+
|
|
125
133
|
var factory = sel;
|
|
126
134
|
sel = sel.name || 'sygnal-factory';
|
|
127
135
|
data || (data = {});
|
|
128
136
|
data.sygnalFactory = factory;
|
|
129
137
|
}
|
|
130
138
|
|
|
131
|
-
for (var _len = arguments.length, children = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
132
|
-
children[_key - 2] = arguments[_key];
|
|
133
|
-
}
|
|
134
|
-
|
|
135
139
|
var text = sanitizeText(children, modules);
|
|
136
140
|
return considerSvg({
|
|
137
141
|
sel: sel,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sygnal",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "An intuitive framework for building fast and small components or applications based on Cycle.js",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"@cycle/run": "^5.7.0",
|
|
37
37
|
"@cycle/state": "^1.7.0",
|
|
38
38
|
"extend": "^3.0.2",
|
|
39
|
+
"snabbdom": "^3.5.0",
|
|
39
40
|
"xstream": "^11.14.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
package/sygnal-2.1.0.tgz
ADDED
|
Binary file
|
package/sygnal-1.2.1.tgz
DELETED
|
Binary file
|