Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Feature/dynamic element#71

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
wokalski wants to merge9 commits intomaster
base:master
Choose a base branch
Loading
fromfeature/dynamic-element
Draft

Conversation

@wokalski
Copy link
Member

@wokalskiwokalski commentedDec 17, 2019
edited
Loading

Imagine there's no keyIt's so yum yum if you tryNo conflicts upon usElements side by sideImagine all the componentsWith typed identities

This PR removes keys and removes lists as the container for sequences of elements. Instead of keys you can use constant identity like so:

let%component reorder = (~flipped=false, ()) => {openComponents;let%hook text1 =    <movableStateContainer> <Texttitle="x"/> </movableStateContainer>;let%hook text2 =    <movableStateContainer> <Texttitle="y"/> </movableStateContainer>;  flipped? <> <text1 /> <text2 /> </>: <> <text1 /> <text2 /> </>;};

Dynamic list API is not done yet but it will be amazing. Believe me.

Btw, if you use the component returned bymovableStateContainer multiple times the result is undefined but in the future I'll make it so that all resulting instances will share state but won't share the view.

let%component reorder = (~flipped=false, ()) => {openComponents;let%hook text1 =    <movableStateContainer> <Texttitle="x"/> </movableStateContainer>;/* Three texts but they share the internal state*/   <> <text1 /> <text1 /> <text1 /> </>;};

They will be essentially cloned.

glennsl, jchavarri, bryphe, and jordwalke reacted with hooray emoji
@wokalskiwokalskiforce-pushed thefeature/dynamic-element branch froma0578b0 to65f03f8CompareApril 26, 2020 17:46
@glennsl
Copy link
Collaborator

Would it be possible to add a phantom type variable to the element type, so that "compound" elements can be distinguished from "simple"/"single" elements? I believe that would allow components to restrict themselves to only accepting a single child. E.g.:

letmake= (~children:element(single),())=> ...

AndlistToElement, for example, would then be:list(element(_)) => element(compound)

@wokalski
Copy link
MemberAuthor

@glennsl I'm afraid no.

let fragment = <> <ImSingle /> <ImSingle /> </><IJustWantOneChild> {fragment} </IJustWantOneChild>

OOps

@glennsl
Copy link
Collaborator

Couldn't fragment just beelement(compound) outright? While that would exclude the possibly valid use of a fragment with a single child, that doesn't seem like a big deal.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@wokalski@glennsl

[8]ページ先頭

©2009-2025 Movatter.jp