composite-select 1.0.0

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 (105) hide show
  1. package/README.md +5 -0
  2. package/commitlint.config.js +3 -0
  3. package/composition/composite-select/CompositeManager.js +43 -0
  4. package/composition/composite-select/composite-select.js +199 -0
  5. package/composition/composite-select/debounce.js +10 -0
  6. package/composition/composite-select/helpers.js +96 -0
  7. package/composition/composite-select/react.js +189 -0
  8. package/composition/container/ContainerManager.js +76 -0
  9. package/composition/img/ai.png +0 -0
  10. package/composition/img/chatgpt.png +0 -0
  11. package/composition/img/claude.png +0 -0
  12. package/composition/img/gemini.png +0 -0
  13. package/composition/img/gmail.png +0 -0
  14. package/composition/img/google_calendar.png +0 -0
  15. package/composition/img/google_drive.png +0 -0
  16. package/composition/img/google_keep.png +0 -0
  17. package/composition/img/img.json +5 -0
  18. package/composition/img/perplexity.png +0 -0
  19. package/composition/img/t3chat.png +0 -0
  20. package/composition/img/timeanddate.png +0 -0
  21. package/composition/img/tools.png +0 -0
  22. package/composition/img/youtube.png +0 -0
  23. package/composition/options-section/OptionsSectionManager.css +263 -0
  24. package/composition/options-section/OptionsSectionManager.js +486 -0
  25. package/composition/options-section/options-section.js +245 -0
  26. package/composition/options-section/react.js +90 -0
  27. package/composition/selected-section/SelectedSectionManager.css +214 -0
  28. package/composition/selected-section/SelectedSectionManager.js +336 -0
  29. package/composition/selected-section/react.js +91 -0
  30. package/composition/selected-section/selected-section.js +207 -0
  31. package/composition/unbind/clickOutside.js +17 -0
  32. package/diff/coreBundle.patch +13 -0
  33. package/diff/recorderApp.patch +13 -0
  34. package/dist/cjs/Module.cjs +15 -0
  35. package/dist/cjs/composite-select/CompositeManager.js +43 -0
  36. package/dist/cjs/composite-select/composite-select.js +199 -0
  37. package/dist/cjs/composite-select/debounce.js +10 -0
  38. package/dist/cjs/composite-select/helpers.js +96 -0
  39. package/dist/cjs/composite-select/react.js +189 -0
  40. package/dist/cjs/container/ContainerManager.js +76 -0
  41. package/dist/cjs/createSubscriber.cjs +48 -0
  42. package/dist/cjs/options-section/OptionsSectionManager.js +486 -0
  43. package/dist/cjs/options-section/options-section.js +245 -0
  44. package/dist/cjs/options-section/react.js +90 -0
  45. package/dist/cjs/selected-section/SelectedSectionManager.js +336 -0
  46. package/dist/cjs/selected-section/react.js +91 -0
  47. package/dist/cjs/selected-section/selected-section.js +207 -0
  48. package/dist/cjs/types.cjs +1 -0
  49. package/dist/cjs/unbind/clickOutside.js +17 -0
  50. package/dist/esm/Module.js +15 -0
  51. package/dist/esm/composite-select/CompositeManager.js +43 -0
  52. package/dist/esm/composite-select/composite-select.js +199 -0
  53. package/dist/esm/composite-select/debounce.js +10 -0
  54. package/dist/esm/composite-select/helpers.js +96 -0
  55. package/dist/esm/composite-select/react.js +189 -0
  56. package/dist/esm/container/ContainerManager.js +76 -0
  57. package/dist/esm/createSubscriber.js +48 -0
  58. package/dist/esm/options-section/OptionsSectionManager.js +486 -0
  59. package/dist/esm/options-section/options-section.js +245 -0
  60. package/dist/esm/options-section/react.js +90 -0
  61. package/dist/esm/selected-section/SelectedSectionManager.js +336 -0
  62. package/dist/esm/selected-section/react.js +91 -0
  63. package/dist/esm/selected-section/selected-section.js +207 -0
  64. package/dist/esm/types.js +1 -0
  65. package/dist/esm/unbind/clickOutside.js +17 -0
  66. package/dist/types/Module.d.ts +15 -0
  67. package/dist/types/composite-select/CompositeManager.d.ts +21 -0
  68. package/dist/types/composite-select/ContainerManager.html.d.ts +1 -0
  69. package/dist/types/composite-select/composite-select.d.ts +26 -0
  70. package/dist/types/composite-select/composite-select.html.d.ts +1 -0
  71. package/dist/types/composite-select/debounce.d.ts +1 -0
  72. package/dist/types/composite-select/helpers.d.ts +38 -0
  73. package/dist/types/composite-select/namesSource.d.ts +4 -0
  74. package/dist/types/composite-select/react.d.ts +61 -0
  75. package/dist/types/composite-select/urlManager.d.ts +49 -0
  76. package/dist/types/composite-select/urlManagerWc.d.ts +44 -0
  77. package/dist/types/container/ContainerManager.d.ts +33 -0
  78. package/dist/types/createSubscriber.d.ts +26 -0
  79. package/dist/types/options-section/OptionsSectionManager.d.ts +117 -0
  80. package/dist/types/options-section/OptionsSectionManager.html.d.ts +1 -0
  81. package/dist/types/options-section/OptionsSectionManagerWebComponent.attributes.html.d.ts +1 -0
  82. package/dist/types/options-section/OptionsSectionManagerWebComponent.html.d.ts +1 -0
  83. package/dist/types/options-section/OptionsSectionManagerWebComponent.nocssrequest.html.d.ts +1 -0
  84. package/dist/types/options-section/options-section.d.ts +67 -0
  85. package/dist/types/options-section/react.d.ts +27 -0
  86. package/dist/types/options-section/urlManager.d.ts +28 -0
  87. package/dist/types/selected-section/SelectedSectionManager.d.ts +89 -0
  88. package/dist/types/selected-section/SelectedSectionManager.html.d.ts +1 -0
  89. package/dist/types/selected-section/SelectedSectionManager.templates.html.d.ts +1 -0
  90. package/dist/types/selected-section/SelectedSectionManagerWebComponent.attributes.html.d.ts +1 -0
  91. package/dist/types/selected-section/SelectedSectionManagerWebComponent.html.d.ts +1 -0
  92. package/dist/types/selected-section/SelectedSectionManagerWebComponent.nocssrequest.html.d.ts +1 -0
  93. package/dist/types/selected-section/react.d.ts +32 -0
  94. package/dist/types/selected-section/selected-section.d.ts +54 -0
  95. package/dist/types/selected-section/urlManager.d.ts +25 -0
  96. package/dist/types/types.d.ts +9 -0
  97. package/dist/types/unbind/clickOutside.d.ts +1 -0
  98. package/floating-label-pattern.css +502 -0
  99. package/js/CenterAndHeightResizer.js +263 -0
  100. package/js/CenterResizer.js +190 -0
  101. package/madooei.tar.gz +0 -0
  102. package/package.json +28 -0
  103. package/release.config.js +3 -0
  104. package/test/lib.d.ts +6 -0
  105. package/test/lib.js +30 -0
@@ -0,0 +1,263 @@
1
+ /**
2
+ * <center-and-height-resizer
3
+ * left="50px"
4
+ * center="350px"
5
+ * height="200px"
6
+ * style="padding: 12px;"
7
+ * data-test="idfortest"
8
+ * >
9
+ * <div>Content</div>
10
+ * </center-and-height-resizer>
11
+ *
12
+ * const resizer = document.querySelector('center-and-height-resizer');
13
+ * resizer.addEventListener('onLeft', e => console.log(e.detail.width));
14
+ * resizer.addEventListener('onCenter', e => console.log(e.detail.width));
15
+ * resizer.addEventListener('onHeight', e => console.log(e.detail.height));
16
+ */
17
+ const SKIP_ATTRIBUTES = ["id", "class", "left", "center", "height", "style"];
18
+ class CenterAndHeightResizer extends HTMLElement {
19
+ leftDiv;
20
+ rightDiv;
21
+ centerDiv;
22
+ resizerLeft;
23
+ resizerRight;
24
+ resizerBottom;
25
+ constructor() {
26
+ super();
27
+ this.attachShadow({ mode: "open" });
28
+ this.shadowRoot.innerHTML = `
29
+ <style>
30
+ :host {
31
+ display: block;
32
+ width: 100%;
33
+ padding: 0 !important;
34
+ }
35
+ .flex {
36
+ display: flex;
37
+ width: 100%;
38
+ align-items: stretch;
39
+ }
40
+ .center-column {
41
+ display: flex;
42
+ flex-direction: column;
43
+ min-width: 0;
44
+ }
45
+ .center-div {
46
+ flex-grow: 1;
47
+ min-width: 0;
48
+ box-sizing: border-box;
49
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.1);
50
+ background: #fff;
51
+ border-radius: 6px;
52
+ overflow: auto;
53
+ min-height: 50px;
54
+ border: 1px solid #eaeaea;
55
+ }
56
+ .side-div {
57
+ flex-shrink: 0;
58
+ box-sizing: border-box;
59
+ }
60
+ #right-div {
61
+ flex-grow: 1;
62
+ }
63
+ .resizer {
64
+ flex-shrink: 0;
65
+ transition: background 0.2s;
66
+ user-select: none;
67
+ position: relative;
68
+ }
69
+ .resizer.horizontal {
70
+ width: 8px;
71
+ cursor: col-resize;
72
+ }
73
+ .resizer.vertical {
74
+ height: 8px;
75
+ cursor: row-resize;
76
+ width: 100%;
77
+ }
78
+ .resizer:hover,
79
+ .resizer.active {
80
+ background: rgba(26, 115, 232, 0.12);
81
+ }
82
+ .resizer::after {
83
+ content: "";
84
+ position: absolute;
85
+ background: #ccc;
86
+ transition: background 0.2s;
87
+ }
88
+ .resizer.horizontal::after {
89
+ left: 50%;
90
+ top: 0;
91
+ bottom: 0;
92
+ width: 14px;
93
+ transform: translateX(-50%);
94
+ }
95
+ .resizer.vertical::after {
96
+ top: 50%;
97
+ left: 0;
98
+ right: 0;
99
+ height: 14px;
100
+ transform: translateY(-50%);
101
+ }
102
+ .resizer:hover::after,
103
+ .resizer.active::after {
104
+ background: #1a73e8;
105
+ }
106
+
107
+ #resizer-left {
108
+ margin-right: 5px;
109
+ }
110
+ #resizer-right {
111
+ margin-left: 5px;
112
+ }
113
+ #resizer-bottom {
114
+ margin-top: 5px;
115
+ }
116
+ </style>
117
+ <div class="flex">
118
+ <div class="side-div" id="left-div"></div>
119
+ <div class="resizer horizontal" id="resizer-left"></div>
120
+ <div class="center-column">
121
+ <div class="center-div" id="center-div">
122
+ <slot></slot>
123
+ </div>
124
+ <div class="resizer vertical" id="resizer-bottom"></div>
125
+ </div>
126
+ <div class="resizer horizontal" id="resizer-right"></div>
127
+ <div class="side-div" id="right-div"></div>
128
+ </div>
129
+ `;
130
+ }
131
+ static get observedAttributes() {
132
+ return SKIP_ATTRIBUTES.filter((attr) => !["id", "class"].includes(attr));
133
+ }
134
+ attributeChangedCallback(name, oldValue, newValue) {
135
+ if (oldValue === newValue) return;
136
+ if (!this.leftDiv) return;
137
+ // Not connected yet
138
+ switch (name) {
139
+ case "left":
140
+ this.leftDiv.style.width = newValue;
141
+ break;
142
+ case "center":
143
+ this.centerDiv.style.width = newValue;
144
+ break;
145
+ case "height":
146
+ this.centerDiv.style.height = newValue;
147
+ break;
148
+ case "style":
149
+ this.centerDiv.style.cssText = newValue;
150
+ this._applyInternalStylesToCenterDiv();
151
+ break;
152
+ }
153
+ }
154
+ connectedCallback() {
155
+ this.leftDiv = this.shadowRoot.getElementById("left-div");
156
+ this.rightDiv = this.shadowRoot.getElementById("right-div");
157
+ this.centerDiv = this.shadowRoot.getElementById("center-div");
158
+ this.resizerLeft = this.shadowRoot.getElementById("resizer-left");
159
+ this.resizerRight = this.shadowRoot.getElementById("resizer-right");
160
+ this.resizerBottom = this.shadowRoot.getElementById("resizer-bottom");
161
+ const attrLeft = this.getAttribute("left");
162
+ const attrCenter = this.getAttribute("center");
163
+ const attrHeight = this.getAttribute("height");
164
+ if (attrLeft) {
165
+ this.leftDiv.style.width = attrLeft;
166
+ }
167
+ if (attrCenter) {
168
+ this.centerDiv.style.width = attrCenter;
169
+ }
170
+ if (attrHeight) {
171
+ this.centerDiv.style.height = attrHeight;
172
+ }
173
+ this.setupResizer(this.resizerLeft, this.leftDiv, "left", false);
174
+ this.setupResizer(this.resizerRight, this.centerDiv, "center", false);
175
+ this.setupHeightResizer(this.resizerBottom, this.centerDiv);
176
+ this._initForwarding();
177
+ }
178
+ _applyInternalStylesToCenterDiv() {
179
+ const center = this.getAttribute("center");
180
+ if (center) this.centerDiv.style.width = center;
181
+ const height = this.getAttribute("height");
182
+ if (height) this.centerDiv.style.height = height;
183
+ }
184
+ _initForwarding() {
185
+ const observer = new MutationObserver((mutations) => {
186
+ let syncNeeded = false;
187
+ for (const mutation of mutations) {
188
+ if (mutation.type === "attributes") {
189
+ if (!SKIP_ATTRIBUTES.includes(mutation.attributeName)) {
190
+ syncNeeded = true;
191
+ break;
192
+ }
193
+ }
194
+ }
195
+ if (syncNeeded) this._syncAttributes();
196
+ });
197
+ observer.observe(this, { attributes: true });
198
+ this._syncAttributes();
199
+ }
200
+ _syncAttributes() {
201
+ for (const attr of Array.from(this.attributes)) {
202
+ if (SKIP_ATTRIBUTES.includes(attr.name)) continue;
203
+ this.centerDiv.setAttribute(attr.name, attr.value);
204
+ }
205
+ if (this.hasAttribute("style")) {
206
+ this.centerDiv.style.cssText = this.getAttribute("style") || "";
207
+ this._applyInternalStylesToCenterDiv();
208
+ }
209
+ }
210
+ getContentRoot() {
211
+ return this.centerDiv || this.shadowRoot.getElementById("center-div");
212
+ }
213
+ setupResizer(handle, target, attrName, invert) {
214
+ handle.addEventListener("mousedown", (e) => {
215
+ e.preventDefault();
216
+ handle.classList.add("active");
217
+ const startX = e.clientX;
218
+ const startWidth = target.offsetWidth;
219
+ const onMouseMove = (moveEvent) => {
220
+ let diff = moveEvent.clientX - startX;
221
+ if (invert) diff = -diff;
222
+ let newWidth = startWidth + diff;
223
+ newWidth = Math.max(0, newWidth);
224
+ target.style.width = newWidth + "px";
225
+ this.setAttribute(attrName, newWidth + "px");
226
+ const eventName = attrName === "left" ? "onLeft" : "onCenter";
227
+ this.dispatchEvent(new CustomEvent(eventName, { detail: { width: newWidth } }));
228
+ };
229
+ const onMouseUp = () => {
230
+ handle.classList.remove("active");
231
+ document.removeEventListener("mousemove", onMouseMove);
232
+ document.removeEventListener("mouseup", onMouseUp);
233
+ };
234
+ document.addEventListener("mousemove", onMouseMove);
235
+ document.addEventListener("mouseup", onMouseUp);
236
+ });
237
+ }
238
+ setupHeightResizer(handle, target) {
239
+ handle.addEventListener("mousedown", (e) => {
240
+ e.preventDefault();
241
+ handle.classList.add("active");
242
+ const startY = e.clientY;
243
+ const startHeight = target.offsetHeight;
244
+ const onMouseMove = (moveEvent) => {
245
+ const diff = moveEvent.clientY - startY;
246
+ let newHeight = startHeight + diff;
247
+ newHeight = Math.max(0, newHeight);
248
+ target.style.height = newHeight + "px";
249
+ this.setAttribute("height", newHeight + "px");
250
+ this.dispatchEvent(new CustomEvent("onHeight", { detail: { height: newHeight } }));
251
+ };
252
+ const onMouseUp = () => {
253
+ handle.classList.remove("active");
254
+ document.removeEventListener("mousemove", onMouseMove);
255
+ document.removeEventListener("mouseup", onMouseUp);
256
+ };
257
+ document.addEventListener("mousemove", onMouseMove);
258
+ document.addEventListener("mouseup", onMouseUp);
259
+ });
260
+ }
261
+ }
262
+ customElements.define("center-and-height-resizer", CenterAndHeightResizer);
263
+ export { CenterAndHeightResizer };
@@ -0,0 +1,190 @@
1
+ /**
2
+ * <center-resizer
3
+ * left="50px"
4
+ * center="350px"
5
+ * style="padding: 12px;"
6
+ * data-test="idfortest"
7
+ * >
8
+ * <div>Content</div>
9
+ * </center-resizer>
10
+ *
11
+ * const resizer = document.querySelector('center-resizer');
12
+ * resizer.addEventListener('onLeft', e => console.log(e.detail.width));
13
+ * resizer.addEventListener('onCenter', e => console.log(e.detail.width));
14
+ */
15
+ const SKIP_ATTRIBUTES = ["id", "class", "left", "center", "style"];
16
+ class CenterResizer extends HTMLElement {
17
+ leftDiv;
18
+ centerDiv;
19
+ rightDiv;
20
+ resizerLeft;
21
+ resizerRight;
22
+ constructor() {
23
+ super();
24
+ this.attachShadow({ mode: "open" });
25
+ this.shadowRoot.innerHTML = `
26
+ <style>
27
+ :host {
28
+ display: block;
29
+ width: 100%;
30
+ padding: 0 !important;
31
+ }
32
+ .flex {
33
+ display: flex;
34
+ width: 100%;
35
+ align-items: stretch;
36
+ }
37
+ .center-div {
38
+ flex-shrink: 0;
39
+ min-width: 0;
40
+ padding-left: 15px;
41
+ padding-right: 15px;
42
+ box-sizing: border-box;
43
+ }
44
+ .side-div {
45
+ flex-shrink: 0;
46
+ box-sizing: border-box;
47
+ }
48
+ #right-div {
49
+ flex-grow: 1;
50
+ }
51
+ .resizer {
52
+ width: 8px;
53
+ cursor: col-resize;
54
+ flex-shrink: 0;
55
+ transition: background 0.2s;
56
+ user-select: none;
57
+ margin: 0 -4px;
58
+ position: relative;
59
+ }
60
+ .resizer:hover,
61
+ .resizer.active {
62
+ background: rgba(26, 115, 232, 0.2);
63
+ }
64
+ .resizer::after {
65
+ content: "";
66
+ position: absolute;
67
+ left: 50%;
68
+ top: 0;
69
+ bottom: 0;
70
+ width: 2px;
71
+ background: #ccc;
72
+ transform: translateX(-50%);
73
+ }
74
+ .resizer:hover::after,
75
+ .resizer.active::after {
76
+ background: #1a73e8;
77
+ }
78
+ </style>
79
+ <div class="flex">
80
+ <div class="side-div" id="left-div"></div>
81
+ <div class="resizer" id="resizer-left"></div>
82
+ <div class="center-div" id="center-div">
83
+ <slot></slot>
84
+ </div>
85
+ <div class="resizer" id="resizer-right"></div>
86
+ <div class="side-div" id="right-div"></div>
87
+ </div>
88
+ `;
89
+ }
90
+ static get observedAttributes() {
91
+ return SKIP_ATTRIBUTES.filter((attr) => !["id", "class"].includes(attr));
92
+ }
93
+ attributeChangedCallback(name, oldValue, newValue) {
94
+ if (oldValue === newValue) return;
95
+ if (!this.centerDiv) return;
96
+ switch (name) {
97
+ case "left":
98
+ this.leftDiv.style.width = newValue;
99
+ break;
100
+ case "center":
101
+ this.centerDiv.style.width = newValue;
102
+ break;
103
+ case "style":
104
+ this.centerDiv.style.cssText = newValue;
105
+ this._applyInternalStylesToCenterDiv();
106
+ break;
107
+ }
108
+ }
109
+ connectedCallback() {
110
+ this.leftDiv = this.shadowRoot.getElementById("left-div");
111
+ this.centerDiv = this.shadowRoot.getElementById("center-div");
112
+ this.rightDiv = this.shadowRoot.getElementById("right-div");
113
+ this.resizerLeft = this.shadowRoot.getElementById("resizer-left");
114
+ this.resizerRight = this.shadowRoot.getElementById("resizer-right");
115
+ const attrLeft = this.getAttribute("left");
116
+ const attrCenter = this.getAttribute("center");
117
+ if (attrLeft) {
118
+ this.leftDiv.style.width = attrLeft;
119
+ }
120
+ if (attrCenter) {
121
+ this.centerDiv.style.width = attrCenter;
122
+ }
123
+ this.setupResizer(this.resizerLeft, this.leftDiv, "left");
124
+ this.setupResizer(this.resizerRight, this.centerDiv, "center");
125
+ this._initForwarding();
126
+ }
127
+ _applyInternalStylesToCenterDiv() {
128
+ const center = this.getAttribute("center");
129
+ if (center) this.centerDiv.style.width = center;
130
+ }
131
+ _initForwarding() {
132
+ const observer = new MutationObserver((mutations) => {
133
+ let syncNeeded = false;
134
+ for (const mutation of mutations) {
135
+ if (mutation.type === "attributes") {
136
+ if (!SKIP_ATTRIBUTES.includes(mutation.attributeName)) {
137
+ syncNeeded = true;
138
+ break;
139
+ }
140
+ }
141
+ }
142
+ if (syncNeeded) this._syncAttributes();
143
+ });
144
+ observer.observe(this, { attributes: true });
145
+ this._syncAttributes();
146
+ }
147
+ _syncAttributes() {
148
+ for (const attr of Array.from(this.attributes)) {
149
+ if (SKIP_ATTRIBUTES.includes(attr.name)) continue;
150
+ this.centerDiv.setAttribute(attr.name, attr.value);
151
+ }
152
+ if (this.hasAttribute("style")) {
153
+ this.centerDiv.style.cssText = this.getAttribute("style") || "";
154
+ this._applyInternalStylesToCenterDiv();
155
+ }
156
+ }
157
+ getContentRoot() {
158
+ return this.centerDiv || this.shadowRoot.getElementById("center-div");
159
+ }
160
+ setupResizer(handle, target, attributeName) {
161
+ handle.addEventListener("mousedown", (e) => {
162
+ e.preventDefault();
163
+ handle.classList.add("active");
164
+ const startX = e.clientX;
165
+ const startWidth = target.offsetWidth;
166
+ const onMouseMove = (moveEvent) => {
167
+ let diff = moveEvent.clientX - startX;
168
+ let newWidth = startWidth + diff;
169
+ newWidth = Math.max(0, newWidth);
170
+ target.style.width = newWidth + "px";
171
+ if (attributeName === "center") {
172
+ this.setAttribute("center", newWidth + "px");
173
+ this.dispatchEvent(new CustomEvent("onCenter", { detail: { width: newWidth } }));
174
+ } else {
175
+ this.setAttribute("left", newWidth + "px");
176
+ this.dispatchEvent(new CustomEvent("onLeft", { detail: { width: newWidth } }));
177
+ }
178
+ };
179
+ const onMouseUp = () => {
180
+ handle.classList.remove("active");
181
+ document.removeEventListener("mousemove", onMouseMove);
182
+ document.removeEventListener("mouseup", onMouseUp);
183
+ };
184
+ document.addEventListener("mousemove", onMouseMove);
185
+ document.addEventListener("mouseup", onMouseUp);
186
+ });
187
+ }
188
+ }
189
+ customElements.define("center-resizer", CenterResizer);
190
+ export { CenterResizer };
package/madooei.tar.gz ADDED
Binary file
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "type": "module",
3
+ "version": "1.0.0",
4
+ "name": "composite-select",
5
+ "main": "./dist/esm/Module.js",
6
+ "types": "./dist/types/Module.d.ts",
7
+ "module": "./dist/esm/Module.js",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/types/Module.d.ts",
11
+ "import": "./dist/esm/Module.js",
12
+ "require": "./dist/cjs/Module.cjs"
13
+ },
14
+ "./package.json": "./package.json",
15
+ "./*.css": "./*.css",
16
+ "./*.json": "./*.json",
17
+ "./*.png": "./*.png",
18
+ "./*.jpg": "./*.jpg",
19
+ "./*.svg": "./*.svg",
20
+ "./composition/*": "./composition/*",
21
+ "./*": {
22
+ "types": "./dist/types/*.d.ts",
23
+ "import": "./dist/esm/*.js",
24
+ "require": "./dist/cjs/*.js",
25
+ "default": "./*"
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,3 @@
1
+ export default {
2
+ preset: "conventionalcommits",
3
+ };
package/test/lib.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ import { type Page } from "@playwright/test";
2
+ export declare function softNavigate(page: Page, url: string): Promise<void>;
3
+ export declare function querySelector(page: Page, selector: string): Promise<import("playwright-core").Locator>;
4
+ export declare function clickSelector(page: Page, selector: string): Promise<void>;
5
+ export declare function prepare(page: Page, link: string): Promise<void>;
6
+ export declare function compareSelectedItems(page: Page, selector: string, data: string | any[], decodeJson?: boolean): Promise<void>;
package/test/lib.js ADDED
@@ -0,0 +1,30 @@
1
+ import { expect } from "@playwright/test";
2
+ export async function softNavigate(page, url) {
3
+ await page.evaluate((url) => {
4
+ window.history.pushState({}, "", url);
5
+ window.dispatchEvent(new PopStateEvent("popstate", { state: {} }));
6
+ }, url);
7
+ }
8
+ export async function querySelector(page, selector) {
9
+ const linkLocator = page.locator(selector);
10
+ await expect(linkLocator).toHaveCount(1);
11
+ return linkLocator;
12
+ }
13
+ export async function clickSelector(page, selector) {
14
+ const selectorLocator = await querySelector(page, selector);
15
+ await selectorLocator.click();
16
+ }
17
+ export async function prepare(page, link) {
18
+ await page.goto("/vite-project/dist/");
19
+ const linkLocator = await querySelector(page, link);
20
+ await expect(linkLocator).toHaveText("CompositeSelect Manager Demo");
21
+ }
22
+ export async function compareSelectedItems(page, selector, data, decodeJson = true) {
23
+ const selectedItems = await querySelector(page, selector);
24
+ // then extract innerHTML and parse as JSON
25
+ let content = await selectedItems.innerHTML();
26
+ if (decodeJson) {
27
+ content = JSON.parse(content);
28
+ }
29
+ expect(content).toEqual(data);
30
+ }