@constela/core 0.17.1 → 0.17.2

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 +43 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -990,7 +990,7 @@ function isObject3(value) {
990
990
  var VALID_VIEW_KINDS = ["element", "text", "if", "each", "component", "slot", "markdown", "code", "portal", "island"];
991
991
  var VALID_EXPR_TYPES = ["lit", "state", "var", "bin", "not", "param", "cond", "get", "style", "validity", "index", "call", "lambda", "array"];
992
992
  var VALID_PARAM_TYPES = ["string", "number", "boolean", "json"];
993
- var VALID_ACTION_TYPES = ["set", "update", "setPath", "fetch", "delay", "interval", "clearTimer", "focus", "if"];
993
+ var VALID_ACTION_TYPES = ["set", "update", "setPath", "fetch", "delay", "interval", "clearTimer", "focus", "if", "storage", "dom"];
994
994
  var VALID_STATE_TYPES = ["number", "string", "list", "boolean", "object"];
995
995
  var VALID_BIN_OPS = BINARY_OPERATORS;
996
996
  var VALID_UPDATE_OPS = UPDATE_OPERATIONS;
@@ -1502,6 +1502,48 @@ function validateActionStep(step, path) {
1502
1502
  }
1503
1503
  }
1504
1504
  break;
1505
+ case "storage":
1506
+ if (!("operation" in step)) {
1507
+ return { path: path + "/operation", message: "operation is required" };
1508
+ }
1509
+ if (!["get", "set", "remove"].includes(step["operation"])) {
1510
+ return { path: path + "/operation", message: "must be one of: get, set, remove" };
1511
+ }
1512
+ if (!("key" in step)) {
1513
+ return { path: path + "/key", message: "key is required" };
1514
+ }
1515
+ {
1516
+ const keyError = validateExpression(step["key"], path + "/key");
1517
+ if (keyError) return keyError;
1518
+ if (step["operation"] === "set" && "value" in step) {
1519
+ const valueError = validateExpression(step["value"], path + "/value");
1520
+ if (valueError) return valueError;
1521
+ }
1522
+ }
1523
+ break;
1524
+ case "dom":
1525
+ if (!("operation" in step)) {
1526
+ return { path: path + "/operation", message: "operation is required" };
1527
+ }
1528
+ if (!["addClass", "removeClass", "toggleClass", "setAttribute", "removeAttribute"].includes(step["operation"])) {
1529
+ return { path: path + "/operation", message: "must be one of: addClass, removeClass, toggleClass, setAttribute, removeAttribute" };
1530
+ }
1531
+ if (!("selector" in step)) {
1532
+ return { path: path + "/selector", message: "selector is required" };
1533
+ }
1534
+ {
1535
+ const selectorError = validateExpression(step["selector"], path + "/selector");
1536
+ if (selectorError) return selectorError;
1537
+ if ("value" in step) {
1538
+ const valueError = validateExpression(step["value"], path + "/value");
1539
+ if (valueError) return valueError;
1540
+ }
1541
+ if ("attribute" in step) {
1542
+ const attrError = validateExpression(step["attribute"], path + "/attribute");
1543
+ if (attrError) return attrError;
1544
+ }
1545
+ }
1546
+ break;
1505
1547
  }
1506
1548
  return null;
1507
1549
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/core",
3
- "version": "0.17.1",
3
+ "version": "0.17.2",
4
4
  "description": "Core types, schema, and validator for Constela UI framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",