xmlui 0.10.19 → 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.
Files changed (118) hide show
  1. package/dist/lib/{apiInterceptorWorker-DPgtUtdA.mjs → apiInterceptorWorker-QiltRtq1.mjs} +1 -1
  2. package/dist/lib/{index-cuh97e2e.mjs → index-BiS4wEuu.mjs} +1486 -1211
  3. package/dist/lib/index.css +1 -1
  4. package/dist/{metadata/initMock-C-cnv--V.mjs → lib/initMock-CB_cMi6U.mjs} +25 -15
  5. package/dist/lib/language-server-web-worker.mjs +1 -1
  6. package/dist/lib/language-server.mjs +1 -1
  7. package/dist/lib/{metadata-utils-CtY0QcvH.mjs → metadata-utils-BTIt1_wE.mjs} +1 -1
  8. package/dist/lib/{server-common-Cine5nRR.mjs → server-common-DYZtsdM7.mjs} +51 -14
  9. package/dist/lib/{transform-bHBjkKSL.mjs → transform-Tooy42EB.mjs} +16 -18
  10. package/dist/lib/xmlui-parser.mjs +2 -2
  11. package/dist/lib/{xmlui-serializer-DB6BLiXK.mjs → xmlui-serializer-uCYa8_tZ.mjs} +1 -1
  12. package/dist/lib/xmlui.d.ts +11 -3
  13. package/dist/lib/xmlui.mjs +2 -2
  14. package/dist/metadata/{apiInterceptorWorker-BmKP8bnq.mjs → apiInterceptorWorker-Dql7QGw2.mjs} +1 -1
  15. package/dist/metadata/{collectedComponentMetadata-Cp-9lpnG.mjs → collectedComponentMetadata-MFUg6aSX.mjs} +1655 -1390
  16. package/dist/{lib/initMock-BMxsanHc.mjs → metadata/initMock-Dw9wrVkQ.mjs} +25 -15
  17. package/dist/metadata/style.css +1 -1
  18. package/dist/metadata/xmlui-metadata.mjs +1 -1
  19. package/dist/metadata/xmlui-metadata.umd.js +3 -3
  20. package/dist/scripts/package.json +3 -6
  21. package/dist/scripts/src/components/Animation/AnimationNative.js +28 -28
  22. package/dist/scripts/src/components/App/App.js +4 -4
  23. package/dist/scripts/src/components/App/App.spec.js +17 -17
  24. package/dist/scripts/src/components/App/AppNative.js +1 -1
  25. package/dist/scripts/src/components/AppState/AppState.js +3 -2
  26. package/dist/scripts/src/components/AppState/AppState.spec.js +26 -2
  27. package/dist/scripts/src/components/AppState/AppStateNative.js +3 -4
  28. package/dist/scripts/src/components/AutoComplete/AutoComplete.js +15 -10
  29. package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +4 -4
  30. package/dist/scripts/src/components/Carousel/Carousel.spec.js +214 -0
  31. package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +1 -1
  32. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +2 -0
  33. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.spec.js +193 -0
  34. package/dist/scripts/src/components/DateInput/DateInput.spec.js +6 -6
  35. package/dist/scripts/src/components/DateInput/DateInputNative.js +0 -1
  36. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.spec.js +3 -3
  37. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZoneNative.js +4 -13
  38. package/dist/scripts/src/components/Form/Form.spec.js +25 -9
  39. package/dist/scripts/src/components/Form/FormNative.js +7 -5
  40. package/dist/scripts/src/components/FormItem/FormItem.js +3 -1
  41. package/dist/scripts/src/components/FormItem/FormItem.spec.js +5 -14
  42. package/dist/scripts/src/components/FormItem/FormItemNative.js +12 -8
  43. package/dist/scripts/src/components/FormItem/Validations.js +2 -2
  44. package/dist/scripts/src/components/IFrame/IFrameNative.js +0 -2
  45. package/dist/scripts/src/components/IconRegistryContext.js +1 -1
  46. package/dist/scripts/src/components/List/ListNative.js +2 -2
  47. package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +3 -12
  48. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +2 -2
  49. package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +6 -3
  50. package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +1 -1
  51. package/dist/scripts/src/components/NestedApp/NestedAppNative.js +3 -3
  52. package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +2 -2
  53. package/dist/scripts/src/components/Pagination/Pagination.spec.js +5 -0
  54. package/dist/scripts/src/components/Pagination/PaginationNative.js +1 -3
  55. package/dist/scripts/src/components/Queue/Queue.spec.js +45 -47
  56. package/dist/scripts/src/components/Queue/QueueNative.js +1 -1
  57. package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +5 -5
  58. package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapterNative.js +1 -1
  59. package/dist/scripts/src/components/Select/MultiSelectOption.js +42 -0
  60. package/dist/scripts/src/components/Select/Select.js +3 -3
  61. package/dist/scripts/src/components/Select/SelectContext.js +8 -1
  62. package/dist/scripts/src/components/Select/SelectNative.js +134 -142
  63. package/dist/scripts/src/components/Select/SelectOption.js +34 -0
  64. package/dist/scripts/src/components/Select/SimpleSelect.js +57 -0
  65. package/dist/scripts/src/components/Spinner/Spinner.spec.js +1 -1
  66. package/dist/scripts/src/components/Table/useRowSelection.js +14 -23
  67. package/dist/scripts/src/components/Text/Text.js +5 -1
  68. package/dist/scripts/src/components/Text/Text.spec.js +317 -0
  69. package/dist/scripts/src/components/Text/TextNative.js +112 -1
  70. package/dist/scripts/src/components/TextArea/TextArea.spec.js +8 -8
  71. package/dist/scripts/src/components/Theme/Theme.js +2 -1
  72. package/dist/scripts/src/components/Theme/Theme.spec.js +266 -0
  73. package/dist/scripts/src/components/Theme/ThemeNative.js +8 -1
  74. package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +3 -3
  75. package/dist/scripts/src/components/TimeInput/TimeInputNative.js +0 -1
  76. package/dist/scripts/src/components/Timer/TimerNative.js +0 -1
  77. package/dist/scripts/src/components/Tree/TreeNative.js +16 -23
  78. package/dist/scripts/src/components-core/InspectorContext.js +1 -1
  79. package/dist/scripts/src/components-core/StandaloneApp.js +6 -8
  80. package/dist/scripts/src/components-core/action/FileUploadAction.js +1 -1
  81. package/dist/scripts/src/components-core/behaviors/BehaviorContext.js +50 -0
  82. package/dist/scripts/src/components-core/behaviors/CoreBehaviors.js +6 -1
  83. package/dist/scripts/src/components-core/interception/ApiInterceptor.js +9 -11
  84. package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +3 -3
  85. package/dist/scripts/src/components-core/interception/Backend.js +1 -1
  86. package/dist/scripts/src/components-core/interception/IndexedDb.js +64 -66
  87. package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +2 -2
  88. package/dist/scripts/src/components-core/loader/DataLoader.js +6 -14
  89. package/dist/scripts/src/components-core/loader/Loader.js +11 -11
  90. package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +4 -2
  91. package/dist/scripts/src/components-core/loader/PageableLoader.js +10 -9
  92. package/dist/scripts/src/components-core/rendering/AppContent.js +1 -7
  93. package/dist/scripts/src/components-core/rendering/ErrorBoundary.js +1 -1
  94. package/dist/scripts/src/components-core/script-runner/bannedFunctions.js +1 -1
  95. package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +180 -186
  96. package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +6 -6
  97. package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +2 -2
  98. package/dist/scripts/src/components-core/utils/actionUtils.js +1 -1
  99. package/dist/scripts/src/components-core/utils/hooks.js +1 -1
  100. package/dist/scripts/src/components-core/utils/misc.js +4 -4
  101. package/dist/scripts/src/components-core/xmlui-parser.js +47 -31
  102. package/dist/scripts/src/language-server/server-common.js +25 -24
  103. package/dist/scripts/src/language-server/services/common/lsp-utils.js +2 -2
  104. package/dist/scripts/src/language-server/services/completion.js +20 -2
  105. package/dist/scripts/src/language-server/services/diagnostic.js +1 -1
  106. package/dist/scripts/src/language-server/services/hover.js +2 -2
  107. package/dist/scripts/src/parsers/common/utils.js +2 -2
  108. package/dist/scripts/src/parsers/scripting/Lexer.js +21 -15
  109. package/dist/scripts/src/parsers/scripting/Parser.js +8 -9
  110. package/dist/scripts/src/parsers/style-parser/StyleLexer.js +22 -22
  111. package/dist/scripts/src/parsers/style-parser/StyleParser.js +70 -68
  112. package/dist/scripts/src/testing/ComponentDrivers.js +20 -39
  113. package/dist/scripts/src/testing/component-test-helpers.js +34 -50
  114. package/dist/scripts/src/testing/fixtures.js +114 -113
  115. package/dist/scripts/src/testing/themed-app-test-helpers.js +7 -13
  116. package/dist/standalone/xmlui-standalone.es.d.ts +11 -3
  117. package/dist/standalone/xmlui-standalone.umd.js +35 -35
  118. package/package.json +3 -6
@@ -1063,6 +1063,323 @@ fixtures_1.test.describe("Theme Variables", () => {
1063
1063
  }));
1064
1064
  });
1065
1065
  // =============================================================================
1066
+ // CUSTOM VARIANT TESTS
1067
+ // =============================================================================
1068
+ fixtures_1.test.describe("Custom Variants", () => {
1069
+ (0, fixtures_1.test)("custom variant textColor theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1070
+ const EXPECTED = "rgb(255, 0, 0)";
1071
+ yield initTestBed(`
1072
+ <App>
1073
+ <Theme textColor-Text-customRed="${EXPECTED}">
1074
+ <Text variant="customRed" testId="text">Hello Custom!</Text>
1075
+ </Theme>
1076
+ </App>
1077
+ `);
1078
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("color", EXPECTED);
1079
+ }));
1080
+ (0, fixtures_1.test)("custom variant fontFamily theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1081
+ const EXPECTED = "monospace";
1082
+ yield initTestBed(`
1083
+ <App>
1084
+ <Theme fontFamily-Text-customMono="${EXPECTED}">
1085
+ <Text variant="customMono" testId="text">Hello Custom!</Text>
1086
+ </Theme>
1087
+ </App>
1088
+ `);
1089
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("font-family", EXPECTED);
1090
+ }));
1091
+ (0, fixtures_1.test)("custom variant fontSize theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1092
+ const EXPECTED = "24px";
1093
+ yield initTestBed(`
1094
+ <App>
1095
+ <Theme fontSize-Text-customLarge="${EXPECTED}">
1096
+ <Text variant="customLarge" testId="text">Hello Custom!</Text>
1097
+ </Theme>
1098
+ </App>
1099
+ `);
1100
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("font-size", EXPECTED);
1101
+ }));
1102
+ (0, fixtures_1.test)("custom variant fontStyle theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1103
+ const EXPECTED = "italic";
1104
+ yield initTestBed(`
1105
+ <App>
1106
+ <Theme fontStyle-Text-customItalic="${EXPECTED}">
1107
+ <Text variant="customItalic" testId="text">Hello Custom!</Text>
1108
+ </Theme>
1109
+ </App>
1110
+ `);
1111
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("font-style", EXPECTED);
1112
+ }));
1113
+ (0, fixtures_1.test)("custom variant fontWeight theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1114
+ const EXPECTED = "700";
1115
+ yield initTestBed(`
1116
+ <App>
1117
+ <Theme fontWeight-Text-customBold="bold">
1118
+ <Text variant="customBold" testId="text">Hello Custom!</Text>
1119
+ </Theme>
1120
+ </App>
1121
+ `);
1122
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("font-weight", EXPECTED);
1123
+ }));
1124
+ (0, fixtures_1.test)("custom variant fontStretch theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1125
+ const EXPECTED = "125%";
1126
+ yield initTestBed(`
1127
+ <App>
1128
+ <Theme fontStretch-Text-customExpanded="expanded">
1129
+ <Text variant="customExpanded" testId="text">Hello Custom!</Text>
1130
+ </Theme>
1131
+ </App>
1132
+ `);
1133
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("font-stretch", EXPECTED);
1134
+ }));
1135
+ (0, fixtures_1.test)("custom variant textDecorationLine theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1136
+ const EXPECTED = "underline";
1137
+ yield initTestBed(`
1138
+ <App>
1139
+ <Theme textDecorationLine-Text-customUnderline="${EXPECTED}">
1140
+ <Text variant="customUnderline" testId="text">Hello Custom!</Text>
1141
+ </Theme>
1142
+ </App>
1143
+ `);
1144
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("text-decoration-line", EXPECTED);
1145
+ }));
1146
+ (0, fixtures_1.test)("custom variant textDecorationColor theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1147
+ const EXPECTED = "rgb(255, 0, 0)";
1148
+ yield initTestBed(`
1149
+ <App>
1150
+ <Theme
1151
+ textDecorationLine-Text-customDeco="underline"
1152
+ textDecorationColor-Text-customDeco="${EXPECTED}"
1153
+ >
1154
+ <Text variant="customDeco" testId="text">Hello Custom!</Text>
1155
+ </Theme>
1156
+ </App>
1157
+ `);
1158
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("text-decoration-color", EXPECTED);
1159
+ }));
1160
+ (0, fixtures_1.test)("custom variant textDecorationStyle theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1161
+ const EXPECTED = "wavy";
1162
+ yield initTestBed(`
1163
+ <App>
1164
+ <Theme
1165
+ textDecorationLine-Text-customWavy="underline"
1166
+ textDecorationStyle-Text-customWavy="${EXPECTED}"
1167
+ >
1168
+ <Text variant="customWavy" testId="text">Hello Custom!</Text>
1169
+ </Theme>
1170
+ </App>
1171
+ `);
1172
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("text-decoration-style", EXPECTED);
1173
+ }));
1174
+ (0, fixtures_1.test)("custom variant textDecorationThickness theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1175
+ const EXPECTED = "3px";
1176
+ yield initTestBed(`
1177
+ <App>
1178
+ <Theme
1179
+ textDecorationLine-Text-customThick="underline"
1180
+ textDecorationThickness-Text-customThick="${EXPECTED}"
1181
+ >
1182
+ <Text variant="customThick" testId="text">Hello Custom!</Text>
1183
+ </Theme>
1184
+ </App>
1185
+ `);
1186
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("text-decoration-thickness", EXPECTED);
1187
+ }));
1188
+ (0, fixtures_1.test)("custom variant textUnderlineOffset theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1189
+ const EXPECTED = "5px";
1190
+ yield initTestBed(`
1191
+ <App>
1192
+ <Theme
1193
+ textDecorationLine-Text-customOffset="underline"
1194
+ textUnderlineOffset-Text-customOffset="${EXPECTED}"
1195
+ >
1196
+ <Text variant="customOffset" testId="text">Hello Custom!</Text>
1197
+ </Theme>
1198
+ </App>
1199
+ `);
1200
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("text-underline-offset", EXPECTED);
1201
+ }));
1202
+ (0, fixtures_1.test)("custom variant lineHeight theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1203
+ const EXPECTED = "32px";
1204
+ yield initTestBed(`
1205
+ <App>
1206
+ <Theme lineHeight-Text-customLineHeight="${EXPECTED}">
1207
+ <Text variant="customLineHeight" testId="text">Hello Custom!</Text>
1208
+ </Theme>
1209
+ </App>
1210
+ `);
1211
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("line-height", EXPECTED);
1212
+ }));
1213
+ (0, fixtures_1.test)("custom variant backgroundColor theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1214
+ const EXPECTED = "rgb(255, 255, 0)";
1215
+ yield initTestBed(`
1216
+ <App>
1217
+ <Theme backgroundColor-Text-customBg="${EXPECTED}">
1218
+ <Text variant="customBg" testId="text">Hello Custom!</Text>
1219
+ </Theme>
1220
+ </App>
1221
+ `);
1222
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("background-color", EXPECTED);
1223
+ }));
1224
+ (0, fixtures_1.test)("custom variant textTransform theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1225
+ const EXPECTED = "uppercase";
1226
+ yield initTestBed(`
1227
+ <App>
1228
+ <Theme textTransform-Text-customUpper="${EXPECTED}">
1229
+ <Text variant="customUpper" testId="text">Hello Custom!</Text>
1230
+ </Theme>
1231
+ </App>
1232
+ `);
1233
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("text-transform", EXPECTED);
1234
+ }));
1235
+ (0, fixtures_1.test)("custom variant letterSpacing theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1236
+ const EXPECTED = "5px";
1237
+ yield initTestBed(`
1238
+ <App>
1239
+ <Theme letterSpacing-Text-customSpaced="${EXPECTED}">
1240
+ <Text variant="customSpaced" testId="text">Hello Custom!</Text>
1241
+ </Theme>
1242
+ </App>
1243
+ `);
1244
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("letter-spacing", EXPECTED);
1245
+ }));
1246
+ (0, fixtures_1.test)("custom variant wordSpacing theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1247
+ const EXPECTED = "10px";
1248
+ yield initTestBed(`
1249
+ <App>
1250
+ <Theme wordSpacing-Text-customWordSpace="${EXPECTED}">
1251
+ <Text variant="customWordSpace" testId="text">Hello Custom!</Text>
1252
+ </Theme>
1253
+ </App>
1254
+ `);
1255
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("word-spacing", EXPECTED);
1256
+ }));
1257
+ (0, fixtures_1.test)("custom variant textShadow theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1258
+ const EXPECTED = "rgb(255, 0, 0) 2px 2px 4px";
1259
+ yield initTestBed(`
1260
+ <App>
1261
+ <Theme textShadow-Text-customShadow="${EXPECTED}">
1262
+ <Text variant="customShadow" testId="text">Hello Custom!</Text>
1263
+ </Theme>
1264
+ </App>
1265
+ `);
1266
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("text-shadow", EXPECTED);
1267
+ }));
1268
+ (0, fixtures_1.test)("custom variant textIndent theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1269
+ const EXPECTED = "20px";
1270
+ yield initTestBed(`
1271
+ <App>
1272
+ <Theme textIndent-Text-customIndent="${EXPECTED}">
1273
+ <Text variant="customIndent" testId="text">Hello Custom!</Text>
1274
+ </Theme>
1275
+ </App>
1276
+ `);
1277
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("text-indent", EXPECTED);
1278
+ }));
1279
+ (0, fixtures_1.test)("custom variant textAlign theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1280
+ const EXPECTED = "center";
1281
+ yield initTestBed(`
1282
+ <App>
1283
+ <Theme textAlign-Text-customCenter="${EXPECTED}">
1284
+ <Text variant="customCenter" testId="text">Hello Custom!</Text>
1285
+ </Theme>
1286
+ </App>
1287
+ `);
1288
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("text-align", EXPECTED);
1289
+ }));
1290
+ (0, fixtures_1.test)("custom variant textAlignLast theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1291
+ const EXPECTED = "right";
1292
+ yield initTestBed(`
1293
+ <App>
1294
+ <Theme textAlignLast-Text-customAlignLast="${EXPECTED}">
1295
+ <Text variant="customAlignLast" testId="text">Hello Custom!</Text>
1296
+ </Theme>
1297
+ </App>
1298
+ `);
1299
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("text-align-last", EXPECTED);
1300
+ }));
1301
+ (0, fixtures_1.test)("custom variant wordBreak theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1302
+ const EXPECTED = "break-all";
1303
+ yield initTestBed(`
1304
+ <App>
1305
+ <Theme wordBreak-Text-customBreak="${EXPECTED}">
1306
+ <Text variant="customBreak" breakMode="'{undefined}'" testId="text">Hello Custom!</Text>
1307
+ </Theme>
1308
+ </App>
1309
+ `);
1310
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("word-break", EXPECTED);
1311
+ }));
1312
+ (0, fixtures_1.test)("custom variant wordWrap theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1313
+ const EXPECTED = "break-word";
1314
+ yield initTestBed(`
1315
+ <App>
1316
+ <Theme wordWrap-Text-customWrap="${EXPECTED}">
1317
+ <Text variant="customWrap" breakMode="'{undefined}'" testId="text">Hello Custom!</Text>
1318
+ </Theme>
1319
+ </App>
1320
+ `);
1321
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("word-wrap", EXPECTED);
1322
+ }));
1323
+ (0, fixtures_1.test)("custom variant direction theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1324
+ const EXPECTED = "rtl";
1325
+ yield initTestBed(`
1326
+ <App>
1327
+ <Theme direction-Text-customRtl="${EXPECTED}">
1328
+ <Text variant="customRtl" testId="text">Hello Custom!</Text>
1329
+ </Theme>
1330
+ </App>
1331
+ `);
1332
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("direction", EXPECTED);
1333
+ }));
1334
+ (0, fixtures_1.test)("custom variant writingMode theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1335
+ const EXPECTED = "vertical-rl";
1336
+ yield initTestBed(`
1337
+ <App>
1338
+ <Theme writingMode-Text-customVertical="${EXPECTED}">
1339
+ <Text variant="customVertical" testId="text">Hello Custom!</Text>
1340
+ </Theme>
1341
+ </App>
1342
+ `);
1343
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("writing-mode", EXPECTED);
1344
+ }));
1345
+ (0, fixtures_1.test)("custom variant lineBreak theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1346
+ const EXPECTED = "strict";
1347
+ yield initTestBed(`
1348
+ <App>
1349
+ <Theme lineBreak-Text-customLineBreak="${EXPECTED}">
1350
+ <Text variant="customLineBreak" testId="text">Hello Custom!</Text>
1351
+ </Theme>
1352
+ </App>
1353
+ `);
1354
+ yield (0, fixtures_1.expect)(page.getByTestId("text")).toHaveCSS("line-break", EXPECTED);
1355
+ }));
1356
+ (0, fixtures_1.test)("custom variant with multiple theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
1357
+ yield initTestBed(`
1358
+ <App>
1359
+ <Theme
1360
+ textColor-Text-pinkElephant="rgb(255, 192, 203)"
1361
+ fontWeight-Text-pinkElephant="bold"
1362
+ textColor-Text-greenDog="rgb(0, 128, 0)"
1363
+ fontStyle-Text-greenDog="italic"
1364
+ >
1365
+ <Text variant="pinkElephant" testId="pink">
1366
+ Hello Pink Elephant!
1367
+ </Text>
1368
+ <Text variant="greenDog" testId="green">
1369
+ Hello Green Dog!
1370
+ </Text>
1371
+ </Theme>
1372
+ </App>
1373
+ `);
1374
+ const pinkText = page.getByTestId("pink");
1375
+ const greenText = page.getByTestId("green");
1376
+ yield (0, fixtures_1.expect)(pinkText).toHaveCSS("color", "rgb(255, 192, 203)");
1377
+ yield (0, fixtures_1.expect)(pinkText).toHaveCSS("font-weight", "700");
1378
+ yield (0, fixtures_1.expect)(greenText).toHaveCSS("color", "rgb(0, 128, 0)");
1379
+ yield (0, fixtures_1.expect)(greenText).toHaveCSS("font-style", "italic");
1380
+ }));
1381
+ });
1382
+ // =============================================================================
1066
1383
  // SMOKE TESTS (kept for compatibility)
1067
1384
  // =============================================================================
1068
1385
  fixtures_1.test.describe("smoke tests", { tag: "@smoke" }, () => {
@@ -15,6 +15,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.Text = exports.defaultProps = void 0;
18
+ exports.getCustomVariantCache = getCustomVariantCache;
19
+ exports.setCustomVariantCache = setCustomVariantCache;
20
+ exports.hasCustomVariantCache = hasCustomVariantCache;
21
+ exports.clearCustomVariantCache = clearCustomVariantCache;
22
+ exports.getCustomVariantCacheStats = getCustomVariantCacheStats;
18
23
  const jsx_runtime_1 = require("react/jsx-runtime");
19
24
  const react_1 = require("react");
20
25
  const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
@@ -22,6 +27,54 @@ const classnames_1 = __importDefault(require("classnames"));
22
27
  const Text_module_scss_1 = __importDefault(require("./Text.module.scss"));
23
28
  const css_utils_1 = require("../../components-core/utils/css-utils");
24
29
  const abstractions_1 = require("../abstractions");
30
+ const StyleContext_1 = require("../../components-core/theming/StyleContext");
31
+ const constants_1 = require("../../components-core/constants");
32
+ const layout_resolver_1 = require("../../components-core/theming/layout-resolver");
33
+ /**
34
+ * Global cache that stores custom variant CSS styles.
35
+ * Key: variant value (string)
36
+ *
37
+ * This cache ensures the same variant value always generates the same CSS.
38
+ */
39
+ const customVariantCache = new Map();
40
+ /**
41
+ * Retrieves a cached custom variant entry if it exists.
42
+ */
43
+ function getCustomVariantCache(variant) {
44
+ return customVariantCache.get(variant);
45
+ }
46
+ /**
47
+ * Stores a custom variant entry in the cache.
48
+ */
49
+ function setCustomVariantCache(variant, entry) {
50
+ customVariantCache.set(variant, Object.assign(Object.assign({}, entry), { createdAt: Date.now() }));
51
+ }
52
+ /**
53
+ * Checks if a custom variant is already cached.
54
+ */
55
+ function hasCustomVariantCache(variant) {
56
+ return customVariantCache.has(variant);
57
+ }
58
+ /**
59
+ * Clears the entire custom variant cache.
60
+ * Useful for testing or full app resets.
61
+ */
62
+ function clearCustomVariantCache() {
63
+ customVariantCache.clear();
64
+ }
65
+ /**
66
+ * Gets cache statistics for debugging.
67
+ */
68
+ function getCustomVariantCacheStats() {
69
+ return {
70
+ totalEntries: customVariantCache.size,
71
+ entries: Array.from(customVariantCache.entries()).map(([key, entry]) => ({
72
+ key,
73
+ className: entry.className,
74
+ createdAt: new Date(entry.createdAt).toISOString(),
75
+ })),
76
+ };
77
+ }
25
78
  exports.defaultProps = {
26
79
  maxLines: 0,
27
80
  preserveLinebreaks: false,
@@ -57,6 +110,62 @@ exports.Text = (0, react_1.forwardRef)(function Text(_a, forwardedRef) {
57
110
  return "div";
58
111
  return abstractions_1.TextVariantElement[variant];
59
112
  }, [variant]);
113
+ // Custom variant CSS generation
114
+ // Following React hook rules: hooks must be called unconditionally
115
+ // We always call useComponentStyle, passing empty object for known variants
116
+ const isCustomVariant = (0, react_1.useMemo)(() => {
117
+ return variant && !abstractions_1.TextVariantElement[variant];
118
+ }, [variant]);
119
+ // Always call useComponentStyle (React hook rule: no conditional hooks)
120
+ // For now, pass empty object; later this will contain assembled CSS properties
121
+ const variantSpec = (0, react_1.useMemo)(() => {
122
+ if (!isCustomVariant)
123
+ return constants_1.EMPTY_OBJECT;
124
+ const subject = `-Text-${variant}`;
125
+ const cssInput = {
126
+ color: (0, layout_resolver_1.toCssVar)(`$textColor${subject}`),
127
+ "font-family": (0, layout_resolver_1.toCssVar)(`$fontFamily${subject}`),
128
+ "font-size": (0, layout_resolver_1.toCssVar)(`$fontSize${subject}`),
129
+ "font-style": (0, layout_resolver_1.toCssVar)(`$fontStyle${subject}`),
130
+ "font-weight": (0, layout_resolver_1.toCssVar)(`$fontWeight${subject}`),
131
+ "font-stretch": (0, layout_resolver_1.toCssVar)(`$fontStretch${subject}`),
132
+ "text-decoration-line": (0, layout_resolver_1.toCssVar)(`$textDecorationLine${subject}`),
133
+ "text-decoration-color": (0, layout_resolver_1.toCssVar)(`$textDecorationColor${subject}`),
134
+ "text-decoration-style": (0, layout_resolver_1.toCssVar)(`$textDecorationStyle${subject}`),
135
+ "text-decoration-thickness": (0, layout_resolver_1.toCssVar)(`$textDecorationThickness${subject}`),
136
+ "text-underline-offset": (0, layout_resolver_1.toCssVar)(`$textUnderlineOffset${subject}`),
137
+ "line-height": (0, layout_resolver_1.toCssVar)(`$lineHeight${subject}`),
138
+ "background-color": (0, layout_resolver_1.toCssVar)(`$backgroundColor${subject}`),
139
+ "text-transform": (0, layout_resolver_1.toCssVar)(`$textTransform${subject}`),
140
+ "letter-spacing": (0, layout_resolver_1.toCssVar)(`$letterSpacing${subject}`),
141
+ "word-spacing": (0, layout_resolver_1.toCssVar)(`$wordSpacing${subject}`),
142
+ "text-shadow": (0, layout_resolver_1.toCssVar)(`$textShadow${subject}`),
143
+ "text-indent": (0, layout_resolver_1.toCssVar)(`$textIndent${subject}`),
144
+ "text-align": (0, layout_resolver_1.toCssVar)(`$textAlign${subject}`),
145
+ "text-align-last": (0, layout_resolver_1.toCssVar)(`$textAlignLast${subject}`),
146
+ "word-break": (0, layout_resolver_1.toCssVar)(`$wordBreak${subject}`),
147
+ "word-wrap": (0, layout_resolver_1.toCssVar)(`$wordWrap${subject}`),
148
+ direction: (0, layout_resolver_1.toCssVar)(`$direction${subject}`),
149
+ "writing-mode": (0, layout_resolver_1.toCssVar)(`$writingMode${subject}`),
150
+ "line-break": (0, layout_resolver_1.toCssVar)(`$lineBreak${subject}`),
151
+ };
152
+ return cssInput;
153
+ }, [isCustomVariant, variant]);
154
+ const customVariantClassName = (0, StyleContext_1.useComponentStyle)(variantSpec);
155
+ // Store custom variant in cache if it's a new custom variant
156
+ (0, react_1.useEffect)(() => {
157
+ if (isCustomVariant && variant && customVariantClassName) {
158
+ // Check if this variant is already cached
159
+ if (!hasCustomVariantCache(variant)) {
160
+ // TODO: When CSS generation is implemented, extract the actual CSS text
161
+ // For now, store placeholder information
162
+ setCustomVariantCache(variant, {
163
+ className: customVariantClassName,
164
+ cssText: "", // Will be populated when CSS generation is implemented
165
+ });
166
+ }
167
+ }
168
+ }, [isCustomVariant, variant, customVariantClassName]);
60
169
  // Determine overflow mode classes based on overflowMode and existing props
61
170
  const overflowClasses = (0, react_1.useMemo)(() => {
62
171
  const classes = {};
@@ -127,7 +236,9 @@ exports.Text = (0, react_1.forwardRef)(function Text(_a, forwardedRef) {
127
236
  }
128
237
  return classes;
129
238
  }, [breakMode]);
130
- return ((0, jsx_runtime_1.jsx)(Element, Object.assign({}, restVariantSpecificProps, { ref: ref, className: (0, classnames_1.default)(syntaxHighlightClasses, Text_module_scss_1.default.text, Text_module_scss_1.default[variant || "default"], Object.assign(Object.assign({ [Text_module_scss_1.default.preserveLinebreaks]: preserveLinebreaks }, overflowClasses), breakClasses), className), style: Object.assign(Object.assign({}, style), (overflowMode === "ellipsis" || (!overflowMode && maxLines)
239
+ return ((0, jsx_runtime_1.jsx)(Element, Object.assign({}, restVariantSpecificProps, { ref: ref, className: (0, classnames_1.default)(syntaxHighlightClasses, Text_module_scss_1.default.text,
240
+ // Use custom variant className if it's a custom variant, otherwise use predefined variant style
241
+ isCustomVariant ? customVariantClassName : Text_module_scss_1.default[variant || "default"], Object.assign(Object.assign({ [Text_module_scss_1.default.preserveLinebreaks]: preserveLinebreaks }, overflowClasses), breakClasses), className), style: Object.assign(Object.assign({}, style), (overflowMode === "ellipsis" || (!overflowMode && maxLines)
131
242
  ? (0, css_utils_1.getMaxLinesStyle)(maxLines)
132
243
  : {})), children: children })));
133
244
  });
@@ -98,7 +98,7 @@ fixtures_1.test.describe("Basic Functionality", () => {
98
98
  const textarea = page.getByRole("textbox");
99
99
  yield textarea.fill("Some content");
100
100
  yield (0, fixtures_1.expect)(textarea).toHaveValue("Some content");
101
- (0, fixtures_1.expect)(textarea).toHaveAttribute("placeholder", "Enter comments");
101
+ yield (0, fixtures_1.expect)(textarea).toHaveAttribute("placeholder", "Enter comments");
102
102
  }));
103
103
  (0, fixtures_1.test)("maxLength limits input length", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
104
104
  yield initTestBed(`<TextArea maxLength="10" />`);
@@ -275,7 +275,7 @@ fixtures_1.test.describe("Accessibility", () => {
275
275
  }));
276
276
  (0, fixtures_1.test)("component is keyboard accessible when interactive", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
277
277
  const { testStateDriver } = yield initTestBed(`
278
- <TextArea
278
+ <TextArea
279
279
  label="Comments"
280
280
  onGotFocus="testState = 'keyboard-focused'"
281
281
  />
@@ -408,7 +408,7 @@ fixtures_1.test.describe("Visual States", () => {
408
408
  testThemeVars: {
409
409
  "backgroundColor-TextArea--disabled": "rgb(255, 0, 0)",
410
410
  "textColor-TextArea--disabled": "rgb(0, 255, 0)",
411
- "borderColor-TextArea--disabled": "rgb(0, 0, 255)"
411
+ "borderColor-TextArea--disabled": "rgb(0, 0, 255)",
412
412
  },
413
413
  });
414
414
  const textarea = page.getByRole("textbox");
@@ -510,15 +510,15 @@ fixtures_1.test.describe("Edge Cases", () => {
510
510
  yield (0, fixtures_1.expect)(textarea).toBeVisible();
511
511
  yield (0, fixtures_1.expect)(textarea).toHaveValue(longValue);
512
512
  }));
513
- (0, fixtures_1.test)("component handles invalid maxRows/minRows combinations with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
513
+ (0, fixtures_1.test)("component handles invalid maxRows/minRows combinations with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
514
514
  yield initTestBed(`<TextArea autoSize="true" maxRows="2" minRows="5" />`);
515
515
  yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
516
516
  }));
517
- (0, fixtures_1.test)("component handles zero maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
517
+ (0, fixtures_1.test)("component handles zero maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
518
518
  yield initTestBed(`<TextArea autoSize="true" maxRows="0" minRows="0" />`);
519
519
  yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
520
520
  }));
521
- (0, fixtures_1.test)("component handles negative maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
521
+ (0, fixtures_1.test)("component handles negative maxRows/minRows values with autoSize", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
522
522
  yield initTestBed(`<TextArea autoSize="true" maxRows="{-1}" minRows="{-1}" />`);
523
523
  yield (0, fixtures_1.expect)(page.getByRole("textbox")).toBeVisible();
524
524
  }));
@@ -529,7 +529,7 @@ fixtures_1.test.describe("Edge Cases", () => {
529
529
  fixtures_1.test.describe("Performance", () => {
530
530
  (0, fixtures_1.test)("component memoization prevents unnecessary re-renders", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
531
531
  const { testStateDriver } = yield initTestBed(`
532
- <TextArea
532
+ <TextArea
533
533
  label="Performance Test"
534
534
  onDidChange="testState = ++testState || 1"
535
535
  />
@@ -620,7 +620,7 @@ fixtures_1.test.describe("Integration", () => {
620
620
  (0, fixtures_1.test)("component works with event handling chain", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
621
621
  const { testStateDriver } = yield initTestBed(`
622
622
  <Fragment>
623
- <TextArea
623
+ <TextArea
624
624
  onGotFocus="testState = 'focused'"
625
625
  onLostFocus="testState = 'blurred'"
626
626
  onDidChange="(value) => testState = 'changed: ' + value"
@@ -31,6 +31,7 @@ exports.ThemeMd = (0, metadata_helpers_1.createMetadata)({
31
31
  defaultValue: "light",
32
32
  },
33
33
  root: (0, metadata_helpers_1.d)(`This property indicates whether the component is at the root of the application.`, undefined, "boolean", ThemeNative_1.defaultProps.root),
34
+ applyIf: (0, metadata_helpers_1.d)(`This property controls whether the theme wrapper is applied. When true (default), the theme wraps the children. When false, children are rendered unwrapped.`, undefined, "boolean", true),
34
35
  },
35
36
  opaque: true,
36
37
  });
@@ -42,5 +43,5 @@ exports.themeComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP,
42
43
  if (themeTone && themeTone !== "dark") {
43
44
  themeTone = "light";
44
45
  }
45
- return ((0, jsx_runtime_1.jsx)(ThemeNative_1.Theme, { id: extractValue.asOptionalString(node.props.themeId), isRoot: extractValue.asOptionalBoolean(node.props.root), layoutContext: layoutContext, renderChild: renderChild, tone: themeTone, toastDuration: toastDuration, themeVars: extractValue(restProps), node: node }));
46
+ return ((0, jsx_runtime_1.jsx)(ThemeNative_1.Theme, { id: extractValue.asOptionalString(node.props.themeId), isRoot: extractValue.asOptionalBoolean(node.props.root), applyIf: extractValue.asOptionalBoolean(node.props.applyIf), layoutContext: layoutContext, renderChild: renderChild, tone: themeTone, toastDuration: toastDuration, themeVars: extractValue(restProps), node: node }));
46
47
  });