@omnia/velcron 8.0.322-dev → 8.0.324-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.
- package/formatters/CapitalizeFormatter.d.ts +2 -0
- package/formatters/CapitalizeFormatter.js +14 -0
- package/formatters/DateFormatter.d.ts +2 -0
- package/formatters/DateFormatter.js +19 -0
- package/formatters/InterpolationFormatter.d.ts +4 -0
- package/formatters/JsonFormatter.d.ts +2 -0
- package/formatters/JsonFormatter.js +11 -0
- package/formatters/LengthFormatter.d.ts +2 -0
- package/formatters/LengthFormatter.js +14 -0
- package/formatters/ReplaceFormatter.d.ts +2 -0
- package/formatters/ReplaceFormatter.js +14 -0
- package/formatters/SubStringFormatter.d.ts +2 -0
- package/formatters/SubStringFormatter.js +14 -0
- package/formatters/TrimFormatter.d.ts +2 -0
- package/formatters/TrimFormatter.js +17 -0
- package/formatters/UppercaseFormatter.d.ts +2 -0
- package/formatters/UppercaseFormatter.js +14 -0
- package/formatters/index.d.ts +9 -0
- package/formatters/index.js +12 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/internal-do-not-import-from-here/shared/models/OmniaHub.d.ts +5 -0
- package/internal-do-not-import-from-here/shared/models/{hub/activities/ActivityHubServiceId.js → OmniaHub.js} +3 -1
- package/internal-do-not-import-from-here/shared/models/OmniaSharedBootstrapData.d.ts +1 -1
- package/internal-do-not-import-from-here/shared/models/Realtime.d.ts +0 -15
- package/internal-do-not-import-from-here/shared/models/Realtime.js +0 -17
- package/internal-do-not-import-from-here/shared/models/index.d.ts +1 -1
- package/internal-do-not-import-from-here/shared/models/index.js +1 -1
- package/internal-do-not-import-from-here/shared/models/theme/Blueprints.d.ts +9 -8
- package/internal-do-not-import-from-here/shared/models/theme/SharedBlueprintMethods.d.ts +3 -1
- package/internal-do-not-import-from-here/shared/models/theme/SharedBlueprintMethods.js +38 -34
- package/internal-do-not-import-from-here/shared/models/theme/ThemeDefinition.d.ts +4 -3
- package/internal-do-not-import-from-here/shared/models/theme/Typography.d.ts +1 -2
- package/package.json +1 -1
- package/parser/VelcronDataBinder.d.ts +50 -0
- package/parser/VelcronDataBinder.js +132 -22
- package/parser/VelcronFormatters.d.ts +6 -0
- package/parser/VelcronFormatters.js +20 -0
- package/parser/VelcronStyles.js +19 -19
- package/parser/index.d.ts +1 -0
- package/parser/index.js +1 -0
- package/stores/VelcronTheming.js +2 -2
- package/internal-do-not-import-from-here/shared/models/hub/TempSocialReactions.d.ts +0 -13
- package/internal-do-not-import-from-here/shared/models/hub/TempSocialReactions.js +0 -20
- package/internal-do-not-import-from-here/shared/models/hub/activities/Activity.d.ts +0 -75
- package/internal-do-not-import-from-here/shared/models/hub/activities/Activity.js +0 -13
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityChannel.d.ts +0 -7
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityChannel.js +0 -4
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityDefinition.d.ts +0 -14
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityDefinition.js +0 -15
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityFeed.d.ts +0 -31
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityHubServiceId.d.ts +0 -2
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRenderer.d.ts +0 -15
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRenderer.js +0 -4
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRendererLoadingReferences.d.ts +0 -8
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityRendererLoadingReferences.js +0 -2
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivitySubscription.d.ts +0 -16
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActivitySubscription.js +0 -4
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActorActivity.d.ts +0 -48
- package/internal-do-not-import-from-here/shared/models/hub/activities/ActorActivity.js +0 -17
- package/internal-do-not-import-from-here/shared/models/hub/activities/index.d.ts +0 -9
- package/internal-do-not-import-from-here/shared/models/hub/activities/index.js +0 -12
- package/internal-do-not-import-from-here/shared/models/hub/actors/Actor.d.ts +0 -21
- package/internal-do-not-import-from-here/shared/models/hub/actors/Actor.js +0 -10
- package/internal-do-not-import-from-here/shared/models/hub/actors/ExternalActorId.d.ts +0 -2
- package/internal-do-not-import-from-here/shared/models/hub/actors/ExternalActorId.js +0 -2
- package/internal-do-not-import-from-here/shared/models/hub/actors/index.d.ts +0 -2
- package/internal-do-not-import-from-here/shared/models/hub/actors/index.js +0 -5
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/FileOwnerId.d.ts +0 -3
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/FileOwnerId.js +0 -4
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/TemporaryFileId.d.ts +0 -4
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/TemporaryFileId.js +0 -4
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/index.d.ts +0 -2
- package/internal-do-not-import-from-here/shared/models/hub/fileupload/index.js +0 -5
- package/internal-do-not-import-from-here/shared/models/hub/index.d.ts +0 -7
- package/internal-do-not-import-from-here/shared/models/hub/index.js +0 -10
- package/internal-do-not-import-from-here/shared/models/hub/social/HubComment.d.ts +0 -10
- package/internal-do-not-import-from-here/shared/models/hub/social/HubComment.js +0 -2
- package/internal-do-not-import-from-here/shared/models/hub/social/HubReaction.d.ts +0 -5
- package/internal-do-not-import-from-here/shared/models/hub/social/HubReaction.js +0 -2
- package/internal-do-not-import-from-here/shared/models/hub/social/index.d.ts +0 -2
- package/internal-do-not-import-from-here/shared/models/hub/social/index.js +0 -5
- package/internal-do-not-import-from-here/shared/models/hub/targeting/ExternalIdentityProperty.d.ts +0 -10
- package/internal-do-not-import-from-here/shared/models/hub/targeting/ExternalIdentityProperty.js +0 -19
- package/internal-do-not-import-from-here/shared/models/hub/targeting/HubSource.d.ts +0 -4
- package/internal-do-not-import-from-here/shared/models/hub/targeting/HubSource.js +0 -8
- package/internal-do-not-import-from-here/shared/models/hub/targeting/index.d.ts +0 -1
- package/internal-do-not-import-from-here/shared/models/hub/targeting/index.js +0 -4
- /package/{internal-do-not-import-from-here/shared/models/hub/activities/ActivityFeed.js → formatters/InterpolationFormatter.js} +0 -0
|
@@ -5,9 +5,15 @@ const TextValue_1 = require("./TextValue");
|
|
|
5
5
|
const VelcronConstants_1 = require("./VelcronConstants");
|
|
6
6
|
const VelcronData_1 = require("./VelcronData");
|
|
7
7
|
const __1 = require("..");
|
|
8
|
-
|
|
9
|
-
const
|
|
8
|
+
const _interpolationRegex = /^{{\s*([^|}]+?)\s*(\|.*)?}}$/;
|
|
9
|
+
const _formatterRegex = /\|\s*(\w+)(?:\s*:\s*([^|]+))?/g;
|
|
10
10
|
class VelcronDataBinder {
|
|
11
|
+
/**
|
|
12
|
+
* Binds a value based on the provided binding expression.
|
|
13
|
+
* @param renderContext The render context containing state and other data.
|
|
14
|
+
* @param bindTo The binding expression or value.
|
|
15
|
+
* @returns The bound value after applying formatters and other logic.
|
|
16
|
+
*/
|
|
11
17
|
static bind(renderContext, bindTo) {
|
|
12
18
|
if (typeof bindTo === "object" && bindTo !== null) {
|
|
13
19
|
// Check if it's a switch expression
|
|
@@ -40,27 +46,104 @@ class VelcronDataBinder {
|
|
|
40
46
|
// Computed String interpolation > {{@getName}}
|
|
41
47
|
return VelcronDataBinder.interpolateTokens(bindTo, renderContext);
|
|
42
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Interpolates tokens within a binding string and applies formatters.
|
|
51
|
+
* @param bindTo The binding string containing tokens.
|
|
52
|
+
* @param renderContext The render context.
|
|
53
|
+
* @returns The interpolated string with formatters applied.
|
|
54
|
+
*/
|
|
43
55
|
static interpolateTokens(bindTo, renderContext) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
// Regex to match all interpolations like {{ variable | formatter1:'arg1','arg2' | formatter2 }}
|
|
57
|
+
const interpolationRegex = /{{\s*[^{}]*?}}/g;
|
|
58
|
+
return bindTo.replace(interpolationRegex, (match) => {
|
|
59
|
+
const interpolation = this.parseInterpolation(match);
|
|
60
|
+
if (!interpolation) {
|
|
61
|
+
__1.VelcronLogger.logDataError(`Failed to parse interpolation: ${match}`);
|
|
62
|
+
return match; // Return as-is if parsing fails
|
|
63
|
+
}
|
|
64
|
+
let value;
|
|
65
|
+
if (__1.VelcronActions.valueIsAction(interpolation.variable)) {
|
|
66
|
+
// If the variable is an action (e.g., @getData()), process it
|
|
67
|
+
value = this.processToken(interpolation.variable, renderContext);
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
value = VelcronData_1.VelcronData.getOrSet(renderContext, interpolation.variable);
|
|
71
|
+
}
|
|
72
|
+
if (value === undefined || value === null) {
|
|
73
|
+
__1.VelcronLogger.logDataError(`Variable "${interpolation.variable}" is not defined in the context.`);
|
|
74
|
+
return "";
|
|
75
|
+
}
|
|
76
|
+
for (const formatter of interpolation.formatters) {
|
|
77
|
+
const formatterObj = __1.VelcronFormatters.getFormatter(formatter.name);
|
|
78
|
+
if (!formatterObj) {
|
|
79
|
+
__1.VelcronLogger.logDataError(`Formatter "${formatter.name}" is not registered.`);
|
|
80
|
+
continue; // Skip unknown formatter
|
|
81
|
+
}
|
|
82
|
+
try {
|
|
83
|
+
value = formatterObj.format(value, ...formatter.args);
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
__1.VelcronLogger.logDataError(`Error applying formatter "${formatter.name}" to variable "${interpolation.variable}": ${error}`);
|
|
87
|
+
}
|
|
57
88
|
}
|
|
58
|
-
|
|
59
|
-
|
|
89
|
+
if (value instanceof TextValue_1.TextValue) {
|
|
90
|
+
value = value.value;
|
|
91
|
+
}
|
|
92
|
+
return value !== undefined && value !== null ? String(value) : "";
|
|
60
93
|
});
|
|
61
|
-
result += bindTo.substring(lastIndex);
|
|
62
|
-
return result;
|
|
63
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Parses an interpolation string to extract the variable and its formatters.
|
|
97
|
+
* @param match The interpolation string, e.g., "{{ variable | formatter1:'arg1','arg2' | formatter2 }}"
|
|
98
|
+
* @returns An Interpolation object or null if parsing fails.
|
|
99
|
+
*/
|
|
100
|
+
static parseInterpolation(match) {
|
|
101
|
+
const mainMatch = _interpolationRegex.exec(match);
|
|
102
|
+
if (!mainMatch)
|
|
103
|
+
return null;
|
|
104
|
+
const variable = mainMatch[1].trim();
|
|
105
|
+
const formattersPart = mainMatch[2] || "";
|
|
106
|
+
const formatters = [];
|
|
107
|
+
let formatterMatch;
|
|
108
|
+
while ((formatterMatch = _formatterRegex.exec(formattersPart)) !== null) {
|
|
109
|
+
const name = formatterMatch[1];
|
|
110
|
+
const rawArgs = formatterMatch[2] || "";
|
|
111
|
+
const args = [];
|
|
112
|
+
if (rawArgs) {
|
|
113
|
+
// Split arguments by comma and trim spaces
|
|
114
|
+
const argStrings = rawArgs.split(",").map(arg => arg.trim());
|
|
115
|
+
for (const argStr of argStrings) {
|
|
116
|
+
// Detect and convert argument types
|
|
117
|
+
let argValue;
|
|
118
|
+
if (/^'(.*)'$/.test(argStr)) {
|
|
119
|
+
// String argument enclosed in single quotes
|
|
120
|
+
argValue = argStr.slice(1, -1);
|
|
121
|
+
}
|
|
122
|
+
else if (/^\d+(\.\d+)?$/.test(argStr)) {
|
|
123
|
+
// Numeric argument
|
|
124
|
+
argValue = parseFloat(argStr);
|
|
125
|
+
}
|
|
126
|
+
else if (/^(true|false)$/i.test(argStr)) {
|
|
127
|
+
// Boolean argument
|
|
128
|
+
argValue = argStr.toLowerCase() === "true";
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
// Treat as string (unquoted)
|
|
132
|
+
argValue = argStr;
|
|
133
|
+
}
|
|
134
|
+
args.push(argValue);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
formatters.push({ name, args });
|
|
138
|
+
}
|
|
139
|
+
return { variable, formatters };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Processes a token that might represent an action or a state variable.
|
|
143
|
+
* @param tokenWithoutBrackets The token string without the surrounding {{ }}.
|
|
144
|
+
* @param renderContext The render context.
|
|
145
|
+
* @returns The result of processing the token.
|
|
146
|
+
*/
|
|
64
147
|
static processToken(tokenWithoutBrackets, renderContext) {
|
|
65
148
|
if (__1.VelcronActions.valueIsAction(tokenWithoutBrackets)) {
|
|
66
149
|
let result;
|
|
@@ -94,6 +177,12 @@ class VelcronDataBinder {
|
|
|
94
177
|
return VelcronData_1.VelcronData.getOrSet(renderContext, tokenWithoutBrackets);
|
|
95
178
|
}
|
|
96
179
|
}
|
|
180
|
+
/**
|
|
181
|
+
* Evaluates a switch expression based on the render context.
|
|
182
|
+
* @param expression The switch expression object.
|
|
183
|
+
* @param renderContext The render context.
|
|
184
|
+
* @returns The result of the switch expression.
|
|
185
|
+
*/
|
|
97
186
|
static evaluateSwitchExpression(expression, renderContext) {
|
|
98
187
|
// Evaluate the switch expression
|
|
99
188
|
const switchValue = VelcronDataBinder.evaluateExpression(expression.switch, renderContext);
|
|
@@ -104,7 +193,7 @@ class VelcronDataBinder {
|
|
|
104
193
|
const caseValue = expression.cases[switchValueStr];
|
|
105
194
|
if (typeof caseValue === "string") {
|
|
106
195
|
// If caseValue is a string, interpolate tokens
|
|
107
|
-
return VelcronDataBinder.
|
|
196
|
+
return VelcronDataBinder.interpolateTokens(caseValue, renderContext);
|
|
108
197
|
}
|
|
109
198
|
else {
|
|
110
199
|
// If caseValue is an object, evaluate it directly
|
|
@@ -115,7 +204,7 @@ class VelcronDataBinder {
|
|
|
115
204
|
const defaultValue = expression.default;
|
|
116
205
|
if (typeof defaultValue === "string") {
|
|
117
206
|
// If defaultValue is a string, interpolate tokens
|
|
118
|
-
return VelcronDataBinder.
|
|
207
|
+
return VelcronDataBinder.interpolateTokens(defaultValue, renderContext);
|
|
119
208
|
}
|
|
120
209
|
else {
|
|
121
210
|
// If defaultValue is an object, evaluate it directly
|
|
@@ -126,11 +215,17 @@ class VelcronDataBinder {
|
|
|
126
215
|
return undefined;
|
|
127
216
|
}
|
|
128
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Recursively evaluates an expression which can be a string, object, or other types.
|
|
220
|
+
* @param expr The expression to evaluate.
|
|
221
|
+
* @param renderContext The render context.
|
|
222
|
+
* @returns The evaluated result.
|
|
223
|
+
*/
|
|
129
224
|
static evaluateExpression(expr, renderContext) {
|
|
130
225
|
if (typeof expr === "string") {
|
|
131
226
|
return VelcronDataBinder.bind(renderContext, expr);
|
|
132
227
|
}
|
|
133
|
-
else if (typeof expr === "object") {
|
|
228
|
+
else if (typeof expr === "object" && expr !== null) {
|
|
134
229
|
// If expr is another switch expression
|
|
135
230
|
if ("switch" in expr) {
|
|
136
231
|
return VelcronDataBinder.evaluateSwitchExpression(expr, renderContext);
|
|
@@ -151,11 +246,25 @@ class VelcronDataBinder {
|
|
|
151
246
|
return expr;
|
|
152
247
|
}
|
|
153
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* Attempts to update a bound value in the render context.
|
|
251
|
+
* @param renderContext The render context.
|
|
252
|
+
* @param bindPath The binding path string.
|
|
253
|
+
* @param value The new value to set.
|
|
254
|
+
*/
|
|
154
255
|
static tryUpdateBoundValue(renderContext, bindPath, value) {
|
|
155
256
|
if (VelcronData_1.VelcronData.isBindable(bindPath)) {
|
|
156
257
|
VelcronData_1.VelcronData.getOrSet(renderContext, VelcronData_1.VelcronData.getBindPath(bindPath), value);
|
|
157
258
|
}
|
|
158
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Binds multiple properties at once based on the provided definitions.
|
|
262
|
+
* @param renderContext The render context.
|
|
263
|
+
* @param definition The binding definitions for each property.
|
|
264
|
+
* @param propertiesToBind The list of property keys to bind.
|
|
265
|
+
* @param objectToBindTo The target object where properties will be bound.
|
|
266
|
+
* @returns The object with bound properties.
|
|
267
|
+
*/
|
|
159
268
|
static bindMany(renderContext, definition, propertiesToBind, objectToBindTo) {
|
|
160
269
|
propertiesToBind.forEach((property) => {
|
|
161
270
|
const definitionValue = definition[property];
|
|
@@ -167,4 +276,5 @@ class VelcronDataBinder {
|
|
|
167
276
|
}
|
|
168
277
|
}
|
|
169
278
|
exports.VelcronDataBinder = VelcronDataBinder;
|
|
279
|
+
// Ensure the internal binding method uses the updated binder
|
|
170
280
|
VelcronData_1.VelcronData.bindInternal = VelcronDataBinder.bind;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InterpolationFormatter } from "../formatters";
|
|
2
|
+
export declare class VelcronFormatters {
|
|
3
|
+
static _formatters: Record<string, InterpolationFormatter>;
|
|
4
|
+
static registerFormatter(formatter: InterpolationFormatter): void;
|
|
5
|
+
static getFormatter(name: string): InterpolationFormatter | undefined;
|
|
6
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VelcronFormatters = void 0;
|
|
4
|
+
const VelcronLogger_1 = require("./VelcronLogger");
|
|
5
|
+
class VelcronFormatters {
|
|
6
|
+
static { this._formatters = {}; }
|
|
7
|
+
static registerFormatter(formatter) {
|
|
8
|
+
const name = formatter.name.toLowerCase();
|
|
9
|
+
if (this._formatters && this._formatters[name]) {
|
|
10
|
+
VelcronLogger_1.VelcronLogger.logActionError(`The action handler with name ${name} is already registered`);
|
|
11
|
+
}
|
|
12
|
+
else if (this._formatters) {
|
|
13
|
+
this._formatters[name] = formatter;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
static getFormatter(name) {
|
|
17
|
+
return this._formatters[name.toLowerCase()];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.VelcronFormatters = VelcronFormatters;
|
package/parser/VelcronStyles.js
CHANGED
|
@@ -111,13 +111,13 @@ class VelcronStyles {
|
|
|
111
111
|
const margin = VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, definition.margin);
|
|
112
112
|
const spacing = renderCtx.theming.get.spacing();
|
|
113
113
|
if (typeof margin === "object") {
|
|
114
|
-
styleBase.marginTop = this.unitProvider.formatDimension(
|
|
115
|
-
styleBase.marginRight = this.unitProvider.formatDimension(
|
|
116
|
-
styleBase.marginBottom = this.unitProvider.formatDimension(
|
|
117
|
-
styleBase.marginLeft = this.unitProvider.formatDimension(
|
|
114
|
+
styleBase.marginTop = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, margin.top), spacing, margin.scale));
|
|
115
|
+
styleBase.marginRight = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, margin.right), spacing, margin.scale));
|
|
116
|
+
styleBase.marginBottom = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, margin.bottom), spacing, margin.scale));
|
|
117
|
+
styleBase.marginLeft = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, margin.left), spacing, margin.scale));
|
|
118
118
|
}
|
|
119
119
|
else {
|
|
120
|
-
const value = this.unitProvider.formatDimension(
|
|
120
|
+
const value = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, margin), spacing));
|
|
121
121
|
styleBase.marginTop = value;
|
|
122
122
|
styleBase.marginRight = value;
|
|
123
123
|
styleBase.marginBottom = value;
|
|
@@ -128,13 +128,13 @@ class VelcronStyles {
|
|
|
128
128
|
const padding = VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, definition.padding);
|
|
129
129
|
const spacing = renderCtx.theming.get.spacing();
|
|
130
130
|
if (typeof padding === "object") {
|
|
131
|
-
styleBase.paddingTop = this.unitProvider.formatDimension(
|
|
132
|
-
styleBase.paddingRight = this.unitProvider.formatDimension(
|
|
133
|
-
styleBase.paddingBottom = this.unitProvider.formatDimension(
|
|
134
|
-
styleBase.paddingLeft = this.unitProvider.formatDimension(
|
|
131
|
+
styleBase.paddingTop = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, padding.top), spacing, padding.scale));
|
|
132
|
+
styleBase.paddingRight = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, padding.right), spacing, padding.scale));
|
|
133
|
+
styleBase.paddingBottom = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, padding.bottom), spacing, padding.scale));
|
|
134
|
+
styleBase.paddingLeft = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, padding.left), spacing, padding.scale));
|
|
135
135
|
}
|
|
136
136
|
else {
|
|
137
|
-
const value = this.unitProvider.formatDimension(
|
|
137
|
+
const value = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, padding), spacing));
|
|
138
138
|
styleBase.paddingTop = value;
|
|
139
139
|
styleBase.paddingRight = value;
|
|
140
140
|
styleBase.paddingBottom = value;
|
|
@@ -191,10 +191,10 @@ class VelcronStyles {
|
|
|
191
191
|
const flexDefinition = definition;
|
|
192
192
|
const spacingBlueprint = renderCtx.theming.get.spacing();
|
|
193
193
|
const gapX = flexDefinition.gapX || flexDefinition?.gapX?.toString() === "0"
|
|
194
|
-
?
|
|
195
|
-
:
|
|
194
|
+
? __1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, flexDefinition.gapX), spacingBlueprint)
|
|
195
|
+
: __1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, flexDefinition.gapY), spacingBlueprint);
|
|
196
196
|
const gapY = flexDefinition.gapY || flexDefinition?.gapY?.toString() === "0"
|
|
197
|
-
?
|
|
197
|
+
? __1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, flexDefinition.gapY), spacingBlueprint)
|
|
198
198
|
: gapX;
|
|
199
199
|
const width = VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, flexDefinition.width);
|
|
200
200
|
const minWidth = VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, flexDefinition.minWidth);
|
|
@@ -273,10 +273,10 @@ class VelcronStyles {
|
|
|
273
273
|
const columns = VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, gridDefinition.columns);
|
|
274
274
|
const minWidth = VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, gridDefinition.minColumnWidth);
|
|
275
275
|
const gapX = gridDefinition.gapX || gridDefinition?.gapX?.toString() === "0"
|
|
276
|
-
?
|
|
277
|
-
:
|
|
276
|
+
? __1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, gridDefinition.gapX), spacingBlueprint)
|
|
277
|
+
: __1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, gridDefinition.gapY), spacingBlueprint);
|
|
278
278
|
const gapY = gridDefinition.gapY || gridDefinition?.gapY?.toString() === "0"
|
|
279
|
-
?
|
|
279
|
+
? __1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, gridDefinition.gapY), spacingBlueprint)
|
|
280
280
|
: gapX;
|
|
281
281
|
styleBase.display = "grid";
|
|
282
282
|
styleBase.width = "100%";
|
|
@@ -315,7 +315,7 @@ class VelcronStyles {
|
|
|
315
315
|
return this.styleProvider(styleBase, definition, renderCtx);
|
|
316
316
|
}
|
|
317
317
|
static applySpacingDimension(value, spacing) {
|
|
318
|
-
return this.unitProvider.formatDimension(
|
|
318
|
+
return this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(value, spacing));
|
|
319
319
|
}
|
|
320
320
|
static applyOverflow(definition, renderCtx, styleBase) {
|
|
321
321
|
const overflowProps = ["overflow", "overflowX", "overflowY"];
|
|
@@ -336,7 +336,7 @@ class VelcronStyles {
|
|
|
336
336
|
const styleName = styleType?.length > 0
|
|
337
337
|
? `${styleType}${prop.charAt(0).toUpperCase() + prop.slice(1)}`
|
|
338
338
|
: prop;
|
|
339
|
-
styleBase[styleName] = this.unitProvider.formatDimension(
|
|
339
|
+
styleBase[styleName] = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(dataBound[prop], spacingDef));
|
|
340
340
|
}
|
|
341
341
|
});
|
|
342
342
|
}
|
|
@@ -346,7 +346,7 @@ class VelcronStyles {
|
|
|
346
346
|
const styleName = styleType?.length > 0
|
|
347
347
|
? `${styleType}${prop.charAt(0).toUpperCase() + prop.slice(1)}`
|
|
348
348
|
: prop;
|
|
349
|
-
styleBase[styleName] = this.unitProvider.formatDimension(
|
|
349
|
+
styleBase[styleName] = this.unitProvider.formatDimension(__1.SpacingMethods.getSpacingValueFromBlueprint(VelcronDataBinder_1.VelcronDataBinder.bind(renderCtx, spacing[prop]), spacingDef));
|
|
350
350
|
}
|
|
351
351
|
});
|
|
352
352
|
additionalPropsToDataBind &&
|
package/parser/index.d.ts
CHANGED
package/parser/index.js
CHANGED
|
@@ -10,3 +10,4 @@ tslib_1.__exportStar(require("./VelcronRenderers"), exports);
|
|
|
10
10
|
tslib_1.__exportStar(require("./TextValue"), exports);
|
|
11
11
|
tslib_1.__exportStar(require("./VelcronPropertyEditors"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./VelcronDataBinder"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./VelcronFormatters"), exports);
|
package/stores/VelcronTheming.js
CHANGED
|
@@ -23,10 +23,10 @@ exports.useVelcronThemingStore = (0, VelcronStore_1.defineVelcronStore)("Velcron
|
|
|
23
23
|
return (0, __1.useThemeMethods)(() => state.currentTheme).colorSchema(colorSchemaType);
|
|
24
24
|
},
|
|
25
25
|
spacing: () => {
|
|
26
|
-
return state.currentTheme.spacing
|
|
26
|
+
return state.currentTheme.spacing;
|
|
27
27
|
},
|
|
28
28
|
typography: (typographyType, size) => {
|
|
29
|
-
const typography = state.currentTheme.typography
|
|
29
|
+
const typography = state.currentTheme.typography;
|
|
30
30
|
if (typographyType === __1.TypographyTypes.text) {
|
|
31
31
|
return typography.text[size];
|
|
32
32
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { guid } from "../Guid";
|
|
2
|
-
import { RealtimeChannel, RealtimeData } from "../Realtime";
|
|
3
|
-
export declare class SocialRealtimeChannel extends RealtimeChannel {
|
|
4
|
-
getId(): string;
|
|
5
|
-
}
|
|
6
|
-
export interface SocialRealtimeMessage {
|
|
7
|
-
reactionCount: number;
|
|
8
|
-
commentCount: number;
|
|
9
|
-
}
|
|
10
|
-
export declare class SocialRealtimeData extends RealtimeData<SocialRealtimeChannel, SocialRealtimeMessage> {
|
|
11
|
-
constructor(channel: SocialRealtimeChannel);
|
|
12
|
-
getId(): guid;
|
|
13
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SocialRealtimeData = exports.SocialRealtimeChannel = void 0;
|
|
4
|
-
const Guid_1 = require("../Guid");
|
|
5
|
-
const Realtime_1 = require("../Realtime");
|
|
6
|
-
class SocialRealtimeChannel extends Realtime_1.RealtimeChannel {
|
|
7
|
-
getId() {
|
|
8
|
-
return "social";
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.SocialRealtimeChannel = SocialRealtimeChannel;
|
|
12
|
-
class SocialRealtimeData extends Realtime_1.RealtimeData {
|
|
13
|
-
constructor(channel) {
|
|
14
|
-
super(channel);
|
|
15
|
-
}
|
|
16
|
-
getId() {
|
|
17
|
-
return (0, Guid_1.guid)("445350a8-4565-4a94-ba01-a05dd2cccca6");
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.SocialRealtimeData = SocialRealtimeData;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { ChannelId } from "./ActivityChannel";
|
|
2
|
-
import { ActivityRenderer, ActivityRendererReference } from "./ActivityRenderer";
|
|
3
|
-
import { Id } from "../../Id";
|
|
4
|
-
import { DynamicState } from "../../DynamicState";
|
|
5
|
-
import { ActorActivityCategory } from "./ActorActivity";
|
|
6
|
-
import { TemporaryFileId } from "../fileupload";
|
|
7
|
-
import { ActorId } from "../actors";
|
|
8
|
-
import { guid } from "../../Guid";
|
|
9
|
-
export type ActivityId = Id<number, "ActivityId">;
|
|
10
|
-
export declare function ActivityId(id: number): ActivityId;
|
|
11
|
-
export type ActivityTypeId = Id<guid, "ActivityTypeId">;
|
|
12
|
-
export declare function ActivityTypeId(id: guid): ActivityTypeId;
|
|
13
|
-
export interface Activity<TRenderState = DynamicState> extends ActivityBase {
|
|
14
|
-
id: ActivityId;
|
|
15
|
-
state: TRenderState;
|
|
16
|
-
renderer: ActivityRenderer | ActivityRendererReference;
|
|
17
|
-
createdBy: ActorId;
|
|
18
|
-
}
|
|
19
|
-
export interface ActivityWithJson extends ActivityBase {
|
|
20
|
-
id: ActivityId;
|
|
21
|
-
createdBy: ActorId;
|
|
22
|
-
stateJson: string;
|
|
23
|
-
rendererJson: string;
|
|
24
|
-
}
|
|
25
|
-
export interface ActivityBase {
|
|
26
|
-
channelId: ChannelId;
|
|
27
|
-
activityTypeId: ActivityTypeId;
|
|
28
|
-
targeting: Array<Array<SourceRelatedHubProperty>>;
|
|
29
|
-
notificationTeaser: NotificationTeaser;
|
|
30
|
-
expires?: Date;
|
|
31
|
-
createdAt: Date;
|
|
32
|
-
reactionCount?: number;
|
|
33
|
-
commentCount?: number;
|
|
34
|
-
}
|
|
35
|
-
export interface ActivityRenderState<TActivityState = DynamicState, TIdentityState = DynamicState> {
|
|
36
|
-
activity: TActivityState;
|
|
37
|
-
identity: TIdentityState;
|
|
38
|
-
}
|
|
39
|
-
export interface SourceRelatedHubProperty extends HubProperty {
|
|
40
|
-
propertySourceId: guid;
|
|
41
|
-
}
|
|
42
|
-
export interface HubProperty {
|
|
43
|
-
name: string;
|
|
44
|
-
values: Array<string>;
|
|
45
|
-
}
|
|
46
|
-
export interface NotificationTeaser {
|
|
47
|
-
title: string;
|
|
48
|
-
description: string;
|
|
49
|
-
url: string;
|
|
50
|
-
}
|
|
51
|
-
export declare enum PrivacyLevel {
|
|
52
|
-
Private = 0,
|
|
53
|
-
Public = 1,
|
|
54
|
-
Followers = 2
|
|
55
|
-
}
|
|
56
|
-
export interface CreateActivityRequest {
|
|
57
|
-
channelId: ChannelId;
|
|
58
|
-
activityTypeId: ActivityTypeId;
|
|
59
|
-
createdBy: ActorId;
|
|
60
|
-
stateJson: string;
|
|
61
|
-
rendererJson: string;
|
|
62
|
-
notificationTeaser: NotificationTeaser;
|
|
63
|
-
targeting: Array<Array<SourceRelatedHubProperty>>;
|
|
64
|
-
addToActors?: {
|
|
65
|
-
[actorId: ActorId]: PrivacyLevel;
|
|
66
|
-
};
|
|
67
|
-
category: ActorActivityCategory;
|
|
68
|
-
activityIdPlaceHolder?: TemporaryFileId;
|
|
69
|
-
expires?: Date;
|
|
70
|
-
createdAt?: Date;
|
|
71
|
-
}
|
|
72
|
-
export interface CreateActivityResult {
|
|
73
|
-
id: ActivityId;
|
|
74
|
-
createdAt: Date;
|
|
75
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PrivacyLevel = void 0;
|
|
4
|
-
exports.ActivityId = ActivityId;
|
|
5
|
-
exports.ActivityTypeId = ActivityTypeId;
|
|
6
|
-
function ActivityId(id) { return id; }
|
|
7
|
-
function ActivityTypeId(id) { return id; }
|
|
8
|
-
var PrivacyLevel;
|
|
9
|
-
(function (PrivacyLevel) {
|
|
10
|
-
PrivacyLevel[PrivacyLevel["Private"] = 0] = "Private";
|
|
11
|
-
PrivacyLevel[PrivacyLevel["Public"] = 1] = "Public";
|
|
12
|
-
PrivacyLevel[PrivacyLevel["Followers"] = 2] = "Followers";
|
|
13
|
-
})(PrivacyLevel || (exports.PrivacyLevel = PrivacyLevel = {}));
|
package/internal-do-not-import-from-here/shared/models/hub/activities/ActivityDefinition.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DynamicState } from "../../DynamicState";
|
|
2
|
-
import { ActivityTypeId } from "./Activity";
|
|
3
|
-
import { ActivityRenderer, ActivityRendererReference } from "./ActivityRenderer";
|
|
4
|
-
export declare abstract class FeedActivityDefinition<TFeedItemState> implements ActivityDefinition<TFeedItemState> {
|
|
5
|
-
state: TFeedItemState;
|
|
6
|
-
renderer: ActivityRenderer | ActivityRendererReference;
|
|
7
|
-
activityTypeId: ActivityTypeId;
|
|
8
|
-
constructor(state: TFeedItemState, renderer: ActivityRenderer | ActivityRendererReference, activityTypeId: ActivityTypeId);
|
|
9
|
-
}
|
|
10
|
-
export declare abstract class ActivityDefinition<TRenderState = DynamicState> {
|
|
11
|
-
state: TRenderState;
|
|
12
|
-
renderer: ActivityRenderer | ActivityRendererReference;
|
|
13
|
-
abstract activityTypeId: ActivityTypeId;
|
|
14
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ActivityDefinition = exports.FeedActivityDefinition = void 0;
|
|
4
|
-
class FeedActivityDefinition {
|
|
5
|
-
constructor(state, renderer, activityTypeId) {
|
|
6
|
-
this.state = state;
|
|
7
|
-
this.renderer = renderer;
|
|
8
|
-
this.activityTypeId = activityTypeId;
|
|
9
|
-
this.activityTypeId = activityTypeId;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.FeedActivityDefinition = FeedActivityDefinition;
|
|
13
|
-
class ActivityDefinition {
|
|
14
|
-
}
|
|
15
|
-
exports.ActivityDefinition = ActivityDefinition;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ActorId } from "../actors";
|
|
2
|
-
import { Activity, ActivityId, ActivityWithJson } from "./Activity";
|
|
3
|
-
import { ActivityRenderer, ActivityRendererId } from "./ActivityRenderer";
|
|
4
|
-
import { ActivityCategoryCount, ActorActivity, ActorActivityCategory, ActorActivityWithJson, NewActivitiesByCreatorBase } from "./ActorActivity";
|
|
5
|
-
export interface ActivityFeed extends ActivityFeedBase {
|
|
6
|
-
renderers: {
|
|
7
|
-
[key: ActivityRendererId]: Array<ActivityRenderer>;
|
|
8
|
-
};
|
|
9
|
-
actorActivities: Array<ActorActivity<object, object>>;
|
|
10
|
-
activities: Array<Activity>;
|
|
11
|
-
}
|
|
12
|
-
export interface ActivityFeedResult extends ActivityFeedBase {
|
|
13
|
-
actorActivities: Array<ActorActivityWithJson>;
|
|
14
|
-
activities: Array<ActivityWithJson>;
|
|
15
|
-
loadStateHash: string;
|
|
16
|
-
}
|
|
17
|
-
export interface ActivityFeedBase {
|
|
18
|
-
newActivities: Array<NewActivitiesByCreatorBase>;
|
|
19
|
-
nextStartingFromId: ActivityId;
|
|
20
|
-
recentCreators: Array<ActorId>;
|
|
21
|
-
categories: Array<ActivityCategoryCount>;
|
|
22
|
-
}
|
|
23
|
-
export interface FeedQuery {
|
|
24
|
-
forActorId?: ActorId;
|
|
25
|
-
newerThenId?: ActivityId;
|
|
26
|
-
olderThenId?: ActivityId;
|
|
27
|
-
filterByCreator?: ActorId;
|
|
28
|
-
filterByCategory?: ActorActivityCategory;
|
|
29
|
-
includeRecentCreators?: number;
|
|
30
|
-
includeCategories?: boolean;
|
|
31
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { guid } from "../../Guid";
|
|
2
|
-
import { Id } from "../../Id";
|
|
3
|
-
import { VelcronAppDefinition } from "../../velcron";
|
|
4
|
-
export type ActivityRendererId = Id<guid, "ActivityRendererId">;
|
|
5
|
-
export declare function ActivityRendererId(id: guid): ActivityRendererId;
|
|
6
|
-
export interface ActivityRendererReference {
|
|
7
|
-
id: ActivityRendererId;
|
|
8
|
-
version: string;
|
|
9
|
-
}
|
|
10
|
-
export interface ActivityRendererWithJson extends ActivityRendererReference {
|
|
11
|
-
definition: string;
|
|
12
|
-
}
|
|
13
|
-
export interface ActivityRenderer extends ActivityRendererReference {
|
|
14
|
-
definition: VelcronAppDefinition;
|
|
15
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ActivityRendererReference } from "./ActivityRenderer";
|
|
2
|
-
export interface ActivityRendererLoadReference extends ActivityRendererReference {
|
|
3
|
-
versionHash: string;
|
|
4
|
-
}
|
|
5
|
-
export interface ActivityRendererLoadingReferences {
|
|
6
|
-
stateHash: string;
|
|
7
|
-
loadReferences: Array<ActivityRendererLoadReference>;
|
|
8
|
-
}
|
package/internal-do-not-import-from-here/shared/models/hub/activities/ActivitySubscription.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Id } from "../../Id";
|
|
2
|
-
import { ActorId } from "../actors";
|
|
3
|
-
export type SubscriptionId = Id<string, "SubscriptionId">;
|
|
4
|
-
export declare function SubscriptionId(id: string): SubscriptionId;
|
|
5
|
-
export interface SubscriptionInformation extends ActorSubscription {
|
|
6
|
-
title: Record<string, string>;
|
|
7
|
-
description: Record<string, string>;
|
|
8
|
-
clientId: string;
|
|
9
|
-
}
|
|
10
|
-
export interface ActorSubscription {
|
|
11
|
-
id: SubscriptionId;
|
|
12
|
-
subscriptionOwner: ActorId;
|
|
13
|
-
}
|
|
14
|
-
export interface Subscription extends ActorSubscription {
|
|
15
|
-
subscriber: ActorId;
|
|
16
|
-
}
|