lilact 0.9.1 → 0.10.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 (60) hide show
  1. package/dist/lilact.development.js +279 -129
  2. package/dist/lilact.development.js.map +1 -1
  3. package/dist/lilact.development.min.js +1 -1
  4. package/dist/lilact.development.min.js.map +1 -1
  5. package/dist/lilact.production.min.js +1 -1
  6. package/dist/lilact.production.min.js.map +1 -1
  7. package/docs/assets/navigation.js +1 -1
  8. package/docs/assets/search.js +1 -1
  9. package/docs/functions/errors.globalErrorHandler.html +3 -2
  10. package/docs/functions/errors.traceError.html +4 -3
  11. package/docs/functions/hooks.useImperativeHandle.html +1 -1
  12. package/docs/functions/misc.classNames.html +1 -1
  13. package/docs/functions/misc.deepEqual.html +1 -1
  14. package/docs/functions/misc.forwardRef.html +4 -0
  15. package/docs/functions/misc.getComponentByPointer.html +1 -1
  16. package/docs/functions/misc.isAsync.html +1 -1
  17. package/docs/functions/misc.isClass.html +1 -1
  18. package/docs/functions/misc.isEmpty.html +1 -1
  19. package/docs/functions/misc.isError.html +1 -1
  20. package/docs/functions/misc.isThenable.html +1 -1
  21. package/docs/functions/misc.shallowEqual.html +1 -1
  22. package/docs/functions/misc.toBool.html +1 -1
  23. package/docs/functions/run.lazy.html +1 -1
  24. package/docs/functions/run.require.html +2 -2
  25. package/docs/functions/timers.timeoutPromise.html +2 -2
  26. package/docs/modules/hooks.html +1 -1
  27. package/docs/modules/misc.html +1 -1
  28. package/docs/static/demos/css-transition.jsx +1 -1
  29. package/docs/static/demos/error-boundary.jsx +8 -1
  30. package/docs/static/demos/modal.jsx +2 -1
  31. package/docs/static/demos/reducer.jsx +30 -23
  32. package/docs/static/demos/transition.jsx +2 -1
  33. package/docs/static/demos/usedeffered.jsx +33 -0
  34. package/docs/static/index.html +59 -30
  35. package/docs/static/lilact.development.js +279 -129
  36. package/docs/static/lilact.development.min.js +1 -1
  37. package/docs/static/lilact.production.min.js +1 -1
  38. package/package.json +1 -1
  39. package/root/demos/css-transition.jsx +1 -1
  40. package/root/demos/error-boundary.jsx +8 -1
  41. package/root/demos/modal.jsx +2 -1
  42. package/root/demos/reducer.jsx +30 -23
  43. package/root/demos/transition.jsx +2 -1
  44. package/root/demos/usedeffered.jsx +33 -0
  45. package/root/index.html +59 -30
  46. package/root/lilact.development.js +279 -129
  47. package/root/lilact.development.min.js +1 -1
  48. package/root/lilact.production.min.js +1 -1
  49. package/src/errors.jsx +36 -32
  50. package/src/events.jsx +194 -66
  51. package/src/hooks.jsx +0 -15
  52. package/src/jsx.js +1 -1
  53. package/src/lilact.jsx +21 -2
  54. package/src/misc.jsx +14 -0
  55. package/src/pane.jsx +2 -2
  56. package/src/run.jsx +4 -4
  57. package/src/timers.jsx +4 -4
  58. package/docs/functions/hooks.forwardRef.html +0 -4
  59. package/docs/static/demos/use-deffered.jsx +0 -30
  60. package/root/demos/use-deffered.jsx +0 -30
@@ -70,7 +70,9 @@ injectGlobal({
70
70
  overflowWrap: "anywhere"
71
71
  },
72
72
  p: {padding: "10px"},
73
- body: {padding: "20px"}
73
+ body: { padding: "20px", background: "#262d36", color: "#e7e7e7" },
74
+ ":visited": {color: "#c16480"},
75
+
74
76
  });
75
77
 
76
78
  const outer = css({
@@ -78,15 +80,24 @@ const outer = css({
78
80
  flexDirection: "row",
79
81
  gap: 2,
80
82
  alignItems: "stretch",
81
- width: "100%",
83
+ width: "calc(100% - 8px)",
84
+ margin: "2px 4px;",
85
+ borderRadius: "10px",
86
+ overflow: "hidden"
82
87
  });
83
88
 
84
89
  const collapsible = css({
85
- width: "100%",
90
+ width: "calc(100% - 8px)",
86
91
  display: "block",
87
92
  fontSize: "16px",
88
- border: "1px solid #888",
89
- padding: "5px"
93
+ padding: "10px",
94
+ borderRadius: "10px",
95
+ border: "none",
96
+ margin: "4px",
97
+ background:"#ece9ea",
98
+ ":hover": {
99
+ background:"#ffa7c2"
100
+ }
90
101
  });
91
102
 
92
103
  const responsiveOuter = css({
@@ -96,31 +107,44 @@ const responsiveOuter = css({
96
107
  });
97
108
 
98
109
  const pane = css({ flex: "1 1 0",
99
- border: "1px solid",
100
- height: "400px",
101
- minHeight: "400px",
102
- overflowY: "auto",
103
- padding: "10px"
104
- });
110
+ height: "400px",
111
+ minHeight: "400px",
112
+ overflowY: "auto",
113
+ padding: "10px",
114
+ background:"#fff",
115
+ color: "#222",
116
+ button: {
117
+ background:"#ece9ea",
118
+ padding: "10px",
119
+ border: "none",
120
+ borderRadius: "7px",
121
+ margin: "5px",
122
+
123
+ ":hover": {
124
+ background:"#ffa7c2"
125
+ }
126
+ }
127
+ });
105
128
 
106
129
  const left = css({ float: "left" });
107
130
  const right = css({ float: "right" });
131
+ const demobox = css({ background: "#fff3", borderRadius: "12px", padding: "2px", margin: "4px"});
108
132
 
109
133
 
110
134
 
111
- function DemoView({ file })
135
+ function DemoView({ entry })
112
136
  {
113
137
  const [isOpen, setOpen] = useState(false);
114
138
 
115
139
  const viewRef = useRef();
116
140
  const codeRef = useRef();
117
141
 
118
- const resource = createResource("demos/"+file[0]);
142
+ const resource = createResource("demos/"+entry[0]);
119
143
  const code = resource.read(); // Suspense will handle the promise
120
144
 
121
145
  if(isOpen) {
122
146
  useEffect(() => {
123
- const Comp = run(code, "demos/"+file[0]);
147
+ const Comp = run(code, "demos/"+entry[0]);
124
148
  Lilact.render(<Comp/>, viewRef.current);
125
149
  });
126
150
 
@@ -131,8 +155,8 @@ function DemoView({ file })
131
155
 
132
156
  return <>
133
157
  <button onClick={()=>setOpen(!isOpen)} className={collapsible} type="button">
134
- <span className={left}>{ (isOpen?'- ':'+ ') + file[0] + ' '}</span>
135
- <b className={right}>{file[1]}</b>
158
+ <span className={left}>{ (isOpen?'- ':'+ ') + entry[0] + ' '}</span>
159
+ <b className={right}>{entry[1]}</b>
136
160
  </button>
137
161
  {isOpen &&
138
162
  <div style={{width:"100%"}}>
@@ -148,11 +172,12 @@ function DemoView({ file })
148
172
  }
149
173
 
150
174
 
151
- function DemoBlock({file})
175
+ function DemoBlock({entry})
152
176
  {
153
- return <div key={file[0]}>
177
+ if(typeof(entry)==='string') return <h3><br/><center>{entry}</center></h3>;
178
+ return <div key={entry[0]} className={demobox}>
154
179
  <Suspense fallback={<Spinner/>}>
155
- <DemoView file={file} />
180
+ <DemoView entry={entry} />
156
181
  </Suspense>
157
182
  </div>
158
183
  }
@@ -160,24 +185,28 @@ function DemoBlock({file})
160
185
 
161
186
  function App()
162
187
  {
163
- const demos =[
188
+ const demos =[
189
+ "Hooks",
164
190
  ['stopwatch.jsx', '( useState, useRef )'],
165
- ['pane.jsx', '( useRef, useState, ResizablePane )'],
166
- ['modal.jsx', '( useEffect, useRef, useState )'],
167
191
  ['actionstate.jsx', '( useActionState, useState )'],
192
+ ['usedeffered.jsx', '( useState, useDeferredValue )'],
193
+ ['usetransition.jsx', '( useTransition, useState, useCallback, useId ), emotion:( css, cx )'],
194
+ ['reducer.jsx', '( useReducer )'],
168
195
  ['context.jsx', '( createContext, useContext, useState ), emotion:( css, cx )'],
196
+ "API",
197
+ ['lazy.jsx', '( lazy, require, Suspene, Spinner )'],
169
198
  ['proptypes.jsx', '( PropTypes )'],
199
+ ['redux.jsx', '( Provider, useSelector, useDispatch, connect ), redux:( createStore )'],
200
+ ['transition.jsx', '( useState, Transition )'],
201
+ "Components",
202
+ <!-- ['switch-transition.jsx', '( SwitchTransition, useState )'], -->
170
203
  ['router.jsx', '( HashRouter, NavLink, Routes, Route, useNavigate, useLocation )'],
171
- ['use-deffered.jsx', '( useState, useDeferredValue )'],
204
+ ['modal.jsx', '( useEffect, useRef, useState )'],
205
+ ['pane.jsx', '( useRef, useState, ResizablePane )'],
172
206
  ['css-transition.jsx', '( CSSTransition, useState, useRef )'],
173
- <!-- ['switch-transition.jsx', '( SwitchTransition, useState )'], -->
174
- ['usetransition.jsx', '( useTransition, useState, useCallback, useId ), emotion:( css, cx )'],
175
- ['transition.jsx', '( useState, Transition )'],
176
- ['reducer.jsx', '( useReducer )'],
177
- ['redux.jsx', '( Provider, useSelector, useDispatch, connect ), redux:( createStore )'],
178
207
  ['suspense.jsx', '( Suspense, Spinner )'],
179
- ['lazy.jsx', '( lazy, require, Suspene, Spinner )'],
180
208
  ['form-elements.jsx', '()'],
209
+ "Error Report and Handling",
181
210
  ['error-boundary.jsx', '( ErrorBoundary, useState )'],
182
211
  ['error-parser.jsx', '-- JSX Parser Error --'],
183
212
  ['error-init.jsx', '-- Error in Component initialization --'],
@@ -206,7 +235,7 @@ function App()
206
235
 
207
236
  <p>See the{" "}<a href="../">Lilact Documentation</a>{" "}for more info.</p>
208
237
  </center>
209
- {demos.map((x)=><DemoBlock file={x}/>)}
238
+ {demos.map((x)=><DemoBlock entry={x}/>)}
210
239
 
211
240
  <hr/>
212
241
  <p>