lilact 0.28.1 → 0.28.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 +36 -22
- package/dist/lilact.development.js.map +2 -2
- package/dist/lilact.development.min.js +31 -31
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +31 -31
- package/docs/classes/accessories.ErrorBoundary.html +8 -8
- package/docs/classes/accessories.Suspense.html +7 -7
- 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/components.cloneComponent.html +1 -1
- package/docs/functions/components.createComponent.html +1 -1
- package/docs/functions/components.createPortal.html +1 -1
- package/docs/functions/components.createRoot.html +1 -1
- package/docs/functions/components.memo.html +1 -1
- package/docs/functions/components.render.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.run.html +1 -1
- package/docs/functions/run.runScripts.html +1 -1
- package/docs/static/demos/error-nested-5.jsx +2 -3
- package/docs/static/index.html +1 -2
- package/docs/static/lilact.development.js +36 -22
- package/docs/static/lilact.development.js.map +2 -2
- package/docs/static/lilact.development.min.js +31 -31
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +31 -31
- package/docs/variables/components.cloneElement.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-5.jsx +2 -3
- package/examples/index.html +1 -2
- package/examples/lilact.development.js +36 -22
- package/examples/lilact.development.js.map +2 -2
- package/examples/lilact.development.min.js +31 -31
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +31 -31
- package/package.json +1 -1
- package/src/components.jsx +21 -14
- package/src/errors.jsx +45 -24
- package/src/jsx.js +3 -1
- package/src/run.jsx +10 -17
|
@@ -2549,19 +2549,23 @@ var ComponentCore = class {
|
|
|
2549
2549
|
this.outlet.splice(i2, 1, ...item);
|
|
2550
2550
|
i2--;
|
|
2551
2551
|
} else {
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
core
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
core.element
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
core
|
|
2563
|
-
|
|
2552
|
+
try {
|
|
2553
|
+
const core = prepareCore(this, item);
|
|
2554
|
+
this.outlet[i2] = core;
|
|
2555
|
+
if (core[TEXT2] === void 0) {
|
|
2556
|
+
core.container = this.element ? this : this.container;
|
|
2557
|
+
core.apply(item.props);
|
|
2558
|
+
} else {
|
|
2559
|
+
if (!core.element) {
|
|
2560
|
+
core.element = document.createTextNode(item[TEXT2]);
|
|
2561
|
+
core[TEXT2] = item[TEXT2];
|
|
2562
|
+
} else if (core[TEXT2] !== item[TEXT2]) {
|
|
2563
|
+
core.element.textContent = item[TEXT2];
|
|
2564
|
+
core[TEXT2] = item[TEXT2];
|
|
2565
|
+
}
|
|
2564
2566
|
}
|
|
2567
|
+
} catch (e) {
|
|
2568
|
+
renderErrorHandler(this, e);
|
|
2565
2569
|
}
|
|
2566
2570
|
}
|
|
2567
2571
|
}
|
|
@@ -3698,7 +3702,8 @@ function createModule(path2, {
|
|
|
3698
3702
|
}
|
|
3699
3703
|
function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {
|
|
3700
3704
|
isInline = true,
|
|
3701
|
-
isModule = true
|
|
3705
|
+
isModule = true,
|
|
3706
|
+
hotReload = true
|
|
3702
3707
|
} = {}) {
|
|
3703
3708
|
let module = required_scripts[path];
|
|
3704
3709
|
if (!module) {
|
|
@@ -3723,7 +3728,7 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {
|
|
|
3723
3728
|
path,
|
|
3724
3729
|
mappings: module.mappings,
|
|
3725
3730
|
factory: "createComponent",
|
|
3726
|
-
appendSourcemap:
|
|
3731
|
+
appendSourcemap: true,
|
|
3727
3732
|
injectTraceLabels: true,
|
|
3728
3733
|
produceCJS: true,
|
|
3729
3734
|
blocks_info: lilact_default.blocks_info
|
|
@@ -3731,6 +3736,7 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {
|
|
|
3731
3736
|
} catch (value) {
|
|
3732
3737
|
const error2 = asError(value);
|
|
3733
3738
|
error2.fileName ?? (error2.fileName = path);
|
|
3739
|
+
error2.lilact_source ?? (error2.lilact_source = { path });
|
|
3734
3740
|
error2.sourcePhase = "transpile";
|
|
3735
3741
|
module.error = error2;
|
|
3736
3742
|
lilact_default.error = error2;
|
|
@@ -3739,9 +3745,8 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {
|
|
|
3739
3745
|
if (typeof lilact_default.scanBlockLabels === "function") {
|
|
3740
3746
|
lilact_default.scanBlockLabels(processed, path);
|
|
3741
3747
|
}
|
|
3742
|
-
processed += `
|
|
3743
|
-
//# sourceURL=eval:/${path}`;
|
|
3744
3748
|
try {
|
|
3749
|
+
new Function(processed);
|
|
3745
3750
|
globalThis.Lilact = lilact_default;
|
|
3746
3751
|
globalThis.createComponent = lilact_default.createComponent;
|
|
3747
3752
|
globalThis.Fragment = lilact_default.Fragment;
|
|
@@ -4662,6 +4667,10 @@ __export(errors_exports, {
|
|
|
4662
4667
|
scanBlockLabels: () => scanBlockLabels,
|
|
4663
4668
|
traceError: () => traceError
|
|
4664
4669
|
});
|
|
4670
|
+
function isSafari() {
|
|
4671
|
+
const userAgent = navigator.userAgent;
|
|
4672
|
+
return /Safari/.test(userAgent) && !/Chrome|Chromium|CriOS|FxiOS|EdgiOS|OPiOS/.test(userAgent);
|
|
4673
|
+
}
|
|
4665
4674
|
function number(value) {
|
|
4666
4675
|
const result2 = Number(value);
|
|
4667
4676
|
return Number.isFinite(result2) ? result2 : null;
|
|
@@ -4704,8 +4713,9 @@ function browserLocation(error2) {
|
|
|
4704
4713
|
const column2 = number(
|
|
4705
4714
|
error2?.columnNumber ?? error2?.colno ?? error2?.column
|
|
4706
4715
|
);
|
|
4716
|
+
const lineOffset = isSafari() ? 0 : 1;
|
|
4707
4717
|
return {
|
|
4708
|
-
line: line2 == null ? null : Math.max(0, line2 -
|
|
4718
|
+
line: line2 == null ? null : Math.max(0, line2 - lineOffset),
|
|
4709
4719
|
column: column2 == null ? null : Math.max(0, column2 - 1)
|
|
4710
4720
|
};
|
|
4711
4721
|
}
|
|
@@ -4756,8 +4766,9 @@ function traceError(value, runPath) {
|
|
|
4756
4766
|
column: number(error2.columnNumber)
|
|
4757
4767
|
} : browserLocation(error2);
|
|
4758
4768
|
const fileName = source?.path || stack?.path || error2.fileName || runPath || null;
|
|
4759
|
-
|
|
4760
|
-
let
|
|
4769
|
+
const sameSource = !source?.path || !stack?.path || source.path === stack.path;
|
|
4770
|
+
let line2 = sameSource ? stack?.line ?? browser.line ?? null : browser.line ?? null;
|
|
4771
|
+
let column2 = sameSource ? stack?.column ?? browser.column ?? null : browser.column ?? null;
|
|
4761
4772
|
const result2 = {
|
|
4762
4773
|
fileName,
|
|
4763
4774
|
lineNumber: line2,
|
|
@@ -4783,7 +4794,7 @@ function traceError(value, runPath) {
|
|
|
4783
4794
|
if (block && (result2.lineNumber == null || result2.columnNumber == null || !result2.fileName)) {
|
|
4784
4795
|
result2.fileName || (result2.fileName = block.path || runPath || null);
|
|
4785
4796
|
result2.lineNumber ?? (result2.lineNumber = block.line);
|
|
4786
|
-
result2.columnNumber ?? (result2.columnNumber = block.
|
|
4797
|
+
result2.columnNumber ?? (result2.columnNumber = block.column);
|
|
4787
4798
|
result2.label = block.desc;
|
|
4788
4799
|
}
|
|
4789
4800
|
lilact_default.error = result2;
|
|
@@ -4876,7 +4887,7 @@ function scanBlockLabels(code2, path2) {
|
|
|
4876
4887
|
lilact_default.blocks_info.labels[match2[1]] = {
|
|
4877
4888
|
path: path2,
|
|
4878
4889
|
line: Number(match2[2]),
|
|
4879
|
-
|
|
4890
|
+
column: Number(match2[3]),
|
|
4880
4891
|
desc: match2[4]
|
|
4881
4892
|
};
|
|
4882
4893
|
}
|
|
@@ -6725,7 +6736,10 @@ function generateSourceMap(json, path2, jsx_eols, out_eols, mappings = []) {
|
|
|
6725
6736
|
lc = m[3];
|
|
6726
6737
|
}
|
|
6727
6738
|
sourcemap.mappings = mstr.substring(1).replace(/;,/g, ";");
|
|
6728
|
-
|
|
6739
|
+
let out = "\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64," + btoa(JSON.stringify(sourcemap));
|
|
6740
|
+
out += `
|
|
6741
|
+
//# sourceURL=eval:/${path2}`;
|
|
6742
|
+
return out;
|
|
6729
6743
|
}
|
|
6730
6744
|
function transpileJSX(jsx2, {
|
|
6731
6745
|
factory = "createComponent",
|