@omnia/velcron 8.0.293-dev → 8.0.295-dev

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 (32) hide show
  1. package/actions/Array.js +3 -3
  2. package/actions/Debounce.js +2 -2
  3. package/actions/Delay.js +2 -2
  4. package/actions/Http.js +1 -1
  5. package/actions/MsGraph.js +2 -2
  6. package/actions/MsSharePoint.js +2 -2
  7. package/internal-do-not-import-from-here/shared/models/theming/Blueprints.d.ts +10 -6
  8. package/internal-do-not-import-from-here/shared/models/theming/ThemeDefinitionV2.d.ts +3 -1
  9. package/internal-do-not-import-from-here/shared/models/theming/ThemingBase.d.ts +14 -0
  10. package/internal-do-not-import-from-here/shared/models/theming/ThemingBase.js +12 -0
  11. package/internal-do-not-import-from-here/shared/models/theming/ThemingDefinitionV3.d.ts +44 -0
  12. package/internal-do-not-import-from-here/shared/models/theming/ThemingDefinitionV3.js +6 -0
  13. package/internal-do-not-import-from-here/shared/models/theming/Typography.d.ts +28 -2
  14. package/internal-do-not-import-from-here/shared/models/theming/Typography.js +6 -1
  15. package/internal-do-not-import-from-here/shared/models/theming/index.d.ts +2 -0
  16. package/internal-do-not-import-from-here/shared/models/theming/index.js +2 -0
  17. package/models/VelcronDefinitions.d.ts +34 -2
  18. package/models/VelcronTypes.d.ts +7 -0
  19. package/package.json +1 -1
  20. package/parser/VelcronActions.d.ts +0 -2
  21. package/parser/VelcronActions.js +1 -27
  22. package/parser/VelcronData.d.ts +2 -1
  23. package/parser/VelcronData.js +165 -56
  24. package/parser/VelcronDataBinder.d.ts +13 -0
  25. package/parser/VelcronDataBinder.js +154 -0
  26. package/parser/VelcronRenderers.js +1 -1
  27. package/parser/VelcronStyles.d.ts +1 -1
  28. package/parser/VelcronStyles.js +165 -174
  29. package/parser/index.d.ts +1 -0
  30. package/parser/index.js +1 -0
  31. package/stores/VelcronTheming.d.ts +4 -4
  32. package/stores/VelcronTheming.js +2 -2
@@ -6,38 +6,49 @@ const VelcronConstants_1 = require("./VelcronConstants");
6
6
  const VelcronLogger_1 = require("./VelcronLogger");
7
7
  const TextValue_1 = require("./TextValue");
8
8
  class VelcronData {
9
- static dataBind(renderContext, bindTo) {
10
- if (!VelcronData.isString(bindTo)) {
11
- return bindTo;
12
- }
13
- //Bound to one state property and supports 2 way data binding > $bind: $state.title
14
- if (bindTo.startsWith(VelcronConstants_1.VelcronConstants.state.bindToken)) {
15
- bindTo = bindTo.substring(VelcronConstants_1.VelcronConstants.state.bindToken.length).trim();
16
- return VelcronData.getOrSet(renderContext, bindTo);
17
- }
18
- //Built-in context tokens
19
- if (bindTo === VelcronConstants_1.VelcronConstants.context.editModeToken) {
9
+ static { this.bindInternal = null; }
10
+ // static dataBind<T = string>(renderContext: VelcronRenderContext, bindTo: VelcronBindableProp<any>): T {
11
+ // if (!VelcronData.isString(bindTo)) {
12
+ // return bindTo;
13
+ // }
14
+ // //Bound to one state property and supports 2 way data binding > $bind: $state.title
15
+ // if (bindTo.startsWith(VelcronConstants.state.bindToken)) {
16
+ // bindTo = bindTo.substring(VelcronConstants.state.bindToken.length).trim();
17
+ // return VelcronData.getOrSet(renderContext, bindTo);
18
+ // }
19
+ // //Built-in context tokens
20
+ // const contextValue = VelcronData.getContextTokenValue<T>(renderContext, bindTo);
21
+ // if (contextValue !== undefined) {
22
+ // return contextValue;
23
+ // }
24
+ // //String interpolation > {{ $state.title }} and {{ $state.description }}
25
+ // const tokens = this.getTokens(bindTo, false);
26
+ // tokens.forEach((token) => {
27
+ // let data = this.getOrSet<any>(renderContext, token.replace(/\s*{{\s*|\s*}}\s*/g, ""));
28
+ // if (data instanceof TextValue) {
29
+ // data = (data as TextValue).value;
30
+ // }
31
+ // bindTo = bindTo.replace(token, data);
32
+ // });
33
+ // return bindTo as T;
34
+ // }
35
+ static getContextTokenValue(renderContext, token) {
36
+ const { editModeToken, displayToken, activeToken, thisToken } = VelcronConstants_1.VelcronConstants.context;
37
+ if (token === editModeToken || token.startsWith(`${editModeToken}.`)) {
20
38
  return renderContext.$editmode;
21
39
  }
22
- else if (bindTo === VelcronConstants_1.VelcronConstants.context.displayToken) {
40
+ else if (token === displayToken || token.startsWith(`${displayToken}.`)) {
23
41
  return renderContext.$display;
24
42
  }
25
- else if (bindTo === VelcronConstants_1.VelcronConstants.context.activeToken) {
43
+ else if (token === activeToken || token.startsWith(`${activeToken}.`)) {
26
44
  return renderContext.$active;
27
45
  }
28
- else if (bindTo === VelcronConstants_1.VelcronConstants.context.thisToken) {
46
+ else if (token === thisToken || token.startsWith(`${thisToken}.`)) {
29
47
  return renderContext.currentContext;
30
48
  }
31
- //String interpolation > {{ $state.title }} and {{ $state.description }}
32
- const tokens = this.getTokens(bindTo, false);
33
- tokens.forEach((token) => {
34
- let data = this.getOrSet(renderContext, token.replace(/\s*{{\s*|\s*}}\s*/g, ""));
35
- if (data instanceof TextValue_1.TextValue) {
36
- data = data.value;
37
- }
38
- bindTo = bindTo.replace(token, data);
39
- });
40
- return bindTo;
49
+ else {
50
+ return undefined;
51
+ }
41
52
  }
42
53
  static isBindable(bindable) {
43
54
  if (!VelcronData.isString(bindable)) {
@@ -53,49 +64,138 @@ class VelcronData {
53
64
  return text;
54
65
  }
55
66
  static addCtxToVariableNames(template, skipIfNameStartsWith, skipIfNameMatches, overridePrefixWhenNameMatches) {
56
- const re = new RegExp(/[^0-9a-z-.'$]/, "gi");
67
+ let isInsideString = false;
68
+ let isEscapeChar = false;
57
69
  const results = [];
58
- let match;
59
- let lastIndex;
60
- while (lastIndex = re.lastIndex, match = re.exec(template)) {
61
- const text = template.substring(lastIndex, match.index);
62
- if (text.length > 0 && text.startsWith("'") === false && text.endsWith("'") === false) {
63
- results.push({ text: text, index: lastIndex });
70
+ let variableName = "";
71
+ let variableStartIndex = -1;
72
+ const appendedLength = 0;
73
+ for (let i = 0; i < template.length; i++) {
74
+ const c = template.charAt(i);
75
+ if (isEscapeChar) {
76
+ isEscapeChar = false;
77
+ continue;
78
+ }
79
+ if (c === "\\") {
80
+ isEscapeChar = true;
81
+ continue;
82
+ }
83
+ if (c === "'") {
84
+ isInsideString = !isInsideString;
85
+ continue;
86
+ }
87
+ if (isInsideString) {
88
+ continue;
89
+ }
90
+ // If c is a valid variable name character
91
+ if (/[0-9a-z-.'$]/i.test(c)) {
92
+ if (variableName.length === 0) {
93
+ variableStartIndex = i;
94
+ }
95
+ variableName += c;
64
96
  }
97
+ else {
98
+ // Non-variable character
99
+ if (variableName.length > 0) {
100
+ // Process the variableName
101
+ results.push({ text: variableName, index: variableStartIndex });
102
+ variableName = "";
103
+ variableStartIndex = -1;
104
+ }
105
+ }
106
+ }
107
+ // Process any remaining variableName
108
+ if (variableName.length > 0) {
109
+ results.push({ text: variableName, index: variableStartIndex });
65
110
  }
66
- results.push({ text: template.substring(lastIndex), index: lastIndex });
67
- let appendedLenght = 0;
111
+ // Now process the results
112
+ let adjustedTemplate = template;
113
+ let offset = 0;
68
114
  results.forEach((variableMatch) => {
69
- //variable name cant start as a number
70
- //'' is not allowed as variable name we used it in regex so if a value is set
71
- //containing same name as a variable it will not be replaced
72
- if (isNaN(variableMatch.text.substring(0, 1)) && (!variableMatch.text.startsWith("'")) && variableMatch.text.length > 0) {
73
- if (skipIfNameStartsWith && variableMatch.text.startsWith(skipIfNameStartsWith) || skipIfNameMatches && skipIfNameMatches.filter(p => p === variableMatch.text).length > 0) { }
115
+ const text = variableMatch.text;
116
+ const index = variableMatch.index + offset;
117
+ // Variable name can't start with a number and should not be empty
118
+ if (isNaN(parseInt(text.charAt(0), 10)) &&
119
+ text.length > 0) {
120
+ if ((skipIfNameStartsWith && text.startsWith(skipIfNameStartsWith)) ||
121
+ (skipIfNameMatches && skipIfNameMatches.includes(text))) {
122
+ // Skip variable names that match the conditions
123
+ }
74
124
  else {
75
- let subName = variableMatch.text;
125
+ let subName = text;
76
126
  if (subName.startsWith(VelcronConstants_1.VelcronConstants.state.stateRootToken)) {
77
127
  subName = subName.substring(VelcronConstants_1.VelcronConstants.state.stateRootToken.length + 1);
78
128
  }
79
- let prefix = variableMatch.text.startsWith(VelcronConstants_1.VelcronConstants.state.stateRootToken) ? "rootCtx " : "currentCtx";
80
- if (overridePrefixWhenNameMatches && overridePrefixWhenNameMatches[variableMatch.text]) {
81
- prefix = overridePrefixWhenNameMatches[variableMatch.text];
129
+ let prefix = text.startsWith(VelcronConstants_1.VelcronConstants.state.stateRootToken)
130
+ ? "rootCtx "
131
+ : "currentCtx";
132
+ if (overridePrefixWhenNameMatches &&
133
+ overridePrefixWhenNameMatches[text]) {
134
+ prefix = overridePrefixWhenNameMatches[text];
82
135
  }
83
- else if (overridePrefixWhenNameMatches && variableMatch.text.indexOf(".") > -1) {
84
- //TODO: If this gets issues we need make overridePrefixWhenNameMatches to contain settings object
85
- const toMatch = variableMatch.text.substring(0, variableMatch.text.indexOf("."));
136
+ else if (overridePrefixWhenNameMatches &&
137
+ text.indexOf(".") > -1) {
138
+ const toMatch = text.substring(0, text.indexOf("."));
86
139
  if (overridePrefixWhenNameMatches[toMatch]) {
87
140
  prefix = overridePrefixWhenNameMatches[toMatch];
88
- subName = variableMatch.text.substring(toMatch.length + 1);
141
+ subName = text.substring(toMatch.length + 1);
89
142
  }
90
143
  }
91
144
  const newName = `${prefix.trim()}.${subName}`;
92
- template = template.substring(0, (variableMatch.index + appendedLenght)) + newName + template.substring((variableMatch.index + appendedLenght) + variableMatch.text.length);
93
- appendedLenght = +prefix.length + 1;
145
+ adjustedTemplate =
146
+ adjustedTemplate.substring(0, index) +
147
+ newName +
148
+ adjustedTemplate.substring(index + text.length);
149
+ offset += newName.length - text.length;
94
150
  }
95
151
  }
96
152
  });
97
- return template;
153
+ return adjustedTemplate;
98
154
  }
155
+ // static addCtxToVariableNames(template: string, skipIfNameStartsWith?: string, skipIfNameMatches?: Array<string>, overridePrefixWhenNameMatches?: { [name: string]: string }): string {
156
+ // const re = new RegExp(/[^0-9a-z-.'$]/, "gi");
157
+ // const results: Array<{ text: string, index: number }> = [];
158
+ // let match: RegExpExecArray | null;
159
+ // let lastIndex: number;
160
+ // while (lastIndex = re.lastIndex, match = re.exec(template)) {
161
+ // const text = template.substring(lastIndex, match.index);
162
+ // if (text.length > 0 && text.startsWith("'") === false && text.endsWith("'") === false) {
163
+ // results.push({ text: text, index: lastIndex });
164
+ // }
165
+ // }
166
+ // results.push({ text: template.substring(lastIndex), index: lastIndex });
167
+ // let appendedLenght = 0;
168
+ // results.forEach((variableMatch) => {
169
+ // //variable name cant start as a number
170
+ // //'' is not allowed as variable name we used it in regex so if a value is set
171
+ // //containing same name as a variable it will not be replaced
172
+ // if (isNaN(variableMatch.text.substring(0, 1) as any as number) && (!variableMatch.text.startsWith("'")) && variableMatch.text.length > 0) {
173
+ // if (skipIfNameStartsWith && variableMatch.text.startsWith(skipIfNameStartsWith) || skipIfNameMatches && skipIfNameMatches.filter(p => p === variableMatch.text).length > 0) { }
174
+ // else {
175
+ // let subName = variableMatch.text;
176
+ // if (subName.startsWith(VelcronConstants.state.stateRootToken)) {
177
+ // subName = subName.substring(VelcronConstants.state.stateRootToken.length + 1);
178
+ // }
179
+ // let prefix = variableMatch.text.startsWith(VelcronConstants.state.stateRootToken) ? "rootCtx " : "currentCtx";
180
+ // if (overridePrefixWhenNameMatches && overridePrefixWhenNameMatches[variableMatch.text]) {
181
+ // prefix = overridePrefixWhenNameMatches[variableMatch.text];
182
+ // }
183
+ // else if (overridePrefixWhenNameMatches && variableMatch.text.indexOf(".") > -1) {
184
+ // //TODO: If this gets issues we need make overridePrefixWhenNameMatches to contain settings object
185
+ // const toMatch = variableMatch.text.substring(0, variableMatch.text.indexOf("."));
186
+ // if (overridePrefixWhenNameMatches[toMatch]) {
187
+ // prefix = overridePrefixWhenNameMatches[toMatch];
188
+ // subName = variableMatch.text.substring(toMatch.length + 1);
189
+ // }
190
+ // }
191
+ // const newName = `${prefix.trim()}.${subName}`;
192
+ // template = template.substring(0, (variableMatch.index + appendedLenght)) + newName + template.substring((variableMatch.index + appendedLenght) + variableMatch.text.length);
193
+ // appendedLenght = + prefix.length + 1;
194
+ // }
195
+ // }
196
+ // });
197
+ // return template;
198
+ // }
99
199
  static evauluateJs(template, renderContext, overrideNamesMatching = null) {
100
200
  const obj = [];
101
201
  const names = [];
@@ -134,8 +234,10 @@ class VelcronData {
134
234
  obj.push(renderContext.rootContext);
135
235
  obj.push(renderContext.currentContext);
136
236
  obj.push(renderContext);
137
- //TODO we shouls try catch and return info
237
+ //TODO we shouls try catch and return info
138
238
  const evalResult = Function(...names, "\"use strict\";return " + template)(...obj);
239
+ // console.dir("Eval result");
240
+ // console.dir(evalResult);
139
241
  return evalResult;
140
242
  }
141
243
  static { this.variables = {}; }
@@ -252,7 +354,7 @@ class VelcronData {
252
354
  //Direct string assignment remove the ' ' in the string
253
355
  if (strValue.startsWith("'") && strValue.endsWith(("'"))) {
254
356
  strValue = strValue.substring(1, strValue.length - 1);
255
- value = new TextValue_1.TextValue(VelcronData.dataBind(renderContext, strValue));
357
+ value = new TextValue_1.TextValue(VelcronData.bindInternal(renderContext, strValue));
256
358
  }
257
359
  else if (renderContext.id && variableReassignmentFromValue) {
258
360
  //Get the variable from value = parameter value
@@ -595,7 +697,7 @@ class VelcronData {
595
697
  const propObj = VelcronData.getOrSetObjectByPath(renderContext.properties, path);
596
698
  if (VelcronData.isString(propObj)) {
597
699
  const propString = propObj;
598
- path = VelcronData.dataBind(renderContext, propString);
700
+ path = VelcronData.bindInternal(renderContext, propString);
599
701
  result = path;
600
702
  }
601
703
  result = propObj;
@@ -605,25 +707,32 @@ class VelcronData {
605
707
  result = renderContext.currentContext;
606
708
  }
607
709
  else {
710
+ const contextValue = VelcronData.getContextTokenValue(renderContext, path);
608
711
  const tokens = VelcronData.getTokens(path, true);
609
712
  if (tokens.length > 0) {
610
713
  path = tokens[0];
611
714
  }
612
715
  let object = null;
613
716
  if (path.startsWith(`${VelcronConstants_1.VelcronConstants.state.stateRootToken}.`) || path === VelcronConstants_1.VelcronConstants.state.stateRootToken) {
614
- //Fetch from the data object
717
+ // Fetch from the data object
615
718
  object = renderContext.rootContext;
616
- path = path.substring(6);
719
+ path = path.substring(VelcronConstants_1.VelcronConstants.state.stateRootToken.length + 1);
720
+ }
721
+ else if (contextValue !== undefined) {
722
+ object = contextValue;
723
+ if (path.indexOf(".") > -1) {
724
+ path = path.substring(path.indexOf(".") + 1);
725
+ }
617
726
  }
618
727
  else {
619
- //Fetch from current ctx
728
+ // Fetch from current context
620
729
  object = renderContext.currentContext;
621
730
  }
622
731
  if (VelcronData.isObject(object) && object) {
623
732
  result = VelcronData.getOrSetObjectByPath(object, path, value);
624
733
  }
625
734
  else {
626
- //For example if you bind to Array of ["string"] the currentContext is only a string so we just return the object without mapping path
735
+ // For example, if you bind to an array of ["string"], the currentContext is only a string, so we just return the object without mapping path
627
736
  result = object;
628
737
  }
629
738
  }
@@ -0,0 +1,13 @@
1
+ import { VelcronRenderContext } from "../models";
2
+ import { VelcronBindableProp } from "..";
3
+ export declare class VelcronDataBinder {
4
+ static bind<T = string>(renderContext: VelcronRenderContext, bindTo: VelcronBindableProp<any>): T;
5
+ private static interpolateTokens;
6
+ private static processToken;
7
+ private static evaluateSwitchExpression;
8
+ private static evaluateExpression;
9
+ static tryUpdateBoundValue(renderContext: VelcronRenderContext, bindPath: string, value: unknown): void;
10
+ static bindMany<T>(renderContext: VelcronRenderContext, definition: {
11
+ [P in keyof T]?: VelcronBindableProp<T[P]>;
12
+ }, propertiesToBind: Array<keyof T>, state: Partial<T>): void;
13
+ }
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VelcronDataBinder = void 0;
4
+ const TextValue_1 = require("./TextValue");
5
+ const VelcronConstants_1 = require("./VelcronConstants");
6
+ const VelcronData_1 = require("./VelcronData");
7
+ const __1 = require("..");
8
+ // Precompiled regular expression for token replacement
9
+ const TOKEN_REGEX = /\s*{{\s*|\s*}}\s*/g;
10
+ class VelcronDataBinder {
11
+ static bind(renderContext, bindTo) {
12
+ if (typeof bindTo === "object" && bindTo !== null) {
13
+ // Check if it's a switch expression
14
+ if ("switch" in bindTo) {
15
+ return this.evaluateSwitchExpression(bindTo, renderContext);
16
+ }
17
+ // Handle other object types if necessary
18
+ return bindTo;
19
+ }
20
+ if (!VelcronData_1.VelcronData.isString(bindTo)) {
21
+ return bindTo;
22
+ }
23
+ // Bound to one state property and supports 2 way data binding > $bind: $state.title
24
+ if (bindTo.startsWith(VelcronConstants_1.VelcronConstants.state.bindToken)) {
25
+ const trimmedBindTo = bindTo.substring(VelcronConstants_1.VelcronConstants.state.bindToken.length).trim();
26
+ return VelcronData_1.VelcronData.getOrSet(renderContext, trimmedBindTo);
27
+ }
28
+ // Process bindTo if it is an action
29
+ if (__1.VelcronActions.valueIsAction(bindTo)) {
30
+ return this.processToken(bindTo, renderContext);
31
+ }
32
+ // Built-in context tokens
33
+ const contextValue = VelcronData_1.VelcronData.getContextTokenValue(renderContext, bindTo);
34
+ if (contextValue !== undefined) {
35
+ return bindTo.includes(".")
36
+ ? VelcronData_1.VelcronData.getOrSetObjectByPath(contextValue, bindTo.substring(bindTo.indexOf(".") + 1))
37
+ : contextValue;
38
+ }
39
+ // String interpolation > {{ $state.title }} and {{ $state.description }}
40
+ // Computed String interpolation > {{@getName}}
41
+ return this.interpolateTokens(bindTo, renderContext);
42
+ }
43
+ static interpolateTokens(bindTo, renderContext) {
44
+ const tokens = VelcronData_1.VelcronData.getTokens(bindTo, false);
45
+ if (tokens.length === 0) {
46
+ return bindTo;
47
+ }
48
+ let result = "";
49
+ let lastIndex = 0;
50
+ tokens.forEach((token) => {
51
+ const tokenIndex = bindTo.indexOf(token, lastIndex);
52
+ result += bindTo.substring(lastIndex, tokenIndex);
53
+ const tokenWithoutBrackets = token.replace(TOKEN_REGEX, "");
54
+ let data = this.processToken(tokenWithoutBrackets, renderContext);
55
+ if (data instanceof TextValue_1.TextValue) {
56
+ data = data.value;
57
+ }
58
+ result += data;
59
+ lastIndex = tokenIndex + token.length;
60
+ });
61
+ result += bindTo.substring(lastIndex);
62
+ return result;
63
+ }
64
+ static processToken(tokenWithoutBrackets, renderContext) {
65
+ if (__1.VelcronActions.valueIsAction(tokenWithoutBrackets)) {
66
+ let result;
67
+ const paramValues = [];
68
+ const template = tokenWithoutBrackets.includes("(")
69
+ ? tokenWithoutBrackets.substring(0, tokenWithoutBrackets.indexOf("("))
70
+ : tokenWithoutBrackets;
71
+ __1.VelcronActions.parseFunction(renderContext.computed, template, renderContext, paramValues, (acName, params) => {
72
+ const funcContent = renderContext.computed[acName];
73
+ // Prepare params for evaluation
74
+ Object.keys(params).forEach((key) => {
75
+ params[key] = "currentCtx";
76
+ });
77
+ // Check if funcContent is an array
78
+ if (Array.isArray(funcContent)) {
79
+ const c = funcContent[0];
80
+ result = VelcronData_1.VelcronData.evauluateJs(c, renderContext, params);
81
+ }
82
+ // Check if funcContent is a switch expression
83
+ else if (funcContent && typeof funcContent === "object" && "switch" in funcContent) {
84
+ result = VelcronDataBinder.evaluateSwitchExpression(funcContent, renderContext);
85
+ }
86
+ // Handle other possible function types if necessary
87
+ else {
88
+ result = undefined;
89
+ }
90
+ });
91
+ return result;
92
+ }
93
+ else {
94
+ return VelcronData_1.VelcronData.getOrSet(renderContext, tokenWithoutBrackets);
95
+ }
96
+ }
97
+ static evaluateSwitchExpression(expression, renderContext) {
98
+ // Evaluate the switch expression
99
+ const switchValue = VelcronDataBinder.evaluateExpression(expression.switch, renderContext);
100
+ // Convert switchValue to string to match case keys
101
+ const switchValueStr = String(switchValue);
102
+ // Check if the case matches
103
+ if (switchValueStr in expression.cases) {
104
+ const caseValue = expression.cases[switchValueStr];
105
+ return VelcronDataBinder.evaluateExpression(this.interpolateTokens(caseValue, renderContext), renderContext);
106
+ }
107
+ else if ("default" in expression) {
108
+ return VelcronDataBinder.evaluateExpression(this.interpolateTokens(expression.default, renderContext), renderContext);
109
+ }
110
+ else {
111
+ return undefined;
112
+ }
113
+ }
114
+ static evaluateExpression(expr, renderContext) {
115
+ if (typeof expr === "string") {
116
+ return VelcronDataBinder.bind(renderContext, expr);
117
+ }
118
+ else if (typeof expr === "object") {
119
+ // If expr is another switch expression
120
+ if ("switch" in expr) {
121
+ return VelcronDataBinder.evaluateSwitchExpression(expr, renderContext);
122
+ }
123
+ else {
124
+ // If the expression is an object, evaluate its values if they are bindings
125
+ const evaluatedObject = {};
126
+ for (const key in expr) {
127
+ if (expr.hasOwnProperty(key)) {
128
+ evaluatedObject[key] = VelcronDataBinder.evaluateExpression(expr[key], renderContext);
129
+ }
130
+ }
131
+ return evaluatedObject;
132
+ }
133
+ }
134
+ else {
135
+ // Return the value as-is (number, boolean, etc.)
136
+ return expr;
137
+ }
138
+ }
139
+ static tryUpdateBoundValue(renderContext, bindPath, value) {
140
+ if (VelcronData_1.VelcronData.isBindable(bindPath)) {
141
+ VelcronData_1.VelcronData.getOrSet(renderContext, VelcronData_1.VelcronData.getBindPath(bindPath), value);
142
+ }
143
+ }
144
+ static bindMany(renderContext, definition, propertiesToBind, state) {
145
+ propertiesToBind.forEach((property) => {
146
+ const definitionValue = definition[property];
147
+ if (definitionValue !== undefined) {
148
+ state[property] = VelcronDataBinder.bind(renderContext, definitionValue);
149
+ }
150
+ });
151
+ }
152
+ }
153
+ exports.VelcronDataBinder = VelcronDataBinder;
154
+ VelcronData_1.VelcronData.bindInternal = VelcronDataBinder.bind;
@@ -99,7 +99,7 @@ class VelcronRenderers {
99
99
  subApp: currentRenderCtx.subApp
100
100
  };
101
101
  if (VelcronRenderers.definitionContainsCustomColorSchema(definition)) {
102
- const colorSchemaType = __1.VelcronData.dataBind(currentRenderCtx, definition.colorSchemaType);
102
+ const colorSchemaType = __1.VelcronDataBinder.bind(currentRenderCtx, definition.colorSchemaType);
103
103
  if (colorSchemaType && colorSchemaType !== "" && result.colors.state.colorSchemaType !== colorSchemaType) {
104
104
  const colorSchemaStore = (0, __1.useVelcronColorSchemaStore)(definition.key.toString());
105
105
  colorSchemaStore.actions.setThemeStore(currentRenderCtx.theming, colorSchemaType);
@@ -23,7 +23,7 @@ export declare class VelcronStyles {
23
23
  static registerEffectsProvider(fn: (effects: VelcronEffects, renderCtx: VelcronRenderContext) => VelcronEffects): void;
24
24
  static applyEffects(definition: VelcronDefinitionHasEffects, renderCtx: VelcronRenderContext, applyTo: (effects: VelcronEffects) => any): any;
25
25
  static insertBackgroundColor(styleBase: any, color: VelcronColorStyling, renderCtx: VelcronRenderContext): void;
26
- static insertBorderRadiusStyles(styleBase: any, settings: VelcronDimensions): void;
26
+ static insertBorderRadiusStyles(styleBase: any, settings: VelcronDimensions, renderCtx: VelcronRenderContext): void;
27
27
  static insertBorderStyles(styleBase: any, borderSettings: VelcronBorder, renderCtx: VelcronRenderContext): void;
28
28
  static create(definition: VelcronDefinition, renderCtx: VelcronRenderContext): object | string;
29
29
  static applySpacingDimension(value: string | number, spacing: SpacingBlueprint): string | number;