cradova 2.2.2 → 2.2.3

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 (2) hide show
  1. package/dist/index.js +63 -76
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -757,7 +757,10 @@ RouterBox.router = async function(e, force = false) {
757
757
  RouterBox["lastNavigatedRouteController"] = route;
758
758
  RouterBox["pageShow"] && RouterBox["pageShow"](url);
759
759
  } catch (error) {
760
- const errorHandler = RouterBox.routes[RouterBox.params.params._path].errorHandler || RouterBox.errorHandler;
760
+ let errorHandler;
761
+ if (RouterBox.routes[RouterBox.params.params._path]) {
762
+ errorHandler = RouterBox.routes[RouterBox.params.params._path].errorHandler || RouterBox.errorHandler;
763
+ }
761
764
  if (errorHandler) {
762
765
  errorHandler(error);
763
766
  }
@@ -792,7 +795,7 @@ Router["onPageHide"] = function(callback) {
792
795
  );
793
796
  }
794
797
  };
795
- Router.packageScreen = async function(path, data2) {
798
+ Router.packageScreen = async function(path, data2 = {}) {
796
799
  if (!RouterBox.routes[path]) {
797
800
  console.error(" \u2718 Cradova err: no screen with path " + path);
798
801
  throw new Error(" \u2718 Cradova err: cradova err: Not a defined screen path");
@@ -1039,7 +1042,6 @@ var menu = cra("menu");
1039
1042
  var meta = cra("meta");
1040
1043
  var meter = cra("meter");
1041
1044
  var nav = cra("nav");
1042
- var noscript = cra("noscript");
1043
1045
  var object = cra("object");
1044
1046
  var ol = cra("ol");
1045
1047
  var optgroup = cra("optgroup");
@@ -1285,77 +1287,63 @@ var Screen = class {
1285
1287
 
1286
1288
  // lib/index.ts
1287
1289
  var make = function(txx) {
1288
- if (!txx) {
1289
- return {
1290
- tag: "div"
1291
- };
1290
+ if (!txx.length) {
1291
+ return ["DIV"];
1292
+ }
1293
+ if (Array.isArray(txx)) {
1294
+ txx = txx[0];
1292
1295
  }
1293
- let tag;
1294
1296
  let innerValue = "";
1295
1297
  if (txx.includes("|")) {
1296
- const tc = txx.split("|");
1297
- innerValue = tc[1];
1298
- txx = tc[0] && tc[0];
1299
- }
1300
- const itemsPurifier = () => {
1301
- if (!txx.includes("#")) {
1302
- txx = txx.split(".");
1303
- tag = txx[0];
1304
- if (tag) {
1305
- txx.shift();
1306
- } else {
1307
- tag = "div";
1308
- }
1309
- return [txx, []];
1310
- } else {
1311
- if (!txx.includes(".")) {
1312
- txx = txx.split("#");
1313
- tag = txx[0];
1314
- if (tag) {
1315
- txx.shift();
1316
- } else {
1317
- tag = "div";
1318
- }
1319
- if (txx[0].includes(" ")) {
1320
- txx = [txx[0].split(" ")[1]];
1321
- }
1322
- return [[], txx];
1323
- }
1298
+ [txx, innerValue] = txx.split("|");
1299
+ if (!txx) {
1300
+ return ["P", void 0, void 0, innerValue];
1324
1301
  }
1302
+ }
1303
+ let tag;
1304
+ if (!txx.includes("#")) {
1325
1305
  txx = txx.split(".");
1326
- const pureItems = [];
1327
- const impureItems = [];
1328
- tag = !txx[0].includes("#") && txx[0];
1329
- if (tag) {
1330
- txx.shift();
1331
- }
1332
- for (let i2 = 0; i2 < txx.length; i2++) {
1333
- if (txx[i2].includes("#")) {
1334
- const item = txx[i2].split("#");
1335
- impureItems.push(item[1]);
1336
- if (i2 === 0) {
1337
- tag = item[0];
1338
- continue;
1339
- }
1340
- pureItems.push(item[0]);
1306
+ tag = txx.shift();
1307
+ if (!tag) {
1308
+ tag = "DIV";
1309
+ }
1310
+ return [tag, void 0, txx.join(" "), innerValue];
1311
+ } else {
1312
+ if (!txx.includes(".")) {
1313
+ txx = txx.split("#");
1314
+ tag = txx.shift();
1315
+ if (!tag) {
1316
+ tag = "DIV";
1317
+ }
1318
+ if (txx[0].includes(" ")) {
1319
+ txx = [txx[0].split(" ")[1]];
1320
+ }
1321
+ return [tag, txx[0], void 0, innerValue];
1322
+ }
1323
+ }
1324
+ txx = txx.split(".");
1325
+ const classes = [];
1326
+ const IDs = [];
1327
+ tag = !txx[0].includes("#") && txx.shift();
1328
+ if (!tag) {
1329
+ tag = "DIV";
1330
+ }
1331
+ for (let i2 = 0; i2 < txx.length; i2++) {
1332
+ if (txx[i2].includes("#")) {
1333
+ const item = txx[i2].split("#");
1334
+ IDs.push(item[1]);
1335
+ if (i2 === 0) {
1336
+ tag = item[0];
1341
1337
  continue;
1342
1338
  }
1343
- pureItems.push(txx[i2]);
1344
- }
1345
- if (!tag) {
1346
- tag = "div";
1339
+ classes.push(item[0]);
1340
+ continue;
1347
1341
  }
1348
- return [pureItems, impureItems];
1349
- };
1350
- const [classes, ids] = itemsPurifier();
1351
- const ID = ids && ids[0];
1352
- const className = classes && classes.join(" ");
1353
- return { tag, className, ID, innerValue };
1342
+ classes.push(txx[i2]);
1343
+ }
1344
+ return [tag || "DIV", IDs[0], classes.join(" "), innerValue];
1354
1345
  };
1355
1346
  var _2 = (...element_initials) => {
1356
- if (element_initials[0].raw) {
1357
- element_initials[0] = element_initials["raw"][0];
1358
- }
1359
1347
  if (typeof element_initials[0] !== "string") {
1360
1348
  return frag(element_initials);
1361
1349
  }
@@ -1363,29 +1351,29 @@ var _2 = (...element_initials) => {
1363
1351
  let props = void 0;
1364
1352
  let element;
1365
1353
  try {
1366
- element = document.createElement(initials.tag.trim());
1354
+ element = document.createElement(initials[0]);
1367
1355
  } catch (error) {
1368
- throw new TypeError(" \u2718 Cradova err: invalid tag given " + initials.tag);
1356
+ throw new TypeError(" \u2718 Cradova err: invalid tag given " + initials[0]);
1369
1357
  }
1370
- if (initials.className) {
1358
+ if (initials[2]) {
1371
1359
  if (props) {
1372
- props["className"] = initials.className.trim();
1360
+ props["className"] = initials[2];
1373
1361
  } else {
1374
- props = { className: initials.className.trim() };
1362
+ props = { className: initials[2] };
1375
1363
  }
1376
1364
  }
1377
- if (initials.ID) {
1365
+ if (initials[1]) {
1378
1366
  if (props) {
1379
- props["id"] = initials.ID.trim();
1367
+ props["id"] = initials[1];
1380
1368
  } else {
1381
- props = { id: initials.ID.trim() };
1369
+ props = { id: initials[1] };
1382
1370
  }
1383
1371
  }
1384
- if (initials.innerValue) {
1372
+ if (initials[3]) {
1385
1373
  if (props) {
1386
- props["innerText"] = initials.innerValue;
1374
+ props["innerText"] = initials[3];
1387
1375
  } else {
1388
- props = { innerText: initials.innerValue };
1376
+ props = { innerText: initials[3] };
1389
1377
  }
1390
1378
  }
1391
1379
  return makeElement(element, props, ...element_initials);
@@ -1473,7 +1461,6 @@ export {
1473
1461
  meta,
1474
1462
  meter,
1475
1463
  nav,
1476
- noscript,
1477
1464
  object,
1478
1465
  ol,
1479
1466
  optgroup,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cradova",
3
- "version": "2.2.2",
3
+ "version": "2.2.3",
4
4
  "description": "Web framework for building web apps and PWAs",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",