-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
71 changed files
with
2,684 additions
and
123 deletions.
There are no files selected for viewing
This file contains 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 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 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
7 changes: 5 additions & 2 deletions
7
packages/@ember/-internals/glimmer/lib/helpers/internal-helper.ts
This file contains 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,10 @@ | ||
import type { InternalOwner } from '@ember/-internals/owner'; | ||
import type { Helper, HelperDefinitionState } from '@glimmer/interfaces'; | ||
import { setInternalHelperManager } from '@glimmer/manager'; | ||
// import { setInternalHelperManager } from '@glimmer/manager'; | ||
|
||
export function internalHelper(helper: Helper<InternalOwner>): HelperDefinitionState { | ||
return setInternalHelperManager(helper, {}); | ||
return function () { | ||
console.log('internal helper', this, [...arguments]); | ||
Check failure on line 7 in packages/@ember/-internals/glimmer/lib/helpers/internal-helper.ts GitHub Actions / Type Checking (current version)
|
||
return helper(...arguments); | ||
} | ||
} |
This file contains 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 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,4 @@ | ||
import { precompileTemplate } from '@ember/template-compilation'; | ||
export default precompileTemplate('', { | ||
moduleName: 'packages/@ember/-internals/glimmer/lib/templates/empty.hbs', | ||
strictMode: true, | ||
}); | ||
import { hbs } from '@lifeart/gxt'; | ||
export default function emptyTemplate() { | ||
return hbs``; | ||
}; |
64 changes: 64 additions & 0 deletions
64
packages/@ember/-internals/glimmer/lib/templates/outlet-helper-component.gts
This file contains 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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Component } from '@lifeart/gxt'; | ||
|
||
interface State { | ||
outlets: { | ||
main: State | undefined, | ||
}, | ||
render: { | ||
template(): () => unknown, | ||
controller: unknown, | ||
name: string, | ||
} | ||
} | ||
|
||
export default class OutletHelper extends Component { | ||
get state() { | ||
return this.args.state().outlets.main || this.args.state(); | ||
} | ||
get nextState() { | ||
return () => { | ||
return this.hasNext; | ||
} | ||
} | ||
get hasNext() { | ||
return this.state.outlets.main; | ||
} | ||
get canRender() { | ||
return !!this?.state?.render; | ||
} | ||
get MyComponent() { | ||
|
||
const state = this.state; | ||
const render = state.render; | ||
const tpl = render.template(); | ||
const args = { | ||
get model() { | ||
return render.model; | ||
} | ||
} | ||
if (tpl.instance) { | ||
return tpl.instance.template; | ||
} | ||
render.controller['args'] = args; | ||
const tplComponentInstance = new tpl(args); | ||
tplComponentInstance.template = tplComponentInstance.template.bind(render.controller); | ||
// we need to provide stable refs here to avoid re-renders | ||
tpl.instance = tplComponentInstance; | ||
return tplComponentInstance.template; | ||
} | ||
get model() { | ||
const state = this.state; | ||
const render = state.render; | ||
return render.model; | ||
} | ||
<template> | ||
{{#if this.canRender}} | ||
<this.MyComponent @model={{this.model}}> | ||
{{#if this.hasNext}} | ||
<OutletHelper @state={{this.nextState}} @root={{false}} /> | ||
{{/if}} | ||
</this.MyComponent> | ||
|
||
{{/if}} | ||
</template> | ||
} |
19 changes: 12 additions & 7 deletions
19
packages/@ember/-internals/glimmer/lib/templates/outlet.ts
This file contains 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,15 @@ | ||
import { precompileTemplate } from '@ember/template-compilation'; | ||
import { hbs } from '@lifeart/gxt'; | ||
import { outletHelper } from '../syntax/outlet'; | ||
import Outlet from './outlet-helper-component'; | ||
|
||
export default precompileTemplate(`{{component (outletHelper)}}`, { | ||
moduleName: 'packages/@ember/-internals/glimmer/lib/templates/outlet.hbs', | ||
strictMode: true, | ||
scope() { | ||
return { outletHelper }; | ||
}, | ||
}); | ||
export default (owner) => { | ||
console.log('outlet factory', owner); | ||
|
||
return function(args) { | ||
console.log('outlet', this, owner, ...arguments); | ||
return hbs`{{#let (component Outlet state=(args.state)) as |Outlet|}} | ||
<div>[main outlet template]<Outlet /></div> | ||
{{/let}}`; | ||
} | ||
} |
This file contains 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,22 @@ | ||
import { precompileTemplate } from '@ember/template-compilation'; | ||
export default precompileTemplate(`{{component this}}`, { | ||
moduleName: 'packages/@ember/-internals/glimmer/lib/templates/root.hbs', | ||
strictMode: true, | ||
}); | ||
import { hbs, $_fin } from '@lifeart/gxt'; | ||
export default function(owner) { | ||
console.log('root-template init', owner); | ||
return function(rootState) { | ||
// console.log('root-template - render', [this], [...arguments]); | ||
// temp1.root.template | ||
// console.log(...arguments); | ||
// return function() { | ||
// console.log(...arguments); | ||
// return $_fin([...rootState.root.template()], this); | ||
// } | ||
// debugger; | ||
const state = rootState.root.ref; | ||
console.log('rootState', state); | ||
return hbs` | ||
{{log 'root-template-create' this rootState}} | ||
{{#let (component rootState.root.template state=state root=true) as |Layout|}} | ||
<Layout /> | ||
{{/let}} | ||
`; | ||
} | ||
} |
This file contains 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 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
Oops, something went wrong.