lilact 0.31.0 → 0.31.2

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 (51) hide show
  1. package/dist/lilact.development.js +23 -21
  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/misc.deepEqual.html +1 -1
  21. package/docs/functions/{misc.getComponentByPointer.html → misc.getComponentUnderPointer.html} +1 -1
  22. package/docs/functions/misc.isAsync.html +1 -1
  23. package/docs/functions/misc.isClass.html +1 -1
  24. package/docs/functions/misc.isEmpty.html +1 -1
  25. package/docs/functions/misc.isError.html +1 -1
  26. package/docs/functions/misc.isThenable.html +1 -1
  27. package/docs/functions/misc.shallowEqual.html +1 -1
  28. package/docs/functions/misc.toBool.html +1 -1
  29. package/docs/functions/run.lazy.html +1 -1
  30. package/docs/functions/run.runScripts.html +1 -1
  31. package/docs/hierarchy.html +1 -1
  32. package/docs/modules/components.html +1 -1
  33. package/docs/modules/misc.html +1 -1
  34. package/docs/static/lilact.development.js +23 -21
  35. package/docs/static/lilact.development.js.map +2 -2
  36. package/docs/static/lilact.development.min.js +22 -22
  37. package/docs/static/lilact.development.min.js.map +3 -3
  38. package/docs/static/lilact.production.min.js +22 -22
  39. package/docs/variables/components.cloneElement.html +1 -1
  40. package/examples/lilact.development.js +23 -21
  41. package/examples/lilact.development.js.map +2 -2
  42. package/examples/lilact.development.min.js +22 -22
  43. package/examples/lilact.development.min.js.map +3 -3
  44. package/examples/lilact.production.min.js +22 -22
  45. package/package.json +1 -1
  46. package/src/components.jsx +21 -33
  47. package/src/jsx.js +6 -2
  48. package/src/misc.jsx +24 -17
  49. package/src/run.jsx +1 -0
  50. package/src/symbols.jsx +5 -1
  51. package/docs/functions/components.hotReloadRoot.html +0 -1
@@ -1689,7 +1689,7 @@ __export(misc_exports, {
1689
1689
  eval_num: () => eval_num,
1690
1690
  findDOMNode: () => findDOMNode,
1691
1691
  forwardRef: () => forwardRef,
1692
- getComponentByPointer: () => getComponentByPointer,
1692
+ getComponentUnderPointer: () => getComponentUnderPointer,
1693
1693
  id_num: () => id_num,
1694
1694
  isAsync: () => isAsync,
1695
1695
  isClass: () => isClass,
@@ -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"),
@@ -1926,15 +1929,20 @@ var forwardRef = (render2) => {
1926
1929
  forwarded.displayName = "Forwarded " + render2.displayName;
1927
1930
  return forwarded;
1928
1931
  };
1929
- function getComponentByPointer() {
1932
+ function getComponentUnderPointer() {
1930
1933
  let resolve_func;
1931
1934
  const pr = new Promise((res, rej) => {
1932
1935
  resolve_func = res;
1933
1936
  });
1937
+ const overlay = document.createElement("div");
1938
+ overlay.style.cssText = "position:fixed;inset:0;z-index:2147483647;cursor:crosshair;background:transparent;";
1939
+ document.body.appendChild(overlay);
1934
1940
  function click_handler(event) {
1935
1941
  event.stopImmediatePropagation();
1936
1942
  window.removeEventListener("click", click_handler, true);
1937
- let t = event.target;
1943
+ overlay.style.display = "none";
1944
+ let t = document.elementFromPoint(event.clientX, event.clientY);
1945
+ overlay.remove();
1938
1946
  while (!t[COMPONENT] && t.parentNode) {
1939
1947
  t = t.parentNode;
1940
1948
  }
@@ -2350,7 +2358,6 @@ __export(components_exports, {
2350
2358
  current_component: () => current_component,
2351
2359
  effect_timeout: () => effect_timeout,
2352
2360
  events_set: () => events_set,
2353
- hotReloadRoot: () => hotReloadRoot,
2354
2361
  insertion_effects: () => insertion_effects,
2355
2362
  layout_effects: () => layout_effects,
2356
2363
  length_css_attributes_set: () => length_css_attributes_set,
@@ -2916,6 +2923,8 @@ function constructFunc(core, parent) {
2916
2923
  if (core[TEXT2] === void 0) {
2917
2924
  let entity = core.entity;
2918
2925
  let memoized = false;
2926
+ const loc = core.props[LOCATION];
2927
+ if (loc) delete core.props[LOCATION];
2919
2928
  if (typeof entity === "object") {
2920
2929
  if (entity[MEMOIZED]) {
2921
2930
  memoized = entity[MEMOIZED];
@@ -2969,6 +2978,7 @@ function constructFunc(core, parent) {
2969
2978
  } else {
2970
2979
  throw new Error("Error in constructing component.");
2971
2980
  }
2981
+ if (loc) comp[CORE].location = loc;
2972
2982
  comp[CORE].entity = entity;
2973
2983
  registerComponentCore(comp[CORE]);
2974
2984
  if (core.container) {
@@ -3262,24 +3272,10 @@ function createRoot(element) {
3262
3272
  }
3263
3273
  },
3264
3274
  getCore() {
3265
- console.log(root, root[CORE]);
3266
3275
  return root[CORE];
3267
3276
  }
3268
3277
  };
3269
3278
  }
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
3279
  function createPortal(children, element) {
3284
3280
  return createComponent2(lilact_default.Portal, { "view": element }, children);
3285
3281
  }
@@ -3994,6 +3990,7 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, options = {})
3994
3990
  appendSourcemap: true,
3995
3991
  injectTraceLabels: true,
3996
3992
  produceCJS: true,
3993
+ addLocationProp: true,
3997
3994
  blocksInfo: lilact_default.blocksInfo
3998
3995
  });
3999
3996
  } catch (value) {
@@ -6241,6 +6238,7 @@ function processImportExports(node3, jsx2, meta) {
6241
6238
  }
6242
6239
 
6243
6240
  // .tmp/src/jsx.js
6241
+ var LOCATION2 = /* @__PURE__ */ Symbol.for("LILACT:LOCATION");
6244
6242
  var transpilerConfig = {
6245
6243
  setBlockLabels: true,
6246
6244
  enableLabelStack: false,
@@ -6955,6 +6953,7 @@ function transpileJSX(jsx2, {
6955
6953
  discardComments = false,
6956
6954
  produceCJS = false,
6957
6955
  logErrors = false,
6956
+ addLocationProp = false,
6958
6957
  // lilact internal
6959
6958
  mappings = [],
6960
6959
  meta,
@@ -7098,7 +7097,10 @@ function transpileJSX(jsx2, {
7098
7097
  }
7099
7098
  }
7100
7099
  const loc = getRowCol(eols, node3.begin);
7101
- out2 = ` ${factory}( ${node3.tag}, { ${out2} )`;
7100
+ if (addLocationProp)
7101
+ out2 = ` ${factory}( ${node3.tag}, { [Lilact.LOCATION]:["${path2}", ${loc}], ${out2} )`;
7102
+ else
7103
+ out2 = ` ${factory}( ${node3.tag}, { ${out2} )`;
7102
7104
  return out2;
7103
7105
  }
7104
7106
  };
@@ -7201,6 +7203,7 @@ export {
7201
7203
  INTERVAL,
7202
7204
  IS_ZOMBIE,
7203
7205
  LAZY,
7206
+ LOCATION,
7204
7207
  Lilact2 as Lilact,
7205
7208
  Link,
7206
7209
  MEMOIZED,
@@ -7247,10 +7250,9 @@ export {
7247
7250
  events_set,
7248
7251
  findDOMNode,
7249
7252
  forwardRef,
7250
- getComponentByPointer,
7253
+ getComponentUnderPointer,
7251
7254
  globalErrorHandler,
7252
7255
  grabTimers,
7253
- hotReloadRoot,
7254
7256
  id_num,
7255
7257
  insertion_effects,
7256
7258
  isAsync,