lilact 0.14.2 → 0.15.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/dist/lilact.development.js +547 -393
- package/dist/lilact.development.js.map +1 -1
- package/dist/lilact.development.min.js +1 -1
- package/dist/lilact.development.min.js.LICENSE.txt +6 -0
- 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/classes/accessories.ErrorBoundary.html +11 -11
- package/docs/classes/accessories.Suspense.html +10 -10
- package/docs/classes/components.Component.html +11 -11
- package/docs/classes/components.HTMLComponent.html +11 -11
- package/docs/classes/components.RootComponent.html +11 -11
- package/docs/functions/accessories.DragHandle.html +1 -1
- package/docs/functions/accessories.Spinner.html +1 -1
- package/docs/functions/components.createComponent.html +1 -1
- package/docs/functions/components.createRoot.html +1 -1
- package/docs/functions/components.render.html +1 -1
- package/docs/functions/errors.globalErrorHandler.html +1 -1
- package/docs/functions/errors.traceError.html +1 -1
- package/docs/functions/hooks.createContext.html +1 -1
- package/docs/functions/hooks.useActionState.html +1 -1
- package/docs/functions/hooks.useCallback.html +1 -1
- package/docs/functions/hooks.useContext.html +1 -1
- package/docs/functions/hooks.useDeferredValue.html +1 -1
- package/docs/functions/hooks.useEffect.html +1 -1
- package/docs/functions/hooks.useHook.html +1 -1
- package/docs/functions/hooks.useId.html +1 -1
- package/docs/functions/hooks.useImperativeHandle.html +1 -1
- package/docs/functions/hooks.useLayoutEffect.html +1 -1
- package/docs/functions/hooks.useLocalStorage.html +1 -1
- package/docs/functions/hooks.useMemo.html +1 -1
- package/docs/functions/hooks.useReducer.html +1 -1
- package/docs/functions/hooks.useRef.html +1 -1
- package/docs/functions/hooks.useState.html +1 -1
- package/docs/functions/hooks.useTransition.html +1 -1
- package/docs/functions/redux.Provider.html +1 -1
- package/docs/functions/redux.combineReducers.html +1 -1
- package/docs/functions/redux.connect.html +1 -1
- package/docs/functions/redux.useDispatch.html +1 -1
- package/docs/functions/redux.useSelector.html +1 -1
- package/docs/functions/redux.useStore.html +1 -1
- package/docs/functions/router.HashRouter.html +1 -1
- package/docs/functions/router.Link.html +1 -1
- package/docs/functions/router.NavLink.html +1 -1
- package/docs/functions/router.Route.html +1 -1
- package/docs/functions/router.Routes.html +1 -1
- package/docs/functions/router.useLocation.html +1 -1
- package/docs/functions/router.useNavigate.html +1 -1
- package/docs/functions/run.lazy.html +1 -1
- package/docs/functions/run.require.html +3 -3
- package/docs/functions/run.run.html +1 -1
- package/docs/functions/run.runScripts.html +3 -3
- package/docs/functions/timers.timeoutPromise.html +133 -2
- package/docs/functions/transition.CSSTransition.html +1 -1
- package/docs/functions/transition.SwitchTransition.html +1 -1
- package/docs/functions/transition.Transition.html +1 -1
- package/docs/functions/transition.TransitionGroup.html +1 -1
- package/docs/static/lilact.development.js +547 -393
- package/docs/static/lilact.development.min.js +1 -1
- package/docs/static/lilact.production.min.js +1 -1
- package/docs/variables/accessories.SplitPane.html +1 -1
- package/package.json +1 -1
- package/root/lilact.development.js +547 -393
- package/root/lilact.development.min.js +1 -1
- package/root/lilact.production.min.js +1 -1
- package/src/accessories.jsx +14 -17
- package/src/components.jsx +87 -27
- package/src/errors.jsx +11 -9
- package/src/hooks.jsx +32 -30
- package/src/lilact.jsx +8 -8
- package/src/loader.cjs +1 -1
- package/src/misc.jsx +1 -60
- package/src/redux.jsx +13 -11
- package/src/router.jsx +88 -49
- package/src/run.jsx +19 -16
- package/src/symbols.jsx +65 -0
- package/src/timers.jsx +6 -6
- package/src/transition.jsx +6 -4
- package/webpack.config.js +7 -3
package/src/redux.jsx
CHANGED
|
@@ -28,8 +28,10 @@
|
|
|
28
28
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
import { createContext, useContext, useRef, useState, useEffect } from './hooks.jsx'
|
|
32
|
+
import { shallowEqual } from './misc.jsx'
|
|
31
33
|
|
|
32
|
-
|
|
34
|
+
import { CORE } from "./symbols.jsx"
|
|
33
35
|
|
|
34
36
|
let ReduxContext;
|
|
35
37
|
|
|
@@ -42,7 +44,7 @@ let ReduxContext;
|
|
|
42
44
|
*/
|
|
43
45
|
export function Provider({ store, children })
|
|
44
46
|
{
|
|
45
|
-
ReduxContext ??=
|
|
47
|
+
ReduxContext ??= createContext(null);
|
|
46
48
|
return (
|
|
47
49
|
<ReduxContext.Provider value={store}>{children}</ReduxContext.Provider>
|
|
48
50
|
);
|
|
@@ -55,7 +57,7 @@ export function Provider({ store, children })
|
|
|
55
57
|
*/
|
|
56
58
|
export function useStore()
|
|
57
59
|
{
|
|
58
|
-
const store =
|
|
60
|
+
const store = useContext(ReduxContext);
|
|
59
61
|
if (!store) {
|
|
60
62
|
throw new Error("Could not find Redux store in context. <Provider> is missing.");
|
|
61
63
|
}
|
|
@@ -70,7 +72,7 @@ export function useStore()
|
|
|
70
72
|
*/
|
|
71
73
|
export function useDispatch()
|
|
72
74
|
{
|
|
73
|
-
const store =
|
|
75
|
+
const store = useStore();
|
|
74
76
|
return store.dispatch;
|
|
75
77
|
}
|
|
76
78
|
|
|
@@ -82,17 +84,17 @@ export function useDispatch()
|
|
|
82
84
|
* @returns The selected slice of state.
|
|
83
85
|
*/
|
|
84
86
|
export function useSelector(selector, equalityFn = (a, b) => a === b) {
|
|
85
|
-
const store =
|
|
86
|
-
const latestSelected =
|
|
87
|
-
const selectorRef =
|
|
87
|
+
const store = useStore();
|
|
88
|
+
const latestSelected = useRef();
|
|
89
|
+
const selectorRef = useRef(selector);
|
|
88
90
|
selectorRef.current = selector;
|
|
89
91
|
|
|
90
|
-
const [selected, setSelected] =
|
|
92
|
+
const [selected, setSelected] = useState(() => selector(store.getState()));
|
|
91
93
|
|
|
92
94
|
// Keep ref in sync for the subscription callback
|
|
93
95
|
latestSelected.current = selected;
|
|
94
96
|
|
|
95
|
-
|
|
97
|
+
useEffect(() => {
|
|
96
98
|
function checkForUpdates() {
|
|
97
99
|
const nextSelected = selectorRef.current(store.getState());
|
|
98
100
|
if (!equalityFn(latestSelected.current, nextSelected)) {
|
|
@@ -127,7 +129,7 @@ export function connect(mapStateToProps, mapDispatchToProps)
|
|
|
127
129
|
return function wrapWithConnect(WrappedComponent) {
|
|
128
130
|
|
|
129
131
|
function ConnectedComponent(props) {
|
|
130
|
-
const store =
|
|
132
|
+
const store = useStore();
|
|
131
133
|
|
|
132
134
|
let dispatchProps = { dispatch: store.dispatch };
|
|
133
135
|
|
|
@@ -148,7 +150,7 @@ export function connect(mapStateToProps, mapDispatchToProps)
|
|
|
148
150
|
const selector = (state) => mapStateToProps(state, props);
|
|
149
151
|
|
|
150
152
|
// todo: is shallowEqual enough?
|
|
151
|
-
stateProps =
|
|
153
|
+
stateProps = useSelector(selector, shallowEqual) || {};
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
const mergedProps = { ...props, ...stateProps, ...dispatchProps };
|
package/src/router.jsx
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
import { CORE, COMPONENT } from "./symbols.jsx"
|
|
32
32
|
|
|
33
33
|
import {createContext, useContext, useState, useCallback, useEffect} from "./hooks.jsx"
|
|
34
34
|
import {Children} from "./misc.jsx"
|
|
@@ -36,8 +36,11 @@ import {Children} from "./misc.jsx"
|
|
|
36
36
|
const RouterContext = createContext(null);
|
|
37
37
|
const RouteContext = createContext({ params: {} });
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
const createURL = (to) =>
|
|
40
|
+
typeof to === "string" ? to : (to.pathname || "") + (to.search || "") + (to.hash || "");
|
|
41
|
+
|
|
42
|
+
const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
43
|
+
|
|
41
44
|
|
|
42
45
|
/**
|
|
43
46
|
* Hash-based router component that syncs navigation state with the URL hash (#...).
|
|
@@ -47,54 +50,90 @@ const createURL = (to) => (typeof to === "string" ? to : (to.pathname || "") + (
|
|
|
47
50
|
* @param [props.basename=""] - Optional base path prefix applied to all route paths.
|
|
48
51
|
*/
|
|
49
52
|
export function HashRouter({ children, basename = "" }) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
53
|
+
const readLocation = () => {
|
|
54
|
+
const raw = window.location.hash || "#/";
|
|
55
|
+
const full = raw.slice(1);
|
|
56
|
+
|
|
57
|
+
const baseRe = new RegExp("^" + escapeRegExp(basename));
|
|
58
|
+
const withoutBase = full.replace(baseRe, "") || "/";
|
|
59
|
+
|
|
60
|
+
const [pathAndSearch, hashPart] = withoutBase.split("#");
|
|
61
|
+
const [path, search = ""] = pathAndSearch.split("?");
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
pathname: path || "/",
|
|
65
|
+
search: search ? "?" + search : "",
|
|
66
|
+
hash: hashPart ? "#" + hashPart : "",
|
|
67
|
+
state: history.state?.__state,
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
const [location, setLocation] = useState(readLocation);
|
|
72
|
+
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
const onChange = () => setLocation(readLocation());
|
|
75
|
+
|
|
76
|
+
window.addEventListener("hashchange", onChange);
|
|
77
|
+
window.addEventListener("popstate", onChange);
|
|
78
|
+
|
|
79
|
+
// initialize once
|
|
80
|
+
onChange();
|
|
81
|
+
|
|
82
|
+
return () => {
|
|
83
|
+
window.removeEventListener("hashchange", onChange);
|
|
84
|
+
window.removeEventListener("popstate", onChange);
|
|
85
|
+
};
|
|
86
|
+
}, [basename]);
|
|
87
|
+
|
|
88
|
+
const navigate = useCallback((to, { replace = false, state } = {}) => {
|
|
89
|
+
if (typeof to === "number") {
|
|
90
|
+
// Wait for the real popstate (don’t rely on synchronous timing)
|
|
91
|
+
return new Promise((resolve) => {
|
|
92
|
+
let done = false;
|
|
93
|
+
|
|
94
|
+
const cleanup = (fn) => {
|
|
95
|
+
if (done) return;
|
|
96
|
+
done = true;
|
|
97
|
+
window.removeEventListener("popstate", onPop);
|
|
98
|
+
window.removeEventListener("hashchange", onHash);
|
|
99
|
+
fn?.();
|
|
100
|
+
resolve();
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
const onPop = () => cleanup(() => setLocation(readLocation()));
|
|
104
|
+
const onHash = () => cleanup(() => setLocation(readLocation()));
|
|
105
|
+
|
|
106
|
+
window.addEventListener("popstate", onPop, { once: true });
|
|
107
|
+
window.addEventListener("hashchange", onHash, { once: true });
|
|
108
|
+
|
|
109
|
+
// Fallback: in case popstate/hashchange timing is weird in a given browser
|
|
110
|
+
setTimeout(() => cleanup(() => setLocation(readLocation())), 0);
|
|
111
|
+
|
|
112
|
+
history.go(to);
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const url = createURL(to);
|
|
117
|
+
const href = "#" + (basename + url);
|
|
118
|
+
|
|
119
|
+
if (replace) {
|
|
120
|
+
history.replaceState({ __state: state }, "", href);
|
|
121
|
+
} else {
|
|
122
|
+
history.pushState({ __state: state }, "", href);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Update immediately for the initiating navigation.
|
|
126
|
+
setLocation(readLocation());
|
|
127
|
+
}, [basename]);
|
|
128
|
+
|
|
129
|
+
return (
|
|
130
|
+
<RouterContext.Provider value={{ location, navigate, basename }}>
|
|
131
|
+
{children}
|
|
132
|
+
</RouterContext.Provider>
|
|
133
|
+
);
|
|
96
134
|
}
|
|
97
135
|
|
|
136
|
+
|
|
98
137
|
/**
|
|
99
138
|
* Hook that returns the current location object (path, search, hash, and navigation state).
|
|
100
139
|
*
|
package/src/run.jsx
CHANGED
|
@@ -27,10 +27,13 @@
|
|
|
27
27
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
28
|
|
|
29
29
|
*/
|
|
30
|
+
import Lilact from './lilact.jsx';
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
import { CORE, COMPONENT, LAZY } from "./symbols.jsx"
|
|
32
33
|
|
|
33
|
-
|
|
34
|
+
|
|
35
|
+
/** @ignore */
|
|
36
|
+
export const required_scripts = {};
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
/**
|
|
@@ -49,7 +52,7 @@ export function run(jsx, path=`InlineJSX-${++Lilact.eval_num}`, is_inline=true)
|
|
|
49
52
|
let processed;
|
|
50
53
|
|
|
51
54
|
|
|
52
|
-
|
|
55
|
+
required_scripts[path] = {
|
|
53
56
|
mappings,
|
|
54
57
|
module,
|
|
55
58
|
is_inline,
|
|
@@ -76,9 +79,9 @@ export function run(jsx, path=`InlineJSX-${++Lilact.eval_num}`, is_inline=true)
|
|
|
76
79
|
throw e;
|
|
77
80
|
}
|
|
78
81
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
if(DEBUG) {
|
|
83
|
+
required_scripts[path].processed = processed;
|
|
84
|
+
}
|
|
82
85
|
|
|
83
86
|
processed += "\n//# sourceURL=eval:/" + path;
|
|
84
87
|
|
|
@@ -105,11 +108,11 @@ export function run(jsx, path=`InlineJSX-${++Lilact.eval_num}`, is_inline=true)
|
|
|
105
108
|
/**
|
|
106
109
|
* Loads a jsx script from a path. All scripts can access Lilact namespace as a global object.
|
|
107
110
|
*
|
|
108
|
-
* `
|
|
111
|
+
* `require` loads synchronously, as it is expected to be loaded on the next instruction.
|
|
109
112
|
*
|
|
110
113
|
* As running the transpiled scripts rely on `new Function`, it is not possible to use module imports
|
|
111
114
|
* and exports. So to import you should use `const {useState} = Lilact` convention. And to
|
|
112
|
-
* export, you should use `module.exports = ...`. `
|
|
115
|
+
* export, you should use `module.exports = ...`. `require` returns `module.exports` value
|
|
113
116
|
* so you can import different modules using the convention above.
|
|
114
117
|
*
|
|
115
118
|
* If the path is in the format #id, it will query the document for a script element with the given
|
|
@@ -126,14 +129,14 @@ export function run(jsx, path=`InlineJSX-${++Lilact.eval_num}`, is_inline=true)
|
|
|
126
129
|
*/
|
|
127
130
|
export function require(path, forceUpdate)
|
|
128
131
|
{
|
|
129
|
-
if(
|
|
132
|
+
if(required_scripts[path] && !forceUpdate) return required_scripts[path].module.exports;
|
|
130
133
|
|
|
131
134
|
if(path[0]==='#') {
|
|
132
135
|
|
|
133
136
|
const el = document.getElementById(path);
|
|
134
137
|
|
|
135
138
|
if(el) {
|
|
136
|
-
return
|
|
139
|
+
return run(el.innerText, path);
|
|
137
140
|
}
|
|
138
141
|
|
|
139
142
|
}
|
|
@@ -146,7 +149,7 @@ export function require(path, forceUpdate)
|
|
|
146
149
|
return res.text();
|
|
147
150
|
})
|
|
148
151
|
.then(res => {
|
|
149
|
-
res =
|
|
152
|
+
res = run(res, path, false);
|
|
150
153
|
// todo: this is for the lazy, so we detect default, should we do it in sync mode too?
|
|
151
154
|
return res?.default ?? res;
|
|
152
155
|
})
|
|
@@ -162,7 +165,7 @@ export function require(path, forceUpdate)
|
|
|
162
165
|
request.open("GET", path, false);
|
|
163
166
|
request.send(null);
|
|
164
167
|
if (request.status === 200) {
|
|
165
|
-
return
|
|
168
|
+
return run(request.responseText, path, false);
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
|
|
@@ -230,8 +233,8 @@ function scanScriptTagsWithType() {
|
|
|
230
233
|
* Scans the whole documents and runs all the script elements with type `text/jsx`.
|
|
231
234
|
* It is automatically attached to document.onload when Lilact is loaded.
|
|
232
235
|
*
|
|
233
|
-
* If element src is set, it will be loaded via `
|
|
234
|
-
* If element has inner content, it will be executed via `
|
|
236
|
+
* If element src is set, it will be loaded via `require`.
|
|
237
|
+
* If element has inner content, it will be executed via `run`.
|
|
235
238
|
*
|
|
236
239
|
* If both are present, first the src is loaded and then the inner content is executed.
|
|
237
240
|
*
|
|
@@ -244,8 +247,8 @@ export function runScripts()
|
|
|
244
247
|
const scripts = scanScriptTagsWithType();
|
|
245
248
|
|
|
246
249
|
for(const s of scripts) {
|
|
247
|
-
if(s.src)
|
|
248
|
-
if(s.content)
|
|
250
|
+
if(s.src) require(s.src);
|
|
251
|
+
if(s.content) run(s.content);
|
|
249
252
|
}
|
|
250
253
|
}
|
|
251
254
|
|
package/src/symbols.jsx
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*
|
|
2
|
+
|
|
3
|
+
Lilact
|
|
4
|
+
Copyright (C) 2024-2026 Arash Kazemi <contact.arash.kazemi@gmail.com>
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
BSD-2-Clause
|
|
8
|
+
|
|
9
|
+
Redistribution and use in source and binary forms, with or without
|
|
10
|
+
modification, are permitted provided that the following conditions are met:
|
|
11
|
+
|
|
12
|
+
* Redistributions of source code must retain the above copyright
|
|
13
|
+
notice, this list of conditions and the following disclaimer.
|
|
14
|
+
* Redistributions in binary form must reproduce the above copyright
|
|
15
|
+
notice, this list of conditions and the following disclaimer in the
|
|
16
|
+
documentation and/or other materials provided with the distribution.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
21
|
+
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
22
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
23
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
24
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
25
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
26
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
27
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
export const [
|
|
33
|
+
CORE,
|
|
34
|
+
COMPONENT,
|
|
35
|
+
TEXT,
|
|
36
|
+
IS_ZOMBIE,
|
|
37
|
+
IDX,
|
|
38
|
+
CHILD_CLASS_ADDENDUM,
|
|
39
|
+
MEMOIZED,
|
|
40
|
+
LAZY,
|
|
41
|
+
|
|
42
|
+
DUE,
|
|
43
|
+
REPEAT,
|
|
44
|
+
CLEARED,
|
|
45
|
+
INTERVAL,
|
|
46
|
+
CALLBACK,
|
|
47
|
+
ARGS
|
|
48
|
+
] =
|
|
49
|
+
[
|
|
50
|
+
Symbol.for('LILACT:CORE'),
|
|
51
|
+
Symbol.for('LILACT:COMPONENT'),
|
|
52
|
+
Symbol.for('LILACT:TEXT'),
|
|
53
|
+
Symbol.for('LILACT:IS_ZOMBIE'),
|
|
54
|
+
Symbol.for('LILACT:IDX'),
|
|
55
|
+
Symbol.for('LILACT:CHILD_CLASS_ADDENDUM'),
|
|
56
|
+
Symbol.for('LILACT:MEMOIZED'),
|
|
57
|
+
Symbol.for('LILACT:LAZY'),
|
|
58
|
+
|
|
59
|
+
Symbol.for('LILACT:TIMERS:DUE'),
|
|
60
|
+
Symbol.for('LILACT:TIMERS:REPEAT'),
|
|
61
|
+
Symbol.for('LILACT:TIMERS:CLEARED'),
|
|
62
|
+
Symbol.for('LILACT:TIMERS:INTERVAL'),
|
|
63
|
+
Symbol.for('LILACT:TIMERS:CALLBACK'),
|
|
64
|
+
Symbol.for('LILACT:TIMERS:ARGS')
|
|
65
|
+
];
|
package/src/timers.jsx
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
//ʔ outputJS('./dist/timers.js');
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
import { IDX, DUE, REPEAT, CLEARED, INTERVAL, CALLBACK, ARGS } from "./symbols.jsx"
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Timer helpers for a promise-friendly timer framework.
|
|
@@ -254,10 +254,10 @@ export function clearInterval(id)
|
|
|
254
254
|
*/
|
|
255
255
|
export function grabTimers()
|
|
256
256
|
{
|
|
257
|
-
globalThis.setTimeout =
|
|
258
|
-
globalThis.setInterval =
|
|
259
|
-
globalThis.clearTimeout =
|
|
260
|
-
globalThis.clearInterval =
|
|
257
|
+
globalThis.setTimeout = Lilact.setTimeout;
|
|
258
|
+
globalThis.setInterval = Lilact.setInterval;
|
|
259
|
+
globalThis.clearTimeout = Lilact.clearTimeout;
|
|
260
|
+
globalThis.clearInterval = Lilact.clearInterval;
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
/**
|
|
@@ -277,7 +277,7 @@ export function releaseTimers()
|
|
|
277
277
|
* @param {number} duration - Delay in milliseconds.
|
|
278
278
|
* @returns {Promise} Promise that resolves after the delay.
|
|
279
279
|
*/
|
|
280
|
-
export function timeoutPromise(duration=0, timerSource=
|
|
280
|
+
export function timeoutPromise(duration=0, timerSource=Lilact)
|
|
281
281
|
{
|
|
282
282
|
let id, resolve, reject;
|
|
283
283
|
|
package/src/transition.jsx
CHANGED
|
@@ -27,8 +27,13 @@
|
|
|
27
27
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
28
|
|
|
29
29
|
*/
|
|
30
|
+
import Lilact from './lilact.jsx';
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
import { setTimeout, clearTimeout } from "./timers.jsx"
|
|
33
|
+
import { Children } from "./misc.jsx"
|
|
34
|
+
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "./hooks.jsx"
|
|
35
|
+
|
|
36
|
+
import { CORE, COMPONENT, CHILD_CLASS_ADDENDUM } from "./symbols.jsx"
|
|
32
37
|
|
|
33
38
|
/* States */
|
|
34
39
|
const UNMOUNTED = "unmounted";
|
|
@@ -37,9 +42,6 @@ const ENTERING = "entering";
|
|
|
37
42
|
const ENTERED = "entered";
|
|
38
43
|
const EXITING = "exiting";
|
|
39
44
|
|
|
40
|
-
import { setTimeout, clearTimeout} from "./timers.jsx"
|
|
41
|
-
import { Children } from "./misc.jsx"
|
|
42
|
-
import { useEffect, useLayoutEffect, useMemo, useRef, useState } from "./hooks.jsx"
|
|
43
45
|
|
|
44
46
|
/**
|
|
45
47
|
* Transition component that manages enter/exit lifecycle and calls callbacks based on state changes.
|
package/webpack.config.js
CHANGED
|
@@ -34,8 +34,7 @@ import { fileURLToPath } from 'url';
|
|
|
34
34
|
import { dirname, resolve } from 'path';
|
|
35
35
|
|
|
36
36
|
import fs from 'fs';
|
|
37
|
-
import 'webpack';
|
|
38
|
-
|
|
37
|
+
import webpack from 'webpack';
|
|
39
38
|
|
|
40
39
|
|
|
41
40
|
export default (env, argv) => {
|
|
@@ -118,7 +117,12 @@ export default (env, argv) => {
|
|
|
118
117
|
}
|
|
119
118
|
]
|
|
120
119
|
},
|
|
121
|
-
plugins: [
|
|
120
|
+
plugins: [
|
|
121
|
+
new webpack.DefinePlugin({
|
|
122
|
+
"DEBUG": mode==='development'
|
|
123
|
+
}),
|
|
124
|
+
|
|
125
|
+
{
|
|
122
126
|
apply: (compiler) => {
|
|
123
127
|
compiler.hooks.done.tap('license-plugin', (compilation) => {
|
|
124
128
|
fs.readFile('./dist/' + filename, 'utf8', function(err, jssc) {
|