xmlui 0.10.21 → 0.10.23
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/{index-BiS4wEuu.mjs → index-CuPvcayg.mjs} +1198 -828
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-CB_cMi6U.mjs → initMock-BBdNO6FB.mjs} +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-BTIt1_wE.mjs → metadata-utils-Dx-2qZBh.mjs} +5 -4
- package/dist/lib/{server-common-DYZtsdM7.mjs → server-common--BHVvP1o.mjs} +1 -1
- package/dist/lib/xmlui-parser.d.ts +1 -1
- package/dist/lib/xmlui.d.ts +34 -1
- package/dist/lib/xmlui.mjs +1 -1
- package/dist/metadata/{collectedComponentMetadata-MFUg6aSX.mjs → collectedComponentMetadata-Cp3Ljk8F.mjs} +1192 -822
- package/dist/metadata/{initMock-Dw9wrVkQ.mjs → initMock-Dki8247s.mjs} +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +3 -3
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/AppHeader/AppHeader.js +6 -1
- package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +7 -4
- package/dist/scripts/src/components/Button/Button.js +7 -0
- package/dist/scripts/src/components/ComponentProvider.js +31 -2
- package/dist/scripts/src/components/Form/Form.js +3 -0
- package/dist/scripts/src/components/Form/FormNative.js +12 -2
- package/dist/scripts/src/components/Heading/Heading.js +5 -4
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +13 -0
- package/dist/scripts/src/components/Pages/Pages.js +11 -0
- package/dist/scripts/src/components/Tabs/TabContext.js +26 -17
- package/dist/scripts/src/components/Tabs/TabItemNative.js +7 -2
- package/dist/scripts/src/components/Tabs/Tabs.js +22 -3
- package/dist/scripts/src/components/Tabs/Tabs.spec.js +362 -0
- package/dist/scripts/src/components/Tabs/TabsNative.js +28 -4
- package/dist/scripts/src/components/Text/Text.js +4 -4
- package/dist/scripts/src/components-core/StandaloneApp.js +1 -1
- package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +118 -7
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +3 -4
- package/dist/scripts/src/components-core/theming/component-layout-resolver.js +4 -4
- package/dist/scripts/src/components-core/theming/parse-layout-props.js +38 -0
- package/dist/standalone/xmlui-standalone.es.d.ts +36 -1
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +1 -1
- package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +0 -50
|
@@ -69,7 +69,6 @@ const event_handlers_1 = require("../event-handlers");
|
|
|
69
69
|
const UnknownComponent_1 = __importDefault(require("./UnknownComponent"));
|
|
70
70
|
const InvalidComponent_1 = __importDefault(require("./InvalidComponent"));
|
|
71
71
|
const layout_resolver_1 = require("../theming/layout-resolver");
|
|
72
|
-
const CoreBehaviors_1 = require("../behaviors/CoreBehaviors");
|
|
73
72
|
/**
|
|
74
73
|
* This component's primary responsibility is to transform a particular component definition
|
|
75
74
|
* into its React representation using the current rendering context.
|
|
@@ -215,13 +214,13 @@ const ComponentAdapter = (0, react_1.forwardRef)(function ComponentAdapter(_a, r
|
|
|
215
214
|
renderedNode = renderer(rendererContext);
|
|
216
215
|
}
|
|
217
216
|
/**
|
|
218
|
-
* Apply any
|
|
217
|
+
* Apply any behaviors to the component.
|
|
219
218
|
*/
|
|
220
|
-
const behaviors =
|
|
219
|
+
const behaviors = componentRegistry.getBehaviors();
|
|
221
220
|
if (!isCompoundComponent) {
|
|
222
221
|
for (const behavior of behaviors) {
|
|
223
222
|
if (behavior.canAttach(rendererContext.node, descriptor)) {
|
|
224
|
-
renderedNode = behavior.attach(rendererContext, renderedNode);
|
|
223
|
+
renderedNode = behavior.attach(rendererContext, renderedNode, descriptor);
|
|
225
224
|
}
|
|
226
225
|
}
|
|
227
226
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BASE_COMPONENT_PART = exports.THEME_VAR_PREFIX = void 0;
|
|
3
|
+
exports.specialResolvers = exports.BASE_COMPONENT_PART = exports.THEME_VAR_PREFIX = void 0;
|
|
4
4
|
exports.resolveComponentLayoutProps = resolveComponentLayoutProps;
|
|
5
5
|
const constants_1 = require("../constants");
|
|
6
6
|
const parse_layout_props_1 = require("./parse-layout-props");
|
|
@@ -22,8 +22,8 @@ function resolveComponentLayoutProps(layoutProps = constants_1.EMPTY_OBJECT, lay
|
|
|
22
22
|
const cssPropName = parsed.property;
|
|
23
23
|
const appliedValue = (_a = value === null || value === void 0 ? void 0 : value.toString()) === null || _a === void 0 ? void 0 : _a.replace(themeVarCapturesRegex, (match) => toCssVar(match.trim()));
|
|
24
24
|
// --- Some properties may need transformation
|
|
25
|
-
const cssProps = cssPropName in specialResolvers
|
|
26
|
-
? specialResolvers[cssPropName](appliedValue, layoutContext)
|
|
25
|
+
const cssProps = cssPropName in exports.specialResolvers
|
|
26
|
+
? exports.specialResolvers[cssPropName](appliedValue, layoutContext)
|
|
27
27
|
: { [cssPropName]: appliedValue };
|
|
28
28
|
// --- Check if the property belongs to one or more states
|
|
29
29
|
const stateName = parsed.states && parsed.states.length > 0 ? parsed.states.join("&") : null;
|
|
@@ -93,7 +93,7 @@ function getOrientation(layoutContext) {
|
|
|
93
93
|
function toCssVar(c) {
|
|
94
94
|
return `var(--${exports.THEME_VAR_PREFIX}-${c.substring(1)})`;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
exports.specialResolvers = {
|
|
97
97
|
paddingHorizontal: (propValue) => ({
|
|
98
98
|
paddingLeft: propValue,
|
|
99
99
|
paddingRight: propValue,
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CSS_PROPERTY_EXCEPTIONS = void 0;
|
|
3
4
|
exports.parseLayoutProperty = parseLayoutProperty;
|
|
5
|
+
exports.toCssPropertyName = toCssPropertyName;
|
|
4
6
|
const AppContextDefs_1 = require("../../abstractions/AppContextDefs");
|
|
7
|
+
/**
|
|
8
|
+
* Mapping exceptions for camelCase property names to CSS property names.
|
|
9
|
+
* These properties don't follow the standard camelCase-to-kebab-case conversion.
|
|
10
|
+
*/
|
|
11
|
+
exports.CSS_PROPERTY_EXCEPTIONS = {
|
|
12
|
+
textColor: "color",
|
|
13
|
+
paddingVertical: "",
|
|
14
|
+
paddingHorizontal: "",
|
|
15
|
+
marginVertical: "",
|
|
16
|
+
marginHorizontal: "",
|
|
17
|
+
borderVertical: "",
|
|
18
|
+
borderHorizontal: "",
|
|
19
|
+
};
|
|
5
20
|
function parseLayoutProperty(prop, parseComponent = false) {
|
|
6
21
|
if (!prop || typeof prop !== 'string') {
|
|
7
22
|
return "Property string cannot be empty";
|
|
@@ -77,6 +92,29 @@ function parseLayoutProperty(prop, parseComponent = false) {
|
|
|
77
92
|
}
|
|
78
93
|
return result;
|
|
79
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* Transforms a camelCase property name (as used in ParsedLayout.property)
|
|
97
|
+
* to its corresponding CSS style property name.
|
|
98
|
+
*
|
|
99
|
+
* Handles special cases defined in CSS_PROPERTY_EXCEPTIONS, otherwise
|
|
100
|
+
* converts camelCase to kebab-case (e.g., "fontSize" -> "font-size").
|
|
101
|
+
*
|
|
102
|
+
* @param property - The camelCase property name from ParsedLayout
|
|
103
|
+
* @returns The CSS property name in kebab-case or the mapped exception
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* toCssPropertyName('fontSize') // returns 'font-size'
|
|
107
|
+
* toCssPropertyName('textColor') // returns 'color' (exception)
|
|
108
|
+
* toCssPropertyName('backgroundColor') // returns 'background-color'
|
|
109
|
+
*/
|
|
110
|
+
function toCssPropertyName(property) {
|
|
111
|
+
// Check if there's a mapping exception
|
|
112
|
+
if (property in exports.CSS_PROPERTY_EXCEPTIONS) {
|
|
113
|
+
return exports.CSS_PROPERTY_EXCEPTIONS[property];
|
|
114
|
+
}
|
|
115
|
+
// Convert camelCase to kebab-case
|
|
116
|
+
return property.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
117
|
+
}
|
|
80
118
|
function isValidPropertyName(name) {
|
|
81
119
|
// CSS property names in camelCase - start with lowercase letter, can contain letters and numbers
|
|
82
120
|
return /^[a-z][a-zA-Z0-9]*$/.test(name);
|
|
@@ -242,6 +242,33 @@ declare type AuthDefinition = {
|
|
|
242
242
|
defaultLoggedInUser?: any;
|
|
243
243
|
};
|
|
244
244
|
|
|
245
|
+
/**
|
|
246
|
+
* Defines the shape of a component behavior that can wrap a component with
|
|
247
|
+
* additional functionality.
|
|
248
|
+
*/
|
|
249
|
+
declare interface Behavior {
|
|
250
|
+
/**
|
|
251
|
+
* The name of the behavior (e.g., "tooltip", "animation").
|
|
252
|
+
*/
|
|
253
|
+
name: string;
|
|
254
|
+
/**
|
|
255
|
+
* A function that determines if the behavior should be applied based on the
|
|
256
|
+
* component's context and props.
|
|
257
|
+
* @param node The component definition.
|
|
258
|
+
* @param metadata The metadata of the component.
|
|
259
|
+
* @returns True if the behavior can be attached, otherwise false.
|
|
260
|
+
*/
|
|
261
|
+
canAttach: (node: ComponentDef, metadata: ComponentMetadata) => boolean;
|
|
262
|
+
/**
|
|
263
|
+
* A function that attaches the behavior to the component's React node.
|
|
264
|
+
* @param context The renderer context of the component.
|
|
265
|
+
* @param node The React node to attach.
|
|
266
|
+
* @param metadata The metadata of the component.
|
|
267
|
+
* @returns The attached React node.
|
|
268
|
+
*/
|
|
269
|
+
attach: (context: RendererContext<any>, node: ReactNode, metadata?: ComponentMetadata) => ReactNode;
|
|
270
|
+
}
|
|
271
|
+
|
|
245
272
|
declare type BINARY_EXPRESSION = typeof T_BINARY_EXPRESSION;
|
|
246
273
|
|
|
247
274
|
declare interface BinaryExpression extends ExpressionBase {
|
|
@@ -453,7 +480,7 @@ declare type ComponentMetadata<TProps extends Record<string, ComponentPropertyMe
|
|
|
453
480
|
nonVisual?: boolean;
|
|
454
481
|
childrenAsTemplate?: string;
|
|
455
482
|
opaque?: boolean;
|
|
456
|
-
themeVars?:
|
|
483
|
+
themeVars?: Record<string, string>;
|
|
457
484
|
themeVarDescriptions?: Record<string, string>;
|
|
458
485
|
defaultThemeVars?: DefaultThemeVars;
|
|
459
486
|
toneSpecificThemeVars?: Record<string, Record<string, string>>;
|
|
@@ -553,6 +580,10 @@ declare type ContributesDefinition = {
|
|
|
553
580
|
* Themes that come with the app.
|
|
554
581
|
*/
|
|
555
582
|
themes?: ThemeDefinition[];
|
|
583
|
+
/**
|
|
584
|
+
* Custom behaviors that come with the app.
|
|
585
|
+
*/
|
|
586
|
+
behaviors?: Behavior[];
|
|
556
587
|
};
|
|
557
588
|
|
|
558
589
|
/**
|
|
@@ -1183,6 +1214,8 @@ declare type Props_3 = {
|
|
|
1183
1214
|
id?: string;
|
|
1184
1215
|
activeTab?: number;
|
|
1185
1216
|
orientation?: "horizontal" | "vertical";
|
|
1217
|
+
tabAlignment?: "start" | "end" | "center" | "stretch";
|
|
1218
|
+
accordionView?: boolean;
|
|
1186
1219
|
headerRenderer?: (item: {
|
|
1187
1220
|
id?: string;
|
|
1188
1221
|
index: number;
|
|
@@ -1543,6 +1576,8 @@ declare const standaloneExports: {
|
|
|
1543
1576
|
id?: string;
|
|
1544
1577
|
activeTab?: number;
|
|
1545
1578
|
orientation?: "horizontal" | "vertical";
|
|
1579
|
+
tabAlignment?: "start" | "end" | "center" | "stretch";
|
|
1580
|
+
accordionView?: boolean;
|
|
1546
1581
|
headerRenderer?: (item: {
|
|
1547
1582
|
id?: string;
|
|
1548
1583
|
index: number;
|