lilact 0.21.0 → 0.22.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.
Files changed (122) hide show
  1. package/README.md +17 -4
  2. package/dist/lilact.development.js +486 -39
  3. package/dist/lilact.development.js.map +4 -4
  4. package/dist/lilact.development.min.js +33 -23
  5. package/dist/lilact.development.min.js.map +4 -4
  6. package/dist/lilact.production.min.js +32 -22
  7. package/docs/assets/highlight.css +20 -20
  8. package/docs/classes/accessories.ErrorBoundary.html +8 -8
  9. package/docs/classes/accessories.Suspense.html +7 -7
  10. package/docs/classes/components.Component.html +11 -11
  11. package/docs/classes/components.HTMLComponent.html +12 -12
  12. package/docs/classes/components.RootComponent.html +12 -12
  13. package/docs/functions/accessories.DragHandle.html +2 -2
  14. package/docs/functions/accessories.Spinner.html +2 -2
  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/redux.Provider.html +2 -2
  21. package/docs/functions/redux.connect.html +2 -2
  22. package/docs/functions/router.HashRouter.html +2 -2
  23. package/docs/functions/router.Link.html +2 -2
  24. package/docs/functions/router.NavLink.html +2 -2
  25. package/docs/functions/router.Routes.html +2 -2
  26. package/docs/functions/run.lazy.html +9 -3
  27. package/docs/functions/run.require.html +4 -4
  28. package/docs/functions/run.run.html +1 -1
  29. package/docs/functions/run.runScripts.html +1 -1
  30. package/docs/functions/timers.animationFramePromise.html +1 -1
  31. package/docs/functions/timers.clearInterval.html +1 -1
  32. package/docs/functions/timers.clearTimeout.html +1 -1
  33. package/docs/functions/timers.grabTimers.html +1 -1
  34. package/docs/functions/timers.pauseTimers.html +1 -1
  35. package/docs/functions/timers.releaseTimers.html +1 -1
  36. package/docs/functions/timers.resetTimers.html +1 -1
  37. package/docs/functions/timers.resumeTimers.html +1 -1
  38. package/docs/functions/timers.setInterval.html +1 -1
  39. package/docs/functions/timers.setTimeout.html +1 -1
  40. package/docs/functions/timers.timeoutPromise.html +3 -145
  41. package/docs/functions/transition.CSSTransition.html +4 -4
  42. package/docs/functions/transition.SwitchTransition.html +2 -2
  43. package/docs/functions/transition.Transition.html +3 -3
  44. package/docs/index.html +17 -10
  45. package/docs/static/demos/actionstate.jsx +2 -2
  46. package/docs/static/demos/capture.jsx +2 -2
  47. package/docs/static/demos/context.jsx +3 -3
  48. package/docs/static/demos/css-transition.jsx +3 -3
  49. package/docs/static/demos/error-boundary.jsx +2 -2
  50. package/docs/static/demos/error-callback.jsx +1 -1
  51. package/docs/static/demos/error-component-stack.jsx +2 -2
  52. package/docs/static/demos/error-init.jsx +1 -1
  53. package/docs/static/demos/error-parser.jsx +1 -1
  54. package/docs/static/demos/form-elements.jsx +1 -1
  55. package/docs/static/demos/forwardref.jsx +2 -2
  56. package/docs/static/demos/lazy.jsx +3 -3
  57. package/docs/static/demos/legacy-context.jsx +2 -2
  58. package/docs/static/demos/memo.jsx +2 -2
  59. package/docs/static/demos/modal.jsx +2 -2
  60. package/docs/static/demos/pane.jsx +2 -2
  61. package/docs/static/demos/portal.jsx +4 -2
  62. package/docs/static/demos/priorities.jsx +2 -2
  63. package/docs/static/demos/proptypes.jsx +2 -2
  64. package/docs/static/demos/reducer.jsx +2 -2
  65. package/docs/static/demos/redux.jsx +3 -3
  66. package/docs/static/demos/router.jsx +2 -2
  67. package/docs/static/demos/stopwatch.jsx +2 -2
  68. package/docs/static/demos/suspense.jsx +2 -2
  69. package/docs/static/demos/switch-transition.jsx +2 -2
  70. package/docs/static/demos/transition.jsx +2 -2
  71. package/docs/static/demos/usedefered.jsx +2 -2
  72. package/docs/static/demos/usetransition.jsx +3 -3
  73. package/docs/static/index.html +3 -3
  74. package/docs/static/lilact.development.js +486 -39
  75. package/docs/static/lilact.development.js.map +4 -4
  76. package/docs/static/lilact.development.min.js +33 -23
  77. package/docs/static/lilact.development.min.js.map +4 -4
  78. package/docs/static/lilact.production.min.js +32 -22
  79. package/docs/variables/accessories.SplitPane.html +1 -1
  80. package/examples/demos/actionstate.jsx +2 -2
  81. package/examples/demos/capture.jsx +2 -2
  82. package/examples/demos/context.jsx +3 -3
  83. package/examples/demos/css-transition.jsx +3 -3
  84. package/examples/demos/error-boundary.jsx +2 -2
  85. package/examples/demos/error-callback.jsx +1 -1
  86. package/examples/demos/error-component-stack.jsx +2 -2
  87. package/examples/demos/error-init.jsx +1 -1
  88. package/examples/demos/error-parser.jsx +1 -1
  89. package/examples/demos/form-elements.jsx +1 -1
  90. package/examples/demos/forwardref.jsx +2 -2
  91. package/examples/demos/lazy.jsx +3 -3
  92. package/examples/demos/legacy-context.jsx +2 -2
  93. package/examples/demos/memo.jsx +2 -2
  94. package/examples/demos/modal.jsx +2 -2
  95. package/examples/demos/pane.jsx +2 -2
  96. package/examples/demos/portal.jsx +4 -2
  97. package/examples/demos/priorities.jsx +2 -2
  98. package/examples/demos/proptypes.jsx +2 -2
  99. package/examples/demos/reducer.jsx +2 -2
  100. package/examples/demos/redux.jsx +3 -3
  101. package/examples/demos/router.jsx +2 -2
  102. package/examples/demos/stopwatch.jsx +2 -2
  103. package/examples/demos/suspense.jsx +2 -2
  104. package/examples/demos/switch-transition.jsx +2 -2
  105. package/examples/demos/transition.jsx +2 -2
  106. package/examples/demos/usedefered.jsx +2 -2
  107. package/examples/demos/usetransition.jsx +3 -3
  108. package/examples/index.html +3 -3
  109. package/examples/lilact.development.js +486 -39
  110. package/examples/lilact.development.js.map +4 -4
  111. package/examples/lilact.development.min.js +33 -23
  112. package/examples/lilact.development.min.js.map +4 -4
  113. package/examples/lilact.production.min.js +32 -22
  114. package/impexptest.js +51 -0
  115. package/package.json +4 -4
  116. package/src/components.jsx +1 -6
  117. package/src/expscan.js +404 -0
  118. package/src/jsx.js +26 -28
  119. package/src/lilact.jsx +10 -1
  120. package/src/run.jsx +86 -37
  121. package/src/timers.jsx +0 -5
  122. package/src/jsx.addons.js +0 -70
@@ -2991,7 +2991,7 @@ var Component = class {
2991
2991
  componentWillUnmount () {}
2992
2992
  getSnapshotBeforeUpdate (prevProps, prevState) {}
2993
2993
  shouldComponentUpdate (nextProps, nextState) {}
2994
- getChildContext()
2994
+ getChildContext ()
2995
2995
 
2996
2996
  static getDerivedStateFromError (error) {}
2997
2997
  static getDerivedStateFromProps (props, state) {}
@@ -3543,18 +3543,35 @@ __export(run_exports, {
3543
3543
  run: () => run,
3544
3544
  runScripts: () => runScripts
3545
3545
  });
3546
+ function joinPaths(basePath, relativePath) {
3547
+ const isAbs = relativePath.startsWith("/");
3548
+ const stack = [];
3549
+ const parts = (isAbs ? "" : basePath).split("/").filter(Boolean);
3550
+ for (const p of parts) stack.push(p);
3551
+ if (!basePath.endsWith("/")) stack.pop();
3552
+ const relParts = relativePath.split("/");
3553
+ for (const p of relParts) {
3554
+ if (p === "" || p === ".") continue;
3555
+ if (p === "..") {
3556
+ if (stack.length > 0) stack.pop();
3557
+ } else {
3558
+ stack.push(p);
3559
+ }
3560
+ }
3561
+ return (isAbs ? "/" : "") + stack.join("/");
3562
+ }
3546
3563
  var required_scripts = {};
3547
3564
  function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, is_inline = true) {
3548
3565
  const mappings = [];
3549
- const module = { exports: {} };
3550
- let processed;
3551
- required_scripts[path] = {
3566
+ const module = {
3552
3567
  mappings,
3553
- module,
3554
3568
  is_inline,
3555
3569
  path,
3556
- code: jsx
3570
+ code: jsx,
3571
+ exports: {}
3557
3572
  };
3573
+ let processed;
3574
+ required_scripts[path] = module;
3558
3575
  try {
3559
3576
  processed = lilact_default.transpileJSX(
3560
3577
  jsx,
@@ -3564,7 +3581,8 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, is_inline = t
3564
3581
  factory: "createComponent",
3565
3582
  appendSourcemap: false,
3566
3583
  blocks_info: lilact_default.blocks_info,
3567
- injectTraceLabels: true
3584
+ injectTraceLabels: true,
3585
+ produceCJS: true
3568
3586
  }
3569
3587
  );
3570
3588
  } catch (e) {
@@ -3588,32 +3606,38 @@ function run(jsx, path = `InlineJSX-${++lilact_default.eval_num}`, is_inline = t
3588
3606
  throw e;
3589
3607
  }
3590
3608
  }
3591
- function require2(path2, forceUpdate) {
3592
- var _a;
3593
- if (required_scripts[path2] && !forceUpdate) return required_scripts[path2].module.exports;
3609
+ function require2(path2, { forceUpdate, checkExport, requirer, isLazy }) {
3610
+ var _a, _b;
3611
+ if ((_a = lilact_default.importObjectPaths) == null ? void 0 : _a[path2]) return lilact_default.importObjectPaths[path2];
3612
+ if (required_scripts[path2] && !forceUpdate) return required_scripts[path2].exports;
3594
3613
  if (path2[0] === "#") {
3595
3614
  const el = document.getElementById(path2);
3596
3615
  if (el) {
3597
3616
  return run(el.innerText, path2);
3598
3617
  }
3599
- } else if ((_a = lilact_default) == null ? void 0 : _a[LAZY]) {
3600
- lilact_default[LAZY] = false;
3601
- return fetch(path2).then((res2) => {
3602
- if (!res2.ok) throw new Error(`HTTP ${res2.status}`);
3603
- return res2.text();
3604
- }).then((res2) => {
3605
- var _a2;
3606
- res2 = run(res2, path2, false);
3607
- return (_a2 = res2 == null ? void 0 : res2.default) != null ? _a2 : res2;
3608
- }).catch((err) => {
3609
- throw err;
3610
- });
3611
3618
  } else {
3612
- const request = new XMLHttpRequest();
3613
- request.open("GET", path2, false);
3614
- request.send(null);
3615
- if (request.status === 200) {
3616
- return run(request.responseText, path2, false);
3619
+ if (requirer && requirer.path) {
3620
+ path2 = joinPaths(requirer.path, path2);
3621
+ }
3622
+ if (((_b = lilact_default) == null ? void 0 : _b[LAZY]) || isLazy) {
3623
+ lilact_default[LAZY] = false;
3624
+ return fetch(path2).then((res2) => {
3625
+ if (!res2.ok) throw new Error(`HTTP ${res2.status}`);
3626
+ return res2.text();
3627
+ }).then((res2) => {
3628
+ var _a2;
3629
+ res2 = run(res2, path2, false);
3630
+ return (_a2 = res2 == null ? void 0 : res2.default) != null ? _a2 : res2;
3631
+ }).catch((err) => {
3632
+ throw err;
3633
+ });
3634
+ } else {
3635
+ const request = new XMLHttpRequest();
3636
+ request.open("GET", path2, false);
3637
+ request.send(null);
3638
+ if (request.status === 200) {
3639
+ return run(request.responseText, path2, false);
3640
+ }
3617
3641
  }
3618
3642
  }
3619
3643
  throw new Error(`Required resource not found (${path2})`);
@@ -5074,9 +5098,420 @@ function encode_integer(num) {
5074
5098
  return result;
5075
5099
  }
5076
5100
 
5101
+ // .tmp/src/expscan.js
5102
+ var keywords = /* @__PURE__ */ new Set([
5103
+ "break",
5104
+ "case",
5105
+ "catch",
5106
+ "class",
5107
+ "const",
5108
+ "continue",
5109
+ "debugger",
5110
+ "default",
5111
+ "do",
5112
+ "else",
5113
+ "export",
5114
+ "extends",
5115
+ "finally",
5116
+ "for",
5117
+ "function",
5118
+ "if",
5119
+ "import",
5120
+ "in",
5121
+ "instanceof",
5122
+ "super",
5123
+ "switch",
5124
+ "this",
5125
+ "throw",
5126
+ "try",
5127
+ "var",
5128
+ "while",
5129
+ "with",
5130
+ "yield",
5131
+ "return",
5132
+ "true",
5133
+ "false",
5134
+ "null",
5135
+ "undefined",
5136
+ "enum",
5137
+ "implements",
5138
+ "interface",
5139
+ "let",
5140
+ "package",
5141
+ "private",
5142
+ "protected",
5143
+ "public",
5144
+ "static",
5145
+ "yield",
5146
+ "as",
5147
+ "from",
5148
+ "of",
5149
+ "async",
5150
+ "get",
5151
+ "set",
5152
+ "static",
5153
+ "super",
5154
+ "delete",
5155
+ "void",
5156
+ "typeof",
5157
+ "new",
5158
+ "await"
5159
+ ]);
5160
+ var operators = /* @__PURE__ */ new Set([
5161
+ "(",
5162
+ ")",
5163
+ "{",
5164
+ "}",
5165
+ "[",
5166
+ "]",
5167
+ "...",
5168
+ ".",
5169
+ "=>",
5170
+ ",",
5171
+ ";",
5172
+ ":",
5173
+ "?",
5174
+ "++",
5175
+ "--",
5176
+ "+",
5177
+ "-",
5178
+ "*",
5179
+ "/",
5180
+ "%",
5181
+ "**",
5182
+ ">>",
5183
+ "<<",
5184
+ ">>>",
5185
+ "<<<",
5186
+ "&",
5187
+ "|",
5188
+ "^",
5189
+ "~",
5190
+ "==",
5191
+ "!=",
5192
+ "===",
5193
+ "!==",
5194
+ ">",
5195
+ "<",
5196
+ ">=",
5197
+ "<=",
5198
+ "&&",
5199
+ "||",
5200
+ "??",
5201
+ "?.",
5202
+ "=",
5203
+ "+=",
5204
+ "-=",
5205
+ "*=",
5206
+ "/=",
5207
+ "%=",
5208
+ "**=",
5209
+ "<<=",
5210
+ ">>=",
5211
+ ">>>=",
5212
+ "&=",
5213
+ "|=",
5214
+ "^=",
5215
+ "??=",
5216
+ "&&=",
5217
+ "||=",
5218
+ "!"
5219
+ ]);
5220
+ function isNumber(s) {
5221
+ if (!/^(?:[+-]?(?:(?:\d(?:\d|_)*)(?:\.(?:\d(?:\d|_)*))?|\.(?:\d(?:\d|_)*))(?:[eE][+-]?(?:\d(?:\d|_)*))?|[+-]?Infinity|[+-]?NaN|[+-]?(?:(?:0[xX](?:[0-9a-fA-F](?:[0-9a-fA-F]|_)*))|(?:0[oO](?:[0-7](?:[0-7]|_)*))|(?:0[bB](?:[01](?:[01]|_)*))|(?:\d(?:\d|_)*))n)$/u.test(s)) return false;
5222
+ return !keywords.has(s);
5223
+ }
5224
+ function isUnicodeEscapeSequence(s) {
5225
+ if (!/(?:\\u\{[0-9a-fA-F]+\}|\\u[0-9a-fA-F]{4})/g.test(s)) return false;
5226
+ return !keywords.has(s);
5227
+ }
5228
+ function isValidIdentifierName(s) {
5229
+ if (!/^(?:[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*)$/u.test(s)) return false;
5230
+ return !keywords.has(s);
5231
+ }
5232
+ function labeler(custom_words, x) {
5233
+ if (typeof x === "string") {
5234
+ if (custom_words && custom_words.hasOwnProperty(x)) return custom_words[x];
5235
+ if (x.trim() === "") {
5236
+ if (x.indexOf("\n") !== -1) return "\n";
5237
+ return " ";
5238
+ }
5239
+ if (keywords.has(x)) return "K";
5240
+ if (operators.has(x)) return "O";
5241
+ if (isValidIdentifierName(x)) return "I";
5242
+ if (isUnicodeEscapeSequence(x)) return "U";
5243
+ if (isNumber(x)) return "N";
5244
+ } else if (typeof x === "object") {
5245
+ if (x.type === "comment") return "C";
5246
+ if (x.type === "regexp") return "R";
5247
+ if (x.type === "js") return "J";
5248
+ if (x.type === "paranthesis") return "P";
5249
+ if (x.type === "string") return "S";
5250
+ if (x.type === "xml") return "X";
5251
+ }
5252
+ return "?";
5253
+ }
5254
+ function generateSequence(arr, labeler2 = labeler2.bind(null, null)) {
5255
+ return arr.map(labeler2).join("");
5256
+ }
5257
+ var import_export_regexp = /(?:i[C \n]*(?:(?:I|J|(?:\*[C \n]*a[C \n]*I))[C \n]*,[C \n]*)*(?:(?:(?:I(?:[C \n]*a[C \n]*I)?)|J|(?:\*[C \n]*a[C \n]*I))[C \n]*f[C \n]*)?S)|(?:e[C \n]*(?:(?:[*J][C \n]*f[C \n]*S)|(?:d[C \n]*[IFJ])|J|(?:[VF][c \n]*I)|I))|(?:r[c \n]*P)/mg;
5258
+ var props_regexp = /O[C \n]*(?:[Id](?:[C \n]*a[C \n]*I)?[C \n]*,[C \n]*)*(?:I(?:[C \n]*a[C \n]*I)?)[C \n]*O/mg;
5259
+ function processImportExports(node3, jsx2) {
5260
+ const s = generateSequence(
5261
+ node3.out,
5262
+ labeler.bind(
5263
+ null,
5264
+ {
5265
+ "import": "i",
5266
+ "export": "e",
5267
+ "as": "a",
5268
+ "from": "f",
5269
+ ",": ",",
5270
+ ".": ".",
5271
+ "*": "*",
5272
+ ";": ";",
5273
+ "var": "V",
5274
+ "let": "V",
5275
+ "const": "V",
5276
+ "function": "F",
5277
+ "class": "F",
5278
+ "=": "=",
5279
+ "default": "d",
5280
+ "require": "r"
5281
+ }
5282
+ )
5283
+ );
5284
+ let i2;
5285
+ const skip_spaces = (dir = 1) => {
5286
+ while (s[i2] === " " || s[i2] === "\n" || s[i2] === "C") {
5287
+ if (dir === 1) node3.out[i2] = null;
5288
+ i2 += dir;
5289
+ }
5290
+ };
5291
+ let begin = node3.begin;
5292
+ const begins = [];
5293
+ for (i2 = 0; i2 < node3.out.length; i2++) {
5294
+ if (i2 == 0) begins.push(node3.begin);
5295
+ else {
5296
+ if (typeof node3.out[i2 - 1] === "string") {
5297
+ begins.push(begins[i2 - 1] + node3.out[i2 - 1].length);
5298
+ } else {
5299
+ begins.push(node3.out[i2 - 1].end);
5300
+ }
5301
+ }
5302
+ }
5303
+ begins.push(node3.end);
5304
+ for (const m of s.matchAll(import_export_regexp)) {
5305
+ if (m[0].startsWith("r")) {
5306
+ const req = m[0];
5307
+ const args = node3.out[m.index + req.length - 1].out;
5308
+ if (args.length === 1) {
5309
+ args.push(", {requirer:module}");
5310
+ }
5311
+ } else if (m[0].startsWith("i")) {
5312
+ const imp = m[0];
5313
+ i2 = m.index - 1;
5314
+ skip_spaces(-1);
5315
+ if (s[i2] === ".") continue;
5316
+ const src = jsx2.substring(node3.out[m.index + imp.length - 1].begin, node3.out[m.index + imp.length - 1].end);
5317
+ const imports = {};
5318
+ let star_imports = [];
5319
+ for (i2 = m.index + 1; i2 < m.index + imp.length - 1; i2++) {
5320
+ node3.out.splice(m.index, 1, {
5321
+ type: "import",
5322
+ begin: begins[m.index],
5323
+ end: begins[m.index + imp.length]
5324
+ });
5325
+ skip_spaces();
5326
+ switch (s[i2]) {
5327
+ case ",":
5328
+ break;
5329
+ case "I": {
5330
+ const prop = node3.out[i2];
5331
+ imports[prop] = "default";
5332
+ continue;
5333
+ }
5334
+ case "J": {
5335
+ let sj = generateSequence(
5336
+ node3.out[i2].out,
5337
+ labeler.bind(
5338
+ null,
5339
+ { "as": "a", ",": "," }
5340
+ )
5341
+ );
5342
+ props_regexp.lastIndex = -1;
5343
+ if (!props_regexp.test(sj)) throw "incorrect import properties definition.";
5344
+ const ps = node3.out[i2].out;
5345
+ for (let j = 1; j < sj.length - 1; j++) {
5346
+ while (sj[j] === " " || sj[j] === "\n" || sj[j] === "C" || sj[j] === ",") j++;
5347
+ const prop = ps[j];
5348
+ j++;
5349
+ while (sj[j] === " " || sj[j] === "\n" || sj[j] === "C") j++;
5350
+ if (sj[j] === "a") {
5351
+ j++;
5352
+ while (sj[j] === " " || sj[j] === "\n" || sj[j] === "C") j++;
5353
+ imports[ps[j]] = prop;
5354
+ j++;
5355
+ } else {
5356
+ imports[prop] = prop;
5357
+ }
5358
+ }
5359
+ continue;
5360
+ }
5361
+ case "*": {
5362
+ i2++;
5363
+ skip_spaces();
5364
+ i2++;
5365
+ skip_spaces();
5366
+ star_imports.push(node3.out[i2]);
5367
+ continue;
5368
+ }
5369
+ case "S":
5370
+ for (i2 = m.index + 1; i2 < m.index + imp.length; i2++) {
5371
+ node3.out[i2] = null;
5372
+ }
5373
+ let cjs = "";
5374
+ for (const s2 of star_imports) {
5375
+ cjs += `const ${s2} = require(${src},{requirer:module});
5376
+ `;
5377
+ }
5378
+ if (Object.keys(imports).length) {
5379
+ let o = "{";
5380
+ let ls = "[";
5381
+ for (const p in imports) {
5382
+ if (o.length > 1) {
5383
+ o += ",";
5384
+ ls += ",";
5385
+ }
5386
+ if (p === imports[p]) {
5387
+ o += p;
5388
+ ls += `'${p}'`;
5389
+ } else {
5390
+ o += p + ":" + imports[p];
5391
+ ls += `'${imports[p]}'`;
5392
+ }
5393
+ }
5394
+ o += "}";
5395
+ ls += "]";
5396
+ cjs += `const ${o} = require(${src}, {checkExport: ${ls},requirer:module})`;
5397
+ } else {
5398
+ cjs += `require(${src},{requirer:module})`;
5399
+ }
5400
+ node3.out[m.index].cjs = cjs;
5401
+ continue;
5402
+ }
5403
+ }
5404
+ } else {
5405
+ const exp = m[0];
5406
+ node3.out.splice(m.index, 1, {
5407
+ type: "export",
5408
+ begin: begins[m.index],
5409
+ end: begins[m.index + 1]
5410
+ });
5411
+ i2 = m.index - 1;
5412
+ skip_spaces(-1);
5413
+ if (s[i2] === ".") continue;
5414
+ i2 = m.index + 1;
5415
+ skip_spaces();
5416
+ switch (s[i2]) {
5417
+ case "d":
5418
+ node3.out[i2] = null;
5419
+ node3.out[m.index].cjs = "module.exports.default =";
5420
+ continue;
5421
+ case "V":
5422
+ case "F":
5423
+ const j = i2;
5424
+ const type = s[i2] === "F" ? `= ${node3.out[i2]} ` : "";
5425
+ node3.out[i2] = null;
5426
+ i2++;
5427
+ skip_spaces();
5428
+ const name = node3.out[i2];
5429
+ if (s[j] === "V") {
5430
+ node3.out[i2] = null;
5431
+ i2++;
5432
+ }
5433
+ skip_spaces();
5434
+ node3.out[m.index].cjs = `module.exports.${name} ${type}`;
5435
+ continue;
5436
+ case "*":
5437
+ node3.out[i2] = null;
5438
+ i2++;
5439
+ skip_spaces();
5440
+ node3.out[i2] = null;
5441
+ i2++;
5442
+ skip_spaces();
5443
+ const src = jsx2.substring(node3.out[i2].begin, node3.out[i2].end);
5444
+ node3.out[i2] = null;
5445
+ node3.out[m.index].cjs = `Object.assign(module.exports, require(${src},{requirer:module}))`;
5446
+ continue;
5447
+ case "I":
5448
+ node3.out[m.index].cjs = `module.exports.${node3.out[i2]} = `;
5449
+ continue;
5450
+ case "J": {
5451
+ const exports = {};
5452
+ let sj = generateSequence(
5453
+ node3.out[i2].out,
5454
+ labeler.bind(
5455
+ null,
5456
+ { "as": "a", ",": ",", "default": "I" }
5457
+ )
5458
+ );
5459
+ props_regexp.lastIndex = -1;
5460
+ if (!props_regexp.test(sj)) throw "incorrect export properties definition.";
5461
+ const ps = node3.out[i2].out;
5462
+ for (let j2 = 1; j2 < sj.length - 1; j2++) {
5463
+ while (sj[j2] === " " || sj[j2] === "\n" || sj[j2] === "C" || sj[j2] === ",") j2++;
5464
+ const prop = ps[j2];
5465
+ j2++;
5466
+ while (sj[j2] === " " || sj[j2] === "\n" || sj[j2] === "C") j2++;
5467
+ if (sj[j2] === "a") {
5468
+ j2++;
5469
+ while (sj[j2] === " " || sj[j2] === "\n" || sj[j2] === "C") j2++;
5470
+ exports[ps[j2]] = prop;
5471
+ j2++;
5472
+ } else {
5473
+ exports[prop] = prop;
5474
+ }
5475
+ }
5476
+ let o = "{";
5477
+ let ls = "{";
5478
+ for (const p in exports) {
5479
+ if (o.length > 1) {
5480
+ o += ",";
5481
+ ls += ",";
5482
+ }
5483
+ if (p === exports[p]) {
5484
+ o += p;
5485
+ ls += p;
5486
+ } else {
5487
+ o += p + ":" + exports[p];
5488
+ ls += exports[p];
5489
+ }
5490
+ }
5491
+ o += "}";
5492
+ ls += "}";
5493
+ node3.out[i2] = null;
5494
+ i2++;
5495
+ skip_spaces();
5496
+ if (node3.out[i2] === "from") {
5497
+ node3.out[i2] = null;
5498
+ i2++;
5499
+ skip_spaces();
5500
+ const src2 = jsx2.substring(node3.out[i2].begin, node3.out[i2].end);
5501
+ node3.out[i2] = null;
5502
+ node3.out[m.index].cjs = `{ const ${o} = require(${src2},{requirer:module}); Object.assign(module.exports, ${ls}); }`;
5503
+ } else {
5504
+ node3.out[m.index].cjs = `Object.assign(module.exports, ${o})`;
5505
+ }
5506
+ continue;
5507
+ }
5508
+ }
5509
+ }
5510
+ }
5511
+ }
5512
+
5077
5513
  // .tmp/src/jsx.js
5078
5514
  var transpilerConfig = {
5079
- //addons: jsxAddons, // addons are not used anymore
5080
5515
  setBlockLabels: true,
5081
5516
  enableLabelStack: false,
5082
5517
  injectLabels: true,
@@ -5085,9 +5520,9 @@ var transpilerConfig = {
5085
5520
  preprocessorDelimiter: "\u0294"
5086
5521
  // alt+shift+. on apple abc extended layout
5087
5522
  };
5088
- var TRANSPILER_OUTPUT = /* @__PURE__ */ Symbol.for("LILACT:TRANSPILER_OUTPUT");
5089
5523
  var raiseError;
5090
5524
  var tab = 0;
5525
+ var TOKENIZE_RE = /(\{|\}|\[|\]|\(|\)|\.\.\.|=>|\?\?=|\?\?|\?\.|===|!==|>>>|<<=|>>=|>>>=|\*\*=|\*\*|&&=|\|\|=|<=|>=|==|!=|<<|>>|\+\+|--|\+=|-=|\*=|\/=|%=|&=|\^=|\|=|=|\+|-|\*|\/|%|&|\^|\||!|~|\?|:|<|>|=|\.|,|;|\n+|[\s^\n]+)/gm;
5091
5526
  function lookAhead(f, code2, index2, ...args) {
5092
5527
  const b2 = f(code2, index2, ...args);
5093
5528
  if (b2) {
@@ -5283,7 +5718,7 @@ function parseString(code2, index2, q, container2) {
5283
5718
  case "$":
5284
5719
  if (q === "`") {
5285
5720
  if (code2[index2 + 1] === "{") {
5286
- [index2] = lookAhead(parseJS, code2, index2 + 1, true, container2);
5721
+ [index2] = lookAhead(parseJS, code2, index2 + 1, true);
5287
5722
  index2--;
5288
5723
  }
5289
5724
  }
@@ -5541,7 +5976,7 @@ function parseParanthesis(code2, index2, container2) {
5541
5976
  case '"':
5542
5977
  case "'":
5543
5978
  case "`":
5544
- [index2] = lookAhead(parseString, code2, index2, ch2);
5979
+ [index2] = lookAhead(parseString, code2, index2, ch2, b2);
5545
5980
  break;
5546
5981
  case "{":
5547
5982
  [index2] = lookAhead(parseJS, code2, index2, true, b2);
@@ -5591,7 +6026,7 @@ function parseJS(code2, index2 = 0, is_block = false, container2) {
5591
6026
  case '"':
5592
6027
  case "'":
5593
6028
  case "`":
5594
- [index2] = lookAhead(parseString, code2, index2, ch2);
6029
+ [index2] = lookAhead(parseString, code2, index2, ch2, b2);
5595
6030
  break;
5596
6031
  case "{": {
5597
6032
  const i2 = index2;
@@ -5742,12 +6177,12 @@ function generateSourceMap(json, path2, jsx_eols, out_eols, mappings2 = []) {
5742
6177
  };
5743
6178
  const scan_leaves = (node3) => {
5744
6179
  var _a;
5745
- if (((_a = node3.out) == null ? void 0 : _a.length) > 0) {
6180
+ if (((_a = node3 == null ? void 0 : node3.out) == null ? void 0 : _a.length) > 0) {
5746
6181
  for (const ch2 of node3.out) {
5747
6182
  scan_leaves(ch2);
5748
6183
  }
5749
6184
  }
5750
- if (node3.begin !== void 0 && node3.out_index !== void 0) {
6185
+ if ((node3 == null ? void 0 : node3.begin) !== void 0 && (node3 == null ? void 0 : node3.out_index) !== void 0) {
5751
6186
  mpps.push([...getRowCol(out_eols, node3.out_index), ...getRowCol(jsx_eols, node3.begin), node3]);
5752
6187
  }
5753
6188
  };
@@ -5787,6 +6222,7 @@ function transpileJSX(jsx2, {
5787
6222
  appendSourcemap = true,
5788
6223
  injectTraceLabels = false,
5789
6224
  discardComments = false,
6225
+ produceCJS = false,
5790
6226
  // lilact internal
5791
6227
  blocks_info: blocks_info2 = {
5792
6228
  labels: {},
@@ -5806,7 +6242,6 @@ function transpileJSX(jsx2, {
5806
6242
  er.lilact_trace = "parse";
5807
6243
  throw er;
5808
6244
  }).bind(null, eols);
5809
- const tokenize_re = /([\{\}\(\),;\[\]\n]|[\s^\n]+)/g;
5810
6245
  const json = parseJS(jsx2);
5811
6246
  json.data = jsx2;
5812
6247
  const prepare = (node3) => {
@@ -5828,7 +6263,7 @@ function transpileJSX(jsx2, {
5828
6263
  if (node3.type === "xml") {
5829
6264
  node3.children.splice(chi, 0, '"' + s.replaceAll("\n", "\\\n").replaceAll('"', '\\"') + '"');
5830
6265
  } else {
5831
- node3.children.splice(chi, 0, ...s.split(tokenize_re));
6266
+ node3.children.splice(chi, 0, ...s.split(TOKENIZE_RE));
5832
6267
  }
5833
6268
  chi++;
5834
6269
  }
@@ -5848,7 +6283,7 @@ function transpileJSX(jsx2, {
5848
6283
  "\n": "\\\n"
5849
6284
  })[m]) + '"');
5850
6285
  } else {
5851
- node3.children.push(...s.split(tokenize_re));
6286
+ node3.children.push(...s.split(TOKENIZE_RE));
5852
6287
  }
5853
6288
  }
5854
6289
  }
@@ -5862,14 +6297,18 @@ function transpileJSX(jsx2, {
5862
6297
  preprocessPragmas(json);
5863
6298
  const codify = (outlen, node3, is_attr = false, is_xml = false) => {
5864
6299
  if (typeof node3 !== "object") return node3;
6300
+ if (node3 === null) return "";
5865
6301
  node3.out_index = outlen;
5866
6302
  if (node3.type === "string") return jsx2.substring(node3.begin, node3.end);
6303
+ if (node3.type === "import") return node3.cjs;
6304
+ if (node3.type === "export") return node3.cjs;
5867
6305
  if (node3.type === "regex") return jsx2.substring(node3.begin, node3.end);
5868
6306
  if (node3.type === "comment") return discardComments || is_attr ? "" : jsx2.substring(node3.begin, node3.end);
5869
6307
  if (node3.type === "directive") return node3.value;
5870
6308
  if (node3.type === "paranthesis") {
5871
6309
  let out2 = "(";
5872
6310
  if (node3.out) {
6311
+ if (produceCJS) processImportExports(node3, jsx2);
5873
6312
  for (const ch2 of node3.out) {
5874
6313
  out2 += codify(outlen + out2.length - 1, ch2);
5875
6314
  }
@@ -5879,6 +6318,7 @@ function transpileJSX(jsx2, {
5879
6318
  if (node3.type === "js") {
5880
6319
  let out2 = "";
5881
6320
  if (node3.out) {
6321
+ if (produceCJS) processImportExports(node3, jsx2);
5882
6322
  for (const ch2 of node3.out) {
5883
6323
  if (is_xml && ch2.type === "comment") continue;
5884
6324
  out2 += codify(outlen + out2.length - (is_attr ? 1 : 0), ch2);
@@ -5947,7 +6387,7 @@ function transpileJSX(jsx2, {
5947
6387
 
5948
6388
  // .tmp/src/lilact.jsx
5949
6389
  var Lilact2 = {
5950
- VERSION: "beta.21",
6390
+ VERSION: "beta.22",
5951
6391
  // Configuration
5952
6392
  defaultTransitionTimeout: 300,
5953
6393
  defaultIsEqual: Object.is,
@@ -5969,11 +6409,18 @@ var Lilact2 = {
5969
6409
  // Dependencies
5970
6410
  PropTypes,
5971
6411
  redux: redux_exports,
5972
- emotion: emotion_css_esm_exports
6412
+ emotion: emotion_css_esm_exports,
6413
+ default: Lilact2
6414
+ };
6415
+ Lilact2.importObjectPaths = {
6416
+ "lilact": Lilact2,
6417
+ "@emotion/css": Lilact2.emotion,
6418
+ "redux": Lilact2.redux
5973
6419
  };
5974
6420
  globalThis.Lilact = Lilact2;
5975
6421
  globalThis.createComponent = Lilact2.createComponent;
5976
6422
  globalThis.Fragment = Lilact2.Fragment;
6423
+ globalThis.require = Lilact2.require;
5977
6424
  document.addEventListener("DOMContentLoaded", () => {
5978
6425
  Lilact2.runScripts();
5979
6426
  });