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

The "client only" directive pre-modifier #43

Open
lowlighter opened this issue Oct 29, 2024 · 0 comments
Open

The "client only" directive pre-modifier #43

lowlighter opened this issue Oct 29, 2024 · 0 comments
Labels
spec Spec definition for non-well defined behaviors
Milestone

Comments

@lowlighter
Copy link
Owner

lowlighter commented Oct 29, 2024

Scope

unstable

What do you want to define?

The new ^ (sigil subject to change) would prevent the directive from being executed by server-side APIs, but would be processed by client-side APIs

Considerations:

  • There-is no need for a server-side equivalent, since the use case would be to partially render with ssr before submitting to client which will then be able to use mizu normally
  • It is unclear whether this should be a regex directive, or handled by the renderer directly
    • It could be either the client side api choose accepts and ignore the ^ sigil altogether
      • Then the parseAttribute method would take this into account
    • Or the server would "clean" the ^ sigil before serving to client, through an API
      • Unlike former solution, this one "loses" information since once processed it's not possible to know whether a directive was client-side only
      • Additionally this force an attribute ref changes since names cannot be modified
  • A directive with this pre-modifier should not be cleaned by *clean.directives as it wasn't processed yet

Example usage

<p *if="true" ^*text="new Date()"></p>
await Mizu.render(template)

<p *text="new Date()"></p>
<p ^*text="new Date()"></p>

I have searched for existing issues

Yes

@lowlighter lowlighter added the spec Spec definition for non-well defined behaviors label Oct 29, 2024
@lowlighter lowlighter added this to the future milestone Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
spec Spec definition for non-well defined behaviors
Projects
None yet
Development

No branches or pull requests

1 participant