mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-21 16:38:23 +01:00
91c293e4be
* new vdomevents to support click, change, keydown, etc. easier type signature * can now pass a prop type instead of always converting to map[string]any * implement DefineComponent to allow easier vdom creation using a component function directly * separate vdomclient Make from Connect * lots of bug fixes to get everything working again * PStyle and special "style" attribute handling
41 lines
735 B
Go
41 lines
735 B
Go
// Copyright 2024, Command Line Inc.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package vdom
|
|
|
|
// so components either render to another component (or fragment)
|
|
// or to a base element (text or vdom). base elements can then render children
|
|
|
|
type ChildKey struct {
|
|
Tag string
|
|
Idx int
|
|
Key string
|
|
}
|
|
|
|
type ComponentImpl struct {
|
|
WaveId string
|
|
Tag string
|
|
Key string
|
|
Elem *VDomElem
|
|
Mounted bool
|
|
|
|
// hooks
|
|
Hooks []*Hook
|
|
|
|
// #text component
|
|
Text string
|
|
|
|
// base component -- vdom, wave elem, or #fragment
|
|
Children []*ComponentImpl
|
|
|
|
// component -> component
|
|
Comp *ComponentImpl
|
|
}
|
|
|
|
func (c *ComponentImpl) compMatch(tag string, key string) bool {
|
|
if c == nil {
|
|
return false
|
|
}
|
|
return c.Tag == tag && c.Key == key
|
|
}
|