xmlui 0.9.49 → 0.9.51
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/lib/{apiInterceptorWorker-jUcCYRz4.mjs → apiInterceptorWorker-BtGYrMWj.mjs} +1 -1
- package/dist/lib/{index-Cm7mLpy4.mjs → index-hS5S81ba.mjs} +7483 -7452
- package/dist/lib/index.css +1 -1
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{metadata-utils-DiiTyP_-.mjs → metadata-utils-QekhOD-W.mjs} +1 -1
- package/dist/lib/{server-common-DJ9dCJkg.mjs → server-common-CtY73qos.mjs} +4483 -4207
- package/dist/lib/{transform-DU7v4c9h.mjs → transform-DXcw0gGl.mjs} +429 -428
- package/dist/lib/xmlui-parser.d.ts +2 -0
- package/dist/lib/xmlui-parser.mjs +2 -2
- package/dist/lib/{xmlui-serializer-B3OkRzrr.mjs → xmlui-serializer-CAZCkpXP.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +2 -0
- package/dist/lib/xmlui.mjs +2 -2
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +2951 -2899
- package/dist/metadata/xmlui-metadata.umd.js +7 -7
- package/dist/scripts/package.json +1 -2
- package/dist/scripts/src/components/App/App.js +4 -1
- package/dist/scripts/src/components/Checkbox/Checkbox.js +1 -0
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +3 -0
- package/dist/scripts/src/components/Footer/Footer.js +1 -0
- package/dist/scripts/src/components/FormItem/FormItem.js +7 -0
- package/dist/scripts/src/components/FormItem/Validations.js +49 -33
- package/dist/scripts/src/components/Heading/Heading.js +1 -0
- package/dist/scripts/src/components/Link/Link.js +7 -7
- package/dist/scripts/src/components/Markdown/Markdown.js +4 -0
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +18 -68
- package/dist/scripts/src/components/NavPanel/NavPanel.js +2 -0
- package/dist/scripts/src/components/NavPanel/NavPanelNative.js +0 -1
- package/dist/scripts/src/components/Switch/Switch.js +1 -0
- package/dist/scripts/src/components/Text/Text.js +4 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +8 -0
- package/dist/standalone/xmlui-standalone.es.d.ts +2 -0
- package/dist/standalone/xmlui-standalone.umd.js +205 -205
- package/package.json +1 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xmlui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.51",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start-test-bed": "cd src/testing/infrastructure && xmlui start",
|
|
@@ -105,7 +105,6 @@
|
|
|
105
105
|
"vite-plugin-svgr": "4.2.0",
|
|
106
106
|
"vscode-languageserver": "^9.0.1",
|
|
107
107
|
"vscode-languageserver-textdocument": "^1.0.11",
|
|
108
|
-
"xml-formatter": "^3.6.6",
|
|
109
108
|
"yargs": "17.7.2",
|
|
110
109
|
"xmlui-charts": "*"
|
|
111
110
|
},
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.appRenderer = exports.AppMd = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const App_module_scss_1 = __importDefault(require("./App.module.scss"));
|
|
9
|
+
const Sheet_module_scss_1 = __importDefault(require("./Sheet.module.scss"));
|
|
9
10
|
const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
|
|
10
11
|
const renderers_1 = require("../../components-core/renderers");
|
|
11
12
|
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
@@ -77,7 +78,8 @@ exports.AppMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
77
78
|
events: {
|
|
78
79
|
ready: (0, ComponentDefs_1.d)(`This event fires when the \`${COMP}\` component finishes rendering on the page.`),
|
|
79
80
|
},
|
|
80
|
-
themeVars: (0, themeVars_1.parseScssVar)(App_module_scss_1.default.themeVars),
|
|
81
|
+
themeVars: Object.assign(Object.assign({}, (0, themeVars_1.parseScssVar)(App_module_scss_1.default.themeVars)), (0, themeVars_1.parseScssVar)(Sheet_module_scss_1.default.themeVars)),
|
|
82
|
+
limitThemeVarsToComponent: true,
|
|
81
83
|
themeVarDescriptions: {
|
|
82
84
|
"maxWidth-content-App": "This theme variable defines the maximum width of the main content. If the main " +
|
|
83
85
|
"content is broader, the engine adds margins to keep the expected maximum size.",
|
|
@@ -88,6 +90,7 @@ exports.AppMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
88
90
|
"with one of the vertical layouts.",
|
|
89
91
|
},
|
|
90
92
|
defaultThemeVars: {
|
|
93
|
+
"maxWidth-Drawer": "20rem",
|
|
91
94
|
[`width-navPanel-${COMP}`]: "$space-64",
|
|
92
95
|
[`backgroundColor-navPanel-${COMP}`]: "$backgroundColor",
|
|
93
96
|
[`maxWidth-content-${COMP}`]: "$maxWidth-content",
|
|
@@ -46,6 +46,7 @@ exports.CheckboxMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
46
46
|
setValue: (0, metadata_helpers_1.dSetValueApi)(),
|
|
47
47
|
},
|
|
48
48
|
themeVars: (0, themeVars_1.parseScssVar)(Toggle_module_scss_1.default.themeVars),
|
|
49
|
+
limitThemeVarsToComponent: true,
|
|
49
50
|
defaultThemeVars: {
|
|
50
51
|
[`borderColor-checked-${COMP}-error`]: `$borderColor-${COMP}-error`,
|
|
51
52
|
[`backgroundColor-checked-${COMP}-error`]: `$borderColor-${COMP}-error`,
|
|
@@ -63,6 +63,7 @@ exports.DropdownMenuMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
63
63
|
close: (0, ComponentDefs_1.d)(`This method command closes the dropdown.`),
|
|
64
64
|
},
|
|
65
65
|
themeVars: (0, themeVars_1.parseScssVar)(DropdownMenu_module_scss_1.default.themeVars),
|
|
66
|
+
limitThemeVarsToComponent: true,
|
|
66
67
|
defaultThemeVars: {
|
|
67
68
|
[`backgroundColor-${DDMCOMP}`]: "$color-surface-raised",
|
|
68
69
|
[`minWidth-${DDMCOMP}`]: "160px",
|
|
@@ -107,6 +108,7 @@ exports.MenuItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
107
108
|
click: (0, metadata_helpers_1.dClick)(MICOMP),
|
|
108
109
|
},
|
|
109
110
|
themeVars: (0, themeVars_1.parseScssVar)(DropdownMenu_module_scss_1.default.themeVars),
|
|
111
|
+
limitThemeVarsToComponent: true,
|
|
110
112
|
defaultThemeVars: {
|
|
111
113
|
[`backgroundColor-${MICOMP}`]: "$backgroundColor-dropdown-item",
|
|
112
114
|
[`color-${MICOMP}`]: "$textColor-primary",
|
|
@@ -155,6 +157,7 @@ exports.MenuSeparatorMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
155
157
|
description: "This component displays a separator line between menu items.",
|
|
156
158
|
docFolder: DDMCOMP,
|
|
157
159
|
themeVars: (0, themeVars_1.parseScssVar)(DropdownMenu_module_scss_1.default.themeVars),
|
|
160
|
+
limitThemeVarsToComponent: true,
|
|
158
161
|
defaultThemeVars: {
|
|
159
162
|
[`marginTop-${MSEP}`]: "$space-1",
|
|
160
163
|
[`marginBottom-${MSEP}`]: "$space-1",
|
|
@@ -14,6 +14,7 @@ const COMP = "Footer";
|
|
|
14
14
|
exports.FooterMd = (0, ComponentDefs_1.createMetadata)({
|
|
15
15
|
description: `The \`${COMP}\` is a component that acts as a placeholder within \`App\`.`,
|
|
16
16
|
themeVars: (0, themeVars_1.parseScssVar)(Footer_module_scss_1.default.themeVars),
|
|
17
|
+
limitThemeVarsToComponent: true,
|
|
17
18
|
defaultThemeVars: {
|
|
18
19
|
[`backgroundColor-${COMP}`]: "$backgroundColor-AppHeader",
|
|
19
20
|
[`verticalAlign-${COMP}`]: "center",
|
|
@@ -158,6 +158,13 @@ exports.FormItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
158
158
|
events: {
|
|
159
159
|
validate: (0, ComponentDefs_1.d)(`This event is used to define a custom validation function.`),
|
|
160
160
|
},
|
|
161
|
+
apis: {
|
|
162
|
+
addItem: (0, ComponentDefs_1.d)("Adds a new item to the `FormItem` data where the particular form item holds " +
|
|
163
|
+
"a list. The function has a single parameter, the data to add to the `FormItem`. " +
|
|
164
|
+
"The new item is appended to the end of the list."),
|
|
165
|
+
removeItem: (0, ComponentDefs_1.d)("Removes the item specified by its index from the list held by the FormItem. " +
|
|
166
|
+
"The function has a single argument, the index to remove."),
|
|
167
|
+
},
|
|
161
168
|
contextVars: {
|
|
162
169
|
$value: (0, ComponentDefs_1.d)(`The context variable represents the current value of the \`${COMP}\`. It can be used in ` +
|
|
163
170
|
`expressions and code snippets within the \`${COMP}\` instance.`),
|
|
@@ -76,23 +76,23 @@ class FormItemValidator {
|
|
|
76
76
|
if (!requiredResult || requiredResult.isValid) {
|
|
77
77
|
validationResults.push(this.validateLength(), this.validateRange(), this.validatePattern(), this.validateRegex());
|
|
78
78
|
}
|
|
79
|
-
validationResults = validationResults.filter(result => result !== undefined);
|
|
79
|
+
validationResults = validationResults.filter((result) => result !== undefined);
|
|
80
80
|
return {
|
|
81
|
-
isValid: validationResults.find(result => !result.isValid) === undefined,
|
|
81
|
+
isValid: validationResults.find((result) => !result.isValid) === undefined,
|
|
82
82
|
validatedValue: this.value,
|
|
83
83
|
partial: this.onValidate !== undefined,
|
|
84
|
-
validations: validationResults
|
|
84
|
+
validations: validationResults,
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
87
|
this.validate = () => __awaiter(this, void 0, void 0, function* () {
|
|
88
88
|
const preValidateResult = this.preValidate();
|
|
89
89
|
const constValidationResult = (yield this.validateCustom()) || [];
|
|
90
|
-
preValidateResult.validations.push(...constValidationResult.map(res => (Object.assign(Object.assign({}, res), { async: true }))));
|
|
90
|
+
preValidateResult.validations.push(...constValidationResult.map((res) => (Object.assign(Object.assign({}, res), { async: true }))));
|
|
91
91
|
return {
|
|
92
|
-
isValid: preValidateResult.validations.find(result => !result.isValid) === undefined,
|
|
92
|
+
isValid: preValidateResult.validations.find((result) => !result.isValid) === undefined,
|
|
93
93
|
validatedValue: this.value,
|
|
94
94
|
partial: false,
|
|
95
|
-
validations: preValidateResult.validations
|
|
95
|
+
validations: preValidateResult.validations,
|
|
96
96
|
};
|
|
97
97
|
});
|
|
98
98
|
}
|
|
@@ -104,36 +104,38 @@ class FormItemValidator {
|
|
|
104
104
|
return {
|
|
105
105
|
isValid: !isInputEmpty(this.value),
|
|
106
106
|
invalidMessage: requiredInvalidMessage || "This field is required",
|
|
107
|
-
severity: "error"
|
|
107
|
+
severity: "error",
|
|
108
108
|
};
|
|
109
109
|
}
|
|
110
110
|
validateLength() {
|
|
111
|
-
const { minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity = "error" } = this.validations;
|
|
111
|
+
const { minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity = "error", } = this.validations;
|
|
112
112
|
if (minLength === undefined && maxLength === undefined) {
|
|
113
113
|
return undefined;
|
|
114
114
|
}
|
|
115
115
|
if (minLength !== undefined && maxLength === undefined) {
|
|
116
116
|
return {
|
|
117
117
|
isValid: isMinLengthValid(this.value, minLength),
|
|
118
|
-
invalidMessage: lengthInvalidMessage ||
|
|
119
|
-
|
|
118
|
+
invalidMessage: lengthInvalidMessage ||
|
|
119
|
+
`Input should be at least ${minLength} ${pluralize(minLength, "character")}`,
|
|
120
|
+
severity: lengthInvalidSeverity,
|
|
120
121
|
};
|
|
121
122
|
}
|
|
122
123
|
if (minLength === undefined && maxLength !== undefined) {
|
|
123
124
|
return {
|
|
124
125
|
isValid: isMaxLengthValid(this.value, maxLength),
|
|
125
|
-
invalidMessage: lengthInvalidMessage ||
|
|
126
|
-
|
|
126
|
+
invalidMessage: lengthInvalidMessage ||
|
|
127
|
+
`Input should be up to ${maxLength} ${pluralize(maxLength, "character")}`,
|
|
128
|
+
severity: lengthInvalidSeverity,
|
|
127
129
|
};
|
|
128
130
|
}
|
|
129
131
|
return {
|
|
130
132
|
isValid: isMinLengthValid(this.value, minLength) && isMaxLengthValid(this.value, maxLength),
|
|
131
133
|
invalidMessage: lengthInvalidMessage || `Input length should be between ${minLength} and ${maxLength}`,
|
|
132
|
-
severity: lengthInvalidSeverity
|
|
134
|
+
severity: lengthInvalidSeverity,
|
|
133
135
|
};
|
|
134
136
|
}
|
|
135
137
|
validateRange() {
|
|
136
|
-
const { minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity = "error" } = this.validations;
|
|
138
|
+
const { minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity = "error", } = this.validations;
|
|
137
139
|
if (minValue === undefined && maxValue === undefined) {
|
|
138
140
|
return undefined;
|
|
139
141
|
}
|
|
@@ -141,20 +143,29 @@ class FormItemValidator {
|
|
|
141
143
|
return {
|
|
142
144
|
isValid: isMinValueValid(this.value, minValue),
|
|
143
145
|
invalidMessage: rangeInvalidMessage || `Input should be bigger than ${minValue}`,
|
|
144
|
-
severity: rangeInvalidSeverity
|
|
146
|
+
severity: rangeInvalidSeverity,
|
|
145
147
|
};
|
|
146
148
|
}
|
|
147
149
|
if (minValue === undefined && maxValue !== undefined) {
|
|
148
150
|
return {
|
|
149
151
|
isValid: isMaxValueValid(this.value, maxValue),
|
|
150
152
|
invalidMessage: rangeInvalidMessage || `Input should be smaller than ${maxValue}`,
|
|
151
|
-
severity: rangeInvalidSeverity
|
|
153
|
+
severity: rangeInvalidSeverity,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
if (typeof this.value === "object" && Array.isArray(this.value)) {
|
|
157
|
+
// If the value is an array, we check if all elements are within the range
|
|
158
|
+
const allValid = this.value.every((val) => isMinValueValid(val, minValue) && isMaxValueValid(val, maxValue));
|
|
159
|
+
return {
|
|
160
|
+
isValid: allValid,
|
|
161
|
+
invalidMessage: rangeInvalidMessage || `All inputs should be between ${minValue} and ${maxValue}`,
|
|
162
|
+
severity: rangeInvalidSeverity,
|
|
152
163
|
};
|
|
153
164
|
}
|
|
154
165
|
return {
|
|
155
166
|
isValid: isMinValueValid(this.value, minValue) && isMaxValueValid(this.value, maxValue),
|
|
156
167
|
invalidMessage: rangeInvalidMessage || `Input should be between ${minValue} and ${maxValue}`,
|
|
157
|
-
severity: rangeInvalidSeverity
|
|
168
|
+
severity: rangeInvalidSeverity,
|
|
158
169
|
};
|
|
159
170
|
}
|
|
160
171
|
validatePattern() {
|
|
@@ -167,13 +178,13 @@ class FormItemValidator {
|
|
|
167
178
|
return {
|
|
168
179
|
isValid: /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/.test(this.value),
|
|
169
180
|
invalidMessage: patternInvalidMessage || "Not a valid email address",
|
|
170
|
-
severity: patternInvalidSeverity
|
|
181
|
+
severity: patternInvalidSeverity,
|
|
171
182
|
};
|
|
172
183
|
case "phone":
|
|
173
184
|
return {
|
|
174
185
|
isValid: /^[a-zA-Z0-9#*)(+.\-_&']+$/g.test(this.value),
|
|
175
186
|
invalidMessage: patternInvalidMessage || "Not a valid phone number",
|
|
176
|
-
severity: patternInvalidSeverity
|
|
187
|
+
severity: patternInvalidSeverity,
|
|
177
188
|
};
|
|
178
189
|
case "url":
|
|
179
190
|
let url;
|
|
@@ -185,18 +196,18 @@ class FormItemValidator {
|
|
|
185
196
|
return {
|
|
186
197
|
isValid: false,
|
|
187
198
|
invalidMessage: "Not a valid URL",
|
|
188
|
-
severity: patternInvalidSeverity
|
|
199
|
+
severity: patternInvalidSeverity,
|
|
189
200
|
};
|
|
190
201
|
}
|
|
191
202
|
return {
|
|
192
203
|
isValid: true,
|
|
193
|
-
severity: "valid"
|
|
204
|
+
severity: "valid",
|
|
194
205
|
};
|
|
195
206
|
default: {
|
|
196
207
|
console.warn("Unknown pattern provided");
|
|
197
208
|
return {
|
|
198
209
|
isValid: true,
|
|
199
|
-
severity: "valid"
|
|
210
|
+
severity: "valid",
|
|
200
211
|
};
|
|
201
212
|
}
|
|
202
213
|
}
|
|
@@ -209,7 +220,7 @@ class FormItemValidator {
|
|
|
209
220
|
return {
|
|
210
221
|
isValid: isRegexValid(this.value, regex),
|
|
211
222
|
invalidMessage: regexInvalidMessage || "Input is not in the correct format",
|
|
212
|
-
severity: regexInvalidSeverity
|
|
223
|
+
severity: regexInvalidSeverity,
|
|
213
224
|
};
|
|
214
225
|
}
|
|
215
226
|
validateCustom() {
|
|
@@ -223,8 +234,8 @@ class FormItemValidator {
|
|
|
223
234
|
{
|
|
224
235
|
isValid: validationFnResult,
|
|
225
236
|
invalidMessage: "Invalid input",
|
|
226
|
-
severity: "error"
|
|
227
|
-
}
|
|
237
|
+
severity: "error",
|
|
238
|
+
},
|
|
228
239
|
];
|
|
229
240
|
}
|
|
230
241
|
if (!(0, lodash_es_1.isArray)(validationFnResult)) {
|
|
@@ -247,7 +258,7 @@ function useValidation(validations, onValidate, value, dispatch, bindTo, throttl
|
|
|
247
258
|
if (throttleWaitInMs !== 0) {
|
|
248
259
|
return (0, misc_1.asyncThrottle)(asyncValidate, throttleWaitInMs, {
|
|
249
260
|
trailing: true,
|
|
250
|
-
leading: true
|
|
261
|
+
leading: true,
|
|
251
262
|
});
|
|
252
263
|
}
|
|
253
264
|
return asyncValidate;
|
|
@@ -274,7 +285,7 @@ function useValidation(validations, onValidate, value, dispatch, bindTo, throttl
|
|
|
274
285
|
}, [bindTo, deferredValue, dispatch, onValidate, throttledAsyncValidate, validations]);
|
|
275
286
|
}
|
|
276
287
|
function useValidationDisplay(bindTo, value, validationResult, validationMode = FormContext_1.defaultValidationMode) {
|
|
277
|
-
const interactionFlags = (0, FormContext_1.useFormContextPart)(value => value.interactionFlags[bindTo]) || constants_1.EMPTY_OBJECT;
|
|
288
|
+
const interactionFlags = (0, FormContext_1.useFormContextPart)((value) => value.interactionFlags[bindTo]) || constants_1.EMPTY_OBJECT;
|
|
278
289
|
const forceShowValidationResult = interactionFlags.forceShowValidationResult;
|
|
279
290
|
const focused = interactionFlags.focused;
|
|
280
291
|
const isValidLostFocus = interactionFlags.isValidLostFocus;
|
|
@@ -288,7 +299,8 @@ function useValidationDisplay(bindTo, value, validationResult, validationMode =
|
|
|
288
299
|
if (val.isValid) {
|
|
289
300
|
continue;
|
|
290
301
|
}
|
|
291
|
-
if (highestValidationSeverity !== "error" &&
|
|
302
|
+
if (highestValidationSeverity !== "error" &&
|
|
303
|
+
val.severity === "warning") {
|
|
292
304
|
highestValidationSeverity = "warning";
|
|
293
305
|
}
|
|
294
306
|
if (val.severity === "error") {
|
|
@@ -299,7 +311,8 @@ function useValidationDisplay(bindTo, value, validationResult, validationMode =
|
|
|
299
311
|
let isHelperTextShown = false;
|
|
300
312
|
switch (validationMode) {
|
|
301
313
|
case "errorLate":
|
|
302
|
-
isHelperTextShown =
|
|
314
|
+
isHelperTextShown =
|
|
315
|
+
isDirty && (focused ? !invalidToValid && !isValidOnFocus : !isValidLostFocus);
|
|
303
316
|
break;
|
|
304
317
|
case "onChanged":
|
|
305
318
|
isHelperTextShown = isDirty;
|
|
@@ -317,14 +330,17 @@ function useValidationDisplay(bindTo, value, validationResult, validationMode =
|
|
|
317
330
|
}
|
|
318
331
|
return {
|
|
319
332
|
isHelperTextShown,
|
|
320
|
-
validationStatus: isHelperTextShown ? highestValidationSeverity : "none"
|
|
333
|
+
validationStatus: isHelperTextShown ? highestValidationSeverity : "none",
|
|
321
334
|
};
|
|
322
335
|
}
|
|
323
336
|
function parseSeverity(severity) {
|
|
324
337
|
if (severity === undefined) {
|
|
325
338
|
return undefined;
|
|
326
339
|
}
|
|
327
|
-
if (severity === "error" ||
|
|
340
|
+
if (severity === "error" ||
|
|
341
|
+
severity === "warning" ||
|
|
342
|
+
severity === "valid" ||
|
|
343
|
+
severity === "none") {
|
|
328
344
|
return severity;
|
|
329
345
|
}
|
|
330
346
|
return "none";
|
|
@@ -334,10 +350,10 @@ function groupInvalidValidationResultsBySeverity(validationResults) {
|
|
|
334
350
|
error: [],
|
|
335
351
|
warning: [],
|
|
336
352
|
valid: [],
|
|
337
|
-
none: []
|
|
353
|
+
none: [],
|
|
338
354
|
};
|
|
339
355
|
Object.entries(validationResults).forEach(([field, validationResult]) => {
|
|
340
|
-
validationResult.validations.forEach(singleValidationResult => {
|
|
356
|
+
validationResult.validations.forEach((singleValidationResult) => {
|
|
341
357
|
if (!singleValidationResult.isValid) {
|
|
342
358
|
ret[singleValidationResult.severity] = ret[singleValidationResult.severity] || [];
|
|
343
359
|
ret[singleValidationResult.severity].push(singleValidationResult);
|
|
@@ -57,6 +57,7 @@ exports.HeadingMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
57
57
|
omitFromToc: OMIT_FROM_TOC_DESC,
|
|
58
58
|
},
|
|
59
59
|
themeVars: (0, themeVars_1.parseScssVar)(Heading_module_scss_1.default.themeVars),
|
|
60
|
+
limitThemeVarsToComponent: true,
|
|
60
61
|
defaultThemeVars: {
|
|
61
62
|
[`fontFamily-${COMP}`]: "$fontFamily",
|
|
62
63
|
[`textColor-${COMP}`]: "inherit",
|
|
@@ -40,12 +40,13 @@ exports.LinkMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
40
40
|
},
|
|
41
41
|
defaultThemeVars: {
|
|
42
42
|
[`border-${COMP}`]: "0px solid $borderColor",
|
|
43
|
-
[`textColor-${COMP}
|
|
44
|
-
[`textDecorationColor-${COMP}
|
|
43
|
+
[`textColor-${COMP}`]: "$color-primary-500",
|
|
44
|
+
[`textDecorationColor-${COMP}`]: "$color-primary-500",
|
|
45
45
|
[`textColor-${COMP}--hover`]: `$color-primary-400`,
|
|
46
|
-
[`textDecorationColor-${COMP}--
|
|
47
|
-
[`
|
|
48
|
-
[`textDecorationColor-${COMP}`]: "$color-primary-400",
|
|
46
|
+
[`textDecorationColor-${COMP}--hover`]: "$color-primary-400",
|
|
47
|
+
[`textColor-${COMP}--active`]: "$color-primary-400",
|
|
48
|
+
[`textDecorationColor-${COMP}--active`]: "$color-primary-400",
|
|
49
|
+
[`textColor-${COMP}--hover--active`]: `$textColor-${COMP}--active`,
|
|
49
50
|
[`textUnderlineOffset-${COMP}`]: "$space-1",
|
|
50
51
|
[`textDecorationLine-${COMP}`]: "underline",
|
|
51
52
|
[`textDecorationStyle-${COMP}`]: "solid",
|
|
@@ -54,10 +55,9 @@ exports.LinkMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
54
55
|
[`outlineStyle-${COMP}--focus`]: "$outlineStyle--focus",
|
|
55
56
|
[`outlineOffset-${COMP}--focus`]: "$outlineOffset--focus",
|
|
56
57
|
[`fontSize-${COMP}`]: "inherit",
|
|
58
|
+
[`fontWeight-${COMP}--active`]: "$fontWeight-bold",
|
|
57
59
|
[`gap-icon-${COMP}`]: "$gap-tight",
|
|
58
60
|
[`padding-icon-${COMP}`]: "$space-0_5",
|
|
59
|
-
[`textColor-${COMP}`]: "$color-primary-500",
|
|
60
|
-
[`textColor-${COMP}--active`]: "$color-primary-500",
|
|
61
61
|
},
|
|
62
62
|
});
|
|
63
63
|
/**
|
|
@@ -65,6 +65,10 @@ exports.MarkdownMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
65
65
|
"accentColor-Blockquote": "$color-surface-500",
|
|
66
66
|
"marginTop-HtmlLi": "$space-2_5",
|
|
67
67
|
"marginBottom-HtmlLi": "$space-2_5",
|
|
68
|
+
"marginTop-Image-markdown": "$space-4",
|
|
69
|
+
"marginBottom-Image-markdown": "$space-4",
|
|
70
|
+
"marginLeft-Image-markdown": "$space-0",
|
|
71
|
+
"marginRight-Image-markdown": "$space-0",
|
|
68
72
|
light: {
|
|
69
73
|
// --- No light-specific theme vars
|
|
70
74
|
},
|
|
@@ -67,6 +67,7 @@ const CodeBlockNative_1 = require("../CodeBlock/CodeBlockNative");
|
|
|
67
67
|
const classnames_1 = __importDefault(require("classnames"));
|
|
68
68
|
const IconNative_1 = __importDefault(require("../Icon/IconNative"));
|
|
69
69
|
const TreeDisplayNative_1 = require("../TreeDisplay/TreeDisplayNative");
|
|
70
|
+
const unist_util_visit_1 = require("unist-util-visit");
|
|
70
71
|
function PreTagComponent({ id, children, codeHighlighter }) {
|
|
71
72
|
// TEMP: After ironing out theming for syntax highlighting, this should be removed
|
|
72
73
|
const { activeThemeTone } = (0, ThemeContext_1.useTheme)();
|
|
@@ -95,7 +96,18 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
|
|
|
95
96
|
return null;
|
|
96
97
|
}
|
|
97
98
|
children = removeIndents ? removeTextIndents(children) : children;
|
|
98
|
-
|
|
99
|
+
const imageInfo = (0, react_1.useRef)(new Map());
|
|
100
|
+
const getImageKey = (node) => { var _a, _b, _c, _d; return `${(_b = (_a = node === null || node === void 0 ? void 0 : node.position) === null || _a === void 0 ? void 0 : _a.start) === null || _b === void 0 ? void 0 : _b.offset}|${(_d = (_c = node === null || node === void 0 ? void 0 : node.position) === null || _c === void 0 ? void 0 : _c.end) === null || _d === void 0 ? void 0 : _d.offset}`; };
|
|
101
|
+
const markdownImgParser = () => {
|
|
102
|
+
imageInfo.current.clear();
|
|
103
|
+
return function transformer(tree) {
|
|
104
|
+
(0, unist_util_visit_1.visit)(tree, "image", visitor);
|
|
105
|
+
};
|
|
106
|
+
function visitor(node, _, parent) {
|
|
107
|
+
imageInfo.current.set(getImageKey(node), parent.type === "paragraph" && parent.children.length > 1);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.markdownContent, style: style, children: (0, jsx_runtime_1.jsx)(react_markdown_1.default, { remarkPlugins: [remark_gfm_1.default, CodeBlockNative_1.markdownCodeBlockParser, markdownImgParser], rehypePlugins: [rehype_raw_1.default], components: {
|
|
99
111
|
details(_a) {
|
|
100
112
|
var { children, node } = _a, props = __rest(_a, ["children", "node"]);
|
|
101
113
|
return ((0, jsx_runtime_1.jsx)("details", Object.assign({ className: HtmlTags_module_scss_1.default.htmlDetails }, props, { children: children })));
|
|
@@ -106,78 +118,19 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
|
|
|
106
118
|
},
|
|
107
119
|
img(_a) {
|
|
108
120
|
var { children, node } = _a, props = __rest(_a, ["children", "node"]);
|
|
121
|
+
console.log("img", node);
|
|
109
122
|
const src = props === null || props === void 0 ? void 0 : props.src;
|
|
110
123
|
const popOut = props === null || props === void 0 ? void 0 : props["data-popout"];
|
|
111
124
|
const alt = (props === null || props === void 0 ? void 0 : props.alt) || "";
|
|
112
125
|
// --- Determine if the image should be inline or block
|
|
113
|
-
let isInline =
|
|
114
|
-
if (node) {
|
|
115
|
-
const nodeData = node;
|
|
116
|
-
// --- Case 1: Image is part of a larger paragraph with other content
|
|
117
|
-
if (nodeData.parent && nodeData.parent.type === "paragraph") {
|
|
118
|
-
if (nodeData.parent.children && nodeData.parent.children.length > 1) {
|
|
119
|
-
// There are siblings in this paragraph - definitely inline
|
|
120
|
-
isInline = true;
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
// --- It's the only child in the paragraph, check if there's text before/after
|
|
124
|
-
// --- by examining the parent of the paragraph
|
|
125
|
-
const paragraphParent = nodeData.parent.parent;
|
|
126
|
-
if (paragraphParent && paragraphParent.children) {
|
|
127
|
-
const paragraphIndex = paragraphParent.children.indexOf(nodeData.parent);
|
|
128
|
-
if (paragraphIndex > 0 ||
|
|
129
|
-
paragraphIndex < paragraphParent.children.length - 1) {
|
|
130
|
-
// --- There are siblings before/after this paragraph, likely inline
|
|
131
|
-
isInline = true;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
// --- Case 2: Image is inside a blockquote or other container with text
|
|
137
|
-
if (!isInline &&
|
|
138
|
-
nodeData.parent &&
|
|
139
|
-
(nodeData.parent.type === "paragraph" ||
|
|
140
|
-
nodeData.parent.type === "blockquote" ||
|
|
141
|
-
nodeData.parent.type === "emphasis" ||
|
|
142
|
-
nodeData.parent.type === "strong")) {
|
|
143
|
-
// --- Look for any parent nodes with other text content
|
|
144
|
-
let currentParent = nodeData.parent;
|
|
145
|
-
while (currentParent) {
|
|
146
|
-
if (currentParent.children &&
|
|
147
|
-
currentParent.children.some((child) => child !== nodeData &&
|
|
148
|
-
((child.type === "text" && child.value && child.value.trim().length > 0) ||
|
|
149
|
-
child.type !== "text"))) {
|
|
150
|
-
isInline = true;
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
currentParent = currentParent.parent;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
// --- For images without context clues, use file type and size as heuristics
|
|
157
|
-
// --- Case 3: Image looks like an icon based on filename or size
|
|
158
|
-
if (!isInline) {
|
|
159
|
-
// --- Check if the image is small enough to be considered an icon
|
|
160
|
-
// --- Small images are likely icons
|
|
161
|
-
const imgSize = (props === null || props === void 0 ? void 0 : props.width) || (props === null || props === void 0 ? void 0 : props.height);
|
|
162
|
-
isInline = imgSize === undefined ? true : parseInt(imgSize.toString()) < 512;
|
|
163
|
-
// Images with icon-like filenames
|
|
164
|
-
if (src &&
|
|
165
|
-
(src.includes("icon") ||
|
|
166
|
-
src.endsWith(".svg") ||
|
|
167
|
-
src.endsWith(".ico") ||
|
|
168
|
-
src.includes("badge") ||
|
|
169
|
-
src.includes("logo"))) {
|
|
170
|
-
isInline = true;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
126
|
+
let isInline = imageInfo.current.get(getImageKey(node));
|
|
174
127
|
// Apply styling based on whether image should be inline or block
|
|
175
128
|
const imgStyle = Object.assign(Object.assign({}, (props.style || {})), { display: isInline ? "inline" : "block" });
|
|
176
129
|
if (popOut) {
|
|
177
|
-
return ((0, jsx_runtime_1.jsx)("a", { href: src, target: "_blank", rel: "noreferrer", children: (0, jsx_runtime_1.jsx)("img",
|
|
130
|
+
return ((0, jsx_runtime_1.jsx)("a", { href: src, target: "_blank", rel: "noreferrer", children: (0, jsx_runtime_1.jsx)("img", { src: src, alt: alt, style: imgStyle, children: children }) }));
|
|
178
131
|
}
|
|
179
132
|
else {
|
|
180
|
-
return ((0, jsx_runtime_1.jsx)("img", Object.assign({ src: src, alt: alt,
|
|
133
|
+
return ((0, jsx_runtime_1.jsx)("img", Object.assign({ src: src, alt: alt, style: imgStyle }, props, { className: (0, classnames_1.default)({ [Markdown_module_scss_1.default.block]: !isInline }), children: children })));
|
|
181
134
|
}
|
|
182
135
|
},
|
|
183
136
|
h1({ children }) {
|
|
@@ -292,7 +245,7 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
|
|
|
292
245
|
return (0, jsx_runtime_1.jsx)(TreeDisplayNative_1.TreeDisplay, { content: content, itemHeight: 24 });
|
|
293
246
|
}
|
|
294
247
|
return null;
|
|
295
|
-
}
|
|
248
|
+
},
|
|
296
249
|
}, children: children }) }));
|
|
297
250
|
});
|
|
298
251
|
const HorizontalRule = () => {
|
|
@@ -361,9 +314,6 @@ const Blockquote = ({ children, style }) => {
|
|
|
361
314
|
}
|
|
362
315
|
return ((0, jsx_runtime_1.jsx)("blockquote", { className: Markdown_module_scss_1.default.blockquote, style: style, children: (0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.blockquoteContainer, children: children }) }));
|
|
363
316
|
};
|
|
364
|
-
const UnorderedList = ({ children, style }) => {
|
|
365
|
-
return ((0, jsx_runtime_1.jsx)("ul", { className: Markdown_module_scss_1.default.unorderedList, style: style, children: children }));
|
|
366
|
-
};
|
|
367
317
|
const OrderedList = ({ children, style }) => {
|
|
368
318
|
return ((0, jsx_runtime_1.jsx)("ol", { className: Markdown_module_scss_1.default.orderedList, style: style, children: children }));
|
|
369
319
|
};
|
|
@@ -19,7 +19,9 @@ exports.NavPanelMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
19
19
|
`\`vertical\` and \`vertical-sticky\` layout.`),
|
|
20
20
|
},
|
|
21
21
|
themeVars: (0, themeVars_1.parseScssVar)(NavPanel_module_scss_1.default.themeVars),
|
|
22
|
+
limitThemeVarsToComponent: true,
|
|
22
23
|
defaultThemeVars: {
|
|
24
|
+
[`horizontalAlignment-logo-${COMP}`]: "center",
|
|
23
25
|
[`backgroundColor-${COMP}`]: "$backgroundColor",
|
|
24
26
|
[`border-${COMP}`]: '0px solid $borderColor',
|
|
25
27
|
[`paddingHorizontal-${COMP}`]: "0",
|
|
@@ -64,7 +64,6 @@ exports.NavPanel = (0, react_1.forwardRef)(function NavPanel({ children, style,
|
|
|
64
64
|
const isCondensed = (_a = appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === null || _a === void 0 ? void 0 : _a.startsWith("condensed");
|
|
65
65
|
const vertical = (_b = appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === null || _b === void 0 ? void 0 : _b.startsWith("vertical");
|
|
66
66
|
const safeLogoContent = logoContent || renderChild(appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.logoContentDef);
|
|
67
|
-
// console.log(appLayoutContext);
|
|
68
67
|
if (inDrawer) {
|
|
69
68
|
return ((0, jsx_runtime_1.jsx)(DrawerNavPanel, { style: style, logoContent: safeLogoContent, className: className, children: children }));
|
|
70
69
|
}
|
|
@@ -41,6 +41,7 @@ exports.SwitchMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
41
41
|
setValue: (0, metadata_helpers_1.dSetValueApi)(),
|
|
42
42
|
},
|
|
43
43
|
themeVars: (0, themeVars_1.parseScssVar)(Toggle_module_scss_1.default.themeVars),
|
|
44
|
+
limitThemeVarsToComponent: true,
|
|
44
45
|
defaultThemeVars: {
|
|
45
46
|
[`borderColor-checked-${COMP}-error`]: `$borderColor-${COMP}-error`,
|
|
46
47
|
[`backgroundColor-checked-${COMP}-error`]: `$borderColor-${COMP}-error`,
|
|
@@ -56,6 +56,7 @@ exports.TextMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
56
56
|
[`borderStyle-${COMP}`]: "solid",
|
|
57
57
|
[`fontSize-${COMP}`]: "$fontSize-small",
|
|
58
58
|
[`borderWidth-${COMP}`]: "$space-0",
|
|
59
|
+
[`lineHeight-${COMP}-codefence`]: "1.4",
|
|
59
60
|
[`fontWeight-${COMP}-abbr`]: "$fontWeight-bold",
|
|
60
61
|
[`textTransform-${COMP}-abbr`]: "uppercase",
|
|
61
62
|
[`fontSize-${COMP}-secondary`]: "$fontSize-small",
|
|
@@ -117,6 +118,9 @@ exports.TextMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
117
118
|
[`color-${COMP}-codefence`]: "$color-surface-900",
|
|
118
119
|
[`color-${COMP}-subheading`]: "$textColor-secondary",
|
|
119
120
|
[`color-${COMP}-secondary`]: "$textColor-secondary",
|
|
121
|
+
dark: {
|
|
122
|
+
[`backgroundColor-${COMP}-marked`]: "rgba($color-primary-400-rgb, .4)",
|
|
123
|
+
}
|
|
120
124
|
},
|
|
121
125
|
});
|
|
122
126
|
exports.textComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TextMd, ({ node, extractValue, layoutCss, renderChild }) => {
|
|
@@ -88,6 +88,7 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
88
88
|
if (!exports.UCRegex.test(compoundName.value)) {
|
|
89
89
|
reportError("T004");
|
|
90
90
|
}
|
|
91
|
+
const codeBehind = attrs.find((attr) => attr.name === "codeBehind");
|
|
91
92
|
// --- Get "method" attributes
|
|
92
93
|
let api;
|
|
93
94
|
const apiAttrs = attrs.filter((attr) => attr.startSegment === "method");
|
|
@@ -159,6 +160,9 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
159
160
|
if (vars) {
|
|
160
161
|
nestedComponent.vars = Object.assign(Object.assign({}, nestedComponent.vars), vars);
|
|
161
162
|
}
|
|
163
|
+
if (codeBehind) {
|
|
164
|
+
component.codeBehind = codeBehind.value;
|
|
165
|
+
}
|
|
162
166
|
nestedComponent.debug = {
|
|
163
167
|
source: {
|
|
164
168
|
start: element.start,
|
|
@@ -328,6 +332,10 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
328
332
|
// --- We already processed name
|
|
329
333
|
return;
|
|
330
334
|
}
|
|
335
|
+
if (name === "codeBehind" && !startSegment) {
|
|
336
|
+
// --- We already processed codeBehind
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
331
339
|
// --- Compound components do not have any other attributable props
|
|
332
340
|
if (!startSegment && name) {
|
|
333
341
|
reportError("T021", name);
|
|
@@ -680,6 +680,7 @@ declare type ComponentMetadata<TProps extends Record<string, ComponentPropertyMe
|
|
|
680
680
|
themeVarDescriptions?: Record<string, string>;
|
|
681
681
|
defaultThemeVars?: DefaultThemeVars;
|
|
682
682
|
toneSpecificThemeVars?: Record<string, Record<string, string>>;
|
|
683
|
+
limitThemeVarsToComponent?: boolean;
|
|
683
684
|
allowArbitraryProps?: boolean;
|
|
684
685
|
specializedFrom?: string;
|
|
685
686
|
docFolder?: string;
|
|
@@ -801,6 +802,7 @@ declare interface CompoundComponentDef extends Scriptable {
|
|
|
801
802
|
* belonging to the particular component definition.
|
|
802
803
|
*/
|
|
803
804
|
debug?: Record<string, any>;
|
|
805
|
+
codeBehind?: string;
|
|
804
806
|
}
|
|
805
807
|
|
|
806
808
|
declare type CONDITIONAL_EXPRESSION = typeof T_CONDITIONAL_EXPRESSION;
|