@uniformdev/canvas 20.49.3-alpha.9 → 20.49.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.
package/dist/index.d.mts CHANGED
@@ -12560,7 +12560,8 @@ declare const CANVAS_VIZ_QUIRKS_RULE = "$qk";
12560
12560
  declare function createQuirksVisibilityRule(quirks: Quirks): VisibilityRules;
12561
12561
 
12562
12562
  type CoreStringOperators = 'is' | 'has' | 'startswith' | 'endswith' | 'empty';
12563
- type StringOperators = CoreStringOperators | `!${CoreStringOperators}`;
12563
+ type NumericOperators = 'gt' | 'lt';
12564
+ type StringOperators = CoreStringOperators | `!${CoreStringOperators}` | NumericOperators;
12564
12565
 
12565
12566
  type PropertyValue = {
12566
12567
  locale: string | undefined;
@@ -13708,7 +13709,7 @@ declare function hasReferencedVariables(value: string | undefined): number;
13708
13709
  */
13709
13710
  declare function parseVariableExpression(serialized: string, onToken?: (token: string, type: 'text' | 'variable') => void | false): number;
13710
13711
 
13711
- declare const version = "20.49.2";
13712
+ declare const version = "20.49.3";
13712
13713
 
13713
13714
  /** API client to enable managing workflow definitions */
13714
13715
  declare class WorkflowClient extends ApiClient {
package/dist/index.d.ts CHANGED
@@ -12560,7 +12560,8 @@ declare const CANVAS_VIZ_QUIRKS_RULE = "$qk";
12560
12560
  declare function createQuirksVisibilityRule(quirks: Quirks): VisibilityRules;
12561
12561
 
12562
12562
  type CoreStringOperators = 'is' | 'has' | 'startswith' | 'endswith' | 'empty';
12563
- type StringOperators = CoreStringOperators | `!${CoreStringOperators}`;
12563
+ type NumericOperators = 'gt' | 'lt';
12564
+ type StringOperators = CoreStringOperators | `!${CoreStringOperators}` | NumericOperators;
12564
12565
 
12565
12566
  type PropertyValue = {
12566
12567
  locale: string | undefined;
@@ -13708,7 +13709,7 @@ declare function hasReferencedVariables(value: string | undefined): number;
13708
13709
  */
13709
13710
  declare function parseVariableExpression(serialized: string, onToken?: (token: string, type: 'text' | 'variable') => void | false): number;
13710
13711
 
13711
- declare const version = "20.49.2";
13712
+ declare const version = "20.49.3";
13712
13713
 
13713
13714
  /** API client to enable managing workflow definitions */
13714
13715
  declare class WorkflowClient extends ApiClient {
package/dist/index.esm.js CHANGED
@@ -2241,11 +2241,34 @@ var stringOperatorEvaluators = {
2241
2241
  endswith: endsWithEvaluator,
2242
2242
  empty: emptyEvaluator
2243
2243
  };
2244
+ var numericOperatorEvaluators = {
2245
+ gt: (left, right) => left > right,
2246
+ lt: (left, right) => left < right
2247
+ };
2248
+ function evaluateNumericOperator(criteria, matchValue) {
2249
+ const { op, value } = criteria;
2250
+ const evaluator = numericOperatorEvaluators[op];
2251
+ if (!evaluator) {
2252
+ return null;
2253
+ }
2254
+ if (typeof matchValue === "string" && matchValue.trim() === "" || typeof value === "string" && value.trim() === "") {
2255
+ return false;
2256
+ }
2257
+ const leftNum = Number(matchValue);
2258
+ const rightNum = Number(value);
2259
+ if (isNaN(leftNum) || isNaN(rightNum)) {
2260
+ return false;
2261
+ }
2262
+ return evaluator(leftNum, rightNum);
2263
+ }
2244
2264
  function evaluateStringMatch(criteria, matchValue, allow) {
2245
2265
  const { op, value } = criteria;
2246
2266
  if (allow && !allow.has(op)) {
2247
2267
  return null;
2248
2268
  }
2269
+ if (op in numericOperatorEvaluators) {
2270
+ return evaluateNumericOperator(criteria, matchValue);
2271
+ }
2249
2272
  let opMatch = op;
2250
2273
  const negation = op.startsWith("!");
2251
2274
  if (negation) {
@@ -2294,17 +2317,49 @@ var dynamicTokenVisibilityOperators = /* @__PURE__ */ new Set([
2294
2317
  "endswith",
2295
2318
  "!endswith",
2296
2319
  "empty",
2297
- "!empty"
2320
+ "!empty",
2321
+ "gt",
2322
+ "lt"
2298
2323
  ]);
2299
2324
  var CANVAS_VIZ_DYNAMIC_TOKEN_RULE = "$dt";
2325
+ function toStringValue(value) {
2326
+ if (typeof value === "string") {
2327
+ return value;
2328
+ }
2329
+ if (typeof value === "number" || typeof value === "boolean") {
2330
+ return String(value);
2331
+ }
2332
+ return "";
2333
+ }
2334
+ function toStringCriteriaValue(value) {
2335
+ if (Array.isArray(value)) {
2336
+ return value.map((v) => toStringValue(v));
2337
+ }
2338
+ return toStringValue(value);
2339
+ }
2340
+ function isUnbound(value) {
2341
+ if (value === void 0 || value === null) {
2342
+ return true;
2343
+ }
2344
+ if (typeof value === "string") {
2345
+ return hasReferencedVariables(value) > 0;
2346
+ }
2347
+ return false;
2348
+ }
2300
2349
  function createDynamicTokenVisibilityRule() {
2301
2350
  return {
2302
2351
  [CANVAS_VIZ_DYNAMIC_TOKEN_RULE]: (criterion) => {
2303
- var _a;
2304
- if (typeof criterion.source !== "string" || hasReferencedVariables(criterion.source)) {
2352
+ const { source, value } = criterion;
2353
+ if (isUnbound(source)) {
2305
2354
  return null;
2306
2355
  }
2307
- return evaluateStringMatch(criterion, (_a = criterion.source) != null ? _a : "", dynamicTokenVisibilityOperators);
2356
+ const stringSource = toStringValue(source);
2357
+ const stringValue = toStringCriteriaValue(value);
2358
+ const stringCriterion = {
2359
+ ...criterion,
2360
+ value: stringValue
2361
+ };
2362
+ return evaluateStringMatch(stringCriterion, stringSource, dynamicTokenVisibilityOperators);
2308
2363
  }
2309
2364
  };
2310
2365
  }
@@ -3551,7 +3606,7 @@ function handleRichTextNodeBinding(object, options) {
3551
3606
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
3552
3607
 
3553
3608
  // src/.version.ts
3554
- var version = "20.49.2";
3609
+ var version = "20.49.3";
3555
3610
 
3556
3611
  // src/WorkflowClient.ts
3557
3612
  import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
package/dist/index.js CHANGED
@@ -2419,11 +2419,34 @@ var stringOperatorEvaluators = {
2419
2419
  endswith: endsWithEvaluator,
2420
2420
  empty: emptyEvaluator
2421
2421
  };
2422
+ var numericOperatorEvaluators = {
2423
+ gt: (left, right) => left > right,
2424
+ lt: (left, right) => left < right
2425
+ };
2426
+ function evaluateNumericOperator(criteria, matchValue) {
2427
+ const { op, value } = criteria;
2428
+ const evaluator = numericOperatorEvaluators[op];
2429
+ if (!evaluator) {
2430
+ return null;
2431
+ }
2432
+ if (typeof matchValue === "string" && matchValue.trim() === "" || typeof value === "string" && value.trim() === "") {
2433
+ return false;
2434
+ }
2435
+ const leftNum = Number(matchValue);
2436
+ const rightNum = Number(value);
2437
+ if (isNaN(leftNum) || isNaN(rightNum)) {
2438
+ return false;
2439
+ }
2440
+ return evaluator(leftNum, rightNum);
2441
+ }
2422
2442
  function evaluateStringMatch(criteria, matchValue, allow) {
2423
2443
  const { op, value } = criteria;
2424
2444
  if (allow && !allow.has(op)) {
2425
2445
  return null;
2426
2446
  }
2447
+ if (op in numericOperatorEvaluators) {
2448
+ return evaluateNumericOperator(criteria, matchValue);
2449
+ }
2427
2450
  let opMatch = op;
2428
2451
  const negation = op.startsWith("!");
2429
2452
  if (negation) {
@@ -2472,17 +2495,49 @@ var dynamicTokenVisibilityOperators = /* @__PURE__ */ new Set([
2472
2495
  "endswith",
2473
2496
  "!endswith",
2474
2497
  "empty",
2475
- "!empty"
2498
+ "!empty",
2499
+ "gt",
2500
+ "lt"
2476
2501
  ]);
2477
2502
  var CANVAS_VIZ_DYNAMIC_TOKEN_RULE = "$dt";
2503
+ function toStringValue(value) {
2504
+ if (typeof value === "string") {
2505
+ return value;
2506
+ }
2507
+ if (typeof value === "number" || typeof value === "boolean") {
2508
+ return String(value);
2509
+ }
2510
+ return "";
2511
+ }
2512
+ function toStringCriteriaValue(value) {
2513
+ if (Array.isArray(value)) {
2514
+ return value.map((v) => toStringValue(v));
2515
+ }
2516
+ return toStringValue(value);
2517
+ }
2518
+ function isUnbound(value) {
2519
+ if (value === void 0 || value === null) {
2520
+ return true;
2521
+ }
2522
+ if (typeof value === "string") {
2523
+ return hasReferencedVariables(value) > 0;
2524
+ }
2525
+ return false;
2526
+ }
2478
2527
  function createDynamicTokenVisibilityRule() {
2479
2528
  return {
2480
2529
  [CANVAS_VIZ_DYNAMIC_TOKEN_RULE]: (criterion) => {
2481
- var _a;
2482
- if (typeof criterion.source !== "string" || hasReferencedVariables(criterion.source)) {
2530
+ const { source, value } = criterion;
2531
+ if (isUnbound(source)) {
2483
2532
  return null;
2484
2533
  }
2485
- return evaluateStringMatch(criterion, (_a = criterion.source) != null ? _a : "", dynamicTokenVisibilityOperators);
2534
+ const stringSource = toStringValue(source);
2535
+ const stringValue = toStringCriteriaValue(value);
2536
+ const stringCriterion = {
2537
+ ...criterion,
2538
+ value: stringValue
2539
+ };
2540
+ return evaluateStringMatch(stringCriterion, stringSource, dynamicTokenVisibilityOperators);
2486
2541
  }
2487
2542
  };
2488
2543
  }
@@ -3729,7 +3784,7 @@ function handleRichTextNodeBinding(object, options) {
3729
3784
  var import_api18 = require("@uniformdev/context/api");
3730
3785
 
3731
3786
  // src/.version.ts
3732
- var version = "20.49.2";
3787
+ var version = "20.49.3";
3733
3788
 
3734
3789
  // src/WorkflowClient.ts
3735
3790
  var import_api17 = require("@uniformdev/context/api");
package/dist/index.mjs CHANGED
@@ -2241,11 +2241,34 @@ var stringOperatorEvaluators = {
2241
2241
  endswith: endsWithEvaluator,
2242
2242
  empty: emptyEvaluator
2243
2243
  };
2244
+ var numericOperatorEvaluators = {
2245
+ gt: (left, right) => left > right,
2246
+ lt: (left, right) => left < right
2247
+ };
2248
+ function evaluateNumericOperator(criteria, matchValue) {
2249
+ const { op, value } = criteria;
2250
+ const evaluator = numericOperatorEvaluators[op];
2251
+ if (!evaluator) {
2252
+ return null;
2253
+ }
2254
+ if (typeof matchValue === "string" && matchValue.trim() === "" || typeof value === "string" && value.trim() === "") {
2255
+ return false;
2256
+ }
2257
+ const leftNum = Number(matchValue);
2258
+ const rightNum = Number(value);
2259
+ if (isNaN(leftNum) || isNaN(rightNum)) {
2260
+ return false;
2261
+ }
2262
+ return evaluator(leftNum, rightNum);
2263
+ }
2244
2264
  function evaluateStringMatch(criteria, matchValue, allow) {
2245
2265
  const { op, value } = criteria;
2246
2266
  if (allow && !allow.has(op)) {
2247
2267
  return null;
2248
2268
  }
2269
+ if (op in numericOperatorEvaluators) {
2270
+ return evaluateNumericOperator(criteria, matchValue);
2271
+ }
2249
2272
  let opMatch = op;
2250
2273
  const negation = op.startsWith("!");
2251
2274
  if (negation) {
@@ -2294,17 +2317,49 @@ var dynamicTokenVisibilityOperators = /* @__PURE__ */ new Set([
2294
2317
  "endswith",
2295
2318
  "!endswith",
2296
2319
  "empty",
2297
- "!empty"
2320
+ "!empty",
2321
+ "gt",
2322
+ "lt"
2298
2323
  ]);
2299
2324
  var CANVAS_VIZ_DYNAMIC_TOKEN_RULE = "$dt";
2325
+ function toStringValue(value) {
2326
+ if (typeof value === "string") {
2327
+ return value;
2328
+ }
2329
+ if (typeof value === "number" || typeof value === "boolean") {
2330
+ return String(value);
2331
+ }
2332
+ return "";
2333
+ }
2334
+ function toStringCriteriaValue(value) {
2335
+ if (Array.isArray(value)) {
2336
+ return value.map((v) => toStringValue(v));
2337
+ }
2338
+ return toStringValue(value);
2339
+ }
2340
+ function isUnbound(value) {
2341
+ if (value === void 0 || value === null) {
2342
+ return true;
2343
+ }
2344
+ if (typeof value === "string") {
2345
+ return hasReferencedVariables(value) > 0;
2346
+ }
2347
+ return false;
2348
+ }
2300
2349
  function createDynamicTokenVisibilityRule() {
2301
2350
  return {
2302
2351
  [CANVAS_VIZ_DYNAMIC_TOKEN_RULE]: (criterion) => {
2303
- var _a;
2304
- if (typeof criterion.source !== "string" || hasReferencedVariables(criterion.source)) {
2352
+ const { source, value } = criterion;
2353
+ if (isUnbound(source)) {
2305
2354
  return null;
2306
2355
  }
2307
- return evaluateStringMatch(criterion, (_a = criterion.source) != null ? _a : "", dynamicTokenVisibilityOperators);
2356
+ const stringSource = toStringValue(source);
2357
+ const stringValue = toStringCriteriaValue(value);
2358
+ const stringCriterion = {
2359
+ ...criterion,
2360
+ value: stringValue
2361
+ };
2362
+ return evaluateStringMatch(stringCriterion, stringSource, dynamicTokenVisibilityOperators);
2308
2363
  }
2309
2364
  };
2310
2365
  }
@@ -3551,7 +3606,7 @@ function handleRichTextNodeBinding(object, options) {
3551
3606
  import { ApiClientError as ApiClientError2 } from "@uniformdev/context/api";
3552
3607
 
3553
3608
  // src/.version.ts
3554
- var version = "20.49.2";
3609
+ var version = "20.49.3";
3555
3610
 
3556
3611
  // src/WorkflowClient.ts
3557
3612
  import { ApiClient as ApiClient16 } from "@uniformdev/context/api";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/canvas",
3
- "version": "20.49.3-alpha.9+e5b9a8ca05",
3
+ "version": "20.49.3",
4
4
  "description": "Common functionality and types for Uniform Canvas",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./dist/index.js",
@@ -41,9 +41,9 @@
41
41
  "svix": "1.71.0"
42
42
  },
43
43
  "dependencies": {
44
- "@uniformdev/assets": "20.49.3-alpha.9+e5b9a8ca05",
45
- "@uniformdev/context": "20.49.3-alpha.9+e5b9a8ca05",
46
- "@uniformdev/richtext": "20.49.3-alpha.9+e5b9a8ca05",
44
+ "@uniformdev/assets": "20.49.3",
45
+ "@uniformdev/context": "20.49.3",
46
+ "@uniformdev/richtext": "20.49.3",
47
47
  "immer": "10.1.3"
48
48
  },
49
49
  "files": [
@@ -52,5 +52,5 @@
52
52
  "publishConfig": {
53
53
  "access": "public"
54
54
  },
55
- "gitHead": "e5b9a8ca05d0b8b26886079b687417e53d44f9cb"
55
+ "gitHead": "a6424635c7b318f5039e4d9c4d5a2ec72125af46"
56
56
  }