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
@@ -122,3 +122,269 @@ fixtures_1.test.use({ viewport: { width: PAGE_WIDTH, height: PAGE_HEIGHT } });
122
122
  (0, fixtures_1.expect)(h1Color).toBe("rgb(255, 0, 0)");
123
123
  (0, fixtures_1.expect)(h2Color).toBe("rgb(0, 255, 0)");
124
124
  }));
125
+ // =============================================================================
126
+ // APPLYIF PROPERTY TESTS
127
+ // =============================================================================
128
+ fixtures_1.test.describe("applyIf Property", () => {
129
+ (0, fixtures_1.test)("applies theme when applyIf is true (default)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
130
+ const EXPECTED_COLOR = "rgb(255, 0, 0)";
131
+ yield initTestBed(`
132
+ <App>
133
+ <Theme backgroundColor-Button="${EXPECTED_COLOR}" applyIf="true">
134
+ <Button testId="themed-button">Themed Button</Button>
135
+ </Theme>
136
+ </App>
137
+ `);
138
+ const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("themed-button"), "background-color");
139
+ (0, fixtures_1.expect)(backgroundColor).toBe(EXPECTED_COLOR);
140
+ }));
141
+ (0, fixtures_1.test)("applies theme when applyIf is omitted (defaults to true)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
142
+ const EXPECTED_COLOR = "rgb(0, 255, 0)";
143
+ yield initTestBed(`
144
+ <App>
145
+ <Theme backgroundColor-Button="${EXPECTED_COLOR}">
146
+ <Button testId="themed-button">Themed Button</Button>
147
+ </Theme>
148
+ </App>
149
+ `);
150
+ const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("themed-button"), "background-color");
151
+ (0, fixtures_1.expect)(backgroundColor).toBe(EXPECTED_COLOR);
152
+ }));
153
+ (0, fixtures_1.test)("does not apply theme when applyIf is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
154
+ const THEME_COLOR = "rgb(255, 0, 0)";
155
+ yield initTestBed(`
156
+ <App>
157
+ <Theme backgroundColor-Button="${THEME_COLOR}" applyIf="false">
158
+ <Button testId="unthemed-button">Unthemed Button</Button>
159
+ </Theme>
160
+ </App>
161
+ `);
162
+ const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("unthemed-button"), "background-color");
163
+ // Should not have the theme color when applyIf is false
164
+ (0, fixtures_1.expect)(backgroundColor).not.toBe(THEME_COLOR);
165
+ }));
166
+ (0, fixtures_1.test)("renders children without theme wrapper when applyIf is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
167
+ yield initTestBed(`
168
+ <App>
169
+ <Theme tone="dark" applyIf="false">
170
+ <Button testId="button">Button Text</Button>
171
+ <H1 testId="header">Header Text</H1>
172
+ </Theme>
173
+ </App>
174
+ `);
175
+ // Children should still be rendered and visible
176
+ yield (0, fixtures_1.expect)(page.getByTestId("button")).toBeVisible();
177
+ yield (0, fixtures_1.expect)(page.getByTestId("header")).toBeVisible();
178
+ yield (0, fixtures_1.expect)(page.getByTestId("button")).toHaveText("Button Text");
179
+ yield (0, fixtures_1.expect)(page.getByTestId("header")).toHaveText("Header Text");
180
+ }));
181
+ (0, fixtures_1.test)("supports dynamic applyIf with binding expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
182
+ const { testStateDriver } = yield initTestBed(`
183
+ <App>
184
+ <Theme backgroundColor-Button="rgb(255, 0, 0)" applyIf="{testState === true}">
185
+ <Button testId="conditional-button" onClick="testState = testState === true ? false : true">Toggle Theme</Button>
186
+ </Theme>
187
+ </App>
188
+ `);
189
+ // Initially testState is null, expression evaluates to false
190
+ const initialBackground = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("conditional-button"), "background-color");
191
+ (0, fixtures_1.expect)(initialBackground.backgroundColor).not.toBe("rgb(255, 0, 0)");
192
+ // Click to make testState true, theme should be applied
193
+ yield page.getByTestId("conditional-button").click();
194
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe(true);
195
+ const appliedBackground = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("conditional-button"), "background-color");
196
+ (0, fixtures_1.expect)(appliedBackground.backgroundColor).toBe("rgb(255, 0, 0)");
197
+ // Click again to make testState false, theme should not be applied
198
+ yield page.getByTestId("conditional-button").click();
199
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe(false);
200
+ const removedBackground = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("conditional-button"), "background-color");
201
+ (0, fixtures_1.expect)(removedBackground.backgroundColor).not.toBe("rgb(255, 0, 0)");
202
+ }));
203
+ (0, fixtures_1.test)("handles nested themes with different applyIf values", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
204
+ const OUTER_COLOR = "rgb(255, 0, 0)";
205
+ const INNER_COLOR = "rgb(0, 255, 0)";
206
+ yield initTestBed(`
207
+ <App>
208
+ <Theme backgroundColor-Button="${OUTER_COLOR}" applyIf="true">
209
+ <Button testId="outer-themed">Outer Themed</Button>
210
+ <Theme backgroundColor-Button="${INNER_COLOR}" applyIf="false">
211
+ <Button testId="inner-unthemed">Inner Unthemed</Button>
212
+ </Theme>
213
+ </Theme>
214
+ </App>
215
+ `);
216
+ // Outer button should have outer theme applied
217
+ const { backgroundColor: outerBg } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("outer-themed"), "background-color");
218
+ (0, fixtures_1.expect)(outerBg).toBe(OUTER_COLOR);
219
+ // Inner button should inherit outer theme (inner theme not applied due to applyIf=false)
220
+ const { backgroundColor: innerBg } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("inner-unthemed"), "background-color");
221
+ (0, fixtures_1.expect)(innerBg).toBe(OUTER_COLOR); // Should inherit from outer theme
222
+ }));
223
+ (0, fixtures_1.test)("applies multiple theme variables when applyIf is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
224
+ const BG_COLOR = "rgb(255, 0, 0)";
225
+ const TEXT_COLOR = "rgb(0, 255, 0)";
226
+ yield initTestBed(`
227
+ <App>
228
+ <Theme
229
+ backgroundColor-Button="${BG_COLOR}"
230
+ textColor-Button="${TEXT_COLOR}"
231
+ applyIf="true"
232
+ >
233
+ <Button testId="multi-themed">Multi Themed</Button>
234
+ </Theme>
235
+ </App>
236
+ `);
237
+ const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("multi-themed"), "background-color");
238
+ const { color } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("multi-themed"), "color");
239
+ (0, fixtures_1.expect)(backgroundColor).toBe(BG_COLOR);
240
+ (0, fixtures_1.expect)(color).toBe(TEXT_COLOR);
241
+ }));
242
+ (0, fixtures_1.test)("does not apply any theme variables when applyIf is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
243
+ const BG_COLOR = "rgb(255, 0, 0)";
244
+ const TEXT_COLOR = "rgb(0, 255, 0)";
245
+ yield initTestBed(`
246
+ <App>
247
+ <Theme
248
+ backgroundColor-Button="${BG_COLOR}"
249
+ textColor-Button="${TEXT_COLOR}"
250
+ applyIf="false"
251
+ >
252
+ <Button testId="no-theme">No Theme</Button>
253
+ </Theme>
254
+ </App>
255
+ `);
256
+ const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("no-theme"), "background-color");
257
+ const { color } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("no-theme"), "color");
258
+ (0, fixtures_1.expect)(backgroundColor).not.toBe(BG_COLOR);
259
+ (0, fixtures_1.expect)(color).not.toBe(TEXT_COLOR);
260
+ }));
261
+ });
262
+ // =============================================================================
263
+ // APPLYIF EDGE CASES
264
+ // =============================================================================
265
+ fixtures_1.test.describe("applyIf Edge Cases", () => {
266
+ (0, fixtures_1.test)("handles null applyIf value gracefully", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
267
+ const { testStateDriver } = yield initTestBed(`
268
+ <App>
269
+ <Theme backgroundColor-Button="rgb(255, 0, 0)" applyIf="{testState === 'apply'}">
270
+ <Button testId="null-apply" onClick="testState = testState === 'apply' ? null : 'apply'">Button</Button>
271
+ </Theme>
272
+ </App>
273
+ `);
274
+ // Initially testState is null, expression evaluates to false
275
+ const initialBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("null-apply"), "background-color");
276
+ (0, fixtures_1.expect)(initialBg.backgroundColor).not.toBe("rgb(255, 0, 0)");
277
+ // Button should still be visible
278
+ yield (0, fixtures_1.expect)(page.getByTestId("null-apply")).toBeVisible();
279
+ // Click to set testState to 'apply', theme should be applied
280
+ yield page.getByTestId("null-apply").click();
281
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe("apply");
282
+ const appliedBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("null-apply"), "background-color");
283
+ (0, fixtures_1.expect)(appliedBg.backgroundColor).toBe("rgb(255, 0, 0)");
284
+ // Click again to set testState to null, theme should not be applied
285
+ yield page.getByTestId("null-apply").click();
286
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe(null);
287
+ const removedBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("null-apply"), "background-color");
288
+ (0, fixtures_1.expect)(removedBg.backgroundColor).not.toBe("rgb(255, 0, 0)");
289
+ }));
290
+ (0, fixtures_1.test)("handles undefined applyIf value (defaults to true)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
291
+ const { testStateDriver } = yield initTestBed(`
292
+ <App>
293
+ <Theme backgroundColor-Button="rgb(255, 0, 0)" applyIf="{testState > 10 ? true : undefined}">
294
+ <Button testId="undefined-apply" onClick="testState = testState == null ? 5 : testState + 10">Button</Button>
295
+ </Theme>
296
+ </App>
297
+ `);
298
+ // Initially testState is null, expression evaluates to undefined (should use default true)
299
+ const initialBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("undefined-apply"), "background-color");
300
+ (0, fixtures_1.expect)(initialBg.backgroundColor).toBe("rgb(255, 0, 0)"); // undefined should default to true
301
+ // Button should still be visible
302
+ yield (0, fixtures_1.expect)(page.getByTestId("undefined-apply")).toBeVisible();
303
+ // Click to set testState to 5, expression evaluates to undefined (should use default true)
304
+ yield page.getByTestId("undefined-apply").click();
305
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe(5);
306
+ const afterFirstClickBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("undefined-apply"), "background-color");
307
+ (0, fixtures_1.expect)(afterFirstClickBg.backgroundColor).toBe("rgb(255, 0, 0)"); // undefined should default to true
308
+ // Click again to set testState to 15, expression evaluates to true (explicit true)
309
+ yield page.getByTestId("undefined-apply").click();
310
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe(15);
311
+ const afterSecondClickBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("undefined-apply"), "background-color");
312
+ (0, fixtures_1.expect)(afterSecondClickBg.backgroundColor).toBe("rgb(255, 0, 0)");
313
+ }));
314
+ (0, fixtures_1.test)("handles string 'false' as truthy value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
315
+ yield initTestBed(`
316
+ <App>
317
+ <Theme backgroundColor-Button="rgb(255, 0, 0)" applyIf="false">
318
+ <Button testId="string-false">Button</Button>
319
+ </Theme>
320
+ </App>
321
+ `);
322
+ // String "false" should be treated as boolean false, so theme should not be applied
323
+ const { backgroundColor } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("string-false"), "background-color");
324
+ (0, fixtures_1.expect)(backgroundColor).not.toBe("rgb(255, 0, 0)");
325
+ }));
326
+ (0, fixtures_1.test)("handles numeric values correctly", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
327
+ const THEME_COLOR = "rgb(255, 0, 0)";
328
+ // Test with 0 (falsy)
329
+ yield initTestBed(`
330
+ <App>
331
+ <Theme backgroundColor-Button="${THEME_COLOR}" applyIf="{0}">
332
+ <Button testId="zero-apply">Button Zero</Button>
333
+ </Theme>
334
+ </App>
335
+ `);
336
+ const { backgroundColor: zeroBg } = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("zero-apply"), "background-color");
337
+ (0, fixtures_1.expect)(zeroBg).not.toBe(THEME_COLOR);
338
+ }));
339
+ (0, fixtures_1.test)("works with complex conditional expressions", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
340
+ const { testStateDriver } = yield initTestBed(`
341
+ <App>
342
+ <Theme backgroundColor-Button="rgb(255, 0, 0)" applyIf="{testState > 5}">
343
+ <Button testId="complex-condition" onClick="testState = testState == null ? 1 : testState + 3">
344
+ Increment by 3
345
+ </Button>
346
+ </Theme>
347
+ </App>
348
+ `);
349
+ // Initially testState is null, condition should be false
350
+ const initialBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("complex-condition"), "background-color");
351
+ (0, fixtures_1.expect)(initialBg.backgroundColor).not.toBe("rgb(255, 0, 0)");
352
+ // Click once: testState becomes 1 (1 > 5 is false)
353
+ yield page.getByTestId("complex-condition").click();
354
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe(1);
355
+ const firstClickBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("complex-condition"), "background-color");
356
+ (0, fixtures_1.expect)(firstClickBg.backgroundColor).not.toBe("rgb(255, 0, 0)");
357
+ // Click again: testState becomes 4 (4 > 5 is false)
358
+ yield page.getByTestId("complex-condition").click();
359
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe(4);
360
+ const secondClickBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("complex-condition"), "background-color");
361
+ (0, fixtures_1.expect)(secondClickBg.backgroundColor).not.toBe("rgb(255, 0, 0)");
362
+ // Click again: testState becomes 7 (7 > 5 is true, theme should apply)
363
+ yield page.getByTestId("complex-condition").click();
364
+ yield fixtures_1.expect.poll(testStateDriver.testState).toBe(7);
365
+ const thirdClickBg = yield (0, component_test_helpers_1.getStyles)(page.getByTestId("complex-condition"), "background-color");
366
+ (0, fixtures_1.expect)(thirdClickBg.backgroundColor).toBe("rgb(255, 0, 0)");
367
+ }));
368
+ (0, fixtures_1.test)("preserves children structure when applyIf is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
369
+ yield initTestBed(`
370
+ <App>
371
+ <Theme applyIf="false">
372
+ <VStack testId="container">
373
+ <Button testId="first-button">First</Button>
374
+ <H1 testId="header">Header</H1>
375
+ <Button testId="second-button">Second</Button>
376
+ </VStack>
377
+ </Theme>
378
+ </App>
379
+ `);
380
+ // All children should be present and in correct order
381
+ yield (0, fixtures_1.expect)(page.getByTestId("container")).toBeVisible();
382
+ yield (0, fixtures_1.expect)(page.getByTestId("first-button")).toBeVisible();
383
+ yield (0, fixtures_1.expect)(page.getByTestId("header")).toBeVisible();
384
+ yield (0, fixtures_1.expect)(page.getByTestId("second-button")).toBeVisible();
385
+ // Check text content is preserved
386
+ yield (0, fixtures_1.expect)(page.getByTestId("first-button")).toHaveText("First");
387
+ yield (0, fixtures_1.expect)(page.getByTestId("header")).toHaveText("Header");
388
+ yield (0, fixtures_1.expect)(page.getByTestId("second-button")).toHaveText("Second");
389
+ }));
390
+ });
@@ -22,11 +22,12 @@ const StyleContext_1 = require("../../components-core/theming/StyleContext");
22
22
  const hooks_1 = require("../../components-core/utils/hooks");
23
23
  exports.defaultProps = {
24
24
  isRoot: false,
25
+ applyIf: true,
25
26
  toastDuration: 5000,
26
27
  themeVars: constants_1.EMPTY_OBJECT,
27
28
  root: false,
28
29
  };
29
- function Theme({ id, isRoot = exports.defaultProps.isRoot, renderChild, node, tone, toastDuration = exports.defaultProps.toastDuration, themeVars = exports.defaultProps.themeVars, layoutContext, children, }) {
30
+ function Theme({ id, isRoot = exports.defaultProps.isRoot, applyIf, renderChild, node, tone, toastDuration = exports.defaultProps.toastDuration, themeVars = exports.defaultProps.themeVars, layoutContext, children, }) {
30
31
  const generatedId = (0, react_1.useId)();
31
32
  const { themes, resources, resourceMap, activeThemeId } = (0, ThemeContext_1.useThemes)();
32
33
  const { activeTheme, activeThemeTone, root } = (0, ThemeContext_1.useTheme)();
@@ -115,6 +116,12 @@ function Theme({ id, isRoot = exports.defaultProps.isRoot, renderChild, node, to
115
116
  if (indexing) {
116
117
  return children;
117
118
  }
119
+ // Use default value if applyIf is undefined
120
+ const shouldApplyTheme = applyIf !== null && applyIf !== void 0 ? applyIf : exports.defaultProps.applyIf;
121
+ // If applyIf is false, render children unwrapped without theme context
122
+ if (!shouldApplyTheme) {
123
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [renderChild && renderChild(node.children), children] }));
124
+ }
118
125
  if (isRoot) {
119
126
  const faviconUrl = getResourceUrl("resource:favicon") || "/resources/favicon.ico";
120
127
  return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_helmet_async_1.Helmet, { children: [!!faviconUrl && (0, jsx_runtime_1.jsx)("link", { rel: "icon", type: "image/svg+xml", href: faviconUrl }), fontLinks === null || fontLinks === void 0 ? void 0 : fontLinks.map((fontLink) => (0, jsx_runtime_1.jsx)("link", { href: fontLink, rel: "stylesheet" }, fontLink))] }), (0, jsx_runtime_1.jsx)(RootClasses, { classNames: rootClasses }), (0, jsx_runtime_1.jsxs)(ErrorBoundary_1.ErrorBoundary, { node: node, location: "theme-root", children: [renderChild && renderChild(node.children), children] }), (0, jsx_runtime_1.jsx)(NotificationToast_1.NotificationToast, { toastDuration: toastDuration })] }));
@@ -328,18 +328,18 @@ fixtures_1.test.describe("Basic Functionality", () => {
328
328
  (0, fixtures_1.test)("clears value when clear button is clicked (clearToInitialValue is true)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver, }) {
329
329
  yield initTestBed(`<TimeInput testId="timeInput" clearable="true" initialValue="14:30" />`);
330
330
  const driver = yield createTimeInputDriver("timeInput");
331
- driver.hourInput.fill("05");
331
+ yield driver.hourInput.fill("05");
332
332
  yield driver.clearButton.click();
333
333
  yield (0, fixtures_1.expect)(driver.hourInput).toHaveValue("14");
334
334
  yield (0, fixtures_1.expect)(driver.minuteInput).toHaveValue("30");
335
335
  }));
336
336
  (0, fixtures_1.test)("clears value when clear button is clicked (clearToInitialValue is false)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createTimeInputDriver, }) {
337
337
  yield initTestBed(`
338
- <TimeInput testId="timeInput" clearable="true"
338
+ <TimeInput testId="timeInput" clearable="true"
339
339
  clearToInitialValue="false" initialValue="14:30" />
340
340
  `);
341
341
  const driver = yield createTimeInputDriver("timeInput");
342
- driver.hourInput.fill("05");
342
+ yield driver.hourInput.fill("05");
343
343
  yield driver.clearButton.click();
344
344
  yield (0, fixtures_1.expect)(driver.hourInput).toHaveValue("");
345
345
  yield (0, fixtures_1.expect)(driver.minuteInput).toHaveValue("");
@@ -357,7 +357,6 @@ exports.TimeInputNative = (0, react_1.forwardRef)(function TimeInputNative(_a, r
357
357
  return `${h24}:${m24}:${s24}`;
358
358
  }, [hour, minute, second, amPm, is12HourFormat]);
359
359
  // Component API registration
360
- (0, react_1.useImperativeHandle)(ref, () => timeInputRef.current);
361
360
  (0, react_1.useEffect)(() => {
362
361
  if (registerComponentApi) {
363
362
  registerComponentApi({
@@ -86,7 +86,6 @@ exports.Timer = (0, react_1.forwardRef)(function Timer(_a, forwardedRef) {
86
86
  isRunning: () => isRunning && !isPaused,
87
87
  }), [pause, resume, isPaused, isRunning]);
88
88
  // Register both APIs together
89
- (0, react_1.useImperativeHandle)(forwardedRef, () => timerApi, [timerApi]);
90
89
  (0, react_1.useEffect)(() => {
91
90
  if (registerComponentApi) {
92
91
  registerComponentApi(timerApi);
@@ -15,14 +15,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.TreeComponent = exports.defaultProps = void 0;
16
16
  const jsx_runtime_1 = require("react/jsx-runtime");
17
17
  const react_1 = require("react");
18
- const react_window_1 = require("react-window");
19
- const react_virtualized_auto_sizer_1 = __importDefault(require("react-virtualized-auto-sizer"));
18
+ const virtua_1 = require("virtua");
20
19
  const classnames_1 = __importDefault(require("classnames"));
21
20
  const IconNative_1 = __importDefault(require("../Icon/IconNative"));
22
21
  const SpinnerNative_1 = require("../Spinner/SpinnerNative");
23
22
  const TreeComponent_module_scss_1 = __importDefault(require("./TreeComponent.module.scss"));
24
23
  const treeUtils_1 = require("../../components-core/utils/treeUtils");
25
- const TreeRow = (0, react_1.memo)(({ index, style, data }) => {
24
+ const TreeRow = (0, react_1.memo)(({ index, data }) => {
26
25
  const { nodes, toggleNode, selectedId, itemRenderer, itemClickExpands, onItemClick, onSelection, focusedIndex, treeContainerRef, iconCollapsed, iconExpanded, iconSize, animateExpand, expandRotation, } = data;
27
26
  const treeItem = nodes[index];
28
27
  const isFocused = focusedIndex === index && focusedIndex >= 0;
@@ -64,7 +63,7 @@ const TreeRow = (0, react_1.memo)(({ index, style, data }) => {
64
63
  // Get loading state for styling and interaction
65
64
  const nodeWithState = treeItem;
66
65
  const isLoading = nodeWithState.loadingState === "loading";
67
- return ((0, jsx_runtime_1.jsx)("div", { style: Object.assign(Object.assign({}, style), { width: "auto", minWidth: "100%", display: "flex" }), children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(TreeComponent_module_scss_1.default.rowWrapper, {
66
+ return ((0, jsx_runtime_1.jsx)("div", { style: { width: "100%", display: "flex" }, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(TreeComponent_module_scss_1.default.rowWrapper, {
68
67
  [TreeComponent_module_scss_1.default.selected]: isSelected,
69
68
  [TreeComponent_module_scss_1.default.focused]: isFocused,
70
69
  }), role: "treeitem", "aria-level": treeItem.depth + 1, "aria-expanded": treeItem.hasChildren ? treeItem.isExpanded : undefined, "aria-selected": isSelected, "aria-label": treeItem.displayName, "aria-busy": isLoading, tabIndex: isFocused ? 0 : -1, children: [(0, jsx_runtime_1.jsxs)("div", { onClick: onToggleNode, className: TreeComponent_module_scss_1.default.gutter, style: { cursor: isLoading ? "default" : "pointer" }, children: [(0, jsx_runtime_1.jsx)("div", { style: { width: treeItem.depth * 10 }, className: TreeComponent_module_scss_1.default.depthPlaceholder }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(TreeComponent_module_scss_1.default.toggleWrapper, {
@@ -156,7 +155,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
156
155
  // Helper function to update internal data and force re-render
157
156
  const updateInternalData = (0, react_1.useCallback)((updater) => {
158
157
  setInternalData(updater);
159
- setDataRevision(prev => prev + 1);
158
+ setDataRevision((prev) => prev + 1);
160
159
  }, []);
161
160
  // Build field configuration
162
161
  const fieldConfig = (0, react_1.useMemo)(() => ({
@@ -265,9 +264,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
265
264
  return !!(fieldConfig.dynamicField && node[fieldConfig.dynamicField]);
266
265
  };
267
266
  if (defaultExpanded === "first-level") {
268
- return treeData
269
- .filter(node => !isDynamic(node))
270
- .map((node) => node.key);
267
+ return treeData.filter((node) => !isDynamic(node)).map((node) => node.key);
271
268
  }
272
269
  else if (defaultExpanded === "all") {
273
270
  const allIds = [];
@@ -288,7 +285,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
288
285
  // Expand full paths to specified nodes by including all parent nodes
289
286
  // But exclude dynamic nodes from the expansion
290
287
  const expandedPaths = expandParentPaths(defaultExpanded, treeItemsById);
291
- return expandedPaths.filter(nodeId => {
288
+ return expandedPaths.filter((nodeId) => {
292
289
  const node = treeItemsById[String(nodeId)];
293
290
  return !node || !isDynamic(node);
294
291
  });
@@ -417,7 +414,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
417
414
  const currentData = prevData !== null && prevData !== void 0 ? prevData : data;
418
415
  if (dataFormat === "flat" && Array.isArray(currentData)) {
419
416
  // Remove existing children of this node
420
- return currentData.filter(item => String(item[fieldConfig.parentField || "parentId"]) !== String(node.key));
417
+ return currentData.filter((item) => String(item[fieldConfig.parentField || "parentId"]) !== String(node.key));
421
418
  }
422
419
  else if (dataFormat === "hierarchy" && Array.isArray(currentData)) {
423
420
  // For hierarchy format, clear children array
@@ -446,7 +443,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
446
443
  if (dataFormat === "flat" && Array.isArray(currentData)) {
447
444
  // Replace existing children with newly loaded data
448
445
  // Remove existing children of this node
449
- const filteredData = currentData.filter(item => String(item[fieldConfig.parentField || "parentId"]) !== String(node.key));
446
+ const filteredData = currentData.filter((item) => String(item[fieldConfig.parentField || "parentId"]) !== String(node.key));
450
447
  // Add new children
451
448
  const newItems = loadedData.map((item) => (Object.assign(Object.assign({}, item), { [fieldConfig.parentField || "parentId"]: String(node.key) })));
452
449
  return [...filteredData, ...newItems];
@@ -518,7 +515,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
518
515
  const currentNode = flatTreeData[currentIndex];
519
516
  if (currentNode.hasChildren && !currentNode.isExpanded) {
520
517
  // Expand node
521
- toggleNode(currentNode);
518
+ void toggleNode(currentNode);
522
519
  }
523
520
  else if (currentNode.hasChildren &&
524
521
  currentNode.isExpanded &&
@@ -535,7 +532,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
535
532
  const currentNode = flatTreeData[currentIndex];
536
533
  if (currentNode.hasChildren && currentNode.isExpanded) {
537
534
  // Collapse node
538
- toggleNode(currentNode);
535
+ void toggleNode(currentNode);
539
536
  }
540
537
  else if (currentNode.depth > 0) {
541
538
  // Move to parent - find previous node with smaller depth
@@ -572,7 +569,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
572
569
  }
573
570
  // Handle expansion for Enter key
574
571
  if (e.key === "Enter" && currentNode.hasChildren) {
575
- toggleNode(currentNode);
572
+ void toggleNode(currentNode);
576
573
  }
577
574
  }
578
575
  handled = true;
@@ -616,10 +613,6 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
616
613
  animateExpand,
617
614
  expandRotation,
618
615
  ]);
619
- const getItemKey = (0, react_1.useCallback)((index, data) => {
620
- const node = data.nodes[index];
621
- return (node === null || node === void 0 ? void 0 : node.key) || (node === null || node === void 0 ? void 0 : node.id) || `fallback-${index}`;
622
- }, []);
623
616
  // Shared API implementation to avoid duplication between ref and component APIs
624
617
  const treeApiMethods = (0, react_1.useMemo)(() => {
625
618
  return {
@@ -683,7 +676,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
683
676
  if (dataFormat === "flat" && Array.isArray(currentData)) {
684
677
  // Replace existing children with newly loaded data
685
678
  // Remove existing children of this node
686
- const filteredData = currentData.filter(item => String(item[fieldConfig.parentField || "parentId"]) !== String(nodeId));
679
+ const filteredData = currentData.filter((item) => String(item[fieldConfig.parentField || "parentId"]) !== String(nodeId));
687
680
  // Add new children
688
681
  const newItems = loadedData.map((item) => (Object.assign(Object.assign({}, item), { [fieldConfig.parentField || "parentId"]: String(nodeId) })));
689
682
  return [...filteredData, ...newItems];
@@ -792,8 +785,8 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
792
785
  const updatedFlatTreeData = (0, treeUtils_1.toFlatTree)(treeData, newExpandedIds, fieldConfig.dynamicField, nodeStates);
793
786
  const nodeIndex = updatedFlatTreeData.findIndex((item) => String(item.key) === String(nodeId));
794
787
  if (nodeIndex >= 0 && listRef.current) {
795
- // Scroll to the item using the FixedSizeList's scrollToItem method
796
- listRef.current.scrollToItem(nodeIndex, "center");
788
+ // Scroll to the item using virtua's scrollToIndex method
789
+ listRef.current.scrollToIndex(nodeIndex, { align: "center" });
797
790
  }
798
791
  }, 0);
799
792
  },
@@ -801,7 +794,7 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
801
794
  // Simple scroll without expanding - just scroll to the item if it's visible
802
795
  const nodeIndex = findNodeIndexById(nodeId);
803
796
  if (nodeIndex >= 0 && listRef.current) {
804
- listRef.current.scrollToItem(nodeIndex, "center");
797
+ listRef.current.scrollToIndex(nodeIndex, { align: "center" });
805
798
  }
806
799
  },
807
800
  appendNode: (parentNodeId, nodeData) => {
@@ -1132,5 +1125,5 @@ exports.TreeComponent = (0, react_1.memo)((props) => {
1132
1125
  setFocusedIndex(-1);
1133
1126
  }
1134
1127
  }, []);
1135
- return ((0, jsx_runtime_1.jsx)("div", { ref: treeContainerRef, className: (0, classnames_1.default)(TreeComponent_module_scss_1.default.wrapper, className), role: "tree", "aria-label": "Tree navigation", "aria-multiselectable": "false", tabIndex: 0, onFocus: handleTreeFocus, onBlur: handleTreeBlur, onKeyDown: handleKeyDown, children: (0, jsx_runtime_1.jsx)(react_virtualized_auto_sizer_1.default, { children: ({ width, height }) => ((0, jsx_runtime_1.jsx)(react_window_1.FixedSizeList, { ref: listRef, height: height, itemCount: itemData.nodes.length, itemData: itemData, itemSize: itemHeight, itemKey: getItemKey, width: width, children: TreeRow })) }) }));
1128
+ return ((0, jsx_runtime_1.jsx)("div", { ref: treeContainerRef, className: (0, classnames_1.default)(TreeComponent_module_scss_1.default.wrapper, className), role: "tree", "aria-label": "Tree navigation", "aria-multiselectable": "false", tabIndex: 0, onFocus: handleTreeFocus, onBlur: handleTreeBlur, onKeyDown: handleKeyDown, style: { height: "100%", overflow: "auto" }, children: (0, jsx_runtime_1.jsx)(virtua_1.Virtualizer, { ref: listRef, children: flatTreeData.map((node, index) => ((0, jsx_runtime_1.jsx)(TreeRow, { index: index, data: itemData }, node.key))) }) }));
1136
1129
  });
@@ -175,7 +175,7 @@ function InspectButton({ inspectId, node, inspectedNode, setInspectedNode, setSh
175
175
  htmlElement.removeEventListener("mouseenter", mouseenter);
176
176
  htmlElement.removeEventListener("mouseleave", mouseleave);
177
177
  };
178
- }, [inspectId, node, inspectMode, setShowCode]);
178
+ }, [inspectId, node, inspectMode, setShowCode, setInspectedNode]);
179
179
  return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: inspectMode
180
180
  ? null
181
181
  : visible &&
@@ -47,7 +47,7 @@ const metadataProvider = new metadata_utils_1.MetadataProvider(collectedComponen
47
47
  * representation); ApiInterceptor can emulate some backend functionality
48
48
  * running in the browser.
49
49
  */
50
- function StandaloneApp({ appDef, appGlobals: globals, decorateComponentsWithTestId, debugEnabled = false, runtime, extensionManager, waitForApiInterceptor = false, children }) {
50
+ function StandaloneApp({ appDef, appGlobals: globals, decorateComponentsWithTestId, debugEnabled = false, runtime, extensionManager, waitForApiInterceptor = false, children, }) {
51
51
  var _a;
52
52
  // --- Fetch all files constituting the standalone app, including components,
53
53
  // --- themes, and other artifacts. Display the app version numbers in the
@@ -377,12 +377,10 @@ function loadThemeFile(url) {
377
377
  * @returns The source file contents response
378
378
  */
379
379
  function fetchWithoutCache(url) {
380
- return __awaiter(this, void 0, void 0, function* () {
381
- return fetch((0, misc_1.normalizePath)(url), {
382
- headers: {
383
- "Cache-Control": "no-cache, no-store",
384
- },
385
- });
380
+ return fetch((0, misc_1.normalizePath)(url), {
381
+ headers: {
382
+ "Cache-Control": "no-cache, no-store",
383
+ },
386
384
  });
387
385
  }
388
386
  /**
@@ -412,7 +410,7 @@ function useStandalone(standaloneAppDef, runtime = constants_1.EMPTY_OBJECT, ext
412
410
  });
413
411
  const [projectCompilation, setProjectCompilation] = (0, react_1.useState)(null);
414
412
  (0, hooks_1.useIsomorphicLayoutEffect)(() => {
415
- (function () {
413
+ void (function () {
416
414
  return __awaiter(this, void 0, void 0, function* () {
417
415
  var _a, _b, _c, _d, _e, _f;
418
416
  const resolvedRuntime = resolveRuntime(runtime);
@@ -81,7 +81,7 @@ function uploadFile(_a, _b) {
81
81
  throw e;
82
82
  }
83
83
  }
84
- (0, actionUtils_1.invalidateQueries)(invalidates, appContext, state);
84
+ void (0, actionUtils_1.invalidateQueries)(invalidates, appContext, state);
85
85
  return result;
86
86
  });
87
87
  }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useBehaviors = exports.BehaviorsProvider = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const CoreBehaviors_1 = require("./CoreBehaviors");
7
+ // --- Create the context with a default value
8
+ const BehaviorContext = (0, react_1.createContext)(undefined);
9
+ /**
10
+ * A provider component that makes the behavior management system available to
11
+ * its children.
12
+ */
13
+ const BehaviorsProvider = ({ children }) => {
14
+ const behaviors = (0, react_1.useMemo)(() => new Map(), []);
15
+ const registerBehavior = (0, react_1.useCallback)((behavior) => {
16
+ behaviors.set(behavior.name, behavior);
17
+ }, [behaviors]);
18
+ (0, react_1.useMemo)(() => {
19
+ if (process.env.VITE_USED_BEHAVIORS_Animation !== "false") {
20
+ registerBehavior(CoreBehaviors_1.animationBehavior);
21
+ }
22
+ if (process.env.VITE_USED_BEHAVIORS_Tooltip !== "false") {
23
+ registerBehavior(CoreBehaviors_1.tooltipBehavior);
24
+ }
25
+ if (process.env.VITE_USED_BEHAVIORS_Label !== "false") {
26
+ registerBehavior(CoreBehaviors_1.labelBehavior);
27
+ }
28
+ }, [registerBehavior]);
29
+ const contextValue = (0, react_1.useMemo)(() => ({
30
+ behaviors,
31
+ registerBehavior,
32
+ unregisterBehavior: (name) => behaviors.delete(name),
33
+ getBehaviors: () => {
34
+ return Array.from(behaviors.values());
35
+ },
36
+ }), [behaviors, registerBehavior]);
37
+ return (0, jsx_runtime_1.jsx)(BehaviorContext.Provider, { value: contextValue, children: children });
38
+ };
39
+ exports.BehaviorsProvider = BehaviorsProvider;
40
+ /**
41
+ * A custom hook to access the behavior context.
42
+ */
43
+ const useBehaviors = () => {
44
+ const context = (0, react_1.useContext)(BehaviorContext);
45
+ if (!context) {
46
+ throw new Error("useBehaviors must be used within a BehaviorsProvider");
47
+ }
48
+ return context;
49
+ };
50
+ exports.useBehaviors = useBehaviors;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCoreBehaviors = exports.labelBehavior = exports.animationBehavior = exports.tooltipBehavior = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
5
6
  const AnimationNative_1 = require("../../components/Animation/AnimationNative");
6
7
  const ItemWithLabel_1 = require("../../components/FormItem/ItemWithLabel");
7
8
  const TooltipNative_1 = require("../../components/Tooltip/TooltipNative");
@@ -41,7 +42,11 @@ exports.animationBehavior = {
41
42
  const animation = extractValue((_a = context.node.props) === null || _a === void 0 ? void 0 : _a.animation, true);
42
43
  const animationOptions = extractValue((_b = context.node.props) === null || _b === void 0 ? void 0 : _b.animationOptions, true);
43
44
  const parsedOptions = (0, AnimationNative_1.parseAnimationOptions)(animationOptions);
44
- return ((0, jsx_runtime_1.jsx)(AnimationNative_1.Animation, Object.assign({ animation: (0, AnimationNative_1.parseAnimation)(animation) }, parsedOptions, { children: node })));
45
+ return ((0, jsx_runtime_1.jsx)(AnimationNative_1.Animation, Object.assign({ animation: (0, AnimationNative_1.parseAnimation)(animation) }, parsedOptions, { children: context.node.type === "ModalDialog"
46
+ ? (0, react_1.cloneElement)(node, {
47
+ externalAnimation: true,
48
+ })
49
+ : node })));
45
50
  },
46
51
  };
47
52
  /**