lilact 0.7.2 → 0.7.4
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 +5 -1
- package/dist/lilact.development.js +9966 -0
- package/dist/lilact.development.js.map +1 -0
- package/dist/lilact.development.min.js +1 -1
- package/dist/lilact.development.min.js.map +1 -1
- package/dist/lilact.production.min.js +1 -1
- package/dist/lilact.production.min.js.map +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/functions/jsx.transpileJSX.html +1 -1
- package/docs/functions/misc.Fragment.html +2 -1
- package/docs/functions/transition.TransitionGroup.html +1 -1
- package/docs/index.html +4 -1
- package/docs/static/demos/switch-transition.jsx +50 -0
- package/docs/static/index.html +51 -47
- package/docs/static/lilact.development.js +9966 -0
- package/docs/static/lilact.development.min.js +1 -1
- package/docs/static/lilact.production.min.js +1 -1
- package/package.json +4 -2
- package/root/demos/switch-transition.jsx +50 -0
- package/root/index.html +51 -47
- package/root/lilact.development.js +9966 -0
- package/root/lilact.development.min.js +1 -1
- package/root/lilact.production.min.js +1 -1
- package/src/components.jsx +3 -3
- package/src/jsx.js +4 -2
- package/src/misc.jsx +2 -2
- package/src/transition.jsx +1 -0
- package/webpack.config.js +5 -5
package/root/index.html
CHANGED
|
@@ -22,38 +22,38 @@ const { css,cx,injectGlobal } = Lilact.emotion;
|
|
|
22
22
|
const cache = new Map();
|
|
23
23
|
|
|
24
24
|
function createResource(url) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
25
|
+
let record = cache.get(url);
|
|
26
|
+
if (!record) {
|
|
27
|
+
record = {
|
|
28
|
+
status: "pending",
|
|
29
|
+
promise: null,
|
|
30
|
+
data: null,
|
|
31
|
+
error: null,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
record.promise = fetch(url)
|
|
35
|
+
.then(r => {
|
|
36
|
+
if (!r.ok) throw new Error(`HTTP ${r.status}`);
|
|
37
|
+
return r.text();
|
|
38
|
+
})
|
|
39
|
+
.then(data => {
|
|
40
|
+
record.status = "success";
|
|
41
|
+
record.data = data;
|
|
42
|
+
})
|
|
43
|
+
.catch(err => {
|
|
44
|
+
record.status = "error";
|
|
45
|
+
record.error = err;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
cache.set(url, record);
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
read() {
|
|
52
|
+
if (record.status === "pending") throw record.promise;
|
|
53
|
+
if (record.status === "error") throw record.error;
|
|
54
|
+
return record.data;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
|
|
@@ -61,14 +61,17 @@ function createResource(url) {
|
|
|
61
61
|
injectGlobal({"*:not(code):not(code *)" : {fontFamily: "Ubuntu, 'Segoe UI', 'Noto Sans', helvetica, sans", fontSize: "14px"}});
|
|
62
62
|
|
|
63
63
|
|
|
64
|
-
injectGlobal({
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
injectGlobal({
|
|
65
|
+
code: {
|
|
66
|
+
whiteSpace: "pre !important",
|
|
67
|
+
padding: "10px 0",
|
|
68
|
+
fontSize: "14px !important",
|
|
69
|
+
display: "block",
|
|
70
|
+
overflowWrap: "anywhere"
|
|
71
|
+
},
|
|
72
|
+
p: {padding: "10px"},
|
|
73
|
+
body: {padding: "20px"}
|
|
74
|
+
});
|
|
72
75
|
|
|
73
76
|
const outer = css({
|
|
74
77
|
display: "flex",
|
|
@@ -112,10 +115,10 @@ function DemoView({ file })
|
|
|
112
115
|
const viewRef = useRef();
|
|
113
116
|
const codeRef = useRef();
|
|
114
117
|
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
const resource = createResource("demos/"+file[0]);
|
|
119
|
+
const code = resource.read(); // Suspense will handle the promise
|
|
117
120
|
|
|
118
|
-
|
|
121
|
+
if(isOpen) {
|
|
119
122
|
useEffect(() => {
|
|
120
123
|
const Comp = run(code, "demos/"+file[0]);
|
|
121
124
|
Lilact.render(<Comp/>, viewRef.current);
|
|
@@ -149,7 +152,7 @@ function DemoBlock({file})
|
|
|
149
152
|
{
|
|
150
153
|
return <div key={file[0]}>
|
|
151
154
|
<Suspense fallback={<Spinner/>}>
|
|
152
|
-
|
|
155
|
+
<DemoView file={file} />
|
|
153
156
|
</Suspense>
|
|
154
157
|
</div>
|
|
155
158
|
}
|
|
@@ -166,12 +169,13 @@ function App()
|
|
|
166
169
|
['proptypes.jsx', '( PropTypes )'],
|
|
167
170
|
['router.jsx', '( HashRouter, NavLink, Routes, Route, useNavigate, useLocation )'],
|
|
168
171
|
['use-deffered.jsx', '( useState, useDeferredValue )'],
|
|
169
|
-
['css-transition.jsx',
|
|
170
|
-
['
|
|
172
|
+
['css-transition.jsx', '( CSSTransition, useState, useRef )'],
|
|
173
|
+
<!-- ['switch-transition.jsx', '( SwitchTransition, useState )'], -->
|
|
171
174
|
['usetransition.jsx', '( useTransition, useState, useCallback, useId ), emotion:( css, cx )'],
|
|
175
|
+
['transition.jsx', '( useState, Transition )'],
|
|
176
|
+
['reducer.jsx', '( useReducer )'],
|
|
172
177
|
['redux.jsx', '( Provider, useSelector, useDispatch, connect ), redux:( createStore )'],
|
|
173
178
|
['suspense.jsx', '( Suspense, Spinner )'],
|
|
174
|
-
['transition.jsx', '( useState, Transition )'],
|
|
175
179
|
['lazy.jsx', '( lazy, require, Suspene, Spinner )'],
|
|
176
180
|
['form-elements.jsx', '()'],
|
|
177
181
|
['error-boundary.jsx', '( ErrorBoundary, useState )'],
|