lilact 0.31.0 → 0.31.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.
Files changed (40) hide show
  1. package/dist/lilact.development.js +14 -17
  2. package/dist/lilact.development.js.map +2 -2
  3. package/dist/lilact.development.min.js +22 -22
  4. package/dist/lilact.development.min.js.map +3 -3
  5. package/dist/lilact.production.min.js +22 -22
  6. package/docs/assets/hierarchy.js +1 -1
  7. package/docs/assets/navigation.js +1 -1
  8. package/docs/assets/search.js +1 -1
  9. package/docs/classes/accessories.ErrorBoundary.html +8 -8
  10. package/docs/classes/accessories.Suspense.html +7 -7
  11. package/docs/classes/components.Component.html +11 -11
  12. package/docs/classes/components.HTMLComponent.html +11 -11
  13. package/docs/classes/components.RootComponent.html +11 -11
  14. package/docs/functions/components.cloneComponent.html +1 -1
  15. package/docs/functions/components.createComponent.html +1 -1
  16. package/docs/functions/components.createPortal.html +1 -1
  17. package/docs/functions/components.createRoot.html +1 -1
  18. package/docs/functions/components.memo.html +1 -1
  19. package/docs/functions/components.render.html +1 -1
  20. package/docs/functions/run.lazy.html +1 -1
  21. package/docs/functions/run.runScripts.html +1 -1
  22. package/docs/hierarchy.html +1 -1
  23. package/docs/modules/components.html +1 -1
  24. package/docs/static/lilact.development.js +14 -17
  25. package/docs/static/lilact.development.js.map +2 -2
  26. package/docs/static/lilact.development.min.js +22 -22
  27. package/docs/static/lilact.development.min.js.map +3 -3
  28. package/docs/static/lilact.production.min.js +22 -22
  29. package/docs/variables/components.cloneElement.html +1 -1
  30. package/examples/lilact.development.js +14 -17
  31. package/examples/lilact.development.js.map +2 -2
  32. package/examples/lilact.development.min.js +22 -22
  33. package/examples/lilact.development.min.js.map +3 -3
  34. package/examples/lilact.production.min.js +22 -22
  35. package/package.json +1 -1
  36. package/src/components.jsx +21 -33
  37. package/src/jsx.js +6 -2
  38. package/src/run.jsx +1 -0
  39. package/src/symbols.jsx +5 -1
  40. package/docs/functions/components.hotReloadRoot.html +0 -1
@@ -1716,11 +1716,13 @@ __export(symbols_exports, {
1716
1716
  INTERVAL: () => INTERVAL,
1717
1717
  IS_ZOMBIE: () => IS_ZOMBIE,
1718
1718
  LAZY: () => LAZY,
1719
+ LOCATION: () => LOCATION,
1719
1720
  MEMOIZED: () => MEMOIZED,
1720
1721
  REPEAT: () => REPEAT,
1721
1722
  TEXT: () => TEXT2
1722
1723
  });
1723
1724
  var [
1725
+ LOCATION,
1724
1726
  CORE,
1725
1727
  COMPONENT,
1726
1728
  TEXT2,
@@ -1736,6 +1738,7 @@ var [
1736
1738
  CALLBACK,
1737
1739
  ARGS
1738
1740
  ] = [
1741
+ /* @__PURE__ */ Symbol.for("LILACT:LOCATION"),
1739
1742
  /* @__PURE__ */ Symbol.for("LILACT:CORE"),
1740
1743
  /* @__PURE__ */ Symbol.for("LILACT:COMPONENT"),
1741
1744
  /* @__PURE__ */ Symbol.for("LILACT:TEXT"),
@@ -2350,7 +2353,6 @@ __export(components_exports, {
2350
2353
  current_component: () => current_component,
2351
2354
  effect_timeout: () => effect_timeout,
2352
2355
  events_set: () => events_set,
2353
- hotReloadRoot: () => hotReloadRoot,
2354
2356
  insertion_effects: () => insertion_effects,
2355
2357
  layout_effects: () => layout_effects,
2356
2358
  length_css_attributes_set: () => length_css_attributes_set,
@@ -2916,6 +2918,8 @@ function constructFunc(core, parent) {
2916
2918
  if (core[TEXT2] === void 0) {
2917
2919
  let entity = core.entity;
2918
2920
  let memoized = false;
2921
+ const loc = core.props[LOCATION];
2922
+ if (loc) delete core.props[LOCATION];
2919
2923
  if (typeof entity === "object") {
2920
2924
  if (entity[MEMOIZED]) {
2921
2925
  memoized = entity[MEMOIZED];
@@ -2969,6 +2973,7 @@ function constructFunc(core, parent) {
2969
2973
  } else {
2970
2974
  throw new Error("Error in constructing component.");
2971
2975
  }
2976
+ if (loc) comp[CORE].location = loc;
2972
2977
  comp[CORE].entity = entity;
2973
2978
  registerComponentCore(comp[CORE]);
2974
2979
  if (core.container) {
@@ -3262,24 +3267,10 @@ function createRoot(element) {
3262
3267
  }
3263
3268
  },
3264
3269
  getCore() {
3265
- console.log(root, root[CORE]);
3266
3270
  return root[CORE];
3267
3271
  }
3268
3272
  };
3269
3273
  }
3270
- function hotReloadRoot(rootCore, nextEntity, props) {
3271
- if (!rootCore || !rootCore.component) {
3272
- throw new Error("Invalid root component.");
3273
- }
3274
- const replaced = replaceComponentEntity(rootCore, nextEntity);
3275
- if (!replaced) {
3276
- throw new Error(
3277
- "Cannot hot-reload the root from a class component to a function component, or vice versa."
3278
- );
3279
- }
3280
- rootCore.apply(props === void 0 ? rootCore.props : { ...rootCore.props, ...props });
3281
- return rootCore;
3282
- }
3283
3274
  function createPortal(children, element) {
3284
3275
  return createComponent2(lilact_default.Portal, { "view": element }, children);
3285
3276
  }
@@ -3994,6 +3985,7 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, options = {})
3994
3985
  appendSourcemap: true,
3995
3986
  injectTraceLabels: true,
3996
3987
  produceCJS: true,
3988
+ addLocationProp: true,
3997
3989
  blocksInfo: lilact_default.blocksInfo
3998
3990
  });
3999
3991
  } catch (value) {
@@ -6241,6 +6233,7 @@ function processImportExports(node3, jsx2, meta) {
6241
6233
  }
6242
6234
 
6243
6235
  // .tmp/src/jsx.js
6236
+ var LOCATION2 = /* @__PURE__ */ Symbol.for("LILACT:LOCATION");
6244
6237
  var transpilerConfig = {
6245
6238
  setBlockLabels: true,
6246
6239
  enableLabelStack: false,
@@ -6955,6 +6948,7 @@ function transpileJSX(jsx2, {
6955
6948
  discardComments = false,
6956
6949
  produceCJS = false,
6957
6950
  logErrors = false,
6951
+ addLocationProp = false,
6958
6952
  // lilact internal
6959
6953
  mappings = [],
6960
6954
  meta,
@@ -7098,7 +7092,10 @@ function transpileJSX(jsx2, {
7098
7092
  }
7099
7093
  }
7100
7094
  const loc = getRowCol(eols, node3.begin);
7101
- out2 = ` ${factory}( ${node3.tag}, { ${out2} )`;
7095
+ if (addLocationProp)
7096
+ out2 = ` ${factory}( ${node3.tag}, { [Lilact.LOCATION]:["${path2}", ${loc}], ${out2} )`;
7097
+ else
7098
+ out2 = ` ${factory}( ${node3.tag}, { ${out2} )`;
7102
7099
  return out2;
7103
7100
  }
7104
7101
  };
@@ -7201,6 +7198,7 @@ export {
7201
7198
  INTERVAL,
7202
7199
  IS_ZOMBIE,
7203
7200
  LAZY,
7201
+ LOCATION,
7204
7202
  Lilact2 as Lilact,
7205
7203
  Link,
7206
7204
  MEMOIZED,
@@ -7250,7 +7248,6 @@ export {
7250
7248
  getComponentByPointer,
7251
7249
  globalErrorHandler,
7252
7250
  grabTimers,
7253
- hotReloadRoot,
7254
7251
  id_num,
7255
7252
  insertion_effects,
7256
7253
  isAsync,