add Int64Component

This commit is contained in:
2026-02-12 20:34:32 +00:00
parent 6099538fa8
commit 08682c35c1
7 changed files with 141 additions and 75 deletions

View File

@@ -52,13 +52,20 @@ type TextComponentInstance struct {
value string
}
func (t *TextComponentInstance) Value() interface{} {
return t.value
}
func (t *TextComponentInstance) FromJSON(component block.Component, data json.RawMessage) error {
var s string
err := json.Unmarshal(data, &s)
if err != nil {
return err
if data != nil {
err := json.Unmarshal(data, &s)
if err != nil {
return err
}
t.value = s
}
t.value = s
for _, v := range component.Validators() {
if err := v(s); err != nil {
@@ -81,5 +88,4 @@ type TextValidator func(value any) error
type TextComponentConfig struct {
Validators []TextValidator
}
type TextComponentOption func(*TextComponentConfig)