lilact 0.5.0 → 0.5.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 (70) hide show
  1. package/README.md +1 -1
  2. package/dist/lilact.development.min.js +1 -1
  3. package/dist/lilact.development.min.js.map +1 -1
  4. package/dist/lilact.production.min.js +1 -1
  5. package/dist/lilact.production.min.js.map +1 -1
  6. package/docs/assets/highlight.css +42 -0
  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 +10 -10
  12. package/docs/classes/components.HTMLComponent.html +10 -10
  13. package/docs/classes/components.RootComponent.html +10 -10
  14. package/docs/functions/components.createComponent.html +1 -1
  15. package/docs/functions/components.createRoot.html +1 -1
  16. package/docs/functions/components.render.html +1 -1
  17. package/docs/functions/errors.globalErrorHandler.html +7 -0
  18. package/docs/functions/errors.traceError.html +6 -0
  19. package/docs/functions/jsx.transpileJSX.html +1 -1
  20. package/docs/functions/misc.Fragment.html +1 -1
  21. package/docs/functions/misc.classNames.html +1 -1
  22. package/docs/functions/misc.deepEqual.html +1 -1
  23. package/docs/functions/misc.getComponentByPointer.html +1 -1
  24. package/docs/functions/misc.isAsync.html +1 -1
  25. package/docs/functions/misc.isClass.html +1 -1
  26. package/docs/functions/misc.isEmpty.html +1 -1
  27. package/docs/functions/misc.isError.html +1 -1
  28. package/docs/functions/misc.isThenable.html +1 -1
  29. package/docs/functions/misc.shallowEqual.html +1 -1
  30. package/docs/functions/misc.toBool.html +1 -1
  31. package/docs/functions/run.lazy.html +1 -1
  32. package/docs/functions/run.require.html +1 -1
  33. package/docs/functions/run.runScripts.html +1 -1
  34. package/docs/index.html +1 -1
  35. package/docs/modules/errors.html +1 -0
  36. package/docs/modules/misc.html +1 -1
  37. package/docs/modules/pane.html +1 -0
  38. package/docs/modules.html +1 -1
  39. package/docs/static/demos/error-callback.jsx +20 -0
  40. package/docs/static/demos/error-component-stack.jsx +39 -0
  41. package/docs/static/demos/form-elements.jsx +9 -9
  42. package/docs/static/icon.png +0 -0
  43. package/docs/static/index.html +25 -20
  44. package/docs/static/lilact.development.min.js +1 -1
  45. package/docs/static/lilact.production.min.js +1 -1
  46. package/docs/variables/misc.Children.html +2 -2
  47. package/docs/variables/pane.ResizablePane.html +48 -0
  48. package/package.json +5 -2
  49. package/root/demos/error-callback.jsx +20 -0
  50. package/root/demos/error-component-stack.jsx +39 -0
  51. package/root/demos/form-elements.jsx +9 -9
  52. package/root/icon.png +0 -0
  53. package/root/index.html +25 -20
  54. package/root/lilact.development.min.js +1 -1
  55. package/root/lilact.production.min.js +1 -1
  56. package/src/components.jsx +3 -7
  57. package/src/errors.jsx +36 -14
  58. package/src/jsx.js +5 -5
  59. package/src/lilact.jsx +2 -0
  60. package/src/misc.jsx +1 -3
  61. package/src/pane.jsx +52 -9
  62. package/src/run.jsx +0 -1
  63. package/typedoc.json +2 -0
  64. package/docs/static/demos/error-3.jsx +0 -9
  65. package/docs/variables/misc.required_scripts.html +0 -1
  66. package/root/demos/error-3.jsx +0 -9
  67. /package/docs/static/demos/{error-2.jsx → error-init.jsx} +0 -0
  68. /package/docs/static/demos/{error-1.jsx → error-parser.jsx} +0 -0
  69. /package/root/demos/{error-2.jsx → error-init.jsx} +0 -0
  70. /package/root/demos/{error-1.jsx → error-parser.jsx} +0 -0
package/src/jsx.js CHANGED
@@ -870,9 +870,10 @@ function generateSourceMap(json, path, jsx_eols, out_eols, mappings=[])
870
870
 
871
871
 
872
872
  const scan_leaves = (node)=>{
873
- if(!!node.children) {
873
+ //console.log("SCAN", node, node.begin, node.out_index);
874
+ if(node.out?.length>0) {
874
875
 
875
- for(const ch of node.children) {
876
+ for(const ch of node.out) {
876
877
  scan_leaves(ch);
877
878
  }
878
879
  }
@@ -908,14 +909,12 @@ function generateSourceMap(json, path, jsx_eols, out_eols, mappings=[])
908
909
  }
909
910
 
910
911
  mstr+=',';
911
-
912
912
  mstr+=( vlq.encode(m[1]-oc,0,m[2]-lr,m[3]-lc) );
913
913
 
914
914
  oc = m[1];
915
915
  lr = m[2];
916
916
  lc = m[3];
917
917
  }
918
-
919
918
  sourcemap.mappings = mstr.substring(1).replace(/;,/g, ";");
920
919
 
921
920
  return "\n\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(JSON.stringify(sourcemap));
@@ -1038,6 +1037,7 @@ export function transpileJSX( jsx, {
1038
1037
  if(typeof(node)!=='object') return node;
1039
1038
 
1040
1039
  node.out_index = outlen;
1040
+ //console.log("CODIFY", node, node.out_index);
1041
1041
 
1042
1042
  if(node.type==='string') return jsx.substring(node.begin, node.end);
1043
1043
  if(node.type==='regex') return jsx.substring(node.begin, node.end);
@@ -1130,7 +1130,7 @@ export function transpileJSX( jsx, {
1130
1130
  if(injectTraceLabels) {
1131
1131
  out=`/*LILACTBLOCK${++blocks_info.counter}:0,0:<EXEC>*/try{`
1132
1132
  }
1133
- out+=codify(0, json);
1133
+ out+=codify(out.length, json);
1134
1134
 
1135
1135
  if(injectTraceLabels) {
1136
1136
  if(transpilerConfig.enableLabelStack) {
package/src/lilact.jsx CHANGED
@@ -105,9 +105,11 @@ document.addEventListener('DOMContentLoaded', () => {
105
105
  Lilact.runScripts();
106
106
  });
107
107
 
108
+ ʔ if(DEBUG) {
108
109
  window.addEventListener('error', (e) => {
109
110
  Lilact.globalErrorHandler(e);
110
111
  });
112
+ ʔ }
111
113
 
112
114
  ʔ if(DEBUG) {
113
115
  console.log(`Lilact (Version: ${Lilact.VERSION}) - Debug Mode`);
package/src/misc.jsx CHANGED
@@ -78,9 +78,6 @@ export const findDOMNode = (comp)=>{
78
78
 
79
79
  Unlike React, in Lilact findDOMNode can also be used on function components.
80
80
  */
81
-
82
- console.warn("NOT IMPLEMENTED YET")
83
-
84
81
  if(!comp[CORE]?.element?.parentNode) throw "findDOMNode only works on mounted components.";
85
82
  return comp[CORE].element;
86
83
  }
@@ -336,6 +333,7 @@ export function toBool(x) {
336
333
 
337
334
  // Internals
338
335
 
336
+ /** @ignore */
339
337
  export const required_scripts = {};
340
338
 
341
339
  /** @ignore */
package/src/pane.jsx CHANGED
@@ -8,16 +8,59 @@ const clamp = (n, min, max) => {
8
8
  };
9
9
 
10
10
  /**
11
- * ResizablePane
11
+ * A split-pane container with a draggable splitter, supporting both horizontal and vertical layouts.
12
12
  *
13
- * Features:
14
- * - Supports "horizontal" (left/top size affects width) and "vertical" (affects height)
15
- * - Initial position via props.position
16
- * - Methods to set mode and position via ref:
17
- * ref.current.setMode(mode)
18
- * ref.current.setPosition(position)
19
- * - Callback when size changes via onSizeChange
20
- * - Children are rendered in two separate containers (no portals)
13
+ * The pane can be either:
14
+ * - **Controlled** via the `position` prop (number between `min` and `max`), or
15
+ * - **Uncontrolled** via `defaultPosition` (used as the initial position).
16
+ *
17
+ * Layout behavior:
18
+ * - `mode="horizontal"`: the `position` controls the width of the **left** pane.
19
+ * - `mode="vertical"`: the `position` controls the height of the **top** pane.
20
+ *
21
+ * Ref API:
22
+ * - Exposes imperative methods on `ref.current`:
23
+ * - `getMode()` to get the current mode
24
+ * - `setMode(mode)` to switch between `"horizontal"` and `"vertical"`
25
+ * - `getPosition()` to get the current splitter position
26
+ * - `setPosition(position)` to update the splitter position
27
+ *
28
+ * Events:
29
+ * - Calls `onSizeChange(position)` whenever the pane size/position changes (e.g., via dragging).
30
+ *
31
+ * Rendering:
32
+ * - Renders `children` into two separate containers (no portals).
33
+ *
34
+ * @param mode - Split direction: `"horizontal"` or `"vertical"`. Defaults to `"horizontal"`.
35
+ * @param position - Controlled splitter position. Normalized value within `[min, max]`.
36
+ * If provided, the component uses this value instead of internal state.
37
+ * @param defaultPosition - Initial splitter position for uncontrolled usage. Defaults to `0.5`.
38
+ * @param min - Minimum allowed position. Defaults to `0.1`.
39
+ * @param max - Maximum allowed position. Defaults to `0.9`.
40
+ * @param splitterSize - Thickness of the draggable splitter in pixels. Defaults to `8`.
41
+ * @param onSizeChange - Callback invoked when the position changes. Receives the new normalized position.
42
+ * @param style - Optional root container styles.
43
+ * @param className - Optional root container CSS class.
44
+ * @param leftPaneStyle - Optional styles applied to the left pane (or top pane in vertical mode).
45
+ * @param rightPaneStyle - Optional styles applied to the right pane (or bottom pane in vertical mode).
46
+ * @param splitterStyle - Optional styles applied to the splitter element.
47
+ * @param children - React children to be rendered into the two pane containers.
48
+ *
49
+ * @example
50
+ * ```tsx
51
+ * const ref = useRef<ResizablePaneHandle>(null);
52
+ *
53
+ * <ResizablePane
54
+ * ref={ref}
55
+ * mode="horizontal"
56
+ * defaultPosition={0.5}
57
+ * min={0.1}
58
+ * max={0.9}
59
+ * onSizeChange={(pos) => console.log(pos)}
60
+ * >
61
+ * <div /> <div />
62
+ * </ResizablePane>
63
+ * ```
21
64
  */
22
65
  export const ResizablePane = forwardRef(function ResizablePane(
23
66
  {
package/src/run.jsx CHANGED
@@ -81,7 +81,6 @@ export function run(jsx, path=`<string input ${++Lilact.eval_num}>`, is_inline=t
81
81
  throw e;
82
82
  }
83
83
 
84
-
85
84
  ʔ if(DEBUG) {
86
85
  Lilact.required_scripts[path].processed = processed;
87
86
  ʔ }
package/typedoc.json CHANGED
@@ -10,6 +10,8 @@
10
10
  ".tmp/router.js",
11
11
  ".tmp/accessories.js",
12
12
  ".tmp/components.js",
13
+ ".tmp/errors.js",
14
+ ".tmp/pane.js",
13
15
  // ".tmp/events.js",
14
16
  ".tmp/hooks.js",
15
17
  ".tmp/misc.js",
@@ -1,9 +0,0 @@
1
- module.exports = function() {
2
-
3
- return <>
4
- <button onClick={()=>{doUnknown()}}>
5
- Press to get Error!
6
- </button>
7
- </>
8
-
9
- }
@@ -1 +0,0 @@
1
- <!DOCTYPE html><html class="default" lang="en" data-base="../"><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>required_scripts | Lilact</title><meta name="description" content="Documentation for Lilact"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => window.app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><a href="../index.html" class="title">Lilact</a><div id="tsd-toolbar-links"></div><button id="tsd-search-trigger" class="tsd-widget" aria-label="Search"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></button><dialog id="tsd-search" aria-label="Search"><input role="combobox" id="tsd-search-input" aria-controls="tsd-search-results" aria-autocomplete="list" aria-expanded="true" autocapitalize="off" autocomplete="off" placeholder="Search the docs" maxLength="100"/><ul role="listbox" id="tsd-search-results"></ul><div id="tsd-search-status" aria-live="polite" aria-atomic="true"><div>Preparing search index...</div></div></dialog><a href="#" class="tsd-widget menu" id="tsd-toolbar-menu-trigger" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb" aria-label="Breadcrumb"><li><a href="../modules/misc.html">misc</a></li><li><a href="" aria-current="page">required_scripts</a></li></ul><h1>Variable required_scripts<code class="tsd-tag">Const</code></h1></div><div class="tsd-signature"><span class="tsd-kind-variable">required_scripts</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span><span class="tsd-signature-symbol"> = {}</span></div><div class="tsd-type-declaration"><h4>Type Declaration</h4><ul class="tsd-parameters"></ul></div><aside class="tsd-sources"><ul><li>Defined in misc.js:339</li></ul></aside></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h3>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">Lilact</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p class="tsd-generator">Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></footer><div class="overlay"></div></body></html>
@@ -1,9 +0,0 @@
1
- module.exports = function() {
2
-
3
- return <>
4
- <button onClick={()=>{doUnknown()}}>
5
- Press to get Error!
6
- </button>
7
- </>
8
-
9
- }
File without changes
File without changes