xmlui 0.10.13 → 0.10.14

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 (186) hide show
  1. package/dist/lib/{index-Db5iQkFp.mjs → index-779mp2Bm.mjs} +943 -736
  2. package/dist/lib/index.css +1 -1
  3. package/dist/lib/{initMock-B9LtmFJG.mjs → initMock-CAXdczCj.mjs} +1 -1
  4. package/dist/lib/xmlui.d.ts +16 -1
  5. package/dist/lib/xmlui.mjs +33 -32
  6. package/dist/metadata/{collectedComponentMetadata-BN8eg9Gr.mjs → collectedComponentMetadata-7DFXlw-J.mjs} +15057 -14865
  7. package/dist/metadata/{initMock-J7pN8owj.mjs → initMock-AFWEftc6.mjs} +1 -1
  8. package/dist/metadata/style.css +1 -1
  9. package/dist/metadata/xmlui-metadata.mjs +1 -1
  10. package/dist/metadata/xmlui-metadata.umd.js +3 -3
  11. package/dist/scripts/bin/build-lib.js +21 -13
  12. package/dist/scripts/bin/viteConfig.js +3 -1
  13. package/dist/scripts/package.json +1 -1
  14. package/dist/scripts/src/abstractions/scripting/Token.js +2 -0
  15. package/dist/scripts/src/abstractions/scripting/TryScope.js +2 -0
  16. package/dist/scripts/src/abstractions/scripting/modules.js +2 -0
  17. package/dist/scripts/src/components/APICall/APICall.spec.js +910 -0
  18. package/dist/scripts/src/components/Accordion/Accordion.spec.js +969 -0
  19. package/dist/scripts/src/components/Animation/Animation.js +50 -0
  20. package/dist/scripts/src/components/App/App.spec.js +219 -0
  21. package/dist/scripts/src/components/AppHeader/AppHeader.spec.js +169 -0
  22. package/dist/scripts/src/components/AppState/AppState.spec.js +268 -0
  23. package/dist/scripts/src/components/AutoComplete/AutoComplete.spec.js +383 -0
  24. package/dist/scripts/src/components/Avatar/Avatar.spec.js +1543 -0
  25. package/dist/scripts/src/components/Backdrop/Backdrop.spec.js +131 -0
  26. package/dist/scripts/src/components/Badge/Badge.spec.js +2214 -0
  27. package/dist/scripts/src/components/Bookmark/Bookmark.spec.js +230 -0
  28. package/dist/scripts/src/components/Breakout/Breakout.spec.js +56 -0
  29. package/dist/scripts/src/components/Button/Button-style.spec.js +274 -0
  30. package/dist/scripts/src/components/Button/Button.spec.js +454 -0
  31. package/dist/scripts/src/components/Card/Card.spec.js +150 -0
  32. package/dist/scripts/src/components/Carousel/Carousel.spec.js +343 -0
  33. package/dist/scripts/src/components/Carousel/CarouselNative.js +2 -2
  34. package/dist/scripts/src/components/ChangeListener/ChangeListener.spec.js +169 -0
  35. package/dist/scripts/src/components/Charts/AreaChart/AreaChart.spec.js +999 -0
  36. package/dist/scripts/src/components/Charts/BarChart/BarChart.spec.js +597 -0
  37. package/dist/scripts/src/components/Charts/DonutChart/DonutChart.spec.js +608 -0
  38. package/dist/scripts/src/components/Charts/LabelList/LabelList.spec.js +539 -0
  39. package/dist/scripts/src/components/Charts/Legend/Legend.spec.js +558 -0
  40. package/dist/scripts/src/components/Charts/LineChart/LineChart.spec.js +450 -0
  41. package/dist/scripts/src/components/Charts/PieChart/PieChart.spec.js +584 -0
  42. package/dist/scripts/src/components/Charts/RadarChart/RadarChart.spec.js +571 -0
  43. package/dist/scripts/src/components/Charts/Tooltip/TooltipContent.spec.js +449 -0
  44. package/dist/scripts/src/components/Checkbox/Checkbox.spec.js +964 -0
  45. package/dist/scripts/src/components/CodeBlock/CodeBlock.spec.js +196 -0
  46. package/dist/scripts/src/components/ColorPicker/ColorPicker.spec.js +283 -0
  47. package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +9 -26
  48. package/dist/scripts/src/components/Column/doc-resources/list-component-data.js +53 -0
  49. package/dist/scripts/src/components/ComponentProvider.js +6 -2
  50. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.spec.js +338 -0
  51. package/dist/scripts/src/components/DateInput/DateInput.spec.js +918 -0
  52. package/dist/scripts/src/components/DatePicker/DatePicker.spec.js +362 -0
  53. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +3 -3
  54. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.spec.js +331 -0
  55. package/dist/scripts/src/components/EmojiSelector/EmojiSelector.spec.js +29 -0
  56. package/dist/scripts/src/components/ExpandableItem/ExpandableItem.spec.js +435 -0
  57. package/dist/scripts/src/components/FileInput/FileInput.spec.js +249 -0
  58. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.spec.js +296 -0
  59. package/dist/scripts/src/components/FlowLayout/FlowLayout.spec.js +518 -0
  60. package/dist/scripts/src/components/Footer/Footer.spec.js +991 -0
  61. package/dist/scripts/src/components/Form/Form.spec.js +1257 -0
  62. package/dist/scripts/src/components/FormItem/FormItem.spec.js +723 -0
  63. package/dist/scripts/src/components/FormSection/FormSection.js +6 -31
  64. package/dist/scripts/src/components/Fragment/Fragment.spec.js +50 -0
  65. package/dist/scripts/src/components/Heading/H1.spec.js +66 -0
  66. package/dist/scripts/src/components/Heading/H2.spec.js +66 -0
  67. package/dist/scripts/src/components/Heading/H3.spec.js +66 -0
  68. package/dist/scripts/src/components/Heading/H4.spec.js +66 -0
  69. package/dist/scripts/src/components/Heading/H5.spec.js +66 -0
  70. package/dist/scripts/src/components/Heading/H6.spec.js +66 -0
  71. package/dist/scripts/src/components/Heading/Heading.spec.js +897 -0
  72. package/dist/scripts/src/components/HtmlTags/HtmlTags.spec.js +69 -0
  73. package/dist/scripts/src/components/IFrame/IFrame.spec.js +527 -0
  74. package/dist/scripts/src/components/Icon/ArrowDropDown.js +11 -0
  75. package/dist/scripts/src/components/Icon/ArrowDropUp.js +11 -0
  76. package/dist/scripts/src/components/Icon/ArrowLeft.js +11 -0
  77. package/dist/scripts/src/components/Icon/ArrowRight.js +11 -0
  78. package/dist/scripts/src/components/Icon/ChevronDownIcon.js +7 -0
  79. package/dist/scripts/src/components/Icon/ChevronUpIcon.js +7 -0
  80. package/dist/scripts/src/components/Icon/Icon.spec.js +527 -0
  81. package/dist/scripts/src/components/Icon/SunIcon.js +10 -0
  82. package/dist/scripts/src/components/Image/Image.js +2 -1
  83. package/dist/scripts/src/components/Image/Image.spec.js +198 -0
  84. package/dist/scripts/src/components/Image/ImageNative.js +30 -2
  85. package/dist/scripts/src/components/Input/InputLabel.js +25 -0
  86. package/dist/scripts/src/components/Input/index.js +5 -0
  87. package/dist/scripts/src/components/Items/Items.spec.js +397 -0
  88. package/dist/scripts/src/components/Link/Link.spec.js +894 -0
  89. package/dist/scripts/src/components/List/List.spec.js +927 -0
  90. package/dist/scripts/src/components/List/doc-resources/list-component-data.js +53 -0
  91. package/dist/scripts/src/components/Markdown/Markdown.spec.js +188 -0
  92. package/dist/scripts/src/components/ModalDialog/ModalDialog.spec.js +162 -0
  93. package/dist/scripts/src/components/NavGroup/NavGroup.spec.js +153 -0
  94. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +2 -2
  95. package/dist/scripts/src/components/NavLink/NavLink.spec.js +864 -0
  96. package/dist/scripts/src/components/NavPanel/NavPanel.spec.js +864 -0
  97. package/dist/scripts/src/components/NoResult/NoResult.spec.js +863 -0
  98. package/dist/scripts/src/components/NumberBox/NumberBox.spec.js +1231 -0
  99. package/dist/scripts/src/components/Option/Option.spec.js +472 -0
  100. package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.spec.js +80 -0
  101. package/dist/scripts/src/components/Pagination/Pagination.spec.js +1003 -0
  102. package/dist/scripts/src/components/ProfileMenu/ProfileMenu.js +20 -0
  103. package/dist/scripts/src/components/ProgressBar/ProgressBar.spec.js +166 -0
  104. package/dist/scripts/src/components/Queue/Queue.spec.js +626 -0
  105. package/dist/scripts/src/components/RadioGroup/RadioGroup.spec.js +479 -0
  106. package/dist/scripts/src/components/Redirect/Redirect.spec.js +527 -0
  107. package/dist/scripts/src/components/ResponsiveBar/ResponsiveBar.spec.js +76 -0
  108. package/dist/scripts/src/components/Select/Select.spec.js +527 -0
  109. package/dist/scripts/src/components/Slider/Slider.js +2 -0
  110. package/dist/scripts/src/components/Slider/Slider.spec.js +574 -0
  111. package/dist/scripts/src/components/Slider/SliderNative.js +62 -25
  112. package/dist/scripts/src/components/Slot/Slot.spec.js +368 -0
  113. package/dist/scripts/src/components/SpaceFiller/SpaceFiller.spec.js +184 -0
  114. package/dist/scripts/src/components/Spinner/Spinner.spec.js +161 -0
  115. package/dist/scripts/src/components/Splitter/HSplitter.spec.js +104 -0
  116. package/dist/scripts/src/components/Splitter/Splitter.spec.js +543 -0
  117. package/dist/scripts/src/components/Splitter/VSplitter.spec.js +104 -0
  118. package/dist/scripts/src/components/Stack/CHStack.spec.js +86 -0
  119. package/dist/scripts/src/components/Stack/CVStack.spec.js +86 -0
  120. package/dist/scripts/src/components/Stack/HStack.spec.js +67 -0
  121. package/dist/scripts/src/components/Stack/Stack.spec.js +654 -0
  122. package/dist/scripts/src/components/Stack/VStack.spec.js +67 -0
  123. package/dist/scripts/src/components/Switch/Switch.spec.js +829 -0
  124. package/dist/scripts/src/components/Table/Table.spec.js +555 -0
  125. package/dist/scripts/src/components/Table/doc-resources/list-component-data.js +53 -0
  126. package/dist/scripts/src/components/TableOfContents/TableOfContents.spec.js +838 -0
  127. package/dist/scripts/src/components/Tabs/Tabs.spec.js +875 -0
  128. package/dist/scripts/src/components/Text/Text.spec.js +1075 -0
  129. package/dist/scripts/src/components/TextArea/TextArea.spec.js +714 -0
  130. package/dist/scripts/src/components/TextBox/TextBox.spec.js +643 -0
  131. package/dist/scripts/src/components/Theme/Theme.spec.js +124 -0
  132. package/dist/scripts/src/components/TimeInput/TimeInput.spec.js +1122 -0
  133. package/dist/scripts/src/components/Timer/Timer.spec.js +358 -0
  134. package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.spec.js +414 -0
  135. package/dist/scripts/src/components/ToneSwitch/ToneSwitch.spec.js +89 -0
  136. package/dist/scripts/src/components/Tooltip/Tooltip.spec.js +418 -0
  137. package/dist/scripts/src/components/chart-color-schemes.js +43 -0
  138. package/dist/scripts/src/components-core/CompoundComponent.js +1 -1
  139. package/dist/scripts/src/components-core/RestApiProxy.js +85 -8
  140. package/dist/scripts/src/components-core/devtools/InspectorDialogVisibilityContext.js +8 -0
  141. package/dist/scripts/src/components-core/renderers.js +31 -0
  142. package/dist/scripts/src/components-core/script-runner/simplify-expression.js +386 -0
  143. package/dist/scripts/src/components-core/theming/component-layout-resolver.js +153 -0
  144. package/dist/scripts/src/components-core/theming/parse-layout-props.js +98 -0
  145. package/dist/scripts/src/components-core/theming/themes/solid.js +16 -0
  146. package/dist/scripts/src/components-core/utils/audio-utils.js +83 -0
  147. package/dist/scripts/src/index-standalone.js +61 -0
  148. package/dist/scripts/src/index.js +2 -1
  149. package/dist/scripts/src/language-server/server-common.js +151 -0
  150. package/dist/scripts/src/language-server/server-web-worker.js +47 -0
  151. package/dist/scripts/src/language-server/server.js +42 -0
  152. package/dist/scripts/src/language-server/services/common/docs-generation.js +73 -0
  153. package/dist/scripts/src/language-server/services/common/lsp-utils.js +9 -0
  154. package/dist/scripts/src/language-server/services/common/syntax-node-utilities.js +135 -0
  155. package/dist/scripts/src/language-server/services/completion.js +270 -0
  156. package/dist/scripts/src/language-server/services/diagnostic.js +19 -0
  157. package/dist/scripts/src/language-server/services/format.js +430 -0
  158. package/dist/scripts/src/language-server/services/hover.js +164 -0
  159. package/dist/scripts/src/language-server/xmlui-metadata-generated.mjs +16266 -0
  160. package/dist/scripts/src/logging/xmlui.js +21 -0
  161. package/dist/scripts/src/parsers/common/utils.js +19 -0
  162. package/dist/scripts/src/syntax/monaco/grammar.monacoLanguage.js +286 -0
  163. package/dist/scripts/src/syntax/monaco/index.js +14 -0
  164. package/dist/scripts/src/syntax/monaco/xmlui-dark.js +25 -0
  165. package/dist/scripts/src/syntax/monaco/xmlui-light.js +25 -0
  166. package/dist/scripts/src/syntax/monaco/xmluiscript.monacoLanguage.js +310 -0
  167. package/dist/scripts/src/syntax/textMate/index.js +14 -0
  168. package/dist/scripts/src/syntax/textMate/xmlui-dark.json +631 -0
  169. package/dist/scripts/src/syntax/textMate/xmlui-light.json +565 -0
  170. package/dist/scripts/src/syntax/textMate/xmlui.json +564 -0
  171. package/dist/scripts/src/syntax/textMate/xmlui.tmLanguage.json +341 -0
  172. package/dist/scripts/src/testing/ComponentDrivers.js +1355 -0
  173. package/dist/scripts/src/testing/assertions.js +444 -0
  174. package/dist/scripts/src/testing/component-test-helpers.js +389 -0
  175. package/dist/scripts/src/testing/drivers/DateInputDriver.js +19 -0
  176. package/dist/scripts/src/testing/drivers/ModalDialogDriver.js +10 -0
  177. package/dist/scripts/src/testing/drivers/TimeInputDriver.js +22 -0
  178. package/dist/scripts/src/testing/drivers/TimerDriver.js +64 -0
  179. package/dist/scripts/src/testing/fixtures.js +487 -0
  180. package/dist/scripts/src/testing/infrastructure/TestBed.js +17 -0
  181. package/dist/scripts/src/testing/infrastructure/main.js +9 -0
  182. package/dist/scripts/src/testing/infrastructure/public/mockServiceWorker.js +266 -0
  183. package/dist/scripts/src/testing/themed-app-test-helpers.js +139 -0
  184. package/dist/standalone/xmlui-standalone.es.d.ts +18 -1
  185. package/dist/standalone/xmlui-standalone.umd.js +36 -36
  186. package/package.json +1 -1
@@ -0,0 +1,418 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const component_test_helpers_1 = require("../../testing/component-test-helpers");
13
+ const fixtures_1 = require("../../testing/fixtures");
14
+ // Use low delay duration for faster tests as suggested
15
+ const LOW_DELAY = 10;
16
+ // =============================================================================
17
+ // BASIC FUNCTIONALITY TESTS
18
+ // =============================================================================
19
+ fixtures_1.test.describe("Basic Functionality", () => {
20
+ (0, fixtures_1.test)("renders component", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
21
+ yield initTestBed(`
22
+ <Tooltip delayDuration="${LOW_DELAY}" text="I'm a tooltip!">
23
+ <Button label="Hover me!" testId="tooltip-button" />
24
+ </Tooltip>
25
+ `);
26
+ const button = page.getByTestId("tooltip-button");
27
+ yield (0, fixtures_1.expect)(button).toBeVisible();
28
+ // Hover over the button to trigger tooltip
29
+ yield button.hover();
30
+ // Wait for tooltip to appear with low delay
31
+ yield (0, fixtures_1.expect)(page.locator("[data-tooltip-container]")).toBeVisible();
32
+ }));
33
+ // Note: This test is mainly to verify that the tooltip has the correct role for accessibility but
34
+ // is placed here since we use getByRole for the content.
35
+ // Fetching by data attribute is for the dimension tests below.
36
+ (0, fixtures_1.test)("has correct 'role' attribute", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
37
+ yield initTestBed(`
38
+ <Tooltip text="Tooltip" defaultOpen="true" delayDuration="${LOW_DELAY}">
39
+ <Button label="Button with default open tooltip" />
40
+ </Tooltip>
41
+ `);
42
+ const tooltip = page.getByRole("tooltip");
43
+ yield (0, fixtures_1.expect)(tooltip).toBeVisible();
44
+ yield (0, fixtures_1.expect)(tooltip).toContainText("Tooltip");
45
+ }));
46
+ (0, fixtures_1.test)("renders with tooltip property", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
47
+ yield initTestBed(`
48
+ <Tooltip delayDuration="${LOW_DELAY}" text="I'm a tooltip!">
49
+ <Button label="Hover me!" testId="tooltip-button" />
50
+ </Tooltip>
51
+ `);
52
+ const button = page.getByTestId("tooltip-button");
53
+ yield (0, fixtures_1.expect)(button).toBeVisible();
54
+ // Hover over the button to trigger tooltip
55
+ yield button.hover();
56
+ // Wait for tooltip to appear with low delay
57
+ yield (0, fixtures_1.expect)(page.getByRole("tooltip")).toHaveText("I'm a tooltip!");
58
+ // Note: We skip testing tooltip hiding as it's dependent on implementation details
59
+ // and the main functionality test is that it appears correctly on hover
60
+ }));
61
+ (0, fixtures_1.test)("renders with markdown content", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
62
+ yield initTestBed(`
63
+ <Tooltip delayDuration="${LOW_DELAY}" markdown="This *example* uses \`tooltipMarkdown\`">
64
+ <Card title="Tooltip with markdown" testId="markdown-card" />
65
+ </Tooltip>
66
+ `);
67
+ const card = page.getByTestId("markdown-card");
68
+ yield (0, fixtures_1.expect)(card).toBeVisible();
69
+ // Hover to show tooltip
70
+ yield card.hover();
71
+ // Check that markdown is rendered (looking for emphasis and code elements)
72
+ const tooltip = page.getByRole("tooltip");
73
+ yield (0, fixtures_1.expect)(tooltip).toBeVisible();
74
+ yield (0, fixtures_1.expect)(tooltip.locator("em")).toContainText("example");
75
+ yield (0, fixtures_1.expect)(tooltip.locator("code")).toContainText("tooltipMarkdown");
76
+ }));
77
+ (0, fixtures_1.test)("renders with 'side' property set to right", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
78
+ yield initTestBed(`
79
+ <CVStack height="200px" horizontalAlignment="center" verticalAlignment="center">
80
+ <Tooltip delayDuration="${LOW_DELAY}" text="I'm positioned right" side="right">
81
+ <Button label="Hover me!" testId="right-tooltip-button" />
82
+ </Tooltip>
83
+ </CVStack>
84
+ `);
85
+ const button = page.getByTestId("right-tooltip-button");
86
+ yield button.hover();
87
+ const tooltip = page.getByText("I'm positioned right");
88
+ yield (0, fixtures_1.expect)(tooltip).toBeVisible();
89
+ // Verify tooltip is positioned to the right of the button
90
+ const buttonBox = yield (0, component_test_helpers_1.getBounds)(button);
91
+ const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
92
+ (0, fixtures_1.expect)(tooltipBox.left).toBeGreaterThan(buttonBox.right);
93
+ }));
94
+ (0, fixtures_1.test)("renders with 'side' property set to left", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
95
+ yield initTestBed(`
96
+ <CVStack height="200px" horizontalAlignment="center" verticalAlignment="center">
97
+ <Tooltip delayDuration="${LOW_DELAY}" text="I'm positioned left" side="left">
98
+ <Button label="Hover me!" testId="left-tooltip-button" />
99
+ </Tooltip>
100
+ </CVStack>
101
+ `);
102
+ const button = page.getByTestId("left-tooltip-button");
103
+ yield button.hover();
104
+ const tooltip = page.getByText("I'm positioned left");
105
+ yield (0, fixtures_1.expect)(tooltip).toBeVisible();
106
+ // Verify tooltip is positioned to the right of the button
107
+ const buttonBox = yield (0, component_test_helpers_1.getBounds)(button);
108
+ const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
109
+ (0, fixtures_1.expect)(tooltipBox.right).toBeLessThan(buttonBox.left);
110
+ }));
111
+ (0, fixtures_1.test)("renders with 'side' property set to top", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
112
+ yield initTestBed(`
113
+ <CVStack height="200px" horizontalAlignment="center" verticalAlignment="center">
114
+ <Tooltip delayDuration="${LOW_DELAY}" text="I'm positioned top" side="top">
115
+ <Button label="Hover me!" testId="top-tooltip-button" />
116
+ </Tooltip>
117
+ </CVStack>
118
+ `);
119
+ const button = page.getByTestId("top-tooltip-button");
120
+ yield button.hover();
121
+ const tooltip = page.getByText("I'm positioned top");
122
+ yield (0, fixtures_1.expect)(tooltip).toBeVisible();
123
+ // Verify tooltip is positioned above the button
124
+ const buttonBox = yield (0, component_test_helpers_1.getBounds)(button);
125
+ const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
126
+ (0, fixtures_1.expect)(tooltipBox.bottom).toBeLessThan(buttonBox.top);
127
+ }));
128
+ (0, fixtures_1.test)("renders with 'side' property set to bottom", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
129
+ yield initTestBed(`
130
+ <CVStack height="200px" horizontalAlignment="center" verticalAlignment="center">
131
+ <Tooltip delayDuration="${LOW_DELAY}" text="I'm positioned bottom" side="bottom">
132
+ <Button label="Hover me!" testId="bottom-tooltip-button" />
133
+ </Tooltip>
134
+ </CVStack>
135
+ `);
136
+ const button = page.getByTestId("bottom-tooltip-button");
137
+ yield button.hover();
138
+ const tooltip = page.getByText("I'm positioned bottom");
139
+ yield (0, fixtures_1.expect)(tooltip).toBeVisible();
140
+ // Verify tooltip is positioned below the button
141
+ const buttonBox = yield (0, component_test_helpers_1.getBounds)(button);
142
+ const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
143
+ (0, fixtures_1.expect)(tooltipBox.top).toBeGreaterThan(buttonBox.bottom);
144
+ }));
145
+ (0, fixtures_1.test)(`renders with 'sideOffset' property when side is top`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
146
+ yield initTestBed(`
147
+ <CVStack height="200px" horizontalAlignment="center" verticalAlignment="center">
148
+ <Tooltip side="top" text="Tooltip" sideOffset="28" delayDuration="${LOW_DELAY}">
149
+ <Icon name="email" testId="tooltip-icon" />
150
+ </Tooltip>
151
+ </CVStack>
152
+ `);
153
+ const icon = page.getByTestId("tooltip-icon");
154
+ yield icon.hover();
155
+ const tooltip = page.locator("[data-tooltip-container]");
156
+ // Verify tooltip is positioned above the icon with the correct offset
157
+ const iconBox = yield (0, component_test_helpers_1.getBounds)(icon);
158
+ const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
159
+ (0, fixtures_1.expect)(iconBox.top - tooltipBox.bottom).toEqualWithTolerance(28, 4);
160
+ }));
161
+ (0, fixtures_1.test)(`renders with 'sideOffset' property when side is bottom`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
162
+ yield initTestBed(`
163
+ <Stack height="200px" horizontalAlignment="center" verticalAlignment="center">
164
+ <Tooltip side="bottom" text="Tooltip" sideOffset="28" delayDuration="${LOW_DELAY}">
165
+ <Icon name="email" testId="tooltip-icon" />
166
+ </Tooltip>
167
+ </Stack>
168
+ `);
169
+ const icon = page.getByTestId("tooltip-icon");
170
+ yield icon.hover();
171
+ const tooltip = page.locator("[data-tooltip-container]");
172
+ // Verify tooltip is positioned below the icon with the correct offset
173
+ const iconBox = yield (0, component_test_helpers_1.getBounds)(icon);
174
+ const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
175
+ (0, fixtures_1.expect)(tooltipBox.top - iconBox.bottom).toBeGreaterThanOrEqual(28);
176
+ }));
177
+ (0, fixtures_1.test)(`renders with 'sideOffset' property when side is left`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
178
+ yield initTestBed(`
179
+ <Stack height="200px" horizontalAlignment="center" verticalAlignment="center">
180
+ <Tooltip side="left" text="Tooltip" sideOffset="28" delayDuration="${LOW_DELAY}">
181
+ <Icon name="email" testId="tooltip-icon-left" />
182
+ </Tooltip>
183
+ </Stack>
184
+ `);
185
+ const icon = page.getByTestId("tooltip-icon-left");
186
+ yield icon.hover();
187
+ const tooltip = page.getByRole("tooltip");
188
+ // Verify tooltip is positioned to the left of the icon with the correct offset
189
+ const iconBox = yield (0, component_test_helpers_1.getBounds)(icon);
190
+ const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
191
+ (0, fixtures_1.expect)(iconBox.left - tooltipBox.right).toBeGreaterThanOrEqual(28);
192
+ }));
193
+ (0, fixtures_1.test)(`renders with 'sideOffset' property when side is right`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
194
+ yield initTestBed(`
195
+ <Stack height="200px" horizontalAlignment="center" verticalAlignment="center">
196
+ <Tooltip side="right" text="Tooltip" sideOffset="28" delayDuration="${LOW_DELAY}">
197
+ <Icon name="email" testId="tooltip-icon-right" />
198
+ </Tooltip>
199
+ </Stack>
200
+ `);
201
+ const icon = page.getByTestId("tooltip-icon-right");
202
+ yield icon.hover();
203
+ const tooltip = page.getByRole("tooltip");
204
+ // Verify tooltip is positioned to the right of the icon with the correct offset
205
+ const iconBox = yield (0, component_test_helpers_1.getBounds)(icon);
206
+ const tooltipBox = yield (0, component_test_helpers_1.getBounds)(tooltip);
207
+ (0, fixtures_1.expect)(tooltipBox.left - iconBox.right).toBeGreaterThanOrEqual(28);
208
+ }));
209
+ (0, fixtures_1.test)("Tooltip is shown for all wrapped children", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
210
+ yield initTestBed(`
211
+ <Tooltip side="bottom" markdown="This *example* uses a \`Tooltip\` component" delayDuration="${LOW_DELAY}">
212
+ <VStack horizontalAlignment="center">
213
+ <Card title="Card 1: within a Tooltip" testId="tooltip-card-1" />
214
+ <Card title="Card 2: within the same Tooltip" testId="tooltip-card-2" />
215
+ </VStack>
216
+ </Tooltip>
217
+ `);
218
+ const card1 = page.getByTestId("tooltip-card-1");
219
+ const card2 = page.getByTestId("tooltip-card-2");
220
+ yield (0, fixtures_1.expect)(card1).toBeVisible();
221
+ yield (0, fixtures_1.expect)(card2).toBeVisible();
222
+ // Hover over first card
223
+ yield card1.hover();
224
+ const tooltip = page.getByRole("tooltip");
225
+ yield (0, fixtures_1.expect)(tooltip.locator("em")).toContainText("example");
226
+ yield (0, fixtures_1.expect)(tooltip.locator("code")).toContainText("Tooltip");
227
+ // Move to second card - tooltip should still be visible
228
+ yield card2.hover();
229
+ yield (0, fixtures_1.expect)(tooltip).toBeVisible();
230
+ }));
231
+ (0, fixtures_1.test)("renders with 'tooltipTemplate' property", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
232
+ yield initTestBed(`
233
+ <VStack height="100px" horizontalAlignment="center">
234
+ <Tooltip side="bottom" delayDuration="${LOW_DELAY}">
235
+ <property name="tooltipTemplate">
236
+ <HStack>
237
+ <Stack width="24px" height="24px" backgroundColor="purple" testId="purple-square" />
238
+ <H2>This is a tooltip</H2>
239
+ </HStack>
240
+ </property>
241
+ <Card title="I have a templated Tooltip!" testId="template-card" />
242
+ </Tooltip>
243
+ </VStack>
244
+ `);
245
+ const card = page.getByTestId("template-card");
246
+ yield card.hover();
247
+ // Check that custom template elements are present
248
+ const tooltip = page.locator('[role="tooltip"]');
249
+ yield (0, fixtures_1.expect)(tooltip).toBeVisible();
250
+ yield (0, fixtures_1.expect)(tooltip.getByTestId("purple-square")).toBeVisible();
251
+ yield (0, fixtures_1.expect)(tooltip.getByRole("heading", { level: 2 })).toContainText("This is a tooltip");
252
+ }));
253
+ (0, fixtures_1.test)("renders with start 'align' property value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
254
+ yield initTestBed(`
255
+ <HStack horizontalAlignment="center">
256
+ <Tooltip delayDuration="${LOW_DELAY}" text="Start aligned" side="bottom" align="start">
257
+ <Button label="Start aligned Start aligned" testId="start-button" />
258
+ </Tooltip>
259
+ </HStack>
260
+ `);
261
+ const startButton = page.getByTestId("start-button");
262
+ yield startButton.hover();
263
+ const tooltipBox = yield (0, component_test_helpers_1.getBounds)(page.locator("div[data-tooltip-container]"));
264
+ const buttonBox = yield (0, component_test_helpers_1.getBounds)(startButton);
265
+ (0, fixtures_1.expect)(tooltipBox.left + tooltipBox.width / 2).toBeLessThan(buttonBox.left + buttonBox.width / 2);
266
+ }));
267
+ (0, fixtures_1.test)("renders with center 'align' property value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
268
+ yield initTestBed(`
269
+ <HStack horizontalAlignment="center">
270
+ <Tooltip delayDuration="${LOW_DELAY}" text="Center aligned" side="bottom" align="center">
271
+ <Button label="Center aligned Center aligned" testId="center-button" />
272
+ </Tooltip>
273
+ </HStack>
274
+ `);
275
+ const centerButton = page.getByTestId("center-button");
276
+ yield centerButton.hover();
277
+ const tooltipBox = yield (0, component_test_helpers_1.getBounds)(page.locator("div[data-tooltip-container]"));
278
+ const buttonBox = yield (0, component_test_helpers_1.getBounds)(centerButton);
279
+ (0, fixtures_1.expect)(tooltipBox.left + tooltipBox.width / 2).toEqualWithTolerance(buttonBox.left + buttonBox.width / 2, 10);
280
+ }));
281
+ (0, fixtures_1.test)("renders with end 'align' property value", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
282
+ yield initTestBed(`
283
+ <HStack horizontalAlignment="center">
284
+ <Tooltip delayDuration="${LOW_DELAY}" text="End aligned" side="bottom" align="end">
285
+ <Button label="End aligned End aligned" testId="end-button" />
286
+ </Tooltip>
287
+ </HStack>
288
+ `);
289
+ const endButton = page.getByTestId("end-button");
290
+ yield endButton.hover();
291
+ const tooltipBox = yield (0, component_test_helpers_1.getBounds)(page.locator("div[data-tooltip-container]"));
292
+ const buttonBox = yield (0, component_test_helpers_1.getBounds)(endButton);
293
+ (0, fixtures_1.expect)(tooltipBox.left + tooltipBox.width / 2).toBeGreaterThan(buttonBox.left + buttonBox.width / 2);
294
+ }));
295
+ (0, fixtures_1.test)("renders with 'defaultOpen' property", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
296
+ yield initTestBed(`
297
+ <Tooltip text="Always visible tooltip" defaultOpen="true" delayDuration="${LOW_DELAY}">
298
+ <Button label="Button with default open tooltip" testId="default-open-button" />
299
+ </Tooltip>
300
+ `);
301
+ yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toBeVisible();
302
+ yield (0, fixtures_1.expect)(page.getByTestId("default-open-button")).toBeVisible();
303
+ }));
304
+ });
305
+ // =============================================================================
306
+ // ACCESSIBILITY TESTS
307
+ // =============================================================================
308
+ fixtures_1.test.describe("Accessibility", () => {
309
+ (0, fixtures_1.test)("tooltip content is accessible via screen reader", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
310
+ yield initTestBed(`
311
+ <Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
312
+ <Button label="Button with default open tooltip" />
313
+ </Tooltip>
314
+ `);
315
+ // Check that tooltip has proper accessibility attributes
316
+ const tooltip = page.getByRole("tooltip");
317
+ yield (0, fixtures_1.expect)(tooltip).toBeVisible();
318
+ // Verify tooltip content is properly exposed
319
+ yield (0, fixtures_1.expect)(tooltip).toHaveText("This tooltip is accessible");
320
+ }));
321
+ });
322
+ // =============================================================================
323
+ // THEME VARIABLE TESTS
324
+ // =============================================================================
325
+ fixtures_1.test.describe("Theme Variables", () => {
326
+ (0, fixtures_1.test)("applies 'backgroundColor-Tooltip' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
327
+ yield initTestBed(`
328
+ <Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
329
+ <Button label="Button with default open tooltip" />
330
+ </Tooltip>
331
+ `, {
332
+ testThemeVars: { "backgroundColor-Tooltip": "rgb(255, 0, 0)" },
333
+ });
334
+ yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toHaveCSS("background-color", "rgb(255, 0, 0)");
335
+ }));
336
+ (0, fixtures_1.test)("applies 'textColor-Tooltip' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
337
+ yield initTestBed(`
338
+ <Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
339
+ <Button label="Button with default open tooltip" />
340
+ </Tooltip>
341
+ `, {
342
+ testThemeVars: { "textColor-Tooltip": "rgb(0, 255, 0)" },
343
+ });
344
+ yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toHaveCSS("color", "rgb(0, 255, 0)");
345
+ }));
346
+ (0, fixtures_1.test)("applies 'borderRadius-Tooltip' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
347
+ yield initTestBed(`
348
+ <Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
349
+ <Button label="Button with default open tooltip" />
350
+ </Tooltip>
351
+ `, {
352
+ testThemeVars: { "borderRadius-Tooltip": "12px" },
353
+ });
354
+ yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toHaveCSS("border-radius", "12px");
355
+ }));
356
+ (0, fixtures_1.test)("applies 'fontSize-Tooltip' theme variable", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
357
+ yield initTestBed(`
358
+ <Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
359
+ <Button label="Button with default open tooltip" />
360
+ </Tooltip>
361
+ `, {
362
+ testThemeVars: { "fontSize-Tooltip": "20px" },
363
+ });
364
+ const tooltip = page.getByRole("tooltip");
365
+ yield (0, fixtures_1.expect)(tooltip).toBeVisible();
366
+ yield (0, fixtures_1.expect)(tooltip).toHaveCSS("font-size", "20px");
367
+ }));
368
+ (0, fixtures_1.test)("applies 'paddingLeft-Tooltip' and 'paddingRight-Tooltip' theme variables", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed, }) {
369
+ yield initTestBed(`
370
+ <Tooltip text="This tooltip is accessible" defaultOpen="true" delayDuration="${LOW_DELAY}">
371
+ <Button label="Button with default open tooltip" />
372
+ </Tooltip>
373
+ `, {
374
+ testThemeVars: {
375
+ "paddingLeft-Tooltip": "20px",
376
+ "paddingRight-Tooltip": "25px",
377
+ },
378
+ });
379
+ yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toHaveCSS("padding-left", "20px");
380
+ yield (0, fixtures_1.expect)(page.locator("div[data-tooltip-container]")).toHaveCSS("padding-right", "25px");
381
+ }));
382
+ });
383
+ // =============================================================================
384
+ // OTHER EDGE CASE TESTS
385
+ // =============================================================================
386
+ fixtures_1.test.describe("Other Edge Cases", () => {
387
+ (0, fixtures_1.test)("handles empty tooltip text", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
388
+ yield initTestBed(`
389
+ <Tooltip text="" defaultOpen="true" delayDuration="${LOW_DELAY}">
390
+ <Button label="Button with empty tooltip" />
391
+ </Tooltip>
392
+ `);
393
+ // There should be no visible tooltip with meaningful content
394
+ const tooltips = page.getByRole("tooltip");
395
+ const count = yield tooltips.count();
396
+ if (count > 0) {
397
+ // If tooltip exists, it should be empty or not visible
398
+ const tooltip = tooltips.first();
399
+ const text = yield tooltip.textContent();
400
+ (0, fixtures_1.expect)(text === null || text === void 0 ? void 0 : text.trim()).toBe("");
401
+ }
402
+ }));
403
+ (0, fixtures_1.test)("handles tooltip without any content properties", (_a) => __awaiter(void 0, [_a], void 0, function* ({ page, initTestBed }) {
404
+ yield initTestBed(`
405
+ <Tooltip>
406
+ <Button label="Button in tooltip without content" testId="no-content-button" />
407
+ </Tooltip>
408
+ `);
409
+ const button = page.getByTestId("no-content-button");
410
+ yield (0, fixtures_1.expect)(button).toBeVisible();
411
+ // Hover should not show tooltip since there's no content
412
+ yield button.hover();
413
+ // Should not find any tooltip with content
414
+ const tooltips = page.getByRole("tooltip");
415
+ const count = yield tooltips.count();
416
+ (0, fixtures_1.expect)(count).toBe(0);
417
+ }));
418
+ });
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const colorSchemes = {
4
+ "set3": "set3",
5
+ "tableau10": "tableau10",
6
+ "brown_blueGreen": "brown_blueGreen",
7
+ "purpleRed_green": "purpleRed_green",
8
+ "pink_yellowGreen": "pink_yellowGreen",
9
+ "purple_orange": "purple_orange",
10
+ "red_blue": "red_blue",
11
+ "red_grey": "red_grey",
12
+ "red_yellow_blue": "red_yellow_blue",
13
+ "red_yellow_green": "red_yellow_green",
14
+ "spectral": "spectral",
15
+ "blues": "blues",
16
+ "greens": "greens",
17
+ "greys": "greys",
18
+ "oranges": "oranges",
19
+ "purples": "purples",
20
+ "reds": "reds",
21
+ "blue_green": "blue_green",
22
+ "blue_purple": "blue_purple",
23
+ "green_blue": "green_blue",
24
+ "orange_red": "orange_red",
25
+ "purple_blue_green": "purple_blue_green",
26
+ "purple_blue": "purple_blue",
27
+ "purple_red": "purple_red",
28
+ "red_purple": "red_purple",
29
+ "yellow_green_blue": "yellow_green_blue",
30
+ "yellow_green": "yellow_green",
31
+ "yellow_orange_brown": "yellow_orange_brown",
32
+ "yellow_orange_red": "yellow_orange_red",
33
+ "nivo": "nivo",
34
+ "category10": "category10",
35
+ "accent": "accent",
36
+ "dark2": "dark2",
37
+ "paired": "paired",
38
+ "pastel1": "pastel1",
39
+ "pastel2": "pastel2",
40
+ "set1": "set1",
41
+ "set2": "set2"
42
+ };
43
+ exports.default = colorSchemes;
@@ -84,7 +84,7 @@ exports.CompoundComponent = (0, react_1.forwardRef)((_a, forwardedRef) => {
84
84
  api,
85
85
  scriptCollected,
86
86
  loaders: loaders,
87
- vars: vars,
87
+ vars,
88
88
  functions: functions,
89
89
  scriptError: scriptError,
90
90
  containerUid: uid,
@@ -52,23 +52,100 @@ const process_statement_sync_1 = require("./script-runner/process-statement-sync
52
52
  function isAxiosResponse(response) {
53
53
  return "data" in response;
54
54
  }
55
- function parseResponseJson(response_1) {
55
+ function getContentType(response) {
56
+ if (isAxiosResponse(response)) {
57
+ return response.headers['content-type'] || response.headers['Content-Type'] || '';
58
+ }
59
+ else {
60
+ return response.headers.get('content-type') || '';
61
+ }
62
+ }
63
+ // --- Tests for the most common binary types
64
+ function isBinaryContentType(contentType) {
65
+ const binaryTypes = [
66
+ // Images
67
+ 'image/',
68
+ // Audio
69
+ 'audio/',
70
+ // Video
71
+ 'video/',
72
+ // Documents
73
+ 'application/pdf',
74
+ 'application/msword',
75
+ 'application/vnd.openxmlformats-officedocument.',
76
+ 'application/vnd.ms-excel',
77
+ 'application/vnd.ms-powerpoint',
78
+ // Archives
79
+ 'application/zip',
80
+ 'application/x-rar-compressed',
81
+ 'application/x-tar',
82
+ 'application/gzip',
83
+ 'application/x-7z-compressed',
84
+ // Other binary
85
+ 'application/octet-stream',
86
+ 'application/x-binary',
87
+ ];
88
+ return binaryTypes.some(type => contentType.toLowerCase().includes(type.toLowerCase()));
89
+ }
90
+ // --- Tests if a particular content type returns an ArrayBuffer
91
+ function shouldReturnAsArrayBuffer(contentType) {
92
+ const arrayBufferTypes = [
93
+ 'application/zip',
94
+ 'application/x-rar-compressed',
95
+ 'application/x-tar',
96
+ 'application/gzip',
97
+ 'application/x-7z-compressed',
98
+ 'application/octet-stream',
99
+ 'application/x-binary',
100
+ ];
101
+ return arrayBufferTypes.some(type => contentType.toLowerCase().includes(type.toLowerCase()));
102
+ }
103
+ function parseResponseBody(response_1) {
56
104
  return __awaiter(this, arguments, void 0, function* (response, logError = false) {
57
105
  let resp;
58
106
  if (isAxiosResponse(response)) {
59
107
  resp = response.data;
60
108
  }
61
109
  else {
62
- try {
63
- resp = yield response.clone().json();
64
- }
65
- catch (e) {
110
+ const contentType = getContentType(response);
111
+ // Handle binary content types
112
+ if (isBinaryContentType(contentType)) {
66
113
  try {
67
- resp = yield response.clone().text();
114
+ if (shouldReturnAsArrayBuffer(contentType)) {
115
+ resp = yield response.clone().arrayBuffer();
116
+ }
117
+ else {
118
+ resp = yield response.clone().blob();
119
+ }
68
120
  }
69
121
  catch (e) {
70
122
  if (logError) {
71
- console.error("Failed to parse response as text or JSON", response.body);
123
+ console.error("Failed to parse binary response", e, contentType);
124
+ }
125
+ // Fallback to text if binary parsing fails
126
+ try {
127
+ resp = yield response.clone().text();
128
+ }
129
+ catch (textError) {
130
+ if (logError) {
131
+ console.error("Failed to parse response as text after binary parsing failed", textError);
132
+ }
133
+ }
134
+ }
135
+ }
136
+ else {
137
+ // Handle text-based content types (JSON, text, etc.)
138
+ try {
139
+ resp = yield response.clone().json();
140
+ }
141
+ catch (e) {
142
+ try {
143
+ resp = yield response.clone().text();
144
+ }
145
+ catch (e) {
146
+ if (logError) {
147
+ console.error("Failed to parse response as text or JSON", response.body);
148
+ }
72
149
  }
73
150
  }
74
151
  }
@@ -325,7 +402,7 @@ class RestApiProxy {
325
402
  }
326
403
  });
327
404
  this.tryParseResponse = (response_1, ...args_1) => __awaiter(this, [response_1, ...args_1], void 0, function* (response, logError = false) {
328
- return yield parseResponseJson(response, logError);
405
+ return yield parseResponseBody(response, logError);
329
406
  });
330
407
  this.raiseError = (response) => __awaiter(this, void 0, void 0, function* () {
331
408
  if ("config" in response) {
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.InspectorDialogVisibilityContext = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ exports.InspectorDialogVisibilityContext = react_1.default.createContext(null);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createComponentRenderer = createComponentRenderer;
4
4
  exports.createPropHolderComponent = createPropHolderComponent;
5
5
  exports.createLoaderRenderer = createLoaderRenderer;
6
+ exports.createUserDefinedComponentRenderer = createUserDefinedComponentRenderer;
6
7
  /**
7
8
  * This helper function creates a component renderer definition from its arguments.
8
9
  * @param type The unique identifier of the component definition
@@ -43,3 +44,33 @@ function createLoaderRenderer(type, renderer, hints) {
43
44
  hints,
44
45
  };
45
46
  }
47
+ /**
48
+ * This helper function creates a user defined component renderer definition from its arguments.
49
+ * @param metadata The metadata of the user-defined component
50
+ * @param componentMarkup The XMLUI markup that defines the user-defined component
51
+ * @param codeBehind Optional code-behind script that contains variable and function definitions
52
+ * used by the component
53
+ * @returns The view renderer definition composed of the arguments
54
+ */
55
+ function createUserDefinedComponentRenderer(metadata, def, codeBehind) {
56
+ var _a, _b;
57
+ // --- Parse the component definition from the markup
58
+ // --- Parse the optional code-behind script
59
+ const component = def.component.component;
60
+ ;
61
+ if (codeBehind) {
62
+ if (codeBehind.vars) {
63
+ (_a = component.vars) !== null && _a !== void 0 ? _a : (component.vars = {});
64
+ component.vars = Object.assign(Object.assign({}, component.vars), codeBehind.vars);
65
+ }
66
+ if (codeBehind.functions) {
67
+ (_b = component.functions) !== null && _b !== void 0 ? _b : (component.functions = {});
68
+ component.functions = Object.assign(Object.assign({}, component.functions), codeBehind.functions);
69
+ }
70
+ }
71
+ // --- Done.
72
+ return {
73
+ compoundComponentDef: def.component,
74
+ metadata,
75
+ };
76
+ }