lilact 0.26.4 → 0.26.5
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 +50 -29
- package/dist/lilact.development.js.map +3 -3
- package/dist/lilact.development.min.js +27 -27
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +27 -27
- package/docs/functions/errors.globalErrorHandler.html +1 -1
- package/docs/functions/errors.traceError.html +1 -1
- package/docs/functions/run.lazy.html +1 -1
- package/docs/functions/run.runScripts.html +1 -1
- package/docs/functions/timers.timeoutPromise.html +3 -3
- package/docs/static/demos/lazy.jsx +2 -2
- package/docs/static/index.html +12 -12
- package/docs/static/lilact.development.js +50 -29
- package/docs/static/lilact.development.js.map +3 -3
- package/docs/static/lilact.development.min.js +27 -27
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +27 -27
- package/examples/demos/lazy.jsx +2 -2
- package/examples/index.html +12 -12
- package/examples/lilact.development.js +50 -29
- package/examples/lilact.development.js.map +3 -3
- package/examples/lilact.development.min.js +27 -27
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +27 -27
- package/package.json +1 -1
- package/src/errors.jsx +4 -2
- package/src/events.jsx +8 -4
- package/src/expscan.js +30 -17
- package/src/run.jsx +33 -20
package/package.json
CHANGED
package/src/errors.jsx
CHANGED
|
@@ -62,7 +62,8 @@ function getErrorLocation(err) // works for both error and error-event, and also
|
|
|
62
62
|
// Firefox: fn@eval:xxx:LINE:COL
|
|
63
63
|
// Safari: @eval:xxx:LINE:COL (sometimes)
|
|
64
64
|
/** @ignore */
|
|
65
|
-
function parseEvalLocationFromStack(stack, urlPrefix = "eval:/")
|
|
65
|
+
function parseEvalLocationFromStack(stack, urlPrefix = "eval:/")
|
|
66
|
+
{
|
|
66
67
|
const raw = typeof stack === "string" ? stack : String(stack || "");
|
|
67
68
|
const lines = raw.split(/\r?\n/);
|
|
68
69
|
|
|
@@ -89,7 +90,8 @@ function parseEvalLocationFromStack(stack, urlPrefix = "eval:/") {
|
|
|
89
90
|
return { url: null, line: null, col: null, matched: null, stackPreview: lines.slice(0, 6).join("\n") };
|
|
90
91
|
}
|
|
91
92
|
|
|
92
|
-
function escapeRegExp(s)
|
|
93
|
+
function escapeRegExp(s)
|
|
94
|
+
{
|
|
93
95
|
return String(s).replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
94
96
|
}
|
|
95
97
|
|
package/src/events.jsx
CHANGED
|
@@ -59,7 +59,8 @@ const _pool = [];
|
|
|
59
59
|
const MAX_POOL_SIZE = 10;
|
|
60
60
|
const POINTER_TYPES = ["mouse", "pen", "touch"];
|
|
61
61
|
|
|
62
|
-
export function createSyntheticEvent(nativeEvent, currentTarget)
|
|
62
|
+
export function createSyntheticEvent(nativeEvent, currentTarget)
|
|
63
|
+
{
|
|
63
64
|
const e = _pool.length ? _pool.pop() : {};
|
|
64
65
|
|
|
65
66
|
e.nativeEvent = nativeEvent;
|
|
@@ -181,7 +182,8 @@ export function createSyntheticEvent(nativeEvent, currentTarget) {
|
|
|
181
182
|
return e;
|
|
182
183
|
}
|
|
183
184
|
|
|
184
|
-
export function releaseSyntheticEvent(e)
|
|
185
|
+
export function releaseSyntheticEvent(e)
|
|
186
|
+
{
|
|
185
187
|
if (e && !e.isPersistent) {
|
|
186
188
|
e.nativeEvent = null;
|
|
187
189
|
e.type = null;
|
|
@@ -261,7 +263,8 @@ export function releaseSyntheticEvent(e) {
|
|
|
261
263
|
// Main wrapper factory
|
|
262
264
|
// fn: function(syntheticEvent) { ... }
|
|
263
265
|
// opts: { capture: bool, passive: bool, once: bool, stopPropagationOnTrueReturn: bool }
|
|
264
|
-
export function wrapListener(fn, opts = {})
|
|
266
|
+
export function wrapListener(fn, opts = {})
|
|
267
|
+
{
|
|
265
268
|
const { stopPropagationOnTrueReturn = false } = opts;
|
|
266
269
|
|
|
267
270
|
return function handler(nativeEvent) {
|
|
@@ -284,7 +287,8 @@ export function wrapListener(fn, opts = {}) {
|
|
|
284
287
|
}
|
|
285
288
|
|
|
286
289
|
// Convenience: add/remove wrapper-managed listener
|
|
287
|
-
export function addWrappedEventListener(target, type, fn, options = {})
|
|
290
|
+
export function addWrappedEventListener(target, type, fn, options = {})
|
|
291
|
+
{
|
|
288
292
|
const handler = wrapListener(fn, options);
|
|
289
293
|
|
|
290
294
|
target.addEventListener(type, handler, options);
|
package/src/expscan.js
CHANGED
|
@@ -72,7 +72,8 @@ function isValidIdentifierName(s) {
|
|
|
72
72
|
return !keywords.has(s);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
export function labeler(custom_words, x)
|
|
75
|
+
export function labeler(custom_words, x)
|
|
76
|
+
{
|
|
76
77
|
if( typeof(x)==='string' ) {
|
|
77
78
|
if(custom_words && custom_words.hasOwnProperty(x)) return custom_words[x];
|
|
78
79
|
|
|
@@ -303,22 +304,34 @@ export function processImportExports(node, jsx)
|
|
|
303
304
|
node.out[m.index].cjs = 'module.exports.default =';
|
|
304
305
|
continue;
|
|
305
306
|
|
|
306
|
-
case 'V':
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
307
|
+
case 'V':{
|
|
308
|
+
const tp = node.out[i];
|
|
309
|
+
node.out[i] = null;
|
|
310
|
+
i++;
|
|
311
|
+
skip_spaces();
|
|
312
|
+
const name = node.out[i];
|
|
313
|
+
|
|
314
|
+
node.out[i] = null;
|
|
315
|
+
i++;
|
|
316
|
+
|
|
317
|
+
skip_spaces();
|
|
318
|
+
node.out[m.index].cjs = `${tp} ${name} = module.exports.${name} `;
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
case 'F':{
|
|
322
|
+
const tp = node.out[i];
|
|
323
|
+
node.out[i] = null;
|
|
324
|
+
i++;
|
|
325
|
+
skip_spaces();
|
|
326
|
+
const name = node.out[i];
|
|
327
|
+
|
|
328
|
+
// node.out[i] = null;
|
|
329
|
+
// i++;
|
|
330
|
+
// skip_spaces();
|
|
331
|
+
|
|
332
|
+
node.out[m.index].cjs = `module.exports.${name} = ${tp} `;
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
322
335
|
case '*':
|
|
323
336
|
node.out[i] = null;
|
|
324
337
|
i++;
|
package/src/run.jsx
CHANGED
|
@@ -180,32 +180,45 @@ export function require(path)
|
|
|
180
180
|
if(Lilact?.[LAZY] || isLazy) {
|
|
181
181
|
Lilact[LAZY]=false;
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
let p = Lilact.resolver?.(path);
|
|
184
|
+
|
|
185
|
+
if(p) {
|
|
186
|
+
p = Promise.resolve(p);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
p = fetch(path).then(res => {
|
|
185
190
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
186
191
|
return res.text();
|
|
187
|
-
})
|
|
188
|
-
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return p.then(res => {
|
|
195
|
+
if(path.endsWith(".css")) {
|
|
196
|
+
injectGlobal(res);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
res = run(res, path, false);
|
|
200
|
+
return res?.default ?? res;
|
|
201
|
+
})
|
|
202
|
+
.catch(err => {
|
|
203
|
+
throw err;
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
const p = Lilact.resolver?.(path);
|
|
208
|
+
if(p) {
|
|
209
|
+
return run(p, path, false);
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
const request = new XMLHttpRequest();
|
|
213
|
+
request.open("GET", path, {isInline:false});
|
|
214
|
+
request.send(null);
|
|
215
|
+
if (request.status === 200) {
|
|
189
216
|
if(path.endsWith(".css")) {
|
|
190
217
|
injectGlobal(res);
|
|
191
218
|
return;
|
|
192
219
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
})
|
|
196
|
-
.catch(err => {
|
|
197
|
-
throw err;
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
// note: this makes a sync request. this is not advised,
|
|
202
|
-
// but import should be sync. for an async solution use lazy and suspense.
|
|
203
|
-
|
|
204
|
-
const request = new XMLHttpRequest();
|
|
205
|
-
request.open("GET", path, {isInline:false});
|
|
206
|
-
request.send(null);
|
|
207
|
-
if (request.status === 200) {
|
|
208
|
-
return run(request.responseText, path, false);
|
|
220
|
+
return run(request.responseText, path, false);
|
|
221
|
+
}
|
|
209
222
|
}
|
|
210
223
|
}
|
|
211
224
|
}
|