xmlui 0.10.20 → 0.10.21

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.
@@ -1,7 +1,7 @@
1
1
  var _a;
2
2
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import * as React from "react";
4
- import React__default, { forwardRef, useState, useEffect, useId, cloneElement, useRef, useInsertionEffect, useCallback, useContext, useLayoutEffect, useMemo, createContext, useTransition, memo, useDeferredValue, useImperativeHandle, createElement, useReducer, isValidElement, Fragment as Fragment$1, Children, startTransition } from "react";
4
+ import React__default, { forwardRef, useState, useEffect, useId, cloneElement, useRef, useInsertionEffect, useCallback, useContext, useLayoutEffect, useMemo, createContext, useTransition, memo, useDeferredValue, createElement, useReducer, isValidElement, Fragment as Fragment$1, Children, startTransition } from "react";
5
5
  import { throttle, get, isEmpty, cloneDeep, omit, omitBy, isUndefined, noop as noop$2, isEqual, isArray, isNumber, set, isPlainObject, isString as isString$1, isNil, union, uniq, orderBy as orderBy$1, isObject, groupBy, sortBy, merge, defaultTo, capitalize, unset, setWith, keyBy, pick, isNaN as isNaN$1 } from "lodash-es";
6
6
  import { formatDistanceToNow, parse, format, parseISO, isValid, isToday, isYesterday, isTomorrow, isThisWeek, formatRelative, isThisYear, isSameDay, differenceInMinutes } from "date-fns";
7
7
  import classnames from "classnames";
@@ -34,12 +34,10 @@ import remarkGfm from "remark-gfm";
34
34
  import rehypeRaw from "rehype-raw";
35
35
  import { visit } from "unist-util-visit";
36
36
  import { useQuery, useInfiniteQuery, QueryClientProvider, QueryClient } from "@tanstack/react-query";
37
- import { FixedSizeList } from "react-window";
38
- import AutoSizer from "react-virtualized-auto-sizer";
37
+ import { Virtualizer } from "virtua";
39
38
  import { useReactTable, getPaginationRowModel, getCoreRowModel, flexRender } from "@tanstack/react-table";
40
39
  import { useVirtualizer } from "@tanstack/react-virtual";
41
40
  import { RenderPropSticky } from "react-sticky-el";
42
- import { Virtualizer } from "virtua";
43
41
  import * as HoverCard from "@radix-ui/react-hover-card";
44
42
  import Papa from "papaparse";
45
43
  import { Root as Root$1, List, Trigger as Trigger$1, Content as Content$1 } from "@radix-ui/react-tabs";
@@ -3717,6 +3715,576 @@ function extractPaddings(extractValue, props) {
3717
3715
  paddingBottom: paddingBottom || paddingVertical || padding
3718
3716
  };
3719
3717
  }
3718
+ function hashString(str) {
3719
+ let hash = 5381;
3720
+ let i = str.length;
3721
+ while (i) {
3722
+ hash = hash * 33 ^ str.charCodeAt(--i);
3723
+ }
3724
+ let s = (hash >>> 0).toString(36);
3725
+ return s;
3726
+ }
3727
+ function toKebabCase(str) {
3728
+ if (str.startsWith("--")) {
3729
+ return str;
3730
+ }
3731
+ return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
3732
+ }
3733
+ function stableJSONStringify(obj) {
3734
+ return JSON.stringify(obj);
3735
+ }
3736
+ class StyleRegistry {
3737
+ constructor() {
3738
+ this.cache = /* @__PURE__ */ new Map();
3739
+ this.rootClasses = /* @__PURE__ */ new Set();
3740
+ this.injected = /* @__PURE__ */ new Set();
3741
+ this.refCounts = /* @__PURE__ */ new Map();
3742
+ this.ssrHashes = /* @__PURE__ */ new Set();
3743
+ }
3744
+ register(styles2) {
3745
+ const key = stableJSONStringify(styles2);
3746
+ const styleHash = hashString(key);
3747
+ const cachedEntry = this.cache.get(styleHash);
3748
+ if (cachedEntry) {
3749
+ return cachedEntry;
3750
+ }
3751
+ const className = `css-${styleHash}`;
3752
+ const css = this._generateCss(`.${className}`, styles2);
3753
+ const entry = { className, styleHash, css };
3754
+ this.cache.set(styleHash, entry);
3755
+ return entry;
3756
+ }
3757
+ /**
3758
+ * [PRIVATE] Recursively generates CSS rules from a style object.
3759
+ * This is the new, more powerful engine.
3760
+ * @param selector - The CSS selector for the current context (e.g., '.css-123' or '&:hover').
3761
+ * @param styles - The style object to process.
3762
+ * @returns A string of CSS rules.
3763
+ */
3764
+ _generateCss(selector, styles2) {
3765
+ const directProps = [];
3766
+ const nestedRules = [];
3767
+ for (const key in styles2) {
3768
+ const value = styles2[key];
3769
+ if (typeof value === "object" && value !== null) {
3770
+ nestedRules.push(this._processNestedRule(selector, key, value));
3771
+ } else {
3772
+ directProps.push(`${toKebabCase(key)}:${value};`);
3773
+ }
3774
+ }
3775
+ let finalCss = "";
3776
+ if (directProps.length > 0) {
3777
+ finalCss += `${selector} {${directProps.join("")}}`;
3778
+ }
3779
+ finalCss += nestedRules.join("");
3780
+ return finalCss;
3781
+ }
3782
+ _processNestedRule(parentSelector, nestedKey, nestedStyles) {
3783
+ if (nestedKey.startsWith("@")) {
3784
+ return `${nestedKey}{${this._generateCss(parentSelector, nestedStyles)}}`;
3785
+ }
3786
+ const newSelector = nestedKey.replace(/&/g, parentSelector);
3787
+ return this._generateCss(newSelector, nestedStyles);
3788
+ }
3789
+ getSsrStyles() {
3790
+ const allCss = Array.from(this.cache.values()).map((entry) => entry.css).join("");
3791
+ return `@layer dynamic {${allCss}}`;
3792
+ }
3793
+ /**
3794
+ * Adds a class name to be applied to the <html> tag.
3795
+ */
3796
+ addRootClasses(classNames) {
3797
+ classNames.forEach((className) => {
3798
+ this.rootClasses.add(className);
3799
+ });
3800
+ }
3801
+ /**
3802
+ * Returns a space-separated string of all collected html classes.
3803
+ */
3804
+ getRootClasses() {
3805
+ return Array.from(this.rootClasses).join(" ");
3806
+ }
3807
+ // NEW: A helper to safely get the current reference count.
3808
+ getRefCount(styleHash) {
3809
+ return this.refCounts.get(styleHash) || 0;
3810
+ }
3811
+ /**
3812
+ * Increments the reference count for a given style hash.
3813
+ */
3814
+ incrementRef(styleHash) {
3815
+ const newCount = (this.refCounts.get(styleHash) || 0) + 1;
3816
+ this.refCounts.set(styleHash, newCount);
3817
+ }
3818
+ /**
3819
+ * Decrements the reference count for a given style hash.
3820
+ * @returns {number} The new reference count.
3821
+ */
3822
+ decrementRef(styleHash) {
3823
+ const currentCount = this.refCounts.get(styleHash) || 0;
3824
+ const newCount = Math.max(0, currentCount - 1);
3825
+ if (newCount > 0) {
3826
+ this.refCounts.set(styleHash, newCount);
3827
+ } else {
3828
+ this.refCounts.delete(styleHash);
3829
+ }
3830
+ return newCount;
3831
+ }
3832
+ }
3833
+ const IndexerContext = React__default.createContext({
3834
+ indexing: false
3835
+ });
3836
+ function useIndexerContext() {
3837
+ return useContext(IndexerContext);
3838
+ }
3839
+ const StyleContext = createContext(null);
3840
+ function StyleProvider({
3841
+ children,
3842
+ styleRegistry = new StyleRegistry(),
3843
+ forceNew = false
3844
+ // Optional prop to force a new registry
3845
+ }) {
3846
+ const parentRegistry = useContext(StyleContext);
3847
+ const [registry] = useState(() => {
3848
+ const newRegistry = styleRegistry;
3849
+ if (typeof window !== "undefined") {
3850
+ const ssrTag = document.querySelector('style[data-style-registry="true"]');
3851
+ const ssrHashes = ssrTag == null ? void 0 : ssrTag.getAttribute("data-ssr-hashes");
3852
+ if (ssrHashes) {
3853
+ let hashes = ssrHashes.split(",");
3854
+ newRegistry.ssrHashes = new Set(hashes);
3855
+ newRegistry.injected = new Set(hashes);
3856
+ }
3857
+ }
3858
+ return newRegistry;
3859
+ });
3860
+ if (parentRegistry && !forceNew) {
3861
+ return /* @__PURE__ */ jsx(Fragment, { children });
3862
+ }
3863
+ return /* @__PURE__ */ jsx(StyleContext.Provider, { value: registry, children });
3864
+ }
3865
+ function useStyleRegistry() {
3866
+ const registry = useContext(StyleContext);
3867
+ if (registry === null) {
3868
+ throw new Error("Component must be used within a StyleProvider");
3869
+ }
3870
+ return registry;
3871
+ }
3872
+ function useComponentStyle(styles2) {
3873
+ const rootStyle = useMemo(() => {
3874
+ return !styles2 || Object.keys(styles2).length === 0 ? EMPTY_OBJECT : {
3875
+ "&": styles2
3876
+ // "@container style(--screenSize: 1) or @container style(--screenSize: 2) ... etc": responsiveSizes,
3877
+ };
3878
+ }, [styles2]);
3879
+ return useStyles(rootStyle);
3880
+ }
3881
+ const StyleInjectionTargetContext = createContext(null);
3882
+ function useDomRoot() {
3883
+ const domRoot = useContext(StyleInjectionTargetContext);
3884
+ return domRoot;
3885
+ }
3886
+ function useStyles(styles2, { prepend } = EMPTY_OBJECT) {
3887
+ const { indexing } = useIndexerContext();
3888
+ const domRoot = useDomRoot();
3889
+ const injectionTarget = typeof document === "undefined" ? null : domRoot instanceof ShadowRoot ? domRoot : document.head;
3890
+ const registry = useStyleRegistry();
3891
+ const { className, styleHash } = useMemo(() => {
3892
+ if (indexing || !styles2 || styles2 === EMPTY_OBJECT || Object.keys(styles2).length === 0) {
3893
+ return { className: void 0, styleHash: void 0 };
3894
+ }
3895
+ return registry.register(styles2);
3896
+ }, [indexing, registry, styles2]);
3897
+ useInsertionEffect(() => {
3898
+ if (!styleHash || registry.injected.has(styleHash)) {
3899
+ return;
3900
+ }
3901
+ const { css } = registry.cache.get(styleHash) || {};
3902
+ if (css) {
3903
+ const styleElement = document.createElement("style");
3904
+ styleElement.setAttribute("data-style-hash", styleHash);
3905
+ styleElement.innerHTML = `@layer dynamic {
3906
+ ${css}
3907
+ }`;
3908
+ if (prepend) {
3909
+ injectionTarget.insertBefore(styleElement, injectionTarget.firstChild.nextSibling);
3910
+ } else {
3911
+ injectionTarget.appendChild(styleElement);
3912
+ }
3913
+ registry.injected.add(styleHash);
3914
+ }
3915
+ }, [registry, styleHash, injectionTarget]);
3916
+ useEffect(() => {
3917
+ if (!styleHash) {
3918
+ return;
3919
+ }
3920
+ registry.incrementRef(styleHash);
3921
+ return () => {
3922
+ registry.decrementRef(styleHash);
3923
+ setTimeout(() => {
3924
+ var _a2;
3925
+ if (registry.getRefCount(styleHash) === 0 && !registry.ssrHashes.has(styleHash)) {
3926
+ registry.injected.delete(styleHash);
3927
+ (_a2 = injectionTarget.querySelector(`style[data-style-hash="${styleHash}"]`)) == null ? void 0 : _a2.remove();
3928
+ }
3929
+ }, 0);
3930
+ };
3931
+ }, [injectionTarget, registry, styleHash]);
3932
+ return className;
3933
+ }
3934
+ const THEME_VAR_PREFIX = "xmlui";
3935
+ const themeVarCapturesRegex = /(\$[a-zA-Z][a-zA-Z0-9-_]*)/g;
3936
+ const booleanRegex = /^(true|false)$/;
3937
+ const starSizeRegex = /^\d*\*$/;
3938
+ const defaultCompResult = {
3939
+ cssProps: {},
3940
+ issues: /* @__PURE__ */ new Set()
3941
+ };
3942
+ function resolveLayoutProps(layoutProps = EMPTY_OBJECT, layoutContext) {
3943
+ const result = {
3944
+ cssProps: {},
3945
+ issues: /* @__PURE__ */ new Set()
3946
+ };
3947
+ if (!!getOrientation(layoutContext)) {
3948
+ result.cssProps.flexShrink = 0;
3949
+ }
3950
+ collectCss("width");
3951
+ const horizontalStarSize = getHorizontalStarSize(result.cssProps.width, layoutContext);
3952
+ if (horizontalStarSize !== null) {
3953
+ result.cssProps.flex = horizontalStarSize;
3954
+ result.cssProps.flexShrink = 1;
3955
+ }
3956
+ collectCss("minWidth");
3957
+ collectCss("maxWidth");
3958
+ collectCss("height");
3959
+ const verticalStarSize = getVerticalStarSize(result.cssProps.height, layoutContext);
3960
+ if (verticalStarSize !== null) {
3961
+ result.cssProps.flex = verticalStarSize;
3962
+ result.cssProps.flexShrink = 1;
3963
+ }
3964
+ collectCss("minHeight");
3965
+ collectCss("maxHeight");
3966
+ collectCss("top");
3967
+ collectCss("right");
3968
+ collectCss("bottom");
3969
+ collectCss("left");
3970
+ collectCss("gap");
3971
+ collectCss("padding");
3972
+ const paddingHorizontal = transformLayoutValue("paddingHorizontal");
3973
+ if (paddingHorizontal) {
3974
+ result.cssProps.paddingLeft = paddingHorizontal;
3975
+ result.cssProps.paddingRight = paddingHorizontal;
3976
+ }
3977
+ collectCss("paddingRight");
3978
+ collectCss("paddingLeft");
3979
+ const paddingVertical = transformLayoutValue("paddingVertical");
3980
+ if (paddingVertical) {
3981
+ result.cssProps.paddingTop = paddingVertical;
3982
+ result.cssProps.paddingBottom = paddingVertical;
3983
+ }
3984
+ collectCss("paddingTop");
3985
+ collectCss("paddingBottom");
3986
+ collectCss("margin");
3987
+ const marginHorizontal = transformLayoutValue("marginHorizontal");
3988
+ if (marginHorizontal) {
3989
+ result.cssProps.marginLeft = marginHorizontal;
3990
+ result.cssProps.marginRight = marginHorizontal;
3991
+ }
3992
+ collectCss("marginRight");
3993
+ collectCss("marginLeft");
3994
+ const marginVertical = transformLayoutValue("marginVertical");
3995
+ if (marginVertical) {
3996
+ result.cssProps.marginTop = marginVertical;
3997
+ result.cssProps.marginBottom = marginVertical;
3998
+ }
3999
+ collectCss("marginTop");
4000
+ collectCss("marginBottom");
4001
+ collectCss("border");
4002
+ const horizontalBorder = transformLayoutValue("borderHorizontal");
4003
+ if (horizontalBorder) {
4004
+ result.cssProps.borderLeft = horizontalBorder;
4005
+ result.cssProps.borderRight = horizontalBorder;
4006
+ }
4007
+ collectCss("borderRight");
4008
+ collectCss("borderLeft");
4009
+ const verticalBorder = transformLayoutValue("borderVertical");
4010
+ if (verticalBorder) {
4011
+ result.cssProps.borderTop = verticalBorder;
4012
+ result.cssProps.borderBottom = verticalBorder;
4013
+ }
4014
+ collectCss("borderTop");
4015
+ collectCss("borderBottom");
4016
+ collectCss("borderColor");
4017
+ collectCss("borderStyle");
4018
+ collectCss("borderWidth");
4019
+ collectCss("borderRadius");
4020
+ collectCss("radiusTopLeft", "borderTopLeftRadius");
4021
+ collectCss("radiusTopRight", "borderTopRightRadius");
4022
+ collectCss("radiusBottomLeft", "borderBottomLeftRadius");
4023
+ collectCss("radiusBottomRight", "borderBottomRightRadius");
4024
+ collectCss("color");
4025
+ collectCss("fontFamily");
4026
+ collectCss("fontSize");
4027
+ collectCss("fontWeight");
4028
+ collectCss("fontStyle");
4029
+ collectCss("fontVariant");
4030
+ collectCss("lineBreak");
4031
+ collectCss("textDecoration");
4032
+ collectCss("textDecorationLine");
4033
+ collectCss("textDecorationColor");
4034
+ collectCss("textDecorationStyle");
4035
+ collectCss("textDecorationThickness");
4036
+ collectCss("textIndent");
4037
+ collectCss("textShadow");
4038
+ collectCss("textUnderlineOffset");
4039
+ collectCss("userSelect");
4040
+ collectCss("letterSpacing");
4041
+ collectCss("textTransform");
4042
+ collectCss("lineHeight");
4043
+ collectCss("textAlign");
4044
+ collectCss("textAlignLast");
4045
+ collectCss("textWrap");
4046
+ collectCss("wordBreak");
4047
+ collectCss("wordSpacing");
4048
+ collectCss("wordWrap");
4049
+ collectCss("writingMode");
4050
+ collectCss("backgroundColor");
4051
+ collectCss("background");
4052
+ collectCss("boxShadow");
4053
+ collectCss("direction");
4054
+ collectCss("overflowX");
4055
+ collectCss("overflowY");
4056
+ collectCss("zIndex");
4057
+ collectCss("opacity");
4058
+ collectCss("zoom");
4059
+ collectCss("cursor");
4060
+ collectCss("whiteSpace");
4061
+ collectCss("transform");
4062
+ collectCss("outline");
4063
+ collectCss("outlineWidth");
4064
+ collectCss("outlineColor");
4065
+ collectCss("outlineStyle");
4066
+ collectCss("outlineOffset");
4067
+ const wrapContent = transformLayoutValue("wrapContent");
4068
+ if (wrapContent) {
4069
+ result.cssProps.flexWrap = wrapContent === "true" ? "wrap" : "nowrap";
4070
+ }
4071
+ collectCss("canShrink", "flexShrink");
4072
+ const canShrink = transformLayoutValue("canShrink");
4073
+ if (canShrink) {
4074
+ result.cssProps.flexShrink = canShrink === "true" ? 1 : 0;
4075
+ }
4076
+ if (isEmpty(result.cssProps) && isEmpty(result.issues)) {
4077
+ return defaultCompResult;
4078
+ }
4079
+ return result;
4080
+ function transformLayoutValue(prop) {
4081
+ var _a2, _b;
4082
+ const defValue = resolveSingleValue();
4083
+ if (((_a2 = layoutContext == null ? void 0 : layoutContext.mediaSize) == null ? void 0 : _a2.sizeIndex) !== void 0) {
4084
+ const sizeIndex = (_b = layoutContext.mediaSize) == null ? void 0 : _b.sizeIndex;
4085
+ const xsValue = resolveSingleValue("xs");
4086
+ const smValue = resolveSingleValue("sm");
4087
+ const mdValue = resolveSingleValue("md");
4088
+ const lgValue = resolveSingleValue("lg");
4089
+ const xlValue = resolveSingleValue("xl");
4090
+ const xxlValue = resolveSingleValue("xxl");
4091
+ let mergedValue;
4092
+ switch (sizeIndex) {
4093
+ case 0:
4094
+ mergedValue = xsValue ?? smValue ?? mdValue;
4095
+ break;
4096
+ case 1:
4097
+ mergedValue = smValue ?? mdValue;
4098
+ break;
4099
+ case 2:
4100
+ mergedValue = mdValue;
4101
+ break;
4102
+ case 3:
4103
+ mergedValue = lgValue;
4104
+ break;
4105
+ case 4:
4106
+ mergedValue = xlValue ?? lgValue;
4107
+ break;
4108
+ case 5:
4109
+ mergedValue = xxlValue ?? xlValue ?? lgValue;
4110
+ break;
4111
+ }
4112
+ return mergedValue ?? defValue;
4113
+ }
4114
+ return defValue;
4115
+ function resolveSingleValue(sizeTag = "") {
4116
+ const fullProp = sizeTag ? `${prop}-${sizeTag}` : prop;
4117
+ let singleInput = layoutProps[fullProp];
4118
+ if (singleInput == void 0) {
4119
+ return;
4120
+ }
4121
+ if (typeof singleInput === "string") {
4122
+ singleInput = singleInput.trim();
4123
+ } else {
4124
+ singleInput = singleInput.toString();
4125
+ }
4126
+ const value = singleInput ? singleInput.replace(
4127
+ themeVarCapturesRegex,
4128
+ (match) => toCssVar(match.trim())
4129
+ ) : void 0;
4130
+ if (singleInput !== value) {
4131
+ return value;
4132
+ }
4133
+ const propPatterns = layoutPatterns[prop];
4134
+ if (!propPatterns || propPatterns.length === 0) {
4135
+ return value;
4136
+ }
4137
+ for (const pattern of propPatterns) {
4138
+ if (pattern.test(value)) {
4139
+ return value;
4140
+ }
4141
+ }
4142
+ result.issues.add(fullProp);
4143
+ return value;
4144
+ }
4145
+ }
4146
+ function collectCss(prop, propCssName = "") {
4147
+ const value = transformLayoutValue(prop);
4148
+ if (value) {
4149
+ result.cssProps[propCssName || prop] = value;
4150
+ }
4151
+ }
4152
+ function getHorizontalStarSize(size, layoutContext2) {
4153
+ if (!size) return null;
4154
+ const orientation = getOrientation(layoutContext2);
4155
+ return orientation === "horizontal" && starSizeRegex.test(size.toString()) ? getStarSizeNumber(size.toString()) : null;
4156
+ }
4157
+ function getVerticalStarSize(size, layoutContext2) {
4158
+ if (!size) return null;
4159
+ const orientation = getOrientation(layoutContext2);
4160
+ return orientation === "vertical" && starSizeRegex.test(size.toString()) ? getStarSizeNumber(size.toString()) : null;
4161
+ }
4162
+ function getStarSizeNumber(input2) {
4163
+ if (starSizeRegex.test(input2)) {
4164
+ const numberPart = input2.slice(0, -1);
4165
+ return numberPart === "" ? 1 : parseInt(numberPart, 10);
4166
+ }
4167
+ return null;
4168
+ }
4169
+ function getOrientation(layoutContext2) {
4170
+ if (!layoutContext2) return;
4171
+ let orientation = (layoutContext2 == null ? void 0 : layoutContext2.type) === "Stack" && (layoutContext2 == null ? void 0 : layoutContext2.orientation);
4172
+ return orientation == null ? void 0 : orientation.toString();
4173
+ }
4174
+ }
4175
+ function toCssVar(c) {
4176
+ return `var(--${THEME_VAR_PREFIX}-${c.substring(1)})`;
4177
+ }
4178
+ const layoutPatterns = {
4179
+ // --- Dimensions
4180
+ width: [],
4181
+ minWidth: [],
4182
+ maxWidth: [],
4183
+ height: [],
4184
+ minHeight: [],
4185
+ maxHeight: [],
4186
+ gap: [],
4187
+ // --- Positions
4188
+ top: [],
4189
+ right: [],
4190
+ bottom: [],
4191
+ left: [],
4192
+ // --- Border
4193
+ border: [],
4194
+ borderTop: [],
4195
+ borderRight: [],
4196
+ borderBottom: [],
4197
+ borderLeft: [],
4198
+ borderColor: [],
4199
+ borderStyle: [],
4200
+ borderWidth: [],
4201
+ borderHorizontal: [],
4202
+ borderVertical: [],
4203
+ // --- Border radius
4204
+ borderRadius: [],
4205
+ radiusTopLeft: [],
4206
+ radiusTopRight: [],
4207
+ radiusBottomLeft: [],
4208
+ radiusBottomRight: [],
4209
+ // --- Padding
4210
+ padding: [],
4211
+ paddingHorizontal: [],
4212
+ paddingVertical: [],
4213
+ paddingTop: [],
4214
+ paddingRight: [],
4215
+ paddingBottom: [],
4216
+ paddingLeft: [],
4217
+ // --- Margin
4218
+ margin: [],
4219
+ marginHorizontal: [],
4220
+ marginVertical: [],
4221
+ marginTop: [],
4222
+ marginRight: [],
4223
+ marginBottom: [],
4224
+ marginLeft: [],
4225
+ // --- Other
4226
+ backgroundColor: [],
4227
+ background: [],
4228
+ boxShadow: [],
4229
+ direction: [],
4230
+ overflowX: [],
4231
+ overflowY: [],
4232
+ zIndex: [],
4233
+ opacity: [],
4234
+ // --- Typography
4235
+ color: [],
4236
+ fontFamily: [],
4237
+ fontSize: [],
4238
+ fontWeight: [],
4239
+ fontStyle: [booleanRegex],
4240
+ fontVariant: [],
4241
+ lineBreak: [],
4242
+ textDecoration: [],
4243
+ userSelect: [],
4244
+ letterSpacing: [],
4245
+ textTransform: [],
4246
+ lineHeight: [],
4247
+ textAlign: [],
4248
+ textWrap: [],
4249
+ textAlignLast: [],
4250
+ textIndent: [],
4251
+ textShadow: [],
4252
+ wordBreak: [],
4253
+ wordSpacing: [],
4254
+ wordWrap: [],
4255
+ writingMode: [],
4256
+ // --- Content rendering
4257
+ wrapContent: [],
4258
+ canShrink: [],
4259
+ // --- Other
4260
+ cursor: [],
4261
+ zoom: [],
4262
+ whiteSpace: [],
4263
+ textDecorationLine: [],
4264
+ textDecorationColor: [],
4265
+ textDecorationStyle: [],
4266
+ textDecorationThickness: [],
4267
+ textUnderlineOffset: [],
4268
+ transform: [],
4269
+ // --- Outline
4270
+ outline: [],
4271
+ outlineWidth: [],
4272
+ outlineColor: [],
4273
+ outlineStyle: [],
4274
+ outlineOffset: [],
4275
+ // --- Animation
4276
+ transition: []
4277
+ };
4278
+ const customVariantCache = /* @__PURE__ */ new Map();
4279
+ function setCustomVariantCache(variant, entry) {
4280
+ customVariantCache.set(variant, {
4281
+ ...entry,
4282
+ createdAt: Date.now()
4283
+ });
4284
+ }
4285
+ function hasCustomVariantCache(variant) {
4286
+ return customVariantCache.has(variant);
4287
+ }
3720
4288
  const defaultProps$1d = {
3721
4289
  maxLines: 0,
3722
4290
  preserveLinebreaks: false,
@@ -3757,6 +4325,56 @@ const Text = forwardRef(function Text2({
3757
4325
  if (!variant || !TextVariantElement[variant]) return "div";
3758
4326
  return TextVariantElement[variant];
3759
4327
  }, [variant]);
4328
+ const isCustomVariant = useMemo(() => {
4329
+ return variant && !TextVariantElement[variant];
4330
+ }, [variant]);
4331
+ const variantSpec = useMemo(
4332
+ () => {
4333
+ if (!isCustomVariant) return EMPTY_OBJECT;
4334
+ const subject = `-Text-${variant}`;
4335
+ const cssInput = {
4336
+ color: toCssVar(`$textColor${subject}`),
4337
+ "font-family": toCssVar(`$fontFamily${subject}`),
4338
+ "font-size": toCssVar(`$fontSize${subject}`),
4339
+ "font-style": toCssVar(`$fontStyle${subject}`),
4340
+ "font-weight": toCssVar(`$fontWeight${subject}`),
4341
+ "font-stretch": toCssVar(`$fontStretch${subject}`),
4342
+ "text-decoration-line": toCssVar(`$textDecorationLine${subject}`),
4343
+ "text-decoration-color": toCssVar(`$textDecorationColor${subject}`),
4344
+ "text-decoration-style": toCssVar(`$textDecorationStyle${subject}`),
4345
+ "text-decoration-thickness": toCssVar(`$textDecorationThickness${subject}`),
4346
+ "text-underline-offset": toCssVar(`$textUnderlineOffset${subject}`),
4347
+ "line-height": toCssVar(`$lineHeight${subject}`),
4348
+ "background-color": toCssVar(`$backgroundColor${subject}`),
4349
+ "text-transform": toCssVar(`$textTransform${subject}`),
4350
+ "letter-spacing": toCssVar(`$letterSpacing${subject}`),
4351
+ "word-spacing": toCssVar(`$wordSpacing${subject}`),
4352
+ "text-shadow": toCssVar(`$textShadow${subject}`),
4353
+ "text-indent": toCssVar(`$textIndent${subject}`),
4354
+ "text-align": toCssVar(`$textAlign${subject}`),
4355
+ "text-align-last": toCssVar(`$textAlignLast${subject}`),
4356
+ "word-break": toCssVar(`$wordBreak${subject}`),
4357
+ "word-wrap": toCssVar(`$wordWrap${subject}`),
4358
+ direction: toCssVar(`$direction${subject}`),
4359
+ "writing-mode": toCssVar(`$writingMode${subject}`),
4360
+ "line-break": toCssVar(`$lineBreak${subject}`)
4361
+ };
4362
+ return cssInput;
4363
+ },
4364
+ [isCustomVariant, variant]
4365
+ );
4366
+ const customVariantClassName = useComponentStyle(variantSpec);
4367
+ useEffect(() => {
4368
+ if (isCustomVariant && variant && customVariantClassName) {
4369
+ if (!hasCustomVariantCache(variant)) {
4370
+ setCustomVariantCache(variant, {
4371
+ className: customVariantClassName,
4372
+ cssText: ""
4373
+ // Will be populated when CSS generation is implemented
4374
+ });
4375
+ }
4376
+ }
4377
+ }, [isCustomVariant, variant, customVariantClassName]);
3760
4378
  const overflowClasses = useMemo(() => {
3761
4379
  const classes = {};
3762
4380
  if (!overflowMode) {
@@ -3812,7 +4430,8 @@ const Text = forwardRef(function Text2({
3812
4430
  className: classnames(
3813
4431
  syntaxHighlightClasses,
3814
4432
  styles$1d.text,
3815
- styles$1d[variant || "default"],
4433
+ // Use custom variant className if it's a custom variant, otherwise use predefined variant style
4434
+ isCustomVariant ? customVariantClassName : styles$1d[variant || "default"],
3816
4435
  {
3817
4436
  [styles$1d.preserveLinebreaks]: preserveLinebreaks2,
3818
4437
  ...overflowClasses,
@@ -4213,453 +4832,109 @@ const passwordInputComponentRenderer = createComponentRenderer(
4213
4832
  }
4214
4833
  );
4215
4834
  const wrapper$l = "_wrapper_1h2jx_14";
4216
- const root$3 = "_root_1h2jx_17";
4217
- const styles$1c = {
4218
- wrapper: wrapper$l,
4219
- root: root$3
4220
- };
4221
- const parsedHVarCache = {};
4222
- function parseHVar(input2) {
4223
- if (parsedHVarCache[input2] !== void 0) {
4224
- return parsedHVarCache[input2];
4225
- }
4226
- const parts = input2.split(/-[A-Z]+/);
4227
- if (parts.length !== 2) {
4228
- parsedHVarCache[input2] = null;
4229
- return parsedHVarCache[input2];
4230
- }
4231
- const firstPart = parts[0];
4232
- const classessParts = firstPart.split(":");
4233
- const attribute = classessParts[classessParts.length - 1];
4234
- const classes = classessParts.length > 1 ? classessParts.slice(0, classessParts.length - 1) : [];
4235
- const secondPart = input2.substring(firstPart.length + 1);
4236
- const [compName, ...rest] = secondPart.split("-");
4237
- const traitsAndStates = secondPart.substring(compName.length).split("--");
4238
- const states = [];
4239
- const traits = [];
4240
- traitsAndStates.forEach((part) => {
4241
- if (!part.includes("-") && part) {
4242
- states.push(part);
4243
- } else {
4244
- part.split("-").forEach((trait) => {
4245
- if (trait) {
4246
- traits.push(trait);
4247
- }
4248
- });
4249
- }
4250
- });
4251
- parsedHVarCache[input2] = {
4252
- classes,
4253
- attribute,
4254
- component: compName,
4255
- traits,
4256
- states
4257
- };
4258
- return parsedHVarCache[input2];
4259
- }
4260
- function createCombinations(arr = []) {
4261
- const stateCombinations = [];
4262
- for (let i = 1; i <= arr.length; i++) {
4263
- for (let j = 0; j <= arr.length - i; j++) {
4264
- stateCombinations.push(arr.slice(j, j + i));
4265
- }
4266
- }
4267
- return stateCombinations.sort((a, b) => b.length - a.length);
4268
- }
4269
- function matchThemeVar(themeVar, availableThemeVars = []) {
4270
- const hvar = parseHVar(themeVar);
4271
- if (!hvar) {
4272
- return;
4273
- }
4274
- const stateCombinations = createCombinations(hvar.states);
4275
- const traitCombinations = createCombinations(hvar.traits);
4276
- const sortedTraitCombinations = [];
4277
- traitCombinations.forEach((traitComb) => {
4278
- let result = "";
4279
- traitComb.forEach((t) => {
4280
- result = `${result}-${t}`;
4281
- });
4282
- sortedTraitCombinations.push(result);
4283
- });
4284
- sortedTraitCombinations.push("");
4285
- const sortedStateCombinations = [];
4286
- stateCombinations.forEach((stateComb) => {
4287
- let result = "";
4288
- stateComb.forEach((s) => {
4289
- result = `${result}--${s}`;
4290
- });
4291
- sortedStateCombinations.push(result);
4292
- });
4293
- sortedStateCombinations.push("");
4294
- const componentParts = [hvar.component, ...hvar.classes];
4295
- const from = [];
4296
- sortedStateCombinations.forEach((stateComb) => {
4297
- sortedTraitCombinations.forEach((traitComb) => {
4298
- componentParts.forEach((componentPart) => {
4299
- from.push(`${hvar.attribute}-${componentPart}${traitComb}${stateComb}`);
4300
- });
4301
- });
4302
- });
4303
- let matchedValue;
4304
- for (let i = availableThemeVars.length - 1; i >= 0; i--) {
4305
- const themeVars2 = availableThemeVars[i];
4306
- let foundValue = from.find((themeVar2) => themeVars2[themeVar2] !== void 0);
4307
- if (foundValue) {
4308
- matchedValue = foundValue;
4309
- break;
4310
- }
4311
- }
4312
- const forValue = from[0];
4313
- return {
4314
- forValue,
4315
- matchedValue,
4316
- from
4317
- };
4318
- }
4319
- const THEME_VAR_PREFIX = "xmlui";
4320
- const themeVarCapturesRegex = /(\$[a-zA-Z][a-zA-Z0-9-_]*)/g;
4321
- const booleanRegex = /^(true|false)$/;
4322
- const starSizeRegex = /^\d*\*$/;
4323
- const defaultCompResult = {
4324
- cssProps: {},
4325
- issues: /* @__PURE__ */ new Set()
4326
- };
4327
- function resolveLayoutProps(layoutProps = EMPTY_OBJECT, layoutContext) {
4328
- const result = {
4329
- cssProps: {},
4330
- issues: /* @__PURE__ */ new Set()
4331
- };
4332
- if (!!getOrientation(layoutContext)) {
4333
- result.cssProps.flexShrink = 0;
4334
- }
4335
- collectCss("width");
4336
- const horizontalStarSize = getHorizontalStarSize(result.cssProps.width, layoutContext);
4337
- if (horizontalStarSize !== null) {
4338
- result.cssProps.flex = horizontalStarSize;
4339
- result.cssProps.flexShrink = 1;
4340
- }
4341
- collectCss("minWidth");
4342
- collectCss("maxWidth");
4343
- collectCss("height");
4344
- const verticalStarSize = getVerticalStarSize(result.cssProps.height, layoutContext);
4345
- if (verticalStarSize !== null) {
4346
- result.cssProps.flex = verticalStarSize;
4347
- result.cssProps.flexShrink = 1;
4348
- }
4349
- collectCss("minHeight");
4350
- collectCss("maxHeight");
4351
- collectCss("top");
4352
- collectCss("right");
4353
- collectCss("bottom");
4354
- collectCss("left");
4355
- collectCss("gap");
4356
- collectCss("padding");
4357
- const paddingHorizontal = transformLayoutValue("paddingHorizontal");
4358
- if (paddingHorizontal) {
4359
- result.cssProps.paddingLeft = paddingHorizontal;
4360
- result.cssProps.paddingRight = paddingHorizontal;
4361
- }
4362
- collectCss("paddingRight");
4363
- collectCss("paddingLeft");
4364
- const paddingVertical = transformLayoutValue("paddingVertical");
4365
- if (paddingVertical) {
4366
- result.cssProps.paddingTop = paddingVertical;
4367
- result.cssProps.paddingBottom = paddingVertical;
4368
- }
4369
- collectCss("paddingTop");
4370
- collectCss("paddingBottom");
4371
- collectCss("margin");
4372
- const marginHorizontal = transformLayoutValue("marginHorizontal");
4373
- if (marginHorizontal) {
4374
- result.cssProps.marginLeft = marginHorizontal;
4375
- result.cssProps.marginRight = marginHorizontal;
4376
- }
4377
- collectCss("marginRight");
4378
- collectCss("marginLeft");
4379
- const marginVertical = transformLayoutValue("marginVertical");
4380
- if (marginVertical) {
4381
- result.cssProps.marginTop = marginVertical;
4382
- result.cssProps.marginBottom = marginVertical;
4383
- }
4384
- collectCss("marginTop");
4385
- collectCss("marginBottom");
4386
- collectCss("border");
4387
- const horizontalBorder = transformLayoutValue("borderHorizontal");
4388
- if (horizontalBorder) {
4389
- result.cssProps.borderLeft = horizontalBorder;
4390
- result.cssProps.borderRight = horizontalBorder;
4391
- }
4392
- collectCss("borderRight");
4393
- collectCss("borderLeft");
4394
- const verticalBorder = transformLayoutValue("borderVertical");
4395
- if (verticalBorder) {
4396
- result.cssProps.borderTop = verticalBorder;
4397
- result.cssProps.borderBottom = verticalBorder;
4398
- }
4399
- collectCss("borderTop");
4400
- collectCss("borderBottom");
4401
- collectCss("borderColor");
4402
- collectCss("borderStyle");
4403
- collectCss("borderWidth");
4404
- collectCss("borderRadius");
4405
- collectCss("radiusTopLeft", "borderTopLeftRadius");
4406
- collectCss("radiusTopRight", "borderTopRightRadius");
4407
- collectCss("radiusBottomLeft", "borderBottomLeftRadius");
4408
- collectCss("radiusBottomRight", "borderBottomRightRadius");
4409
- collectCss("color");
4410
- collectCss("fontFamily");
4411
- collectCss("fontSize");
4412
- collectCss("fontWeight");
4413
- collectCss("fontStyle");
4414
- collectCss("fontVariant");
4415
- collectCss("lineBreak");
4416
- collectCss("textDecoration");
4417
- collectCss("textDecorationLine");
4418
- collectCss("textDecorationColor");
4419
- collectCss("textDecorationStyle");
4420
- collectCss("textDecorationThickness");
4421
- collectCss("textIndent");
4422
- collectCss("textShadow");
4423
- collectCss("textUnderlineOffset");
4424
- collectCss("userSelect");
4425
- collectCss("letterSpacing");
4426
- collectCss("textTransform");
4427
- collectCss("lineHeight");
4428
- collectCss("textAlign");
4429
- collectCss("textAlignLast");
4430
- collectCss("textWrap");
4431
- collectCss("wordBreak");
4432
- collectCss("wordSpacing");
4433
- collectCss("wordWrap");
4434
- collectCss("writingMode");
4435
- collectCss("backgroundColor");
4436
- collectCss("background");
4437
- collectCss("boxShadow");
4438
- collectCss("direction");
4439
- collectCss("overflowX");
4440
- collectCss("overflowY");
4441
- collectCss("zIndex");
4442
- collectCss("opacity");
4443
- collectCss("zoom");
4444
- collectCss("cursor");
4445
- collectCss("whiteSpace");
4446
- collectCss("transform");
4447
- collectCss("outline");
4448
- collectCss("outlineWidth");
4449
- collectCss("outlineColor");
4450
- collectCss("outlineStyle");
4451
- collectCss("outlineOffset");
4452
- const wrapContent = transformLayoutValue("wrapContent");
4453
- if (wrapContent) {
4454
- result.cssProps.flexWrap = wrapContent === "true" ? "wrap" : "nowrap";
4455
- }
4456
- collectCss("canShrink", "flexShrink");
4457
- const canShrink = transformLayoutValue("canShrink");
4458
- if (canShrink) {
4459
- result.cssProps.flexShrink = canShrink === "true" ? 1 : 0;
4835
+ const root$3 = "_root_1h2jx_17";
4836
+ const styles$1c = {
4837
+ wrapper: wrapper$l,
4838
+ root: root$3
4839
+ };
4840
+ const parsedHVarCache = {};
4841
+ function parseHVar(input2) {
4842
+ if (parsedHVarCache[input2] !== void 0) {
4843
+ return parsedHVarCache[input2];
4460
4844
  }
4461
- if (isEmpty(result.cssProps) && isEmpty(result.issues)) {
4462
- return defaultCompResult;
4845
+ const parts = input2.split(/-[A-Z]+/);
4846
+ if (parts.length !== 2) {
4847
+ parsedHVarCache[input2] = null;
4848
+ return parsedHVarCache[input2];
4463
4849
  }
4464
- return result;
4465
- function transformLayoutValue(prop) {
4466
- var _a2, _b;
4467
- const defValue = resolveSingleValue();
4468
- if (((_a2 = layoutContext == null ? void 0 : layoutContext.mediaSize) == null ? void 0 : _a2.sizeIndex) !== void 0) {
4469
- const sizeIndex = (_b = layoutContext.mediaSize) == null ? void 0 : _b.sizeIndex;
4470
- const xsValue = resolveSingleValue("xs");
4471
- const smValue = resolveSingleValue("sm");
4472
- const mdValue = resolveSingleValue("md");
4473
- const lgValue = resolveSingleValue("lg");
4474
- const xlValue = resolveSingleValue("xl");
4475
- const xxlValue = resolveSingleValue("xxl");
4476
- let mergedValue;
4477
- switch (sizeIndex) {
4478
- case 0:
4479
- mergedValue = xsValue ?? smValue ?? mdValue;
4480
- break;
4481
- case 1:
4482
- mergedValue = smValue ?? mdValue;
4483
- break;
4484
- case 2:
4485
- mergedValue = mdValue;
4486
- break;
4487
- case 3:
4488
- mergedValue = lgValue;
4489
- break;
4490
- case 4:
4491
- mergedValue = xlValue ?? lgValue;
4492
- break;
4493
- case 5:
4494
- mergedValue = xxlValue ?? xlValue ?? lgValue;
4495
- break;
4496
- }
4497
- return mergedValue ?? defValue;
4498
- }
4499
- return defValue;
4500
- function resolveSingleValue(sizeTag = "") {
4501
- const fullProp = sizeTag ? `${prop}-${sizeTag}` : prop;
4502
- let singleInput = layoutProps[fullProp];
4503
- if (singleInput == void 0) {
4504
- return;
4505
- }
4506
- if (typeof singleInput === "string") {
4507
- singleInput = singleInput.trim();
4508
- } else {
4509
- singleInput = singleInput.toString();
4510
- }
4511
- const value = singleInput ? singleInput.replace(
4512
- themeVarCapturesRegex,
4513
- (match) => toCssVar(match.trim())
4514
- ) : void 0;
4515
- if (singleInput !== value) {
4516
- return value;
4517
- }
4518
- const propPatterns = layoutPatterns[prop];
4519
- if (!propPatterns || propPatterns.length === 0) {
4520
- return value;
4521
- }
4522
- for (const pattern of propPatterns) {
4523
- if (pattern.test(value)) {
4524
- return value;
4850
+ const firstPart = parts[0];
4851
+ const classessParts = firstPart.split(":");
4852
+ const attribute = classessParts[classessParts.length - 1];
4853
+ const classes = classessParts.length > 1 ? classessParts.slice(0, classessParts.length - 1) : [];
4854
+ const secondPart = input2.substring(firstPart.length + 1);
4855
+ const [compName, ...rest] = secondPart.split("-");
4856
+ const traitsAndStates = secondPart.substring(compName.length).split("--");
4857
+ const states = [];
4858
+ const traits = [];
4859
+ traitsAndStates.forEach((part) => {
4860
+ if (!part.includes("-") && part) {
4861
+ states.push(part);
4862
+ } else {
4863
+ part.split("-").forEach((trait) => {
4864
+ if (trait) {
4865
+ traits.push(trait);
4525
4866
  }
4526
- }
4527
- result.issues.add(fullProp);
4528
- return value;
4867
+ });
4529
4868
  }
4530
- }
4531
- function collectCss(prop, propCssName = "") {
4532
- const value = transformLayoutValue(prop);
4533
- if (value) {
4534
- result.cssProps[propCssName || prop] = value;
4869
+ });
4870
+ parsedHVarCache[input2] = {
4871
+ classes,
4872
+ attribute,
4873
+ component: compName,
4874
+ traits,
4875
+ states
4876
+ };
4877
+ return parsedHVarCache[input2];
4878
+ }
4879
+ function createCombinations(arr = []) {
4880
+ const stateCombinations = [];
4881
+ for (let i = 1; i <= arr.length; i++) {
4882
+ for (let j = 0; j <= arr.length - i; j++) {
4883
+ stateCombinations.push(arr.slice(j, j + i));
4535
4884
  }
4536
4885
  }
4537
- function getHorizontalStarSize(size, layoutContext2) {
4538
- if (!size) return null;
4539
- const orientation = getOrientation(layoutContext2);
4540
- return orientation === "horizontal" && starSizeRegex.test(size.toString()) ? getStarSizeNumber(size.toString()) : null;
4541
- }
4542
- function getVerticalStarSize(size, layoutContext2) {
4543
- if (!size) return null;
4544
- const orientation = getOrientation(layoutContext2);
4545
- return orientation === "vertical" && starSizeRegex.test(size.toString()) ? getStarSizeNumber(size.toString()) : null;
4886
+ return stateCombinations.sort((a, b) => b.length - a.length);
4887
+ }
4888
+ function matchThemeVar(themeVar, availableThemeVars = []) {
4889
+ const hvar = parseHVar(themeVar);
4890
+ if (!hvar) {
4891
+ return;
4546
4892
  }
4547
- function getStarSizeNumber(input2) {
4548
- if (starSizeRegex.test(input2)) {
4549
- const numberPart = input2.slice(0, -1);
4550
- return numberPart === "" ? 1 : parseInt(numberPart, 10);
4893
+ const stateCombinations = createCombinations(hvar.states);
4894
+ const traitCombinations = createCombinations(hvar.traits);
4895
+ const sortedTraitCombinations = [];
4896
+ traitCombinations.forEach((traitComb) => {
4897
+ let result = "";
4898
+ traitComb.forEach((t) => {
4899
+ result = `${result}-${t}`;
4900
+ });
4901
+ sortedTraitCombinations.push(result);
4902
+ });
4903
+ sortedTraitCombinations.push("");
4904
+ const sortedStateCombinations = [];
4905
+ stateCombinations.forEach((stateComb) => {
4906
+ let result = "";
4907
+ stateComb.forEach((s) => {
4908
+ result = `${result}--${s}`;
4909
+ });
4910
+ sortedStateCombinations.push(result);
4911
+ });
4912
+ sortedStateCombinations.push("");
4913
+ const componentParts = [hvar.component, ...hvar.classes];
4914
+ const from = [];
4915
+ sortedStateCombinations.forEach((stateComb) => {
4916
+ sortedTraitCombinations.forEach((traitComb) => {
4917
+ componentParts.forEach((componentPart) => {
4918
+ from.push(`${hvar.attribute}-${componentPart}${traitComb}${stateComb}`);
4919
+ });
4920
+ });
4921
+ });
4922
+ let matchedValue;
4923
+ for (let i = availableThemeVars.length - 1; i >= 0; i--) {
4924
+ const themeVars2 = availableThemeVars[i];
4925
+ let foundValue = from.find((themeVar2) => themeVars2[themeVar2] !== void 0);
4926
+ if (foundValue) {
4927
+ matchedValue = foundValue;
4928
+ break;
4551
4929
  }
4552
- return null;
4553
- }
4554
- function getOrientation(layoutContext2) {
4555
- if (!layoutContext2) return;
4556
- let orientation = (layoutContext2 == null ? void 0 : layoutContext2.type) === "Stack" && (layoutContext2 == null ? void 0 : layoutContext2.orientation);
4557
- return orientation == null ? void 0 : orientation.toString();
4558
4930
  }
4931
+ const forValue = from[0];
4932
+ return {
4933
+ forValue,
4934
+ matchedValue,
4935
+ from
4936
+ };
4559
4937
  }
4560
- function toCssVar(c) {
4561
- return `var(--${THEME_VAR_PREFIX}-${c.substring(1)})`;
4562
- }
4563
- const layoutPatterns = {
4564
- // --- Dimensions
4565
- width: [],
4566
- minWidth: [],
4567
- maxWidth: [],
4568
- height: [],
4569
- minHeight: [],
4570
- maxHeight: [],
4571
- gap: [],
4572
- // --- Positions
4573
- top: [],
4574
- right: [],
4575
- bottom: [],
4576
- left: [],
4577
- // --- Border
4578
- border: [],
4579
- borderTop: [],
4580
- borderRight: [],
4581
- borderBottom: [],
4582
- borderLeft: [],
4583
- borderColor: [],
4584
- borderStyle: [],
4585
- borderWidth: [],
4586
- borderHorizontal: [],
4587
- borderVertical: [],
4588
- // --- Border radius
4589
- borderRadius: [],
4590
- radiusTopLeft: [],
4591
- radiusTopRight: [],
4592
- radiusBottomLeft: [],
4593
- radiusBottomRight: [],
4594
- // --- Padding
4595
- padding: [],
4596
- paddingHorizontal: [],
4597
- paddingVertical: [],
4598
- paddingTop: [],
4599
- paddingRight: [],
4600
- paddingBottom: [],
4601
- paddingLeft: [],
4602
- // --- Margin
4603
- margin: [],
4604
- marginHorizontal: [],
4605
- marginVertical: [],
4606
- marginTop: [],
4607
- marginRight: [],
4608
- marginBottom: [],
4609
- marginLeft: [],
4610
- // --- Other
4611
- backgroundColor: [],
4612
- background: [],
4613
- boxShadow: [],
4614
- direction: [],
4615
- overflowX: [],
4616
- overflowY: [],
4617
- zIndex: [],
4618
- opacity: [],
4619
- // --- Typography
4620
- color: [],
4621
- fontFamily: [],
4622
- fontSize: [],
4623
- fontWeight: [],
4624
- fontStyle: [booleanRegex],
4625
- fontVariant: [],
4626
- lineBreak: [],
4627
- textDecoration: [],
4628
- userSelect: [],
4629
- letterSpacing: [],
4630
- textTransform: [],
4631
- lineHeight: [],
4632
- textAlign: [],
4633
- textWrap: [],
4634
- textAlignLast: [],
4635
- textIndent: [],
4636
- textShadow: [],
4637
- wordBreak: [],
4638
- wordSpacing: [],
4639
- wordWrap: [],
4640
- writingMode: [],
4641
- // --- Content rendering
4642
- wrapContent: [],
4643
- canShrink: [],
4644
- // --- Other
4645
- cursor: [],
4646
- zoom: [],
4647
- whiteSpace: [],
4648
- textDecorationLine: [],
4649
- textDecorationColor: [],
4650
- textDecorationStyle: [],
4651
- textDecorationThickness: [],
4652
- textUnderlineOffset: [],
4653
- transform: [],
4654
- // --- Outline
4655
- outline: [],
4656
- outlineWidth: [],
4657
- outlineColor: [],
4658
- outlineStyle: [],
4659
- outlineOffset: [],
4660
- // --- Animation
4661
- transition: []
4662
- };
4663
4938
  function isThemeVarName(varName) {
4664
4939
  return typeof varName === "string" && (varName == null ? void 0 : varName.startsWith("$"));
4665
4940
  }
@@ -6498,222 +6773,6 @@ const XmlUiRedThemeDefinition = {
6498
6773
  themeVars: { ...redThemeColors }
6499
6774
  };
6500
6775
  const ThemeToneKeys = ["light", "dark"];
6501
- function hashString(str) {
6502
- let hash = 5381;
6503
- let i = str.length;
6504
- while (i) {
6505
- hash = hash * 33 ^ str.charCodeAt(--i);
6506
- }
6507
- let s = (hash >>> 0).toString(36);
6508
- return s;
6509
- }
6510
- function toKebabCase(str) {
6511
- if (str.startsWith("--")) {
6512
- return str;
6513
- }
6514
- return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
6515
- }
6516
- function stableJSONStringify(obj) {
6517
- return JSON.stringify(obj);
6518
- }
6519
- class StyleRegistry {
6520
- constructor() {
6521
- this.cache = /* @__PURE__ */ new Map();
6522
- this.rootClasses = /* @__PURE__ */ new Set();
6523
- this.injected = /* @__PURE__ */ new Set();
6524
- this.refCounts = /* @__PURE__ */ new Map();
6525
- this.ssrHashes = /* @__PURE__ */ new Set();
6526
- }
6527
- register(styles2) {
6528
- const key = stableJSONStringify(styles2);
6529
- const styleHash = hashString(key);
6530
- const cachedEntry = this.cache.get(styleHash);
6531
- if (cachedEntry) {
6532
- return cachedEntry;
6533
- }
6534
- const className = `css-${styleHash}`;
6535
- const css = this._generateCss(`.${className}`, styles2);
6536
- const entry = { className, styleHash, css };
6537
- this.cache.set(styleHash, entry);
6538
- return entry;
6539
- }
6540
- /**
6541
- * [PRIVATE] Recursively generates CSS rules from a style object.
6542
- * This is the new, more powerful engine.
6543
- * @param selector - The CSS selector for the current context (e.g., '.css-123' or '&:hover').
6544
- * @param styles - The style object to process.
6545
- * @returns A string of CSS rules.
6546
- */
6547
- _generateCss(selector, styles2) {
6548
- const directProps = [];
6549
- const nestedRules = [];
6550
- for (const key in styles2) {
6551
- const value = styles2[key];
6552
- if (typeof value === "object" && value !== null) {
6553
- nestedRules.push(this._processNestedRule(selector, key, value));
6554
- } else {
6555
- directProps.push(`${toKebabCase(key)}:${value};`);
6556
- }
6557
- }
6558
- let finalCss = "";
6559
- if (directProps.length > 0) {
6560
- finalCss += `${selector} {${directProps.join("")}}`;
6561
- }
6562
- finalCss += nestedRules.join("");
6563
- return finalCss;
6564
- }
6565
- _processNestedRule(parentSelector, nestedKey, nestedStyles) {
6566
- if (nestedKey.startsWith("@")) {
6567
- return `${nestedKey}{${this._generateCss(parentSelector, nestedStyles)}}`;
6568
- }
6569
- const newSelector = nestedKey.replace(/&/g, parentSelector);
6570
- return this._generateCss(newSelector, nestedStyles);
6571
- }
6572
- getSsrStyles() {
6573
- const allCss = Array.from(this.cache.values()).map((entry) => entry.css).join("");
6574
- return `@layer dynamic {${allCss}}`;
6575
- }
6576
- /**
6577
- * Adds a class name to be applied to the <html> tag.
6578
- */
6579
- addRootClasses(classNames) {
6580
- classNames.forEach((className) => {
6581
- this.rootClasses.add(className);
6582
- });
6583
- }
6584
- /**
6585
- * Returns a space-separated string of all collected html classes.
6586
- */
6587
- getRootClasses() {
6588
- return Array.from(this.rootClasses).join(" ");
6589
- }
6590
- // NEW: A helper to safely get the current reference count.
6591
- getRefCount(styleHash) {
6592
- return this.refCounts.get(styleHash) || 0;
6593
- }
6594
- /**
6595
- * Increments the reference count for a given style hash.
6596
- */
6597
- incrementRef(styleHash) {
6598
- const newCount = (this.refCounts.get(styleHash) || 0) + 1;
6599
- this.refCounts.set(styleHash, newCount);
6600
- }
6601
- /**
6602
- * Decrements the reference count for a given style hash.
6603
- * @returns {number} The new reference count.
6604
- */
6605
- decrementRef(styleHash) {
6606
- const currentCount = this.refCounts.get(styleHash) || 0;
6607
- const newCount = Math.max(0, currentCount - 1);
6608
- if (newCount > 0) {
6609
- this.refCounts.set(styleHash, newCount);
6610
- } else {
6611
- this.refCounts.delete(styleHash);
6612
- }
6613
- return newCount;
6614
- }
6615
- }
6616
- const IndexerContext = React__default.createContext({
6617
- indexing: false
6618
- });
6619
- function useIndexerContext() {
6620
- return useContext(IndexerContext);
6621
- }
6622
- const StyleContext = createContext(null);
6623
- function StyleProvider({
6624
- children,
6625
- styleRegistry = new StyleRegistry(),
6626
- forceNew = false
6627
- // Optional prop to force a new registry
6628
- }) {
6629
- const parentRegistry = useContext(StyleContext);
6630
- const [registry] = useState(() => {
6631
- const newRegistry = styleRegistry;
6632
- if (typeof window !== "undefined") {
6633
- const ssrTag = document.querySelector('style[data-style-registry="true"]');
6634
- const ssrHashes = ssrTag == null ? void 0 : ssrTag.getAttribute("data-ssr-hashes");
6635
- if (ssrHashes) {
6636
- let hashes = ssrHashes.split(",");
6637
- newRegistry.ssrHashes = new Set(hashes);
6638
- newRegistry.injected = new Set(hashes);
6639
- }
6640
- }
6641
- return newRegistry;
6642
- });
6643
- if (parentRegistry && !forceNew) {
6644
- return /* @__PURE__ */ jsx(Fragment, { children });
6645
- }
6646
- return /* @__PURE__ */ jsx(StyleContext.Provider, { value: registry, children });
6647
- }
6648
- function useStyleRegistry() {
6649
- const registry = useContext(StyleContext);
6650
- if (registry === null) {
6651
- throw new Error("Component must be used within a StyleProvider");
6652
- }
6653
- return registry;
6654
- }
6655
- function useComponentStyle(styles2) {
6656
- const rootStyle = useMemo(() => {
6657
- return !styles2 || Object.keys(styles2).length === 0 ? EMPTY_OBJECT : {
6658
- "&": styles2
6659
- // "@container style(--screenSize: 1) or @container style(--screenSize: 2) ... etc": responsiveSizes,
6660
- };
6661
- }, [styles2]);
6662
- return useStyles(rootStyle);
6663
- }
6664
- const StyleInjectionTargetContext = createContext(null);
6665
- function useDomRoot() {
6666
- const domRoot = useContext(StyleInjectionTargetContext);
6667
- return domRoot;
6668
- }
6669
- function useStyles(styles2, { prepend } = EMPTY_OBJECT) {
6670
- const { indexing } = useIndexerContext();
6671
- const domRoot = useDomRoot();
6672
- const injectionTarget = typeof document === "undefined" ? null : domRoot instanceof ShadowRoot ? domRoot : document.head;
6673
- const registry = useStyleRegistry();
6674
- const { className, styleHash } = useMemo(() => {
6675
- if (indexing || !styles2 || styles2 === EMPTY_OBJECT || Object.keys(styles2).length === 0) {
6676
- return { className: void 0, styleHash: void 0 };
6677
- }
6678
- return registry.register(styles2);
6679
- }, [indexing, registry, styles2]);
6680
- useInsertionEffect(() => {
6681
- if (!styleHash || registry.injected.has(styleHash)) {
6682
- return;
6683
- }
6684
- const { css } = registry.cache.get(styleHash) || {};
6685
- if (css) {
6686
- const styleElement = document.createElement("style");
6687
- styleElement.setAttribute("data-style-hash", styleHash);
6688
- styleElement.innerHTML = `@layer dynamic {
6689
- ${css}
6690
- }`;
6691
- if (prepend) {
6692
- injectionTarget.insertBefore(styleElement, injectionTarget.firstChild.nextSibling);
6693
- } else {
6694
- injectionTarget.appendChild(styleElement);
6695
- }
6696
- registry.injected.add(styleHash);
6697
- }
6698
- }, [registry, styleHash, injectionTarget]);
6699
- useEffect(() => {
6700
- if (!styleHash) {
6701
- return;
6702
- }
6703
- registry.incrementRef(styleHash);
6704
- return () => {
6705
- registry.decrementRef(styleHash);
6706
- setTimeout(() => {
6707
- var _a2;
6708
- if (registry.getRefCount(styleHash) === 0 && !registry.ssrHashes.has(styleHash)) {
6709
- registry.injected.delete(styleHash);
6710
- (_a2 = injectionTarget.querySelector(`style[data-style-hash="${styleHash}"]`)) == null ? void 0 : _a2.remove();
6711
- }
6712
- }, 0);
6713
- };
6714
- }, [injectionTarget, registry, styleHash]);
6715
- return className;
6716
- }
6717
6776
  function useCompiledTheme(activeTheme, activeTone, themes = EMPTY_ARRAY, resources = EMPTY_OBJECT, resourceMap = EMPTY_OBJECT) {
6718
6777
  const componentRegistry = useComponentRegistry();
6719
6778
  const { componentThemeVars, componentDefaultThemeVars } = componentRegistry;
@@ -8391,6 +8450,7 @@ function App({
8391
8450
  name,
8392
8451
  className,
8393
8452
  applyDefaultContentPadding,
8453
+ registerComponentApi,
8394
8454
  ...rest
8395
8455
  }) {
8396
8456
  const { getThemeVar } = useTheme();
@@ -8858,7 +8918,7 @@ const AppMd = createMetadata({
8858
8918
  }
8859
8919
  }
8860
8920
  });
8861
- function AppNode({ node, extractValue, renderChild: renderChild2, className, lookupEventHandler }) {
8921
+ function AppNode({ node, extractValue, renderChild: renderChild2, className, lookupEventHandler, registerComponentApi }) {
8862
8922
  const processedNavRef = useRef(false);
8863
8923
  const layoutType = useMemo(
8864
8924
  () => extractValue(node.props.layout),
@@ -9074,6 +9134,7 @@ function AppNode({ node, extractValue, renderChild: renderChild2, className, loo
9074
9134
  navPanelDef: NavPanel3,
9075
9135
  logoContentDef: node.props.logoTemplate,
9076
9136
  renderChild: renderChild2,
9137
+ registerComponentApi,
9077
9138
  children: [
9078
9139
  renderedContent,
9079
9140
  /* @__PURE__ */ jsx(SearchIndexCollector, { Pages: Pages2, renderChild: renderChild2 })
@@ -9205,7 +9266,7 @@ function PageIndexer({
9205
9266
  const appRenderer = createComponentRenderer(
9206
9267
  COMP$1t,
9207
9268
  AppMd,
9208
- ({ node, extractValue, renderChild: renderChild2, className, lookupEventHandler }) => {
9269
+ ({ node, extractValue, renderChild: renderChild2, className, lookupEventHandler, registerComponentApi }) => {
9209
9270
  return /* @__PURE__ */ jsx(
9210
9271
  AppNode,
9211
9272
  {
@@ -9213,7 +9274,8 @@ const appRenderer = createComponentRenderer(
9213
9274
  renderChild: renderChild2,
9214
9275
  extractValue,
9215
9276
  className,
9216
- lookupEventHandler
9277
+ lookupEventHandler,
9278
+ registerComponentApi
9217
9279
  }
9218
9280
  );
9219
9281
  }
@@ -14224,7 +14286,6 @@ const Form = forwardRef(function({
14224
14286
  ...rest
14225
14287
  }, ref) {
14226
14288
  const formRef = useRef(null);
14227
- useImperativeHandle(ref, () => formRef.current);
14228
14289
  const [confirmSubmitModalVisible, setConfirmSubmitModalVisible] = useState(false);
14229
14290
  const requestModalFormClose = useModalFormClose();
14230
14291
  const isEnabled2 = enabled2 && !formState.submitInProgress;
@@ -25549,7 +25610,7 @@ function hierarchyToNative(hierarchyData, fieldConfig) {
25549
25610
  treeItemsById
25550
25611
  };
25551
25612
  }
25552
- const TreeRow = memo(({ index, style: style2, data }) => {
25613
+ const TreeRow = memo(({ index, data }) => {
25553
25614
  const {
25554
25615
  nodes,
25555
25616
  toggleNode,
@@ -25606,7 +25667,7 @@ const TreeRow = memo(({ index, style: style2, data }) => {
25606
25667
  );
25607
25668
  const nodeWithState = treeItem;
25608
25669
  const isLoading = nodeWithState.loadingState === "loading";
25609
- return /* @__PURE__ */ jsx("div", { style: { ...style2, width: "auto", minWidth: "100%", display: "flex" }, children: /* @__PURE__ */ jsxs(
25670
+ return /* @__PURE__ */ jsx("div", { style: { width: "100%", display: "flex" }, children: /* @__PURE__ */ jsxs(
25610
25671
  "div",
25611
25672
  {
25612
25673
  className: classnames(styles$D.rowWrapper, {
@@ -25734,7 +25795,6 @@ const TreeComponent = memo((props) => {
25734
25795
  iconCollapsed = defaultProps$E.iconCollapsed,
25735
25796
  iconExpanded = defaultProps$E.iconExpanded,
25736
25797
  iconSize = defaultProps$E.iconSize,
25737
- itemHeight = defaultProps$E.itemHeight,
25738
25798
  animateExpand = defaultProps$E.animateExpand,
25739
25799
  expandRotation = defaultProps$E.expandRotation,
25740
25800
  onItemClick,
@@ -26197,10 +26257,6 @@ const TreeComponent = memo((props) => {
26197
26257
  animateExpand,
26198
26258
  expandRotation
26199
26259
  ]);
26200
- const getItemKey = useCallback((index, data2) => {
26201
- const node = data2.nodes[index];
26202
- return (node == null ? void 0 : node.key) || (node == null ? void 0 : node.id) || `fallback-${index}`;
26203
- }, []);
26204
26260
  const treeApiMethods = useMemo(() => {
26205
26261
  return {
26206
26262
  // Expansion methods
@@ -26376,14 +26432,14 @@ const TreeComponent = memo((props) => {
26376
26432
  (item2) => String(item2.key) === String(nodeId)
26377
26433
  );
26378
26434
  if (nodeIndex >= 0 && listRef.current) {
26379
- listRef.current.scrollToItem(nodeIndex, "center");
26435
+ listRef.current.scrollToIndex(nodeIndex, { align: "center" });
26380
26436
  }
26381
26437
  }, 0);
26382
26438
  },
26383
26439
  scrollToItem: (nodeId) => {
26384
26440
  const nodeIndex = findNodeIndexById(nodeId);
26385
26441
  if (nodeIndex >= 0 && listRef.current) {
26386
- listRef.current.scrollToItem(nodeIndex, "center");
26442
+ listRef.current.scrollToIndex(nodeIndex, { align: "center" });
26387
26443
  }
26388
26444
  },
26389
26445
  appendNode: (parentNodeId, nodeData) => {
@@ -26700,19 +26756,8 @@ const TreeComponent = memo((props) => {
26700
26756
  onFocus: handleTreeFocus,
26701
26757
  onBlur: handleTreeBlur,
26702
26758
  onKeyDown: handleKeyDown,
26703
- children: /* @__PURE__ */ jsx(AutoSizer, { children: ({ width, height }) => /* @__PURE__ */ jsx(
26704
- FixedSizeList,
26705
- {
26706
- ref: listRef,
26707
- height,
26708
- itemCount: itemData.nodes.length,
26709
- itemData,
26710
- itemSize: itemHeight,
26711
- itemKey: getItemKey,
26712
- width,
26713
- children: TreeRow
26714
- }
26715
- ) })
26759
+ style: { height: "100%", overflow: "auto" },
26760
+ children: /* @__PURE__ */ jsx(Virtualizer, { ref: listRef, children: flatTreeData.map((node, index) => /* @__PURE__ */ jsx(TreeRow, { index, data: itemData }, node.key)) })
26716
26761
  }
26717
26762
  );
26718
26763
  });
@@ -27507,7 +27552,7 @@ const TextMd = createMetadata({
27507
27552
  `The text to be displayed. This value can also be set via nesting the text into the \`${COMP$14}\` component.`
27508
27553
  ),
27509
27554
  variant: {
27510
- description: "An optional string value that provides named presets for text variants with a unique combination of font style, weight, size, color, and other parameters. If not defined, the text uses the current style of its context.",
27555
+ description: "An optional string value that provides named presets for text variants with a unique combination of font style, weight, size, color, and other parameters. If not defined, the text uses the current style of its context. In addition to predefined variants, you can specify custom variant names and style them using theme variables with the pattern `{cssProperty}-Text-{variantName}` (e.g., `textColor-Text-brandTitle`, `fontSize-Text-highlight`). See the documentation for a complete list of supported CSS properties.",
27511
27556
  availableValues: variantOptionsMd
27512
27557
  },
27513
27558
  maxLines: d(
@@ -29984,7 +30029,6 @@ const IFrame = memo(forwardRef(function IFrame2({
29984
30029
  ...rest
29985
30030
  }, ref) {
29986
30031
  const iframeRef = useRef(null);
29987
- useImperativeHandle(ref, () => iframeRef.current, []);
29988
30032
  useEffect(() => {
29989
30033
  registerComponentApi == null ? void 0 : registerComponentApi({
29990
30034
  postMessage: (message, targetOrigin = "*") => {
@@ -35873,7 +35917,6 @@ const DateInput = forwardRef(function DateInputNative({
35873
35917
  return null;
35874
35918
  }
35875
35919
  }, [day2, month2, year2]);
35876
- useImperativeHandle(ref, () => dateInputRef.current);
35877
35920
  useEffect(() => {
35878
35921
  if (registerComponentApi) {
35879
35922
  registerComponentApi({
@@ -37200,7 +37243,6 @@ const TimeInputNative = forwardRef(function TimeInputNative2({
37200
37243
  const s24 = (second2 || "00").padStart(2, "0");
37201
37244
  return `${h24}:${m24}:${s24}`;
37202
37245
  }, [hour2, minute2, second2, amPm, is12HourFormat]);
37203
- useImperativeHandle(ref, () => timeInputRef.current);
37204
37246
  useEffect(() => {
37205
37247
  if (registerComponentApi) {
37206
37248
  registerComponentApi({
@@ -37947,7 +37989,6 @@ const Timer = forwardRef(function Timer2({
37947
37989
  isPaused: () => isPaused,
37948
37990
  isRunning: () => isRunning && !isPaused
37949
37991
  }), [pause, resume, isPaused, isRunning]);
37950
- useImperativeHandle(forwardedRef, () => timerApi, [timerApi]);
37951
37992
  useEffect(() => {
37952
37993
  if (registerComponentApi) {
37953
37994
  registerComponentApi(timerApi);
@@ -46842,7 +46883,7 @@ function IconProvider({ children }) {
46842
46883
  /* @__PURE__ */ jsx("svg", { style: { display: "none" }, ref: spriteRootRef })
46843
46884
  ] });
46844
46885
  }
46845
- const version = "0.10.20";
46886
+ const version = "0.10.21";
46846
46887
  const miscellaneousUtils = {
46847
46888
  capitalize,
46848
46889
  pluralize: pluralize$1,
@@ -51588,7 +51629,7 @@ function ApiInterceptorProvider({
51588
51629
  return;
51589
51630
  }
51590
51631
  void (async () => {
51591
- const { initMock } = await import("./initMock-ZyyFNOpL.mjs");
51632
+ const { initMock } = await import("./initMock-Dw9wrVkQ.mjs");
51592
51633
  const apiInstance2 = await initMock(interceptor);
51593
51634
  setApiInstance(apiInstance2);
51594
51635
  setInitialized(true);
@@ -51605,7 +51646,7 @@ function ApiInterceptorProvider({
51605
51646
  if (define_process_env_default$2.VITE_MOCK_ENABLED) {
51606
51647
  const [{ createApiInterceptorWorker }, { initMock }] = await Promise.all([
51607
51648
  useWorker ? import("./apiInterceptorWorker-Dql7QGw2.mjs") : Promise.resolve({ createApiInterceptorWorker: () => null }),
51608
- import("./initMock-ZyyFNOpL.mjs")
51649
+ import("./initMock-Dw9wrVkQ.mjs")
51609
51650
  ]);
51610
51651
  if (interceptor || forceInitialize) {
51611
51652
  const apiInstance2 = await initMock(interceptor || {});
@@ -51642,7 +51683,7 @@ function ApiInterceptorProvider({
51642
51683
  void (async () => {
51643
51684
  const [{ createApiInterceptorWorker }, { initMock }] = await Promise.all([
51644
51685
  import("./apiInterceptorWorker-Dql7QGw2.mjs"),
51645
- import("./initMock-ZyyFNOpL.mjs")
51686
+ import("./initMock-Dw9wrVkQ.mjs")
51646
51687
  ]);
51647
51688
  const apiInstance2 = await initMock(interceptor);
51648
51689
  await createApiInterceptorWorker(apiInstance2, parentInterceptorWorker);