-
Notifications
You must be signed in to change notification settings - Fork 267
add RippleJS #300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
add RippleJS #300
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
8d8bcf3
feat: add ripple framework
tijnjh 8045c86
refactor: change some data
tijnjh 4ca94a4
refactor: simplify InputFocused
tijnjh 1f1b15b
refactor: make example more clear
tijnjh f68856b
feat: add section three
tijnjh 47c23ce
feat: add almost all others
tijnjh 0a605bd
feat: add app rendering example
tijnjh 60b89b3
refactor: add comment
tijnjh 6425700
feat: use new ripple logo
tijnjh 71b5317
fix: correct component name from CssStyle to Colors
tijnjh 2d9ce03
fix: rename component from Name to DoubleCount
tijnjh 5be2366
fix: replace @use with ref
tijnjh 0a88bc1
refactor: use new reactivity system
tijnjh 6442f63
refactor: destructure children prop
tijnjh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| import { track } from "ripple"; | ||
|
|
||
| export component Name() { | ||
| let $name = "John"; | ||
| let name = track("John"); | ||
|
|
||
| <h1>{`Hello ${$name}`}</h1> | ||
| <h1>{`Hello ${@name}`}</h1> | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| import { track } from "ripple"; | ||
|
|
||
| export component Name() { | ||
| let $name = "John"; | ||
| $name = "Jane"; | ||
| let name = track("John"); | ||
| @name = "Jane"; | ||
|
|
||
| <h1>{`Hello ${$name}`}</h1> | ||
| <h1>{`Hello ${@name}`}</h1> | ||
| } |
8 changes: 5 additions & 3 deletions
8
content/1-reactivity/3-computed-state/ripple/DoubleCount.ripple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,8 @@ | ||
| import { track } from "ripple"; | ||
|
|
||
| export component DoubleCount() { | ||
| let $count = 10; | ||
| const $doubleCount = $count * 2; | ||
| let count = track(10); | ||
| const doubleCount = track(() => @count * 2); | ||
|
|
||
| <div>{$doubleCount}</div> | ||
| <div>{@doubleCount}</div> | ||
| } |
18 changes: 10 additions & 8 deletions
18
content/2-templating/6-conditional/ripple/TrafficLight.ripple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
content/4-component-composition/2-emit-to-parent/ripple/App.ripple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,19 @@ | ||
|
|
||
| import { track } from "ripple"; | ||
| import { AnswerButton } from "./AnswerButton.ripple"; | ||
|
|
||
| export component App() { | ||
| let $isHappy = true; | ||
| let isHappy = track(true); | ||
|
|
||
| function onAnswerNo() { | ||
| $isHappy = false; | ||
| @isHappy = false; | ||
| } | ||
|
|
||
| function onAnswerYes() { | ||
| $isHappy = true; | ||
| @isHappy = true; | ||
| } | ||
|
|
||
| <p>{`Are you happy?`}</p> | ||
| <AnswerButton onYes={onAnswerYes} onNo={onAnswerNo} /> | ||
| <p style="font-size: 50px;">{$isHappy ? "😀" : "😥"}</p> | ||
| <p style="font-size: 50px;">{@isHappy ? "😀" : "😥"}</p> | ||
| } |
4 changes: 2 additions & 2 deletions
4
content/4-component-composition/3-slot/ripple/FunnyButton.ripple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| export component FunnyButton({ $children }) { | ||
| export component FunnyButton(props) { | ||
| <button | ||
| style="background: rgba(0, 0, 0, 0.4); color: #fff; padding: 10px 20px; font-size: 30px; border: 2px solid #fff; margin: 8px; transform: scale(0.9); box-shadow: 4px 4px rgba(0, 0, 0, 0.4); transition: transform 0.2s cubic-bezier(0.34, 1.65, 0.88, 0.925) 0s; outline: 0;" | ||
| > | ||
| <$children /> | ||
| <props.children /> | ||
tijnjh marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </button> | ||
| } | ||
6 changes: 3 additions & 3 deletions
6
content/4-component-composition/4-slot-fallback/ripple/FunnyButton.ripple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,12 @@ | ||
| import { track } from "ripple"; | ||
|
|
||
| export component InputHello() { | ||
| let $text = "Hello world"; | ||
| let text = track("Hello world"); | ||
|
|
||
| function handleChange(event) { | ||
| $text = event.target.value; | ||
| @text = event.target.value; | ||
| } | ||
|
|
||
| <p>{$text}</p> | ||
| <input value={$text} onInput={handleChange} /> | ||
| <p>{@text}</p> | ||
| <input value={@text} onInput={handleChange} /> | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if pattern matching works for Ripple, but it would be a good use-case, especially since light should be an enum
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switch statements arent implemented as of now, though they are planned :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, thanks!
I couldn't find the tracker for it in https://github.com/trueadm/ripple/issues