Skip to content

Commit da1b471

Browse files
authored
Polymorphic records for widget construction (#7)
* Remove the need for explicit use of `asOneOf` for constructing widget props * Move all widgets into `AGS.Widgets.Internal` * Fix implementation of `Widget.slider` * Rename `mkWidgetWithUpdates` to `withUpdates`, export widgets' props types * Update changelog
1 parent 50577c1 commit da1b471

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+799
-1066
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
## Unreleased
44

5+
- Remove the need to wrap widget values with `asOneOf` (#7)
6+
Any of the input record fields can now be either `a` or `Binding a`, as long as props of the widget have that field as `ValueOrBinding a`.
7+
8+
- Move all widgets into a single module (#7)
9+
Modules for individual widgets like `AGS.Widget.Button` are removed.
10+
Now widgets should only be imported from `AGS.widget`.
11+
512
- Make `Applications.matchAppName` return `Boolean` rather than `Effect Boolean`
613

714
## v0.1.0

src/AGS/Widget.purs

Lines changed: 51 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -13,72 +13,73 @@ import AGS.Binding
1313
, overBoth
1414
, overValue
1515
) as Exports
16-
import AGS.Widget.Box (BoxProps, UpdateBoxProps, box, box') as Exports
17-
import AGS.Widget.Button (ButtonProps, UpdateButtonProps, button, button') as Exports
18-
import AGS.Widget.CenterBox
19-
( CenterBoxProps
20-
, UpdateCenterBoxProps
16+
import AGS.Widget.Internal
17+
( class ToValueOrBindingC
18+
, AGSWidgetProps
19+
, Any
20+
, AnyF
21+
, BoxProps
22+
, ButtonProps
23+
, CenterBoxProps
24+
, CircularProgressProps
25+
, EntryProps
26+
, EventBoxProps
27+
, IconProps
28+
, LabelProps
29+
, Mark
30+
, MarkPosition
31+
, MenuItemProps
32+
, MenuProps
33+
, MkWidget
34+
, MkWidgetWithUpdates
35+
, OverlayProps
36+
, ProgressBarProps
37+
, RevealerProps
38+
, ScrollableProps
39+
, SliderProps
40+
, StackProps
41+
, ToValueOrBinding
42+
, box
43+
, box'
44+
, button
45+
, button'
2146
, centerBox
2247
, centerBox'
23-
) as Exports
24-
import AGS.Widget.CircularProgress
25-
( CircularProgressProps
26-
, UpdateCircularProgressProps
2748
, circularProgress
2849
, circularProgress'
29-
) as Exports
30-
import AGS.Widget.Entry (EntryProps, UpdateEntryProps, entry, entry') as Exports
31-
import AGS.Widget.EventBox
32-
( EventBoxProps
33-
, UpdateEventBoxProps
50+
, entry
51+
, entry'
3452
, eventBox
3553
, eventBox'
36-
) as Exports
37-
import AGS.Widget.Icon (IconProps, UpdateIconProps, icon, icon') as Exports
38-
import AGS.Widget.Internal
39-
( AGSWidgetProps
40-
, Any
41-
, AnyF
54+
, icon
55+
, icon'
56+
, label
57+
, label'
58+
, markPositionBottom
59+
, markPositionLeft
60+
, markPositionRight
61+
, markPositionTop
62+
, menu
63+
, menu'
64+
, menuItem
65+
, menuItem'
4266
, mkAny
43-
, unsafeWidgetUpdate
44-
) as Exports
45-
import AGS.Widget.Label (LabelProps, label, label') as Exports
46-
import AGS.Widget.Menu (MenuProps, UpdateMenuProps, menu, menu') as Exports
47-
import AGS.Widget.Menu.Item (MenuItem, MenuItemProps, menuItem, menuItemImpl) as Exports
48-
import AGS.Widget.Overlay (OverlayProps, UpdateOverlayProps, overlay, overlay') as Exports
49-
import AGS.Widget.ProgressBar
50-
( ProgressBarProps
51-
, UpdateProgressBarProps
67+
, overlay
68+
, overlay'
5269
, progressBar
5370
, progressBar'
54-
) as Exports
55-
import AGS.Widget.Revealer
56-
( GtkRevealerTransitionType
57-
, RevealerProps
58-
, UpdateRevealerProps
71+
, propsToValueOrBindings
5972
, revealer
6073
, revealer'
61-
, transitions
62-
) as Exports
63-
import AGS.Widget.Scrollable
64-
( ScrollableProps
65-
, UpdateScrollableProps
6674
, scrollable
6775
, scrollable'
68-
) as Exports
69-
import AGS.Widget.Slider
70-
( Mark
71-
, MarkPosition
72-
, SliderProps
73-
, UpdateSliderProps
74-
, markPositionBottom
75-
, markPositionLeft
76-
, markPositionRight
77-
, markPositionTop
7876
, slider
7977
, slider'
78+
, stack
79+
, stack'
80+
, toValueOrBinding
81+
, withUpdates
8082
) as Exports
81-
import AGS.Widget.Stack (StackProps, stack, stack') as Exports
8283
import AGS.Widget.Window (Window, WindowProps, window) as Exports
8384
import Effect (Effect)
8485
import Effect.Uncurried

src/AGS/Widget/Box.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/AGS/Widget/Box.purs

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/AGS/Widget/Button.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/AGS/Widget/Button.purs

Lines changed: 0 additions & 59 deletions
This file was deleted.

src/AGS/Widget/CenterBox.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/AGS/Widget/CenterBox.purs

Lines changed: 0 additions & 50 deletions
This file was deleted.

src/AGS/Widget/CircularProgress.js

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/AGS/Widget/CircularProgress.purs

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)