@b9g/crank 0.4.4 → 0.5.0-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.
- package/README.md +15 -50
- package/crank.cjs +27 -6
- package/crank.cjs.map +1 -1
- package/crank.d.ts +3 -3
- package/crank.js +27 -7
- package/crank.js.map +1 -1
- package/index.cjs +3 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/package.json +25 -17
- package/umd.js +27 -6
- package/umd.js.map +1 -1
- package/xm.cjs +431 -0
- package/xm.cjs.map +1 -0
- package/xm.d.ts +2 -0
- package/xm.js +428 -0
- package/xm.js.map +1 -0
package/index.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var crank = require('./crank.cjs');
|
|
6
|
+
var xm = require('./xm.cjs');
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
|
|
@@ -13,8 +14,9 @@ exports.Fragment = crank.Fragment;
|
|
|
13
14
|
exports.Portal = crank.Portal;
|
|
14
15
|
exports.Raw = crank.Raw;
|
|
15
16
|
exports.Renderer = crank.Renderer;
|
|
17
|
+
exports.c = crank.c;
|
|
16
18
|
exports.cloneElement = crank.cloneElement;
|
|
17
19
|
exports.createElement = crank.createElement;
|
|
18
|
-
exports["default"] = crank["default"];
|
|
19
20
|
exports.isElement = crank.isElement;
|
|
21
|
+
exports.xm = xm.xm;
|
|
20
22
|
//# sourceMappingURL=index.cjs.map
|
package/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from "./crank.js";
|
|
2
|
-
export {
|
|
2
|
+
export { xm } from "./xm.js";
|
package/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="index.d.ts" />
|
|
2
|
-
export { Context, Copy, Element, Fragment, Portal, Raw, Renderer, cloneElement, createElement,
|
|
2
|
+
export { Context, Copy, Element, Fragment, Portal, Raw, Renderer, c, cloneElement, createElement, isElement } from './crank.js';
|
|
3
|
+
export { xm } from './xm.js';
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@b9g/crank",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-beta.0",
|
|
4
4
|
"description": "Write JSX-driven components with functions, promises and generators.",
|
|
5
5
|
"homepage": "https://crank.js.org",
|
|
6
6
|
"bugs": {
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
|
-
"import": "./
|
|
18
|
-
"require": "./
|
|
17
|
+
"import": "./index.js",
|
|
18
|
+
"require": "./index.cjs"
|
|
19
19
|
},
|
|
20
20
|
"./crank": {
|
|
21
21
|
"import": "./crank.js",
|
|
@@ -50,6 +50,14 @@
|
|
|
50
50
|
"require": "./index.cjs"
|
|
51
51
|
},
|
|
52
52
|
"./package.json": "./package.json",
|
|
53
|
+
"./xm": {
|
|
54
|
+
"import": "./xm.js",
|
|
55
|
+
"require": "./xm.cjs"
|
|
56
|
+
},
|
|
57
|
+
"./xm.js": {
|
|
58
|
+
"import": "./xm.js",
|
|
59
|
+
"require": "./xm.cjs"
|
|
60
|
+
},
|
|
53
61
|
"./umd": {
|
|
54
62
|
"require": "./umd.js"
|
|
55
63
|
},
|
|
@@ -57,30 +65,30 @@
|
|
|
57
65
|
"require": "./umd.js"
|
|
58
66
|
}
|
|
59
67
|
},
|
|
60
|
-
"main": "
|
|
61
|
-
"module": "
|
|
62
|
-
"types": "
|
|
68
|
+
"main": "index.cjs",
|
|
69
|
+
"module": "index.js",
|
|
70
|
+
"types": "index.d.ts",
|
|
63
71
|
"devDependencies": {
|
|
64
72
|
"@arkweid/lefthook": "^0.7.7",
|
|
65
|
-
"@types/
|
|
66
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
67
|
-
"@typescript-eslint/parser": "^5.
|
|
68
|
-
"eslint": "^8.
|
|
73
|
+
"@types/sinon": "^10.0.12",
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^5.30.5",
|
|
75
|
+
"@typescript-eslint/parser": "^5.30.5",
|
|
76
|
+
"eslint": "^8.19.0",
|
|
69
77
|
"eslint-config-prettier": "^8.5.0",
|
|
70
|
-
"eslint-plugin-jest": "^24.4.2",
|
|
71
78
|
"eslint-plugin-prettier": "^4.2.1",
|
|
72
79
|
"eslint-plugin-react": "^7.30.1",
|
|
73
|
-
"jest": "^26.6.3",
|
|
74
80
|
"magic-string": "^0.26.2",
|
|
81
|
+
"playwright-test": "^8.1.1",
|
|
75
82
|
"prettier": "^2.7.1",
|
|
76
|
-
"rollup": "^2.
|
|
83
|
+
"rollup": "^2.76.0",
|
|
77
84
|
"rollup-plugin-typescript2": "^0.32.1",
|
|
78
85
|
"shx": "^0.3.4",
|
|
79
|
-
"
|
|
80
|
-
"ts-
|
|
81
|
-
"typescript": "^4.7.4"
|
|
86
|
+
"sinon": "^14.0.0",
|
|
87
|
+
"ts-node": "^10.9.0",
|
|
88
|
+
"typescript": "^4.7.4",
|
|
89
|
+
"uvu": "^0.5.6"
|
|
82
90
|
},
|
|
83
91
|
"publishConfig": {
|
|
84
92
|
"access": "public"
|
|
85
93
|
}
|
|
86
|
-
}
|
|
94
|
+
}
|
package/umd.js
CHANGED
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
this.static_ = static_;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
+
// See Element interface
|
|
113
114
|
Element.prototype.$$typeof = ElementSymbol;
|
|
114
115
|
function isElement(value) {
|
|
115
116
|
return value != null && value.$$typeof === ElementSymbol;
|
|
@@ -132,6 +133,7 @@
|
|
|
132
133
|
switch (name) {
|
|
133
134
|
case "crank-key":
|
|
134
135
|
case "c-key":
|
|
136
|
+
case "$key":
|
|
135
137
|
// We have to make sure we don’t assign null to the key because we
|
|
136
138
|
// don’t check for null keys in the diffing functions.
|
|
137
139
|
if (props[name] != null) {
|
|
@@ -140,12 +142,14 @@
|
|
|
140
142
|
break;
|
|
141
143
|
case "crank-ref":
|
|
142
144
|
case "c-ref":
|
|
145
|
+
case "$ref":
|
|
143
146
|
if (typeof props[name] === "function") {
|
|
144
147
|
ref = props[name];
|
|
145
148
|
}
|
|
146
149
|
break;
|
|
147
150
|
case "crank-static":
|
|
148
151
|
case "c-static":
|
|
152
|
+
case "$static":
|
|
149
153
|
static_ = !!props[name];
|
|
150
154
|
break;
|
|
151
155
|
default:
|
|
@@ -159,11 +163,27 @@
|
|
|
159
163
|
else if (children.length === 1) {
|
|
160
164
|
props1.children = children[0];
|
|
161
165
|
}
|
|
166
|
+
// string aliases for the special tags
|
|
167
|
+
// TODO: Does this logic belong here, or in the Element constructor
|
|
168
|
+
switch (tag) {
|
|
169
|
+
case "$FRAGMENT":
|
|
170
|
+
tag = Fragment;
|
|
171
|
+
break;
|
|
172
|
+
case "$PORTAL":
|
|
173
|
+
tag = Portal;
|
|
174
|
+
break;
|
|
175
|
+
case "$COPY":
|
|
176
|
+
tag = Copy;
|
|
177
|
+
break;
|
|
178
|
+
case "$RAW":
|
|
179
|
+
tag = Raw;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
162
182
|
return new Element(tag, props1, key, ref, static_);
|
|
163
183
|
}
|
|
164
|
-
/**
|
|
165
|
-
|
|
166
|
-
|
|
184
|
+
/** A single-letter alias for createElement */
|
|
185
|
+
const c = createElement;
|
|
186
|
+
/** Clones a given element, shallowly copying the props object. */
|
|
167
187
|
function cloneElement(el) {
|
|
168
188
|
if (!isElement(el)) {
|
|
169
189
|
throw new TypeError("Cannot clone non-element");
|
|
@@ -737,9 +757,9 @@
|
|
|
737
757
|
*
|
|
738
758
|
* NOTE: This is mainly used to prevent some false positives in component
|
|
739
759
|
* yields or returns undefined warnings. The reason we’re using this versus
|
|
740
|
-
* IsUnmounted is a very troubling
|
|
741
|
-
*
|
|
742
|
-
*
|
|
760
|
+
* IsUnmounted is a very troubling test (cascades sync generator parent and
|
|
761
|
+
* sync generator child) where synchronous code causes a stack overflow error
|
|
762
|
+
* in a non-deterministic way. Deeply disturbing stuff.
|
|
743
763
|
*/
|
|
744
764
|
const IsErrored = 1 << 5;
|
|
745
765
|
/**
|
|
@@ -2012,6 +2032,7 @@
|
|
|
2012
2032
|
exports.Portal = Portal;
|
|
2013
2033
|
exports.Raw = Raw;
|
|
2014
2034
|
exports.Renderer = Renderer;
|
|
2035
|
+
exports.c = c;
|
|
2015
2036
|
exports.cloneElement = cloneElement;
|
|
2016
2037
|
exports.createElement = createElement;
|
|
2017
2038
|
exports.dom = dom;
|