cordo 2.2.2 → 2.2.3
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/package.json
CHANGED
|
@@ -2,7 +2,7 @@ import { ComponentType, createComponent, renderComponentList, type CordoComponen
|
|
|
2
2
|
import type { CordoModifier } from "../modifier"
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
type AllowedComponents = CordoComponent<'ActionRow' | 'Button' | 'TextDisplay' | 'Section' | 'MediaGallery' | 'Seperator' | 'File' | 'StringSelect'> | CordoModifier
|
|
5
|
+
export type AllowedComponents = CordoComponent<'ActionRow' | 'Button' | 'TextDisplay' | 'Section' | 'MediaGallery' | 'Seperator' | 'File' | 'StringSelect'> | CordoModifier
|
|
6
6
|
type AllowedComponentArray = Array<AllowedComponents | AllowedComponents[]>
|
|
7
7
|
|
|
8
8
|
export function container(...components: AllowedComponentArray) {
|
|
@@ -27,11 +27,10 @@ export function container(...components: AllowedComponentArray) {
|
|
|
27
27
|
},
|
|
28
28
|
*[Symbol.iterator]() {
|
|
29
29
|
for (const component of components) {
|
|
30
|
-
if (Array.isArray(component))
|
|
30
|
+
if (Array.isArray(component))
|
|
31
31
|
yield* component
|
|
32
|
-
|
|
32
|
+
else
|
|
33
33
|
yield component
|
|
34
|
-
}
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import defu from "defu"
|
|
2
2
|
import { row } from "./builtin/row"
|
|
3
3
|
import { readModifier, type CordoModifier } from "./modifier"
|
|
4
|
+
import type { AllowedComponents as ContainerAllowedComponents } from "./builtin/container"
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
const CordoComponentSymbol = Symbol('CordoComponent')
|
|
@@ -38,7 +39,11 @@ export type CordoComponent<Type extends StringComponentType = StringComponentTyp
|
|
|
38
39
|
}
|
|
39
40
|
visible: (value: boolean) => CordoComponent<Type>
|
|
40
41
|
attributes: (attrs: Record<string, any>) => CordoComponent<Type>
|
|
41
|
-
} & (
|
|
42
|
+
} & (
|
|
43
|
+
Type extends 'Container'
|
|
44
|
+
? { [Symbol.iterator]: () => Iterator<ContainerAllowedComponents> }
|
|
45
|
+
: { [Symbol.iterator]: never }
|
|
46
|
+
)
|
|
42
47
|
export type CordoComponentPayload<Type extends StringComponentType> = CordoComponent<Type>[typeof CordoComponentSymbol]
|
|
43
48
|
|
|
44
49
|
export function createComponent<Type extends StringComponentType>(
|