@mostfeatured/dbi 0.2.11 → 0.2.12
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.
- package/dist/src/types/Components/HTMLComponentsV2/parser.d.ts.map +1 -1
- package/dist/src/types/Components/HTMLComponentsV2/parser.js +10 -3
- package/dist/src/types/Components/HTMLComponentsV2/parser.js.map +1 -1
- package/dist/src/types/Components/HTMLComponentsV2/svelteRenderer.js +2 -2
- package/dist/src/types/Components/HTMLComponentsV2/svelteRenderer.js.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/llm.txt +1088 -0
- package/package.json +1 -1
- package/src/types/Components/HTMLComponentsV2/parser.ts +10 -3
- package/src/types/Components/HTMLComponentsV2/svelteRenderer.ts +2 -2
- package/test/index.ts +1 -1
package/package.json
CHANGED
|
@@ -100,9 +100,10 @@ function parseStringSelect(dbi: DBI<NamespaceEnums>, dbiName: string, stringSele
|
|
|
100
100
|
let minValues = parseInt(stringSelect.getAttribute("min-values"));
|
|
101
101
|
let maxValues = parseInt(stringSelect.getAttribute("max-values"));
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
// Support both <option> and <select-option> elements (Svelte may output either)
|
|
104
|
+
let options = Array.from(stringSelect.querySelectorAll("option, select-option")).map(option => {
|
|
104
105
|
return {
|
|
105
|
-
label: getCleanTextContent(option),
|
|
106
|
+
label: option.getAttribute("label") || getCleanTextContent(option),
|
|
106
107
|
value: option.getAttribute("value"),
|
|
107
108
|
description: option.getAttribute("description"),
|
|
108
109
|
emoji: option.getAttribute("emoji"),
|
|
@@ -125,7 +126,8 @@ function parseNonStringSelect(dbi: DBI<NamespaceEnums>, dbiName: string, userSel
|
|
|
125
126
|
let minValues = parseInt(userSelect.getAttribute("min-values"));
|
|
126
127
|
let maxValues = parseInt(userSelect.getAttribute("max-values"));
|
|
127
128
|
|
|
128
|
-
|
|
129
|
+
// Support both <option> and <select-option> elements (Svelte may output either)
|
|
130
|
+
let options = Array.from(userSelect.querySelectorAll("option, select-option")).map(option => {
|
|
129
131
|
return {
|
|
130
132
|
id: getCleanTextContent(option) || option.getAttribute("id"),
|
|
131
133
|
type: option.getAttribute("type")
|
|
@@ -264,14 +266,19 @@ function parseElement(dbi: DBI<NamespaceEnums>, dbiName: string, element: Elemen
|
|
|
264
266
|
case "BUTTON":
|
|
265
267
|
return parseButton(dbi, dbiName, element);
|
|
266
268
|
case "STRING-SELECT":
|
|
269
|
+
case "STRING-SELECT-MENU":
|
|
267
270
|
return parseStringSelect(dbi, dbiName, element);
|
|
268
271
|
case "USER-SELECT":
|
|
272
|
+
case "USER-SELECT-MENU":
|
|
269
273
|
return parseNonStringSelect(dbi, dbiName, element, ComponentType.UserSelect);
|
|
270
274
|
case "ROLE-SELECT":
|
|
275
|
+
case "ROLE-SELECT-MENU":
|
|
271
276
|
return parseNonStringSelect(dbi, dbiName, element, ComponentType.RoleSelect);
|
|
272
277
|
case "MENTIONABLE-SELECT":
|
|
278
|
+
case "MENTIONABLE-SELECT-MENU":
|
|
273
279
|
return parseNonStringSelect(dbi, dbiName, element, ComponentType.MentionableSelect);
|
|
274
280
|
case "CHANNEL-SELECT":
|
|
281
|
+
case "CHANNEL-SELECT-MENU":
|
|
275
282
|
return parseNonStringSelect(dbi, dbiName, element, ComponentType.ChannelSelect);
|
|
276
283
|
case "SECTION":
|
|
277
284
|
return parseSection(dbi, dbiName, element);
|
|
@@ -87,8 +87,8 @@ export async function renderSvelteComponent(
|
|
|
87
87
|
if (attrs.includes('data-1:')) return match;
|
|
88
88
|
return `<button${attrs} data-1:ref="${stateRefId}">`;
|
|
89
89
|
});
|
|
90
|
-
// Also handle select elements
|
|
91
|
-
html = html.replace(/<(string-select
|
|
90
|
+
// Also handle select elements (with optional -menu suffix for Svelte compatibility)
|
|
91
|
+
html = html.replace(/<(string-select(?:-menu)?|user-select(?:-menu)?|role-select(?:-menu)?|channel-select(?:-menu)?|mentionable-select(?:-menu)?)([^>]*name="[^"]*"[^>]*)>/g, (match, tag, attrs) => {
|
|
92
92
|
if (attrs.includes('data-1:')) return match;
|
|
93
93
|
return `<${tag}${attrs} data-1:ref="${stateRefId}">`;
|
|
94
94
|
});
|