Skip to content

[experiment]: Demo app for glimmer-next renderer - #20711

Closed
lifeart wants to merge 1 commit into
emberjs:mainfrom
lifeart:demo-app
Closed

lifeart wants to merge 1 commit into
emberjs:mainfrom
lifeart:demo-app

Conversation

@lifeart

@lifeart lifeart commented Jun 29, 2024 •

Copy link
Copy Markdown
Contributor

This is experiment to replace @glimmer/* rendering and reactivity stack with lifeart/glimmer-next

Demo Application setup based on source from lifeart/demo-ember-vite

Check:

cd packages/demo/
rm -rf ./node_modules/.vite
pnpm run dev 

Routes:
http://localhost:5173/profile
http://localhost:5173/

Working (somehow):

  • tracked
  • alias
  • internal component manager
  • LinkTo
  • Input
  • routing
  • {{outlet}}
  • queryParams

Not working:

  • Backburner driven rendering
  • MutableCells
  • Custom outlets
Screen.Recording.2024-07-01.at.16.13.54.mov

@NullVoxPopuli NullVoxPopuli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's fun to see some exploration happening here! 💪 🎉

Comment thread packages/ember/index.ts Resolved
import type { InternalOwner } from '@ember/-internals/owner';
import type { Helper, HelperDefinitionState } from '@glimmer/interfaces';
import { setInternalHelperManager } from '@glimmer/manager';
// import { setInternalHelperManager } from '@glimmer/manager';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why comment this out?

If we need to re-define the implementation, I think that could happen in this PR (like, if it's copying from glimmer-next, for example)

import { getOwner } from '@ember/-internals/owner';
import { guidFor } from '@ember/-internals/utils';
import { getViewElement, getViewId } from '@ember/-internals/views';
import { renderComponent } from '@lifeart/gxt';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should pull this in to the repo (easier maintenance!)

@@ -0,0 +1,58 @@
import { Component } from '@lifeart/gxt';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not @glimmer/component (not the real glimmer component, but re-defined in this PR, using glimmer-next apis?)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

need to do some copy-paste from non-released branch - lifeart/glimmer-next#25

Comment thread packages/@ember/routing/route.ts Resolved
@lifeart lifeart mentioned this pull request Jun 29, 2024
14 tasks done
@lifeart
lifeart force-pushed the demo-app branch 2 times, most recently from 77ef48e to b88ce4b Compare June 29, 2024 18:21

@NullVoxPopuli NullVoxPopuli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

image

hopefully some @glimmer/* packages can be added here?
(for compat, we'd need to re-define @glimmer/component, @glimmer/tracking, etc as their own packages)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why not use ember-resolver?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@NullVoxPopuli it's basically copy pasta, without side deps (glimemer-debug, etc).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

you could provide @glimmer/debug in this PR :)

@@ -0,0 +1,14 @@
export function unwrapTemplate(tpl) {
return {
asLayout(){

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I could be misremembering the purpose of this...
But, I don't think layouts need support as template resolving outside of routes' templates is deprecated for removal in v6

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

for now it's workaround related to existing template handing logic (from glimmer-vm).
compiled glimmer-vm template has special 'shape' and it's hardcoded in ember - we just providing compatible wrapper for it.

}
);
{{on 'click' this.click}} >{{yield}}</a>`;
}

@ef4 ef4 Jul 5, 2024 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the motivation for needing to rewrite these?

You could reimplement the meaning of precompileTemplate to be whatever you need it to be, and then you wouldn't need to touch this code and you would have a much greater chance of actually achieving upgrade compatibility.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ef4 this is just for experimentation purposes, I agree - we could keep same api as-is here (compiler need to be extended a bit)


export default class ApplicationTemplate extends Component {
<template>
<header class="bg-blue-600 p-4">

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

TODO: move to glimmer component

demo-app

+

@glimmer/manager

+

sample component managers

+

reuse tracked data from gxt

+

+

+

destroyable

query params working

support input

+

+

+

?

+

isTracking

+

attempt to run tests

+

bump deps
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.

3 participants