-
-
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.
Bring @glimmer/component into ember repo
The glimmerjs/glimmer.js monorepo is littered with "standalone Glimmer.js" functionality that we don't use and that is not being maintained. But it also contains two packages that are critical to ember: `@glimmer/component` and `@glimmer/tracking`. I want to bring both of those packages into here instead, while jettisoning their extra complexity that exists only to make them portable to the "standalone Glimmer.js" use case. This PR brings over @glimmer/component, and simplifies it by: - dropping support for Ember < 3.13. - converting to a v2 addon This also adds end-to-end test coverage exercising an interactive glimmer component. valid v2 addon expanding end-to-end test coverage to exercise glimmer component and glimmer tracking
- Loading branch information
Showing
17 changed files
with
683 additions
and
111 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
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,5 @@ | ||
/* eslint-env node */ | ||
'use strict'; | ||
|
||
const { addonV1Shim } = require('@embroider/addon-shim'); | ||
module.exports = addonV1Shim(__dirname); |
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,41 @@ | ||
{ | ||
"name": "@glimmer/component", | ||
"version": "2.0.0", | ||
"description": "Glimmer component library", | ||
"exports": { | ||
".": "./dist/index.js" | ||
}, | ||
"keywords": [ | ||
"ember-addon" | ||
], | ||
"license": "MIT", | ||
"contributors": [ | ||
"Dan Gebhardt <[email protected]>", | ||
"Robert Jackson <[email protected]>", | ||
"Tom Dale <[email protected]>" | ||
], | ||
"repository": "https://github.com/emberjs/ember.js", | ||
"scripts": {}, | ||
"dependencies": { | ||
"@embroider/addon-shim": "^1.8.9", | ||
"@glimmer/env": "^0.1.7" | ||
}, | ||
"devDependencies": { | ||
"typescript": "5.1" | ||
}, | ||
"engines": { | ||
"node": ">= 18" | ||
}, | ||
"typesVersions": { | ||
"*": { | ||
"*": [ | ||
"dist/*" | ||
] | ||
} | ||
}, | ||
"ember-addon": { | ||
"type": "addon", | ||
"version": 2, | ||
"main": "addon-main.cjs" | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
packages/@glimmer/component/src/-private/base-component-manager.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { DEBUG } from '@glimmer/env'; | ||
import type { Arguments, ComponentManager, ComponentCapabilities } from '@glimmer/interfaces'; | ||
import { type default as BaseComponent, ARGS_SET } from './component'; | ||
|
||
export interface Constructor<T> { | ||
new (owner: unknown, args: Record<string, unknown>): T; | ||
} | ||
|
||
export default abstract class BaseComponentManager<GlimmerComponent extends BaseComponent> | ||
implements ComponentManager<GlimmerComponent> | ||
{ | ||
abstract capabilities: ComponentCapabilities; | ||
|
||
private owner: unknown; | ||
|
||
constructor(owner: unknown) { | ||
this.owner = owner; | ||
} | ||
|
||
createComponent( | ||
ComponentClass: Constructor<GlimmerComponent>, | ||
args: Arguments | ||
): GlimmerComponent { | ||
if (DEBUG) { | ||
ARGS_SET.set(args.named, true); | ||
} | ||
|
||
return new ComponentClass(this.owner, args.named); | ||
} | ||
|
||
getContext(component: GlimmerComponent): GlimmerComponent { | ||
return component; | ||
} | ||
} |
Oops, something went wrong.