lilact 0.8.4 → 0.9.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.
- package/README.md +22 -8
- package/bin/bundle.cjs +46 -37
- package/dist/lilact.development.js +73 -72
- package/dist/lilact.development.js.map +1 -1
- package/dist/lilact.development.min.js +1 -1
- package/dist/lilact.development.min.js.map +1 -1
- package/dist/lilact.production.min.js +1 -1
- package/dist/lilact.production.min.js.map +1 -1
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/accessories.ErrorBoundary.html +7 -7
- package/docs/classes/accessories.Suspense.html +4 -5
- package/docs/classes/components.Component.html +2 -2
- package/docs/classes/components.HTMLComponent.html +1 -1
- package/docs/classes/components.RootComponent.html +1 -1
- package/docs/functions/hooks.createContext.html +3 -2
- package/docs/functions/hooks.useActionState.html +3 -2
- package/docs/functions/hooks.useContext.html +3 -2
- package/docs/functions/hooks.useState.html +3 -2
- package/docs/functions/misc.classNames.html +2 -1
- package/docs/functions/misc.deepEqual.html +3 -1
- package/docs/functions/misc.findDOMNode.html +3 -2
- package/docs/functions/misc.isAsync.html +3 -2
- package/docs/functions/misc.isClass.html +3 -2
- package/docs/functions/misc.isEmpty.html +3 -2
- package/docs/functions/misc.isError.html +3 -2
- package/docs/functions/misc.isThenable.html +3 -2
- package/docs/functions/misc.isValidElement.html +3 -2
- package/docs/functions/misc.shallowEqual.html +3 -1
- package/docs/functions/misc.toBool.html +3 -2
- package/docs/functions/router.NavLink.html +4 -2
- package/docs/functions/router.Route.html +1 -1
- package/docs/functions/router.Routes.html +1 -1
- package/docs/functions/timers.clearInterval.html +3 -2
- package/docs/functions/timers.clearTimeout.html +3 -2
- package/docs/functions/timers.setInterval.html +3 -2
- package/docs/functions/timers.setTimeout.html +4 -2
- package/docs/hierarchy.html +1 -1
- package/docs/index.html +19 -6
- package/docs/modules.html +1 -1
- package/docs/static/lilact.development.js +73 -72
- package/docs/static/lilact.development.min.js +1 -1
- package/docs/static/lilact.production.min.js +1 -1
- package/package.json +1 -1
- package/root/lilact.development.js +73 -72
- package/root/lilact.development.min.js +1 -1
- package/root/lilact.production.min.js +1 -1
- package/src/accessories.jsx +0 -4
- package/src/components.jsx +1 -1
- package/src/hooks.jsx +14 -14
- package/src/jsx.js +8 -5
- package/src/lilact.jsx +1 -1
- package/src/misc.jsx +31 -31
- package/src/router.jsx +3 -1
- package/src/run.jsx +1 -1
- package/src/timers.jsx +8 -8
- package/typedoc.json +1 -1
- package/bin/bundle.js +0 -118
- package/docs/functions/jsx.transpileJSX.html +0 -6
- package/docs/modules/jsx.html +0 -1
package/src/jsx.js
CHANGED
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
// usage outside Lilact. Also make sure to check the default configuration.
|
|
39
39
|
|
|
40
40
|
// There are some situations that are solved with tricks, as some aspects of
|
|
41
|
-
//
|
|
42
|
-
// Works
|
|
41
|
+
// javascript require a complete parser and I didn't want to get into that!
|
|
42
|
+
// Works almost perfectly so far (all observed bugs are fixed), works
|
|
43
43
|
// even on nasty things like the compressed version of tensorflow.js! Feel free
|
|
44
44
|
// to report any bugs, and please include a testable example. Thanks! :)
|
|
45
45
|
|
|
@@ -964,18 +964,21 @@ function generateSourceMap(json, path, jsx_eols, out_eols, mappings=[])
|
|
|
964
964
|
* @returns The transpiled javascript code.
|
|
965
965
|
*/
|
|
966
966
|
|
|
967
|
+
/** @ignore */
|
|
967
968
|
export function transpileJSX( jsx, {
|
|
968
969
|
factory = "createComponent",
|
|
969
970
|
fragment = "Fragment",
|
|
970
971
|
path = "anonymous",
|
|
971
972
|
appendSourcemap = true,
|
|
973
|
+
injectTraceLabels = false,
|
|
974
|
+
discardComments = false,
|
|
975
|
+
|
|
976
|
+
// lilact internal
|
|
972
977
|
blocks_info = {
|
|
973
978
|
labels: {},
|
|
974
979
|
counter: 0
|
|
975
980
|
},
|
|
976
|
-
mappings = []
|
|
977
|
-
injectTraceLabels = false,
|
|
978
|
-
discardComments = false
|
|
981
|
+
mappings = []
|
|
979
982
|
} = {} )
|
|
980
983
|
{
|
|
981
984
|
|
package/src/lilact.jsx
CHANGED
package/src/misc.jsx
CHANGED
|
@@ -54,17 +54,17 @@ const typeOf = (input) => {
|
|
|
54
54
|
* @param value - Value to inspect.
|
|
55
55
|
* @returns True if the value is a class component; otherwise false.
|
|
56
56
|
*/
|
|
57
|
-
export const isValidElement = (
|
|
58
|
-
return
|
|
57
|
+
export const isValidElement = (value) => {
|
|
58
|
+
return value[CORE]!==undefined || value[TEXT]!==undefined;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
62
|
* Utility to find the underlying DOM node for a mounted Lilact component.
|
|
63
63
|
*
|
|
64
|
-
* @param
|
|
64
|
+
* @param component - A Lilact component instance to locate its DOM node.
|
|
65
65
|
* @returns The corresponding DOM element (or null if unavailable).
|
|
66
66
|
*/
|
|
67
|
-
export const findDOMNode = (
|
|
67
|
+
export const findDOMNode = (component)=>{
|
|
68
68
|
|
|
69
69
|
/*
|
|
70
70
|
When a component renders to null or false, findDOMNode returns null.
|
|
@@ -78,8 +78,8 @@ export const findDOMNode = (comp)=>{
|
|
|
78
78
|
|
|
79
79
|
Unlike React, in Lilact findDOMNode can also be used on function components.
|
|
80
80
|
*/
|
|
81
|
-
if(!
|
|
82
|
-
return
|
|
81
|
+
if(!component[CORE]?.element?.parentNode) throw new Error("findDOMNode only works on mounted components.");
|
|
82
|
+
return component[CORE].element;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
/**
|
|
@@ -181,7 +181,7 @@ export function getComponentByPointer()
|
|
|
181
181
|
/**
|
|
182
182
|
* Utility for applying one or more class names to an element.
|
|
183
183
|
*
|
|
184
|
-
* @param
|
|
184
|
+
* @param classes - One or more class name values to combine.
|
|
185
185
|
*/
|
|
186
186
|
export function classNames(classes) {
|
|
187
187
|
return Object.entries(classes)
|
|
@@ -197,8 +197,8 @@ export function classNames(classes) {
|
|
|
197
197
|
* @param value - Value to check for emptiness.
|
|
198
198
|
* @returns True if empty; otherwise false.
|
|
199
199
|
*/
|
|
200
|
-
export function isEmpty(
|
|
201
|
-
for(let i in
|
|
200
|
+
export function isEmpty(value) {
|
|
201
|
+
for(let i in value) return false;
|
|
202
202
|
return true;
|
|
203
203
|
}
|
|
204
204
|
|
|
@@ -206,8 +206,8 @@ export function isEmpty(o) {
|
|
|
206
206
|
/**
|
|
207
207
|
* Determines whether two values are shallowly equal.
|
|
208
208
|
*
|
|
209
|
-
* @param
|
|
210
|
-
* @param
|
|
209
|
+
* @param source - First object to compare.
|
|
210
|
+
* @param target - Second object to compare.
|
|
211
211
|
* @returns True if shallowly equal; otherwise false.
|
|
212
212
|
*/
|
|
213
213
|
export const shallowEqual = (source, target) => {
|
|
@@ -233,8 +233,8 @@ export const shallowEqual = (source, target) => {
|
|
|
233
233
|
/**
|
|
234
234
|
* Determines whether two values are deeply equal.
|
|
235
235
|
*
|
|
236
|
-
* @param
|
|
237
|
-
* @param
|
|
236
|
+
* @param source - First object to compare.
|
|
237
|
+
* @param target - Second object to compare.
|
|
238
238
|
* @returns True if deeply equal; otherwise false.
|
|
239
239
|
*/
|
|
240
240
|
export function deepEqual(source, target) {
|
|
@@ -271,13 +271,13 @@ export function deepEqual(source, target) {
|
|
|
271
271
|
* @param value - Value to inspect.
|
|
272
272
|
* @returns True if the value is a js class; otherwise false.
|
|
273
273
|
*/
|
|
274
|
-
export function isClass(
|
|
274
|
+
export function isClass(value) {
|
|
275
275
|
// from https://stackoverflow.com/a/66120819
|
|
276
|
-
if(!(
|
|
276
|
+
if(!(value && value.constructor === Function) || value.prototype === undefined)
|
|
277
277
|
return false;
|
|
278
|
-
if(Function.prototype !== Object.getPrototypeOf(
|
|
278
|
+
if(Function.prototype !== Object.getPrototypeOf(value))
|
|
279
279
|
return true;
|
|
280
|
-
return Object.getOwnPropertyNames(
|
|
280
|
+
return Object.getOwnPropertyNames(value.prototype).length > 1;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
283
|
/**
|
|
@@ -286,8 +286,8 @@ export function isClass(func) {
|
|
|
286
286
|
* @param value - Value to inspect.
|
|
287
287
|
* @returns True if the value is an async function; otherwise false.
|
|
288
288
|
*/
|
|
289
|
-
export function isAsync(
|
|
290
|
-
return typeof
|
|
289
|
+
export function isAsync(value) {
|
|
290
|
+
return typeof value === 'function' && value.constructor && value.constructor.name === 'AsyncFunction';
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
/**
|
|
@@ -296,8 +296,8 @@ export function isAsync(fn) {
|
|
|
296
296
|
* @param value - Value to inspect.
|
|
297
297
|
* @returns True if thenable; otherwise false.
|
|
298
298
|
*/
|
|
299
|
-
export function isThenable(
|
|
300
|
-
return
|
|
299
|
+
export function isThenable(value) {
|
|
300
|
+
return value && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
/**
|
|
@@ -306,8 +306,8 @@ export function isThenable(x) {
|
|
|
306
306
|
* @param value - Value to inspect.
|
|
307
307
|
* @returns True if thenable; otherwise false.
|
|
308
308
|
*/
|
|
309
|
-
export function isError(
|
|
310
|
-
return
|
|
309
|
+
export function isError(value) {
|
|
310
|
+
return value instanceof Error || Object.prototype.toString.call(value) === '[object Error]';
|
|
311
311
|
}
|
|
312
312
|
|
|
313
313
|
/**
|
|
@@ -316,18 +316,18 @@ export function isError(x) {
|
|
|
316
316
|
* @param value - Value to inspect.
|
|
317
317
|
* @returns boolean value
|
|
318
318
|
*/
|
|
319
|
-
export function toBool(
|
|
320
|
-
if (typeof
|
|
319
|
+
export function toBool(value) {
|
|
320
|
+
if (typeof value === "boolean") return value;
|
|
321
321
|
|
|
322
|
-
if (typeof
|
|
322
|
+
if (typeof value === "number") return value !== 0;
|
|
323
323
|
|
|
324
|
-
if (typeof
|
|
325
|
-
|
|
326
|
-
if (
|
|
327
|
-
if (
|
|
324
|
+
if (typeof value === "string") {
|
|
325
|
+
value = value.trim().toLowerCase();
|
|
326
|
+
if (value === "true") return true;
|
|
327
|
+
if (value === "false") return false;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
return Boolean(
|
|
330
|
+
return Boolean(value);
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
|
package/src/router.jsx
CHANGED
|
@@ -185,6 +185,8 @@ export function NavLink({
|
|
|
185
185
|
className,
|
|
186
186
|
activeStyle,
|
|
187
187
|
style,
|
|
188
|
+
target,
|
|
189
|
+
download,
|
|
188
190
|
replace = false,
|
|
189
191
|
state,
|
|
190
192
|
children,
|
|
@@ -210,7 +212,7 @@ export function NavLink({
|
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
return (
|
|
213
|
-
<a href={href} onClick={handleClick} className={finalClassName} style={mergedStyle} aria-current={isActive ? "page" : undefined} {...rest}>
|
|
215
|
+
<a href={href} onClick={handleClick} target={target} download={download} className={finalClassName} style={mergedStyle} aria-current={isActive ? "page" : undefined} {...rest}>
|
|
214
216
|
{typeof children === "function" ? children({ isActive }) : children}
|
|
215
217
|
</a>
|
|
216
218
|
);
|
package/src/run.jsx
CHANGED
|
@@ -82,7 +82,7 @@ export function run(jsx, path=`InlineJSX-${++Lilact.eval_num}`, is_inline=true)
|
|
|
82
82
|
|
|
83
83
|
processed += "\n//# sourceURL=eval:/" + path;
|
|
84
84
|
|
|
85
|
-
// todo: this seems to be only useful in safari, should be assessed
|
|
85
|
+
// todo: this seems to be only useful in safari, should be assessed later
|
|
86
86
|
Lilact.scanBlockLabels(processed, path);
|
|
87
87
|
|
|
88
88
|
try {
|
package/src/timers.jsx
CHANGED
|
@@ -209,9 +209,9 @@ export function resumeTimers()
|
|
|
209
209
|
*/
|
|
210
210
|
|
|
211
211
|
|
|
212
|
-
export function setTimeout(
|
|
212
|
+
export function setTimeout(callback, delay, ...args)
|
|
213
213
|
{
|
|
214
|
-
return add_timer( { [CALLBACK]:
|
|
214
|
+
return add_timer( { [CALLBACK]: callback, [INTERVAL]: delay, [DUE]: Date.now()+delay, [REPEAT]: false, [ARGS]: args } );
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
/**
|
|
@@ -222,9 +222,9 @@ export function setTimeout(func, interval, ...args)
|
|
|
222
222
|
* @returns {any} Interval id.
|
|
223
223
|
*/
|
|
224
224
|
|
|
225
|
-
export function setInterval(
|
|
225
|
+
export function setInterval(callback, interval, ...args)
|
|
226
226
|
{
|
|
227
|
-
return add_timer( { [CALLBACK]:
|
|
227
|
+
return add_timer( { [CALLBACK]: callback, [INTERVAL]: interval, [DUE]: Date.now()+interval, [REPEAT]: true, [ARGS]: args } );
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
/**
|
|
@@ -232,9 +232,9 @@ export function setInterval(func, interval, ...args)
|
|
|
232
232
|
* @param {any} id - Timeout id returned by `setTimeout`.
|
|
233
233
|
* @returns {void}
|
|
234
234
|
*/
|
|
235
|
-
export function clearTimeout(
|
|
235
|
+
export function clearTimeout(id)
|
|
236
236
|
{
|
|
237
|
-
if(all_timers[
|
|
237
|
+
if(all_timers[id]) all_timers[id][CLEARED] = true;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
/**
|
|
@@ -242,9 +242,9 @@ export function clearTimeout(t)
|
|
|
242
242
|
* @param {any} id - Interval id returned by `setInterval`.
|
|
243
243
|
* @returns {void}
|
|
244
244
|
*/
|
|
245
|
-
export function clearInterval(
|
|
245
|
+
export function clearInterval(id)
|
|
246
246
|
{
|
|
247
|
-
if(all_timers[
|
|
247
|
+
if(all_timers[id]) all_timers[id][CLEARED] = true;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
/**
|
package/typedoc.json
CHANGED
package/bin/bundle.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
|
|
5
|
-
Lilact
|
|
6
|
-
Copyright (C) 2024-2025 Arash Kazemi <contact.arash.kazemi@gmail.com>
|
|
7
|
-
All rights reserved.
|
|
8
|
-
BSD-2-Clause
|
|
9
|
-
|
|
10
|
-
Redistribution and use in source and binary forms, with or without
|
|
11
|
-
modification, are permitted provided that the following conditions are met:
|
|
12
|
-
|
|
13
|
-
* Redistributions of source code must retain the above copyright
|
|
14
|
-
notice, this list of conditions and the following disclaimer.
|
|
15
|
-
* Redistributions in binary form must reproduce the above copyright
|
|
16
|
-
notice, this list of conditions and the following disclaimer in the
|
|
17
|
-
documentation and/or other materials provided with the distribution.
|
|
18
|
-
|
|
19
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
22
|
-
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
|
23
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
24
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
25
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
26
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
27
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
28
|
-
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
29
|
-
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
const path = require("path");
|
|
33
|
-
const webpack = require("webpack");
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
function parseArgs(argv) {
|
|
37
|
-
// Simple args:
|
|
38
|
-
// bundler --entry ./src/index.js --out ./dist/bundle
|
|
39
|
-
const args = {};
|
|
40
|
-
for (let i = 2; i < argv.length; i++) {
|
|
41
|
-
const k = argv[i];
|
|
42
|
-
if (!k.startsWith("--")) continue;
|
|
43
|
-
const key = k.slice(2);
|
|
44
|
-
const v = argv[i + 1];
|
|
45
|
-
i++;
|
|
46
|
-
args[key] = v;
|
|
47
|
-
}
|
|
48
|
-
return args;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
async function run() {
|
|
52
|
-
const args = parseArgs(process.argv);
|
|
53
|
-
|
|
54
|
-
const userProjectRoot = process.cwd(); // MUST be user's project root
|
|
55
|
-
const userEntry = args.entry
|
|
56
|
-
? path.resolve(userProjectRoot, args.entry)
|
|
57
|
-
: null;
|
|
58
|
-
|
|
59
|
-
if (!userEntry) {
|
|
60
|
-
console.error("Usage: bundler --entry ./path/to/entry.js --out ./dist/out");
|
|
61
|
-
process.exit(1);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Locate lilact root reliably (where this CLI is installed)
|
|
65
|
-
const myPackageRoot = path.dirname(require.resolve("lilact/package.json"));
|
|
66
|
-
|
|
67
|
-
// Load config factory from your package
|
|
68
|
-
const configFactoryPath = path.join(myPackageRoot, "webpack.config.factory.cjs");
|
|
69
|
-
const configFactory = require(configFactoryPath);
|
|
70
|
-
|
|
71
|
-
const userOutDir = args.out
|
|
72
|
-
? path.resolve(userProjectRoot, args.out)
|
|
73
|
-
: path.resolve(userProjectRoot, "dist/bundle-out");
|
|
74
|
-
|
|
75
|
-
// Build config using a factory, then override resolution for user's project
|
|
76
|
-
const baseConfig = configFactory({
|
|
77
|
-
entry: userEntry,
|
|
78
|
-
outputPath: userOutDir,
|
|
79
|
-
userProjectRoot
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// ---- Critical: ensure resolution happens from user's project ----
|
|
83
|
-
baseConfig.context = userProjectRoot;
|
|
84
|
-
baseConfig.resolve = baseConfig.resolve || {};
|
|
85
|
-
baseConfig.resolve.modules = [
|
|
86
|
-
path.join(userProjectRoot, "node_modules"),
|
|
87
|
-
"node_modules"
|
|
88
|
-
];
|
|
89
|
-
|
|
90
|
-
const compiler = webpack(baseConfig);
|
|
91
|
-
|
|
92
|
-
compiler.run((err, stats) => {
|
|
93
|
-
// webpack keeps resources; close when available
|
|
94
|
-
compiler.close(() => {});
|
|
95
|
-
|
|
96
|
-
if (err) {
|
|
97
|
-
console.error(err);
|
|
98
|
-
process.exit(1);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (stats?.hasErrors?.()) {
|
|
102
|
-
console.error(stats.toString("errors-only"));
|
|
103
|
-
process.exit(1);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
console.log(
|
|
107
|
-
stats?.toString?.({
|
|
108
|
-
colors: true,
|
|
109
|
-
chunks: false
|
|
110
|
-
}) || "Build finished."
|
|
111
|
-
);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
run().catch((e) => {
|
|
116
|
-
console.error(e);
|
|
117
|
-
process.exit(1);
|
|
118
|
-
});
|
|
@@ -1,6 +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>transpileJSX | 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/jsx.html">jsx</a></li><li><a href="" aria-current="page">transpileJSX</a></li></ul><h1>Function transpileJSX</h1></div><section class="tsd-panel"><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link" id="transpilejsx"><span class="tsd-kind-call-signature">transpileJSX</span><span class="tsd-signature-symbol">(</span><br/> <span class="tsd-kind-parameter">jsx</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol">,</span><br/> <span class="tsd-kind-parameter">__namedParameters</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">appendSourcemap</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">blocks_info</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">counter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">labels</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">discardComments</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">factory</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">fragment</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">injectTraceLabels</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">mappings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">never</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">path</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><a href="#transpilejsx" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>This is the function that transpiles jsx code to js. It is not recommended to use directly.</p>
|
|
2
|
-
<p>Use <code>Lilact.require</code> instead, or <code>Lilact.run</code> available in <code>run</code>, or add a <code><scirpt type="text/jsx" .../></code> to your html.</p>
|
|
3
|
-
<p>Lilact jsx parser doesn't rely on the Lilact itself, and can be used by other engines. The easiest way
|
|
4
|
-
is using the <code>bin/transpile.js</code> script. It has its own help.</p>
|
|
5
|
-
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">jsx</span>: <span class="tsd-signature-type">any</span></span></li><li><span><span class="tsd-kind-parameter">__namedParameters</span>: <span class="tsd-signature-symbol">{</span><br/> <span class="tsd-kind-property">appendSourcemap</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">blocks_info</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">counter</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">labels</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{}</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">discardComments</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">factory</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">fragment</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">injectTraceLabels</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">mappings</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">never</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">;</span><br/> <span class="tsd-kind-property">path</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol"> = {}</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4><p>The transpiled javascript code.</p>
|
|
6
|
-
<aside class="tsd-sources"><ul><li>Defined in jsx.js:967</li></ul></aside></div></li></ul></section></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>
|
package/docs/modules/jsx.html
DELETED
|
@@ -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>jsx | 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="" aria-current="page">jsx</a></li></ul><h1>Module jsx</h1></div><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Functions"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg><h2>Functions</h2></summary><dl class="tsd-member-summaries"><dt class="tsd-member-summary" id="transpilejsx"><span class="tsd-member-summary-name"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><a href="../functions/jsx.transpileJSX.html">transpileJSX</a><a href="#transpilejsx" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></span></dt><dd class="tsd-member-summary"></dd></dl></details></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><details open class="tsd-accordion tsd-page-navigation"><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>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Functions"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Functions</summary><div><a href="#transpilejsx"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Function"><use href="../assets/icons.svg#icon-64"></use></svg><span>transpile<wbr/>JSX</span></a></div></details></div></details></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>
|