Skip to content
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

feat: add framework - DLight.js #222

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

IanDxSSXX
Copy link

Hi. This pr is to add a new framework called DLight.js. DLight being the fastest and lightweight framework aims to provide developers with the best and pure MVVM DX. V1.0.0 of dlight is about to drop and it's gaining more attention, so I think contributing to component-party is a good move to get developers to know dlight and migrate from other frameworks. Ping me if I made something wrong or there's anything else I can help! Thanks!

frameworks.mjs Outdated Show resolved Hide resolved
}
}

export default Name;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By curiosity, why did you choose to export default like this instead of export default class Name { ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In dlight, we use class to declare a component and use function call to use one:

@View
class Comp {}

@View
class App {
  Body() {
    Comp()
  }
}

This is fine in js. But in ts, this'll arise syntax level errors(even though it's working, but it's ugly in your editor). To we need to force type casting to a self-returning function, which'll resolve this error and give you props auto-completion. But in ts you can't export class {} as xxx. So we do it like:

// ~> Comp.view.ts
@View
class Comp {}
export default Comp as Pretty as Typed<Props>
// ~ App.view.ts
import Comp from "./Comp.view"
@View
class App {
  Body() {
    Comp()
  }
}

And here Pretty is just an alias of "any" to make the typing pretty. I mean make it "as pretty as" your type...

@IanDxSSXX
Copy link
Author

What is this ci error about? I didn't change anything except the pacakge name in this commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants