lilact 0.29.2 → 0.30.0
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 +135 -108
- package/dist/lilact.development.js.map +3 -3
- package/dist/lilact.development.min.js +28 -28
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +28 -28
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- 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.hotReloadRoot.html +1 -0
- package/docs/functions/components.memo.html +1 -1
- package/docs/functions/components.render.html +1 -1
- package/docs/functions/components.replaceComponentEntity.html +1 -0
- package/docs/functions/run.lazy.html +1 -1
- package/docs/functions/run.run.html +1 -1
- package/docs/functions/run.runScripts.html +1 -1
- package/docs/hierarchy.html +1 -1
- package/docs/modules/components.html +1 -1
- package/docs/static/index.html +1 -1
- package/docs/static/lilact.development.js +135 -108
- package/docs/static/lilact.development.js.map +3 -3
- package/docs/static/lilact.development.min.js +28 -28
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +28 -28
- package/docs/variables/components.cloneElement.html +1 -1
- package/examples/index.html +1 -1
- package/examples/lilact.development.js +135 -108
- package/examples/lilact.development.js.map +3 -3
- package/examples/lilact.development.min.js +28 -28
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +28 -28
- package/package.json +1 -1
- package/src/components.jsx +128 -40
- package/src/jsx.js +7 -32
- package/src/lilact.jsx +1 -1
- package/src/run.jsx +41 -51
|
@@ -463,18 +463,18 @@ function sheetForTag(tag) {
|
|
|
463
463
|
}
|
|
464
464
|
return void 0;
|
|
465
465
|
}
|
|
466
|
-
function createStyleElement(
|
|
466
|
+
function createStyleElement(options2) {
|
|
467
467
|
var tag = document.createElement("style");
|
|
468
|
-
tag.setAttribute("data-emotion",
|
|
469
|
-
if (
|
|
470
|
-
tag.setAttribute("nonce",
|
|
468
|
+
tag.setAttribute("data-emotion", options2.key);
|
|
469
|
+
if (options2.nonce !== void 0) {
|
|
470
|
+
tag.setAttribute("nonce", options2.nonce);
|
|
471
471
|
}
|
|
472
472
|
tag.appendChild(document.createTextNode(""));
|
|
473
473
|
tag.setAttribute("data-s", "");
|
|
474
474
|
return tag;
|
|
475
475
|
}
|
|
476
476
|
var StyleSheet = /* @__PURE__ */ (function() {
|
|
477
|
-
function StyleSheet2(
|
|
477
|
+
function StyleSheet2(options2) {
|
|
478
478
|
var _this = this;
|
|
479
479
|
this._insertTag = function(tag) {
|
|
480
480
|
var before;
|
|
@@ -492,14 +492,14 @@ var StyleSheet = /* @__PURE__ */ (function() {
|
|
|
492
492
|
_this.container.insertBefore(tag, before);
|
|
493
493
|
_this.tags.push(tag);
|
|
494
494
|
};
|
|
495
|
-
this.isSpeedy =
|
|
495
|
+
this.isSpeedy = options2.speedy === void 0 ? !isDevelopment : options2.speedy;
|
|
496
496
|
this.tags = [];
|
|
497
497
|
this.ctr = 0;
|
|
498
|
-
this.nonce =
|
|
499
|
-
this.key =
|
|
500
|
-
this.container =
|
|
501
|
-
this.prepend =
|
|
502
|
-
this.insertionPoint =
|
|
498
|
+
this.nonce = options2.nonce;
|
|
499
|
+
this.key = options2.key;
|
|
500
|
+
this.container = options2.container;
|
|
501
|
+
this.prepend = options2.prepend;
|
|
502
|
+
this.insertionPoint = options2.insertionPoint;
|
|
503
503
|
this.before = null;
|
|
504
504
|
}
|
|
505
505
|
var _proto = StyleSheet2.prototype;
|
|
@@ -1187,8 +1187,8 @@ var prefixer = function prefixer2(element, index2, children, callback) {
|
|
|
1187
1187
|
}
|
|
1188
1188
|
};
|
|
1189
1189
|
var defaultStylisPlugins = [prefixer];
|
|
1190
|
-
var createCache = function createCache2(
|
|
1191
|
-
var key =
|
|
1190
|
+
var createCache = function createCache2(options2) {
|
|
1191
|
+
var key = options2.key;
|
|
1192
1192
|
if (key === "css") {
|
|
1193
1193
|
var ssrStyles = document.querySelectorAll("style[data-emotion]:not([data-s])");
|
|
1194
1194
|
Array.prototype.forEach.call(ssrStyles, function(node3) {
|
|
@@ -1200,12 +1200,12 @@ var createCache = function createCache2(options) {
|
|
|
1200
1200
|
node3.setAttribute("data-s", "");
|
|
1201
1201
|
});
|
|
1202
1202
|
}
|
|
1203
|
-
var stylisPlugins =
|
|
1203
|
+
var stylisPlugins = options2.stylisPlugins || defaultStylisPlugins;
|
|
1204
1204
|
var inserted = {};
|
|
1205
1205
|
var container2;
|
|
1206
1206
|
var nodesToHydrate = [];
|
|
1207
1207
|
{
|
|
1208
|
-
container2 =
|
|
1208
|
+
container2 = options2.container || document.head;
|
|
1209
1209
|
Array.prototype.forEach.call(
|
|
1210
1210
|
// this means we will ignore elements which don't have a space in them which
|
|
1211
1211
|
// means that the style elements we're looking at are only Emotion 11 server-rendered style elements
|
|
@@ -1243,12 +1243,12 @@ var createCache = function createCache2(options) {
|
|
|
1243
1243
|
sheet: new StyleSheet({
|
|
1244
1244
|
key,
|
|
1245
1245
|
container: container2,
|
|
1246
|
-
nonce:
|
|
1247
|
-
speedy:
|
|
1248
|
-
prepend:
|
|
1249
|
-
insertionPoint:
|
|
1246
|
+
nonce: options2.nonce,
|
|
1247
|
+
speedy: options2.speedy,
|
|
1248
|
+
prepend: options2.prepend,
|
|
1249
|
+
insertionPoint: options2.insertionPoint
|
|
1250
1250
|
}),
|
|
1251
|
-
nonce:
|
|
1251
|
+
nonce: options2.nonce,
|
|
1252
1252
|
inserted,
|
|
1253
1253
|
registered: {},
|
|
1254
1254
|
insert: _insert
|
|
@@ -1569,8 +1569,8 @@ function merge(registered, css2, className) {
|
|
|
1569
1569
|
}
|
|
1570
1570
|
return rawClassName + css2(registeredStyles);
|
|
1571
1571
|
}
|
|
1572
|
-
var createEmotion = function createEmotion2(
|
|
1573
|
-
var cache2 = createCache(
|
|
1572
|
+
var createEmotion = function createEmotion2(options2) {
|
|
1573
|
+
var cache2 = createCache(options2);
|
|
1574
1574
|
cache2.sheet.speedy = function(value) {
|
|
1575
1575
|
this.isSpeedy = value;
|
|
1576
1576
|
};
|
|
@@ -2350,6 +2350,7 @@ __export(components_exports, {
|
|
|
2350
2350
|
current_component: () => current_component,
|
|
2351
2351
|
effect_timeout: () => effect_timeout,
|
|
2352
2352
|
events_set: () => events_set,
|
|
2353
|
+
hotReloadRoot: () => hotReloadRoot,
|
|
2353
2354
|
insertion_effects: () => insertion_effects,
|
|
2354
2355
|
layout_effects: () => layout_effects,
|
|
2355
2356
|
length_css_attributes_set: () => length_css_attributes_set,
|
|
@@ -2357,6 +2358,7 @@ __export(components_exports, {
|
|
|
2357
2358
|
passive_effects: () => passive_effects,
|
|
2358
2359
|
processEffects: () => processEffects,
|
|
2359
2360
|
render: () => render,
|
|
2361
|
+
replaceComponentEntity: () => replaceComponentEntity,
|
|
2360
2362
|
roots: () => roots,
|
|
2361
2363
|
special_attributes: () => special_attributes,
|
|
2362
2364
|
update_cbs: () => update_cbs,
|
|
@@ -2365,6 +2367,35 @@ __export(components_exports, {
|
|
|
2365
2367
|
update_timeout: () => update_timeout
|
|
2366
2368
|
});
|
|
2367
2369
|
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
2370
|
+
function getComponentEntity(entity) {
|
|
2371
|
+
return entity?.[MEMOIZED] ? entity.component : entity;
|
|
2372
|
+
}
|
|
2373
|
+
function replaceComponentEntity(componentCore, nextEntity) {
|
|
2374
|
+
if (!componentCore || typeof nextEntity !== "function") {
|
|
2375
|
+
return false;
|
|
2376
|
+
}
|
|
2377
|
+
const oldEntity = getComponentEntity(componentCore.entity);
|
|
2378
|
+
const newEntity = getComponentEntity(nextEntity);
|
|
2379
|
+
if (oldEntity === newEntity) {
|
|
2380
|
+
return true;
|
|
2381
|
+
}
|
|
2382
|
+
const component = componentCore.component;
|
|
2383
|
+
if (!component) {
|
|
2384
|
+
return false;
|
|
2385
|
+
}
|
|
2386
|
+
const oldIsClass = isClass(oldEntity);
|
|
2387
|
+
const newIsClass = isClass(newEntity);
|
|
2388
|
+
if (oldIsClass !== newIsClass) {
|
|
2389
|
+
return false;
|
|
2390
|
+
}
|
|
2391
|
+
if (newIsClass) {
|
|
2392
|
+
Object.setPrototypeOf(component, newEntity.prototype);
|
|
2393
|
+
} else {
|
|
2394
|
+
component.render = newEntity;
|
|
2395
|
+
}
|
|
2396
|
+
componentCore.entity = newEntity;
|
|
2397
|
+
return true;
|
|
2398
|
+
}
|
|
2368
2399
|
var ComponentCache = class {
|
|
2369
2400
|
constructor(owner) {
|
|
2370
2401
|
__publicField(this, "owner");
|
|
@@ -2373,34 +2404,35 @@ var ComponentCache = class {
|
|
|
2373
2404
|
__publicField(this, "pick_index", 0);
|
|
2374
2405
|
this.owner = owner;
|
|
2375
2406
|
}
|
|
2376
|
-
pick(key, construct_func) {
|
|
2377
|
-
|
|
2378
|
-
let
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
buck[IDX] = 0;
|
|
2407
|
+
pick(key, construct_func, nextEntity) {
|
|
2408
|
+
let componentCore;
|
|
2409
|
+
let bucket = this.current_map.get(key);
|
|
2410
|
+
if (bucket && bucket.length > bucket[IDX]) {
|
|
2411
|
+
componentCore = bucket[bucket[IDX]];
|
|
2412
|
+
bucket[IDX]++;
|
|
2413
|
+
const oldEntity = getComponentEntity(componentCore.entity);
|
|
2414
|
+
const newEntity = getComponentEntity(nextEntity);
|
|
2415
|
+
const incompatible = typeof oldEntity === "function" && typeof newEntity === "function" && isClass(oldEntity) !== isClass(newEntity);
|
|
2416
|
+
if (incompatible) {
|
|
2417
|
+
componentCore = construct_func();
|
|
2418
|
+
} else if (newEntity) {
|
|
2419
|
+
replaceComponentEntity(componentCore, newEntity);
|
|
2390
2420
|
}
|
|
2391
2421
|
} else {
|
|
2392
|
-
|
|
2393
|
-
buck = this.new_map.get(key);
|
|
2394
|
-
if (buck !== void 0) {
|
|
2395
|
-
buck.push(comp);
|
|
2396
|
-
} else {
|
|
2397
|
-
buck = [comp];
|
|
2398
|
-
this.new_map.set(key, buck);
|
|
2399
|
-
buck[IDX] = 0;
|
|
2400
|
-
}
|
|
2401
|
-
if (comp[CORE]) (_a = comp[CORE]).parent ?? (_a.parent = this.owner);
|
|
2422
|
+
componentCore = construct_func();
|
|
2402
2423
|
}
|
|
2403
|
-
|
|
2424
|
+
bucket = this.new_map.get(key);
|
|
2425
|
+
if (bucket) {
|
|
2426
|
+
bucket.push(componentCore);
|
|
2427
|
+
} else {
|
|
2428
|
+
bucket = [componentCore];
|
|
2429
|
+
this.new_map.set(key, bucket);
|
|
2430
|
+
bucket[IDX] = 0;
|
|
2431
|
+
}
|
|
2432
|
+
if (componentCore) {
|
|
2433
|
+
componentCore.parent ?? (componentCore.parent = this.owner);
|
|
2434
|
+
}
|
|
2435
|
+
return componentCore;
|
|
2404
2436
|
}
|
|
2405
2437
|
commit() {
|
|
2406
2438
|
this.current_map.forEach((arr) => {
|
|
@@ -2867,15 +2899,20 @@ function constructFunc(core, parent) {
|
|
|
2867
2899
|
function prepareCore(parent, core) {
|
|
2868
2900
|
try {
|
|
2869
2901
|
parent.cache ?? (parent.cache = new ComponentCache(parent));
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2902
|
+
const isText = core[TEXT2] !== void 0;
|
|
2903
|
+
const key = isText ? ":text:" : core.props?.key;
|
|
2904
|
+
const entity = isText || core instanceof ComponentCore ? void 0 : core.entity;
|
|
2905
|
+
return parent.cache.pick(
|
|
2906
|
+
key,
|
|
2907
|
+
() => isText || core instanceof ComponentCore ? core : constructFunc(core, parent)[CORE],
|
|
2908
|
+
entity
|
|
2873
2909
|
);
|
|
2874
|
-
return core;
|
|
2875
2910
|
} catch (e) {
|
|
2876
2911
|
if (core?.component?.componentDidCatch) {
|
|
2877
2912
|
core.component.componentDidCatch(e);
|
|
2878
|
-
} else
|
|
2913
|
+
} else {
|
|
2914
|
+
throw e;
|
|
2915
|
+
}
|
|
2879
2916
|
}
|
|
2880
2917
|
}
|
|
2881
2918
|
function doUpdates() {
|
|
@@ -3139,6 +3176,19 @@ function createRoot(element) {
|
|
|
3139
3176
|
}
|
|
3140
3177
|
};
|
|
3141
3178
|
}
|
|
3179
|
+
function hotReloadRoot(rootCore, nextEntity, props) {
|
|
3180
|
+
if (!rootCore || !rootCore.component) {
|
|
3181
|
+
throw new Error("Invalid Lilact root component.");
|
|
3182
|
+
}
|
|
3183
|
+
const replaced = replaceComponentEntity(rootCore, nextEntity);
|
|
3184
|
+
if (!replaced) {
|
|
3185
|
+
throw new Error(
|
|
3186
|
+
"Cannot hot-reload the root from a class component to a function component, or vice versa."
|
|
3187
|
+
);
|
|
3188
|
+
}
|
|
3189
|
+
rootCore.apply(props === void 0 ? rootCore.props : props);
|
|
3190
|
+
return rootCore;
|
|
3191
|
+
}
|
|
3142
3192
|
function createPortal(children, element) {
|
|
3143
3193
|
return createComponent2(lilact_default.Portal, { "view": element }, children);
|
|
3144
3194
|
}
|
|
@@ -3696,16 +3746,16 @@ function createModule(path2, {
|
|
|
3696
3746
|
required_scripts[path2] = module2;
|
|
3697
3747
|
return module2;
|
|
3698
3748
|
}
|
|
3699
|
-
function loadModule(path2,
|
|
3749
|
+
function loadModule(path2, options2 = {}) {
|
|
3700
3750
|
if (lilact_default.importObjectPaths?.[path2]) {
|
|
3701
3751
|
return lilact_default.importObjectPaths[path2];
|
|
3702
3752
|
}
|
|
3703
|
-
if (
|
|
3704
|
-
path2 = joinPaths(
|
|
3753
|
+
if (options2.requirer?.path) {
|
|
3754
|
+
path2 = joinPaths(options2.requirer.path, path2);
|
|
3705
3755
|
}
|
|
3706
|
-
const loadAsync = Boolean(lilact_default[LAZY]) || Boolean(
|
|
3756
|
+
const loadAsync = Boolean(lilact_default[LAZY]) || Boolean(options2.isLazy);
|
|
3707
3757
|
const module2 = getOrCreateModule(path2, {});
|
|
3708
|
-
if (module2.loaded && !
|
|
3758
|
+
if (module2.loaded && !options2.forceReload) {
|
|
3709
3759
|
return module2.exports;
|
|
3710
3760
|
}
|
|
3711
3761
|
if (path2.startsWith("#")) {
|
|
@@ -3719,15 +3769,15 @@ function loadModule(path2, options = {}) {
|
|
|
3719
3769
|
return run(
|
|
3720
3770
|
element.textContent || "",
|
|
3721
3771
|
path2,
|
|
3722
|
-
{ forceReload:
|
|
3772
|
+
{ forceReload: options2.forceReload }
|
|
3723
3773
|
);
|
|
3724
3774
|
}
|
|
3725
3775
|
if (loadAsync) {
|
|
3726
3776
|
lilact_default[LAZY] = false;
|
|
3727
|
-
if (module2.request) {
|
|
3777
|
+
if (module2.request && !options2.forceReload) {
|
|
3728
3778
|
return module2.request;
|
|
3729
3779
|
}
|
|
3730
|
-
return loadAsyncResource(path2, module2);
|
|
3780
|
+
return loadAsyncResource(path2, module2, options2);
|
|
3731
3781
|
}
|
|
3732
3782
|
const resolved = lilact_default.resolver?.(path2);
|
|
3733
3783
|
if (resolved != null) {
|
|
@@ -3740,7 +3790,7 @@ function loadModule(path2, options = {}) {
|
|
|
3740
3790
|
return run(
|
|
3741
3791
|
String(resolved),
|
|
3742
3792
|
path2,
|
|
3743
|
-
{ forceReload:
|
|
3793
|
+
{ forceReload: options2.forceReload }
|
|
3744
3794
|
);
|
|
3745
3795
|
}
|
|
3746
3796
|
const request = new XMLHttpRequest();
|
|
@@ -3771,18 +3821,19 @@ function loadModule(path2, options = {}) {
|
|
|
3771
3821
|
);
|
|
3772
3822
|
}
|
|
3773
3823
|
function require2(path2) {
|
|
3774
|
-
let
|
|
3824
|
+
let options2 = {};
|
|
3775
3825
|
if (arguments.length === 2 && arguments[1] && typeof arguments[1] === "object") {
|
|
3776
|
-
|
|
3826
|
+
options2 = arguments[1];
|
|
3777
3827
|
}
|
|
3778
|
-
return loadModule(path2,
|
|
3828
|
+
return loadModule(path2, options2);
|
|
3779
3829
|
}
|
|
3780
|
-
function makeImportsObject(mod) {
|
|
3830
|
+
function makeImportsObject(mod, options2 = {}) {
|
|
3781
3831
|
mod.importsObject = {};
|
|
3782
3832
|
for (const path2 in mod.meta.imports) {
|
|
3783
3833
|
const imps = mod.meta.imports[path2];
|
|
3784
3834
|
const exps = loadModule(path2, {
|
|
3785
|
-
requirer: mod
|
|
3835
|
+
requirer: mod,
|
|
3836
|
+
forceReload: options2.forceReload
|
|
3786
3837
|
});
|
|
3787
3838
|
for (const i2 in imps.named_imports) {
|
|
3788
3839
|
if (i2 === "") continue;
|
|
@@ -3807,7 +3858,7 @@ function makeImportsObject(mod) {
|
|
|
3807
3858
|
}
|
|
3808
3859
|
}
|
|
3809
3860
|
}
|
|
3810
|
-
function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`,
|
|
3861
|
+
function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, options = {}) {
|
|
3811
3862
|
let module = required_scripts[path];
|
|
3812
3863
|
if (!module) {
|
|
3813
3864
|
module = createModule(path, {
|
|
@@ -3820,7 +3871,6 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {} = {}) {
|
|
|
3820
3871
|
module.exports = {};
|
|
3821
3872
|
module.loaded = false;
|
|
3822
3873
|
module.error = void 0;
|
|
3823
|
-
module.importsObject = void 0;
|
|
3824
3874
|
module.meta = {};
|
|
3825
3875
|
}
|
|
3826
3876
|
let processed;
|
|
@@ -3832,8 +3882,7 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {} = {}) {
|
|
|
3832
3882
|
factory: "createComponent",
|
|
3833
3883
|
appendSourcemap: true,
|
|
3834
3884
|
injectTraceLabels: true,
|
|
3835
|
-
produceCJS:
|
|
3836
|
-
referentiateImports: true,
|
|
3885
|
+
produceCJS: true,
|
|
3837
3886
|
blocksInfo: lilact_default.blocksInfo
|
|
3838
3887
|
});
|
|
3839
3888
|
} catch (value) {
|
|
@@ -3852,8 +3901,6 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {} = {}) {
|
|
|
3852
3901
|
globalThis.Lilact = lilact_default;
|
|
3853
3902
|
globalThis.createComponent = lilact_default.createComponent;
|
|
3854
3903
|
globalThis.Fragment = lilact_default.Fragment;
|
|
3855
|
-
makeImportsObject(module);
|
|
3856
|
-
lilact_default.scriptImportsObject = module.importsObject;
|
|
3857
3904
|
const result = eval(processed);
|
|
3858
3905
|
module.loaded = true;
|
|
3859
3906
|
return isEmpty(module.exports) ? result : module.exports;
|
|
@@ -3864,10 +3911,10 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, {} = {}) {
|
|
|
3864
3911
|
throw error2;
|
|
3865
3912
|
}
|
|
3866
3913
|
}
|
|
3867
|
-
function getOrCreateModule(path2,
|
|
3868
|
-
return required_scripts[path2] || createModule(path2,
|
|
3914
|
+
function getOrCreateModule(path2, options2 = {}) {
|
|
3915
|
+
return required_scripts[path2] || createModule(path2, options2);
|
|
3869
3916
|
}
|
|
3870
|
-
function loadAsyncResource(path2, module2) {
|
|
3917
|
+
function loadAsyncResource(path2, module2, options2 = {}) {
|
|
3871
3918
|
let source;
|
|
3872
3919
|
try {
|
|
3873
3920
|
const resolved = lilact_default.resolver?.(path2);
|
|
@@ -3901,7 +3948,7 @@ function loadAsyncResource(path2, module2) {
|
|
|
3901
3948
|
module2.loaded = true;
|
|
3902
3949
|
return void 0;
|
|
3903
3950
|
}
|
|
3904
|
-
return run(module2.code, path2,
|
|
3951
|
+
return run(module2.code, path2, options2);
|
|
3905
3952
|
}).then((result2) => result2?.default ?? result2).catch((error2) => {
|
|
3906
3953
|
module2.error = report(error2, path2);
|
|
3907
3954
|
throw module2.error;
|
|
@@ -4365,10 +4412,10 @@ function wrapListener(fn, opts = {}) {
|
|
|
4365
4412
|
}
|
|
4366
4413
|
};
|
|
4367
4414
|
}
|
|
4368
|
-
function addWrappedEventListener(target, type, fn,
|
|
4369
|
-
const handler = wrapListener(fn,
|
|
4370
|
-
target.addEventListener(type, handler,
|
|
4371
|
-
return () => target.removeEventListener(type, handler,
|
|
4415
|
+
function addWrappedEventListener(target, type, fn, options2 = {}) {
|
|
4416
|
+
const handler = wrapListener(fn, options2);
|
|
4417
|
+
target.addEventListener(type, handler, options2);
|
|
4418
|
+
return () => target.removeEventListener(type, handler, options2);
|
|
4372
4419
|
}
|
|
4373
4420
|
|
|
4374
4421
|
// .tmp/src/redux.jsx
|
|
@@ -6794,11 +6841,6 @@ function transpileJSX(jsx2, {
|
|
|
6794
6841
|
injectTraceLabels = false,
|
|
6795
6842
|
discardComments = false,
|
|
6796
6843
|
produceCJS = false,
|
|
6797
|
-
referentiateImports = false,
|
|
6798
|
-
importsObject = "Lilact.scriptImportsObject",
|
|
6799
|
-
// first letter must be capital so components work as expected
|
|
6800
|
-
importsObjectVar = "LilactImports",
|
|
6801
|
-
// first letter must be capital so components work as expected
|
|
6802
6844
|
logErrors = false,
|
|
6803
6845
|
// lilact internal
|
|
6804
6846
|
mappings = [],
|
|
@@ -6877,22 +6919,11 @@ function transpileJSX(jsx2, {
|
|
|
6877
6919
|
const flattened_nodes = [];
|
|
6878
6920
|
const codify = (outlen, node3, is_attr = false, is_xml = false) => {
|
|
6879
6921
|
flattened_nodes.push(node3);
|
|
6880
|
-
if (typeof node3 !== "object")
|
|
6881
|
-
|
|
6882
|
-
if (meta?.imported_names.has(node3)) {
|
|
6883
|
-
let j = flattened_nodes.length - 2;
|
|
6884
|
-
while (typeof flattened_nodes[j] === "string" && flattened_nodes[j].trim() === "" || typeof flattened_nodes[j] === "object" && flattened_nodes[j].type === "comment") j--;
|
|
6885
|
-
if (typeof flattened_nodes[j] !== "string" || flattened_nodes[j] !== ".") {
|
|
6886
|
-
return importsObjectVar + "." + node3;
|
|
6887
|
-
}
|
|
6888
|
-
}
|
|
6889
|
-
}
|
|
6890
|
-
return node3;
|
|
6891
|
-
}
|
|
6892
|
-
if (node3 === null) return "";
|
|
6922
|
+
if (typeof node3 !== "object") return node3;
|
|
6923
|
+
if (!node3) return "";
|
|
6893
6924
|
node3.out_index = outlen;
|
|
6894
6925
|
if (node3.type === "string") return jsx2.substring(node3.begin, node3.end);
|
|
6895
|
-
if (node3.type === "import") return
|
|
6926
|
+
if (node3.type === "import") return node3.cjs;
|
|
6896
6927
|
if (node3.type === "export") return node3.cjs;
|
|
6897
6928
|
if (node3.type === "regex") return jsx2.substring(node3.begin, node3.end);
|
|
6898
6929
|
if (node3.type === "comment") return discardComments || is_attr ? "" : jsx2.substring(node3.begin, node3.end);
|
|
@@ -6900,7 +6931,7 @@ function transpileJSX(jsx2, {
|
|
|
6900
6931
|
if (node3.type === "parenthesis") {
|
|
6901
6932
|
let out2 = "(";
|
|
6902
6933
|
if (node3.out) {
|
|
6903
|
-
if (produceCJS
|
|
6934
|
+
if (produceCJS) processImportExports(node3, jsx2, meta);
|
|
6904
6935
|
for (const ch2 of node3.out) {
|
|
6905
6936
|
out2 += codify(outlen + out2.length - 1, ch2);
|
|
6906
6937
|
}
|
|
@@ -6910,7 +6941,7 @@ function transpileJSX(jsx2, {
|
|
|
6910
6941
|
if (node3.type === "js") {
|
|
6911
6942
|
let out2 = "";
|
|
6912
6943
|
if (node3.out) {
|
|
6913
|
-
if (produceCJS
|
|
6944
|
+
if (produceCJS) processImportExports(node3, jsx2, meta);
|
|
6914
6945
|
for (const ch2 of node3.out) {
|
|
6915
6946
|
if (is_xml && ch2.type === "comment") continue;
|
|
6916
6947
|
out2 += codify(outlen + out2.length - (is_attr ? 1 : 0), ch2);
|
|
@@ -6925,9 +6956,6 @@ function transpileJSX(jsx2, {
|
|
|
6925
6956
|
return out2;
|
|
6926
6957
|
}
|
|
6927
6958
|
if (node3.type === "xml") {
|
|
6928
|
-
if (referentiateImports && meta?.imported_names?.has(node3.tag) && node3.tag[0] === node3.tag[0].toUpperCase()) {
|
|
6929
|
-
node3.tag = importsObjectVar + "." + node3.tag;
|
|
6930
|
-
}
|
|
6931
6959
|
if (node3.tag.length === 0) {
|
|
6932
6960
|
node3.tag = fragment;
|
|
6933
6961
|
} else if (node3.tag[0] !== node3.tag[0].toUpperCase()) {
|
|
@@ -6965,9 +6993,6 @@ function transpileJSX(jsx2, {
|
|
|
6965
6993
|
if (injectTraceLabels) {
|
|
6966
6994
|
out = `/*LILACTBLOCK${++blocksInfo2.counter}:0,0:<EXEC>*/try{`;
|
|
6967
6995
|
}
|
|
6968
|
-
if (referentiateImports) {
|
|
6969
|
-
out += `const ${importsObjectVar} = ${importsObject};`;
|
|
6970
|
-
}
|
|
6971
6996
|
out += codify(out.length, json);
|
|
6972
6997
|
if (injectTraceLabels) {
|
|
6973
6998
|
if (transpilerConfig.enableLabelStack) {
|
|
@@ -6985,7 +7010,7 @@ function transpileJSX(jsx2, {
|
|
|
6985
7010
|
|
|
6986
7011
|
// .tmp/src/lilact.jsx
|
|
6987
7012
|
var Lilact2 = {
|
|
6988
|
-
VERSION: "RC.
|
|
7013
|
+
VERSION: "RC.6",
|
|
6989
7014
|
// Configuration
|
|
6990
7015
|
defaultTransitionTimeout: 300,
|
|
6991
7016
|
defaultIsEqual: Object.is,
|
|
@@ -7112,6 +7137,7 @@ export {
|
|
|
7112
7137
|
getComponentByPointer,
|
|
7113
7138
|
globalErrorHandler,
|
|
7114
7139
|
grabTimers,
|
|
7140
|
+
hotReloadRoot,
|
|
7115
7141
|
id_num,
|
|
7116
7142
|
insertion_effects,
|
|
7117
7143
|
isAsync,
|
|
@@ -7132,6 +7158,7 @@ export {
|
|
|
7132
7158
|
releaseSyntheticEvent,
|
|
7133
7159
|
releaseTimers,
|
|
7134
7160
|
render,
|
|
7161
|
+
replaceComponentEntity,
|
|
7135
7162
|
require2 as require,
|
|
7136
7163
|
required_scripts,
|
|
7137
7164
|
resetTimers,
|