lilact 0.28.0 → 0.28.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/bin/bundle.cjs +2 -2
- package/dist/lilact.development.js +315 -280
- package/dist/lilact.development.js.map +3 -3
- package/dist/lilact.development.min.js +38 -36
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +38 -36
- package/docs/classes/accessories.ErrorBoundary.html +6 -6
- package/docs/classes/accessories.Suspense.html +3 -3
- package/docs/functions/accessories.DragHandle.html +1 -1
- package/docs/functions/accessories.Spinner.html +1 -1
- package/docs/functions/errors.globalErrorHandler.html +1 -1
- package/docs/functions/errors.scanBlockLabels.html +1 -1
- package/docs/functions/errors.traceError.html +1 -1
- package/docs/functions/run.lazy.html +1 -1
- package/docs/functions/run.require.html +1 -1
- package/docs/functions/run.runScripts.html +1 -1
- package/docs/functions/timers.animationFramePromise.html +3 -3
- package/docs/functions/timers.clearInterval.html +5 -3
- package/docs/functions/timers.clearTimeout.html +5 -3
- package/docs/functions/timers.grabTimers.html +4 -3
- package/docs/functions/timers.pauseTimers.html +5 -2
- package/docs/functions/timers.releaseTimers.html +4 -2
- package/docs/functions/timers.resetTimers.html +4 -2
- package/docs/functions/timers.resumeTimers.html +4 -2
- package/docs/functions/timers.setInterval.html +8 -6
- package/docs/functions/timers.setTimeout.html +8 -6
- package/docs/functions/timers.timeoutPromise.html +8 -149
- package/docs/static/demos/error-nested-1.jsx +11 -0
- package/docs/static/demos/error-nested-2.jsx +12 -0
- package/docs/static/demos/error-nested-3.jsx +12 -0
- package/docs/static/demos/error-nested-4.jsx +12 -0
- package/docs/static/demos/error-nested-5.jsx +11 -0
- package/docs/static/index.html +45 -38
- package/docs/static/lilact.development.js +315 -280
- package/docs/static/lilact.development.js.map +3 -3
- package/docs/static/lilact.development.min.js +38 -36
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +38 -36
- package/docs/variables/accessories.SplitPane.html +1 -1
- package/docs/variables/errors.blocks_info.html +1 -1
- package/docs/variables/errors.error.html +1 -1
- package/examples/demos/error-nested-1.jsx +11 -0
- package/examples/demos/error-nested-2.jsx +12 -0
- package/examples/demos/error-nested-3.jsx +12 -0
- package/examples/demos/error-nested-4.jsx +12 -0
- package/examples/demos/error-nested-5.jsx +11 -0
- package/examples/index.html +45 -40
- package/examples/lilact.development.js +315 -280
- package/examples/lilact.development.js.map +3 -3
- package/examples/lilact.development.min.js +38 -36
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +38 -36
- package/package.json +1 -1
- package/scripts/build.mjs +1 -1
- package/src/accessories.jsx +1 -4
- package/src/components.jsx +4 -4
- package/src/errors.jsx +50 -27
- package/src/jsx.js +3 -1
- package/src/lilact.jsx +4 -4
- package/src/run.jsx +9 -17
- package/src/timers.jsx +377 -207
package/package.json
CHANGED
package/scripts/build.mjs
CHANGED
package/src/accessories.jsx
CHANGED
|
@@ -32,10 +32,7 @@
|
|
|
32
32
|
import { useEffect, useLayoutEffect, useMemo, useRef, useState, useImperativeHandle, useCallback } from "./hooks.jsx";
|
|
33
33
|
import { Children, forwardRef, isThenable } from "./misc.jsx";
|
|
34
34
|
|
|
35
|
-
//import {setTimeout, clearTimeout} from "./timers.jsx"
|
|
36
35
|
import {Component} from "./components.jsx"
|
|
37
|
-
import {emotion} from "./lilact.jsx"
|
|
38
|
-
const {css,cx} = emotion;
|
|
39
36
|
|
|
40
37
|
/**
|
|
41
38
|
* A CSS-only loading spinner component.
|
|
@@ -375,7 +372,7 @@ export function DragHandle({
|
|
|
375
372
|
role="button"
|
|
376
373
|
tabIndex={0}
|
|
377
374
|
style={{ ...style, touchAction: "none" }}
|
|
378
|
-
className={
|
|
375
|
+
className={`${className} ${isDragging?"dragging":""}`}
|
|
379
376
|
onPointerDown={onPointerDown}
|
|
380
377
|
onPointerMove={onPointerMove}
|
|
381
378
|
onPointerUp={onPointerUp}
|
package/src/components.jsx
CHANGED
|
@@ -420,10 +420,10 @@ if(DEBUG) {
|
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
422
|
else if(this.entity==="select") {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
423
|
+
if(typeof(patch.value)==='string') {
|
|
424
|
+
if(patch.value!==this.element.value) {
|
|
425
|
+
this.element.value=patch.value;
|
|
426
|
+
}
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
else if(this.entity==="option") {
|
package/src/errors.jsx
CHANGED
|
@@ -37,6 +37,15 @@ import Lilact from "./lilact.jsx";
|
|
|
37
37
|
import { required_scripts } from "./run.jsx";
|
|
38
38
|
import { css } from "@emotion/css";
|
|
39
39
|
|
|
40
|
+
function isSafari() {
|
|
41
|
+
const userAgent = navigator.userAgent;
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
/Safari/.test(userAgent) &&
|
|
45
|
+
!/Chrome|Chromium|CriOS|FxiOS|EdgiOS|OPiOS/.test(userAgent)
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
40
49
|
function number(value) {
|
|
41
50
|
const result = Number(value);
|
|
42
51
|
return Number.isFinite(result) ? result : null;
|
|
@@ -87,22 +96,29 @@ function stackLocation(stack) {
|
|
|
87
96
|
}
|
|
88
97
|
|
|
89
98
|
function browserLocation(error) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
99
|
+
const line = number(
|
|
100
|
+
error?.lineNumber ??
|
|
101
|
+
error?.lineno ??
|
|
102
|
+
error?.line
|
|
103
|
+
);
|
|
104
|
+
const column = number(
|
|
105
|
+
error?.columnNumber ??
|
|
106
|
+
error?.colno ??
|
|
107
|
+
error?.column
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
const lineOffset = isSafari() ? 0 : 1;
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
line:
|
|
114
|
+
line == null
|
|
115
|
+
? null
|
|
116
|
+
: Math.max(0, line - lineOffset),
|
|
117
|
+
column:
|
|
118
|
+
column == null
|
|
119
|
+
? null
|
|
120
|
+
: Math.max(0, column - 1),
|
|
121
|
+
};
|
|
106
122
|
}
|
|
107
123
|
|
|
108
124
|
function traceBlock(error) {
|
|
@@ -203,15 +219,20 @@ export function traceError(value, runPath) {
|
|
|
203
219
|
runPath ||
|
|
204
220
|
null;
|
|
205
221
|
|
|
222
|
+
const sameSource =
|
|
223
|
+
!source?.path ||
|
|
224
|
+
!stack?.path ||
|
|
225
|
+
source.path === stack.path;
|
|
226
|
+
|
|
206
227
|
let line =
|
|
207
|
-
|
|
208
|
-
browser.line ??
|
|
209
|
-
null;
|
|
228
|
+
sameSource
|
|
229
|
+
? stack?.line ?? browser.line ?? null
|
|
230
|
+
: browser.line ?? null;
|
|
210
231
|
|
|
211
232
|
let column =
|
|
212
|
-
|
|
213
|
-
browser.column ??
|
|
214
|
-
null;
|
|
233
|
+
sameSource
|
|
234
|
+
? stack?.column ?? browser.column ?? null
|
|
235
|
+
: browser.column ?? null;
|
|
215
236
|
|
|
216
237
|
const result = {
|
|
217
238
|
fileName,
|
|
@@ -253,7 +274,7 @@ export function traceError(value, runPath) {
|
|
|
253
274
|
) {
|
|
254
275
|
result.fileName ||= block.path || runPath || null;
|
|
255
276
|
result.lineNumber ??= block.line;
|
|
256
|
-
result.columnNumber ??= block.
|
|
277
|
+
result.columnNumber ??= block.column;
|
|
257
278
|
result.label = block.desc;
|
|
258
279
|
}
|
|
259
280
|
|
|
@@ -301,8 +322,9 @@ export function globalErrorHandler(eventOrError) {
|
|
|
301
322
|
);
|
|
302
323
|
|
|
303
324
|
const className = css(`
|
|
304
|
-
background:
|
|
305
|
-
|
|
325
|
+
background: #fff;
|
|
326
|
+
text-shadow: 0 0 3px #fff;
|
|
327
|
+
-backdrop-filter: blur(20px);
|
|
306
328
|
border: 1px solid rgba(255,255,255,.25);
|
|
307
329
|
border-radius: 5px;
|
|
308
330
|
box-shadow: 0 10px 30px rgba(0,0,0,.35);
|
|
@@ -315,10 +337,11 @@ export function globalErrorHandler(eventOrError) {
|
|
|
315
337
|
}
|
|
316
338
|
|
|
317
339
|
code {
|
|
318
|
-
|
|
340
|
+
background: #0001;
|
|
319
341
|
overflow: auto;
|
|
320
342
|
padding: 10px;
|
|
321
343
|
display: block;
|
|
344
|
+
border-radius: 3px;
|
|
322
345
|
}
|
|
323
346
|
`);
|
|
324
347
|
|
|
@@ -388,7 +411,7 @@ export function scanBlockLabels(code, path) {
|
|
|
388
411
|
Lilact.blocks_info.labels[match[1]] = {
|
|
389
412
|
path,
|
|
390
413
|
line: Number(match[2]),
|
|
391
|
-
|
|
414
|
+
column: Number(match[3]),
|
|
392
415
|
desc: match[4],
|
|
393
416
|
};
|
|
394
417
|
}
|
package/src/jsx.js
CHANGED
|
@@ -950,8 +950,10 @@ function generateSourceMap(json, path, jsx_eols, out_eols, mappings=[])
|
|
|
950
950
|
}
|
|
951
951
|
sourcemap.mappings = mstr.substring(1).replace(/;,/g, ";");
|
|
952
952
|
|
|
953
|
-
|
|
953
|
+
let out = "\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(JSON.stringify(sourcemap));
|
|
954
|
+
out += `\n//# sourceURL=eval:/${path}`;
|
|
954
955
|
|
|
956
|
+
return out;
|
|
955
957
|
}
|
|
956
958
|
|
|
957
959
|
|
package/src/lilact.jsx
CHANGED
|
@@ -126,10 +126,10 @@ export const Lilact =
|
|
|
126
126
|
redux,
|
|
127
127
|
emotion,
|
|
128
128
|
|
|
129
|
-
_setTimeout:
|
|
130
|
-
_setInterval:
|
|
131
|
-
_clearTimeout:
|
|
132
|
-
_clearInterval:
|
|
129
|
+
_setTimeout: globalThis.setTimeout.bind(globalThis),
|
|
130
|
+
_setInterval: globalThis.setInterval.bind(globalThis),
|
|
131
|
+
_clearTimeout: globalThis.clearTimeout.bind(globalThis),
|
|
132
|
+
_clearInterval: globalThis.clearInterval.bind(globalThis),
|
|
133
133
|
|
|
134
134
|
}
|
|
135
135
|
|
package/src/run.jsx
CHANGED
|
@@ -181,20 +181,19 @@ export function run(
|
|
|
181
181
|
path,
|
|
182
182
|
mappings: module.mappings,
|
|
183
183
|
factory: "createComponent",
|
|
184
|
-
appendSourcemap:
|
|
184
|
+
appendSourcemap: true,
|
|
185
185
|
injectTraceLabels: true,
|
|
186
186
|
produceCJS: true,
|
|
187
187
|
blocks_info: Lilact.blocks_info,
|
|
188
188
|
});
|
|
189
|
-
}
|
|
189
|
+
}
|
|
190
|
+
catch (value) {
|
|
190
191
|
const error = asError(value);
|
|
191
|
-
|
|
192
192
|
error.fileName ??= path;
|
|
193
|
+
error.lilact_source ??= {path};
|
|
193
194
|
error.sourcePhase = "transpile";
|
|
194
|
-
|
|
195
195
|
module.error = error;
|
|
196
196
|
Lilact.error = error;
|
|
197
|
-
|
|
198
197
|
throw error;
|
|
199
198
|
}
|
|
200
199
|
|
|
@@ -206,30 +205,23 @@ export function run(
|
|
|
206
205
|
* sourceURL helps when the browser includes eval locations in its stack.
|
|
207
206
|
* It is not used as the authoritative source; the catch block below is.
|
|
208
207
|
*/
|
|
209
|
-
processed += `\n//# sourceURL=eval:/${path}`;
|
|
210
208
|
|
|
211
209
|
try {
|
|
210
|
+
new Function(processed);
|
|
211
|
+
|
|
212
212
|
globalThis.Lilact = Lilact;
|
|
213
213
|
globalThis.createComponent = Lilact.createComponent;
|
|
214
214
|
globalThis.Fragment = Lilact.Fragment;
|
|
215
215
|
|
|
216
216
|
const result = eval(processed);
|
|
217
|
-
|
|
218
217
|
module.loaded = true;
|
|
219
218
|
|
|
220
|
-
return isEmpty(module.exports)
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
} catch (value) {
|
|
224
|
-
/*
|
|
225
|
-
* This catch executes in the module whose eval failed, including
|
|
226
|
-
* generated-JavaScript syntax errors. Therefore path is authoritative.
|
|
227
|
-
*/
|
|
219
|
+
return isEmpty(module.exports) ? result : module.exports;
|
|
220
|
+
}
|
|
221
|
+
catch (value) {
|
|
228
222
|
const error = report(value, path);
|
|
229
|
-
|
|
230
223
|
error.sourcePhase ??= "runtime";
|
|
231
224
|
module.error = error;
|
|
232
|
-
|
|
233
225
|
throw error;
|
|
234
226
|
}
|
|
235
227
|
}
|