lilact 0.22.0 → 0.23.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 +21 -8
- package/dist/lilact.development.js.map +2 -2
- package/dist/lilact.development.min.js +26 -25
- package/dist/lilact.development.min.js.map +3 -3
- package/dist/lilact.production.min.js +26 -25
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/components.Component.html +1 -1
- package/docs/classes/components.HTMLComponent.html +1 -1
- package/docs/classes/components.RootComponent.html +1 -1
- package/docs/functions/accessories.DragHandle.html +2 -2
- package/docs/functions/accessories.Spinner.html +2 -2
- package/docs/functions/components.cloneComponent.html +1 -0
- package/docs/functions/components.memo.html +1 -1
- package/docs/functions/components.render.html +1 -1
- package/docs/functions/redux.Provider.html +2 -2
- package/docs/functions/redux.connect.html +2 -2
- package/docs/functions/router.HashRouter.html +2 -2
- package/docs/functions/router.Link.html +2 -2
- package/docs/functions/router.NavLink.html +2 -2
- package/docs/functions/router.Routes.html +2 -2
- package/docs/functions/run.lazy.html +3 -3
- package/docs/functions/run.require.html +3 -7
- package/docs/functions/run.runScripts.html +1 -1
- package/docs/functions/timers.timeoutPromise.html +144 -2
- package/docs/functions/transition.CSSTransition.html +4 -4
- package/docs/functions/transition.SwitchTransition.html +2 -2
- package/docs/functions/transition.Transition.html +3 -3
- package/docs/hierarchy.html +1 -1
- package/docs/modules/components.html +1 -1
- package/docs/static/demos/cloneelement.jsx +66 -0
- package/docs/static/demos/reducer.jsx +2 -0
- package/docs/static/demos/router.jsx +1 -1
- package/docs/static/index.html +31 -30
- package/docs/static/lilact.development.js +21 -8
- package/docs/static/lilact.development.js.map +2 -2
- package/docs/static/lilact.development.min.js +26 -25
- package/docs/static/lilact.development.min.js.map +3 -3
- package/docs/static/lilact.production.min.js +26 -25
- package/docs/variables/components.cloneElement.html +1 -0
- package/examples/demos/cloneelement.jsx +66 -0
- package/examples/demos/reducer.jsx +2 -0
- package/examples/demos/router.jsx +1 -1
- package/examples/index.html +31 -30
- package/examples/lilact.development.js +21 -8
- package/examples/lilact.development.js.map +2 -2
- package/examples/lilact.development.min.js +26 -25
- package/examples/lilact.development.min.js.map +3 -3
- package/examples/lilact.production.min.js +26 -25
- package/package.json +1 -1
- package/src/components.jsx +7 -0
- package/src/expscan.js +7 -3
- package/src/lilact.jsx +5 -5
- package/src/run.jsx +6 -8
package/package.json
CHANGED
package/src/components.jsx
CHANGED
|
@@ -1206,6 +1206,13 @@ export function createPortal(children, element)
|
|
|
1206
1206
|
}
|
|
1207
1207
|
|
|
1208
1208
|
|
|
1209
|
+
export function cloneComponent(component, propsPatch, ...children)
|
|
1210
|
+
{
|
|
1211
|
+
return { entity: component.entity, props: {...component.props, ...propsPatch, children} };
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
export const cloneElement = cloneComponent;
|
|
1215
|
+
|
|
1209
1216
|
/**
|
|
1210
1217
|
* Renders a component into a target DOM element.
|
|
1211
1218
|
* If the component maintains internal state, this typically mounts it (or updates the existing tree) under `element`.
|
package/src/expscan.js
CHANGED
|
@@ -174,6 +174,7 @@ export function processImportExports(node, jsx)
|
|
|
174
174
|
const src = jsx.substring(node.out[m.index+imp.length-1].begin, node.out[m.index+imp.length-1].end);
|
|
175
175
|
const imports = {};
|
|
176
176
|
let star_imports = [];
|
|
177
|
+
let import_alls = [];
|
|
177
178
|
|
|
178
179
|
for(i = m.index+1;i<m.index+imp.length-1;i++) {
|
|
179
180
|
|
|
@@ -181,6 +182,7 @@ export function processImportExports(node, jsx)
|
|
|
181
182
|
type: "import",
|
|
182
183
|
begin: begins[m.index],
|
|
183
184
|
end: begins[m.index+imp.length],
|
|
185
|
+
cjs: ''
|
|
184
186
|
});
|
|
185
187
|
|
|
186
188
|
skip_spaces();
|
|
@@ -189,8 +191,7 @@ export function processImportExports(node, jsx)
|
|
|
189
191
|
case ',':
|
|
190
192
|
break;
|
|
191
193
|
case 'I': {
|
|
192
|
-
|
|
193
|
-
imports[prop] = 'default';
|
|
194
|
+
import_alls.push(node.out[i]);
|
|
194
195
|
continue;
|
|
195
196
|
}
|
|
196
197
|
case 'J': {
|
|
@@ -238,9 +239,12 @@ export function processImportExports(node, jsx)
|
|
|
238
239
|
}
|
|
239
240
|
|
|
240
241
|
let cjs = '';
|
|
241
|
-
for(const s of
|
|
242
|
+
for(const s of import_alls) {
|
|
242
243
|
cjs+=`const ${s} = require(${src},{requirer:module});\n`;
|
|
243
244
|
}
|
|
245
|
+
for(const s of star_imports) {
|
|
246
|
+
cjs+=`const ${s} = require(${src},{requirer:module, checkExport: ['default']}).default;\n`;
|
|
247
|
+
}
|
|
244
248
|
if(Object.keys(imports).length) {
|
|
245
249
|
let o = '{';
|
|
246
250
|
let ls = '[';
|
package/src/lilact.jsx
CHANGED
|
@@ -92,7 +92,7 @@ export {transpileJSX, transpilerConfig} from "./jsx";
|
|
|
92
92
|
export const Lilact =
|
|
93
93
|
{
|
|
94
94
|
|
|
95
|
-
VERSION: "beta.
|
|
95
|
+
VERSION: "beta.23",
|
|
96
96
|
|
|
97
97
|
// Configuration
|
|
98
98
|
|
|
@@ -123,10 +123,12 @@ export const Lilact =
|
|
|
123
123
|
redux,
|
|
124
124
|
emotion,
|
|
125
125
|
|
|
126
|
-
default: Lilact,
|
|
127
|
-
|
|
128
126
|
}
|
|
129
127
|
|
|
128
|
+
Lilact.default = Lilact;
|
|
129
|
+
|
|
130
|
+
export default Lilact;
|
|
131
|
+
|
|
130
132
|
Lilact.importObjectPaths = {
|
|
131
133
|
"lilact": Lilact,
|
|
132
134
|
"@emotion/css": Lilact.emotion,
|
|
@@ -153,5 +155,3 @@ if(DEBUG) {
|
|
|
153
155
|
console.log(`Copyright(C) 2024-2026 Arash Kazemi <contact.arash.kazemi@gmail.com>`);
|
|
154
156
|
}
|
|
155
157
|
|
|
156
|
-
export default Lilact;
|
|
157
|
-
|
package/src/run.jsx
CHANGED
|
@@ -135,26 +135,24 @@ if(DEBUG) {
|
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
/**
|
|
138
|
-
* Loads a jsx script from a path.
|
|
139
|
-
*
|
|
140
|
-
* `require` loads synchronously, as it is expected to be loaded on the next instruction.
|
|
141
|
-
*
|
|
142
|
-
* As running the transpiled scripts rely on `new Function`, it is not possible to use module imports
|
|
143
|
-
* and exports. So to import you should use `const {useState} = Lilact` convention. And to
|
|
144
|
-
* export, you should use `module.exports = ...`. `require` returns `module.exports` value
|
|
145
|
-
* so you can import different modules using the convention above.
|
|
138
|
+
* Loads a jsx script from a path. `require` loads synchronously, as it is expected to be loaded on the next instruction.
|
|
146
139
|
*
|
|
147
140
|
* If the path is in the format #id, it will query the document for a script element with the given
|
|
148
141
|
* id and run its contents.
|
|
149
142
|
*
|
|
150
143
|
* If require is called inside the function given to lazy, it will run async. See `lazy`.
|
|
151
144
|
*
|
|
145
|
+
* All required scripts can access Lilact namespace as a global object.
|
|
146
|
+
*
|
|
152
147
|
* @param path - The path to the required file. Must be either absolute path or relative to the current
|
|
153
148
|
* module or document’s URL (the page/location that initiated the request).
|
|
154
149
|
*
|
|
155
150
|
* @param [forceUpdate] - Force re-run module. By default an imported module is only run once.
|
|
151
|
+
*
|
|
156
152
|
* @param [checkExport] - An array of module properties to be checked upon import. This is used for import error detection.
|
|
153
|
+
*
|
|
157
154
|
* @param [isLazy] - if loading is should be async. Returns a promise if true.
|
|
155
|
+
*
|
|
158
156
|
* @param [requirer] - The module that is importing the other module. This is used internally to resolve relative paths.
|
|
159
157
|
*
|
|
160
158
|
* @returns An array representation of the children.
|