Skip to content

Commit eb87894

Browse files
committed
cleanup
1 parent cd51c2c commit eb87894

File tree

4 files changed

+4
-31
lines changed

4 files changed

+4
-31
lines changed

docs/articles/essentials/composition.md

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ signal when a non-reactive value is present.
3737
```go
3838
cmp := composition.Wrap(core.NewComponent("Counter", nil, nil))
3939
count := state.NewSignal(0)
40-
cmp.Prop("count", count) // Since: Unreleased
40+
cmp.Prop("count", count)
4141

42-
other := composition.FromProp[int](cmp, "other", 1) // Since: Unreleased
42+
other := composition.FromProp[int](cmp, "other", 1)
4343
other.Set(2)
4444
```
4545

@@ -51,29 +51,17 @@ count := composition.FromProp[int](cmp, "count", 0) // -> 5, Props["count"] rema
5151
count.Set(6)
5252
```
5353

54-
Both helpers are available since *Unreleased*.
55-
5654
## Event Handlers
5755

5856
Attach functions to DOM events by name. The wrapper forwards handlers to the
5957
`dom` package:
6058

6159
```go
6260
cmp := composition.Wrap(core.NewComponent("Counter", nil, nil))
63-
cmp.On("save", func() { /* handle save */ }) // Since: Unreleased
61+
cmp.On("save", func() { /* handle save */ })
6462
```
6563

66-
## APIs Used
67-
68-
- `core.NewComponent(name string, templateFS []byte, props map[string]any) *core.HTMLComponent`
69-
- `composition.Wrap(c *core.HTMLComponent) *composition.Component`
70-
- `(*composition.Component).Unwrap() *core.HTMLComponent`
71-
- `(*composition.Component).On(name string, fn func())`
72-
- `(*composition.Component).Prop(key string, sig *state.Signal[T])`
73-
- `composition.FromProp[T any](c *composition.Component, key string, def T) *state.Signal[T]`
74-
- `state.NewSignal(initial T) *state.Signal[T]`
75-
76-
## End-to-End Example
64+
## Example
7765

7866
```go
7967
hc := core.NewComponent("Hello", nil, nil)
@@ -206,4 +194,3 @@ Undo/redo handlers work only when the store was created with `state.WithHistory`
206194

207195
- [State history](../api/state#history)
208196
- [DOM handlers](../api/dom#usage)
209-

v1/composition/composition.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ func Wrap(c *core.HTMLComponent) *Component {
3535
func (c *Component) Unwrap() *core.HTMLComponent { return c.HTMLComponent }
3636

3737
// On registers fn under name in the DOM handler registry.
38-
//
39-
// Since: Unreleased.
4038
func (c *Component) On(name string, fn func()) {
4139
if name == "" {
4240
panic("composition.On: empty name")
@@ -50,8 +48,6 @@ func (c *Component) On(name string, fn func()) {
5048
// Prop associates a reactive signal with the component under the provided key.
5149
// The signal is stored in the "composition" state namespace and added to the
5250
// component's props.
53-
//
54-
// Since: Unreleased.
5551
func (c *Component) Prop(key string, sig signalAny) {
5652
if key == "" {
5753
panic("composition.Prop: empty key")
@@ -81,8 +77,6 @@ func (c *Component) Prop(key string, sig signalAny) {
8177
}
8278

8379
// OnUnmount cleans up the composition store when the component is removed.
84-
//
85-
// Since: Unreleased.
8680
func (c *Component) OnUnmount() {
8781
for name := range c.createdStores {
8882
state.GlobalStoreManager.UnregisterStore(c.ID, name)
@@ -98,8 +92,6 @@ func (c *Component) OnUnmount() {
9892
// holds a plain value matching T, the value is wrapped in a new signal. If the
9993
// value type is incompatible, FromProp panics. When the prop is missing, a new
10094
// signal seeded with def is created.
101-
//
102-
// Since: Unreleased.
10395
func FromProp[T any](c *Component, key string, def T) *state.Signal[T] {
10496
if key == "" {
10597
panic("composition.FromProp: empty key")

v1/composition/store.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import (
88
)
99

1010
// Store creates a new state store namespaced to the component's ID.
11-
//
12-
// Since: Unreleased.
1311
func (c *Component) Store(name string, opts ...state.StoreOption) *state.Store {
1412
if name == "" {
1513
panic("composition.Store: empty name")
@@ -25,8 +23,6 @@ func (c *Component) Store(name string, opts ...state.StoreOption) *state.Store {
2523

2624
// History registers undo and redo handlers for the provided store.
2725
// `undo` and `redo` are the handler names used in the template.
28-
//
29-
// Since: Unreleased.
3026
func (c *Component) History(s *state.Store, undo, redo string) {
3127
if s == nil {
3228
panic("composition.History: nil store")

v1/state/store.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,6 @@ func (sm *StoreManager) GetStore(module, name string) *Store {
119119

120120
// UnregisterStore removes the store identified by module and name.
121121
// If the store or module does not exist, it is a no-op.
122-
//
123-
// Since: Unreleased.
124122
func (sm *StoreManager) UnregisterStore(module, name string) {
125123
if stores, ok := sm.modules[module]; ok {
126124
delete(stores, name)

0 commit comments

Comments
 (0)