-
Notifications
You must be signed in to change notification settings - Fork 109
Add Ember #2438
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
Open
NullVoxPopuli
wants to merge
18
commits into
webcomponents:main
Choose a base branch
from
NullVoxPopuli:add-ember
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add Ember #2438
Changes from 7 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
31f505d
Boilerplate
NullVoxPopuli 39477c0
Add components
NullVoxPopuli 7950a1f
Go back to normal app file layout while prototyping -- get tests pass…
NullVoxPopuli 72b45a9
Basic tests pass
NullVoxPopuli 3d753f6
Advanced tests pass
NullVoxPopuli 54c8b18
Add meta
NullVoxPopuli 8d42ade
Update package.json, delete unneeded files
NullVoxPopuli aa76cd3
Update to Vite
NullVoxPopuli b4fe3a5
Lints
NullVoxPopuli b0e04cd
Lints
NullVoxPopuli 5b1f10a
Finish migration (need to do somem debugging tho, cause I broke somet…
NullVoxPopuli 9bc9d60
All tests pass
NullVoxPopuli e5fe391
All tests pass"
NullVoxPopuli 8f6905d
Fix wireit config
NullVoxPopuli afcc1cd
Remove unused deps
NullVoxPopuli d804db9
Switch to npm
NullVoxPopuli 93dd895
Remove unneeded babel config entry
NullVoxPopuli 72f4bec
Maybe we don't need this
NullVoxPopuli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,19 @@ | ||
# EditorConfig helps developers define and maintain consistent | ||
# coding styles between different editors and IDEs | ||
# editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.hbs] | ||
insert_final_newline = false | ||
|
||
[*.{diff,md}] | ||
trim_trailing_whitespace = false |
This file contains hidden or 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,7 @@ | ||
{ | ||
/** | ||
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript | ||
rather than JavaScript by default, when a TypeScript version of a given blueprint is available. | ||
*/ | ||
"isTypeScriptProject": false | ||
} |
This file contains hidden or 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,25 @@ | ||
# compiled output | ||
/dist/ | ||
/declarations/ | ||
|
||
# dependencies | ||
/node_modules/ | ||
|
||
# misc | ||
/.env* | ||
/.pnp* | ||
/.eslintcache | ||
/coverage/ | ||
/npm-debug.log* | ||
/testem.log | ||
/yarn-error.log | ||
|
||
# ember-try | ||
/.node_modules.ember-try/ | ||
/npm-shrinkwrap.json.ember-try | ||
/package.json.ember-try | ||
/package-lock.json.ember-try | ||
/yarn.lock.ember-try | ||
|
||
# broccoli-debug | ||
/DEBUG/ |
This file contains hidden or 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,13 @@ | ||
# unconventional js | ||
/blueprints/*/files/ | ||
|
||
# compiled output | ||
/dist/ | ||
|
||
# misc | ||
/coverage/ | ||
!.* | ||
.*/ | ||
|
||
# ember-try | ||
/.node_modules.ember-try/ |
This file contains hidden or 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,8 @@ | ||
# unconventional files | ||
/blueprints/*/files/ | ||
|
||
# compiled output | ||
/dist/ | ||
|
||
# addons | ||
/.node_modules.ember-try/ |
This file contains hidden or 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 @@ | ||
"use strict"; | ||
NullVoxPopuli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
module.exports = { | ||
extends: ["stylelint-config-standard", "stylelint-prettier/recommended"], | ||
}; |
This file contains hidden or 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 @@ | ||
"use strict"; | ||
NullVoxPopuli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
module.exports = { | ||
extends: "recommended", | ||
}; |
This file contains hidden or 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,3 @@ | ||
{ | ||
"ignore_dirs": ["dist"] | ||
} |
This file contains hidden or 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,13 @@ | ||
import Application from '@ember/application'; | ||
import compatModules from '@embroider/core/entrypoint'; | ||
NullVoxPopuli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
import Resolver from 'ember-resolver'; | ||
import loadInitializers from 'ember-load-initializers'; | ||
import config from './config/environment'; | ||
|
||
export default class App extends Application { | ||
modulePrefix = config.modulePrefix; | ||
podModulePrefix = config.podModulePrefix; | ||
Resolver = Resolver.withModules(compatModules); | ||
} | ||
|
||
loadInitializers(App, config.modulePrefix, compatModules); |
This file contains hidden or 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,149 @@ | ||
/** | ||
* @license | ||
* Copyright 2017 Google Inc. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import "webcomponents/ce-without-children"; | ||
import "webcomponents/ce-with-children"; | ||
import "webcomponents/ce-with-properties"; | ||
import "webcomponents/ce-with-event"; | ||
|
||
import Component from '@glimmer/component'; | ||
import { tracked } from '@glimmer/tracking'; | ||
import { on } from '@ember/modifier'; | ||
import { modifier as customModifier } from 'ember-modifier'; | ||
|
||
const { String } = globalThis; | ||
|
||
export const ComponentWithoutChildren = <template> | ||
<ce-without-children /> | ||
</template>; | ||
|
||
export const ComponentWithChildren = <template> | ||
<ce-with-children /> | ||
</template>; | ||
|
||
export class ComponentWithChildrenRerender extends Component { | ||
@tracked count = 1; | ||
|
||
deferredUpdate = () => { | ||
Promise.resolve().then(() => { | ||
this.count++; | ||
}) | ||
}; | ||
|
||
<template> | ||
{{ (this.deferredUpdate) }} | ||
<ce-with-children>{{ this.count }}</ce-with-children> | ||
</template> | ||
} | ||
|
||
export class ComponentWithDifferentViews extends Component { | ||
@tracked show = true; | ||
|
||
constructor() { | ||
super(...arguments); | ||
|
||
// Allow this component to be externally controlled | ||
this.args.setToggle(() => this.show = !this.show); | ||
} | ||
|
||
<template> | ||
{{#if this.show}} | ||
<ce-with-children id="wc" /> | ||
{{else}} | ||
<div id="dummy">Dummy view</div> | ||
{{/if}} | ||
</template> | ||
} | ||
|
||
|
||
const data = { | ||
bool: true, | ||
num: 42, | ||
str: "Ember", | ||
arr: ["E", "m", "b", "e", "r"], | ||
obj: { org: "emberjs", repo: "ember.js" }, | ||
camelCaseObj: { label: "passed" }, | ||
} | ||
|
||
export const ComponentWithProperties = | ||
<template> | ||
<ce-with-properties | ||
id="wc" | ||
bool={{ data.bool }} | ||
num={{ data.num }} | ||
str={{ data.str }} | ||
arr={{ data.arr }} | ||
obj={{ data.obj }} | ||
camelCaseObj={{ data.camelCaseObj }} | ||
></ce-with-properties> | ||
</template> | ||
; | ||
|
||
export const ComponentWithUnregistered = <template> | ||
<ce-unregistered | ||
bool={{ data.bool }} | ||
num={{ data.num }} | ||
str={{ data.str }} | ||
arr={{ data.arr }} | ||
obj={{ data.obj }} | ||
/> | ||
</template>; | ||
|
||
export class ComponentWithImperativeEvent extends Component { | ||
@tracked eventHandled = false; | ||
|
||
addEventListenerTheLongWay = customModifier(element => { | ||
element.addEventListener('camelEvent', () => { | ||
this.eventHandled = true; | ||
}); | ||
}); | ||
|
||
<template> | ||
<div id="handled">{{ this.eventHandled }}</div> | ||
<ce-with-event id="wc" {{this.addEventListenerTheLongWay}}></ce-with-event> | ||
</template> | ||
} | ||
|
||
export class ComponentWithDeclarativeEvent extends Component { | ||
@tracked lowercaseHandled = false; | ||
@tracked kebabHandled = false; | ||
@tracked camelHandled = false; | ||
@tracked capsHandled = false; | ||
@tracked pascalHandled = false; | ||
|
||
handleLowercaseEvent = () => this.lowercaseHandled = true; | ||
handleKebabEvent = () => this.kebabHandled = true; | ||
handleCamelEvent = () => this.camelHandled = true; | ||
handleCapsEvent = () => this.capsHandled = true; | ||
handlePascalEvent = () => this.pascalHandled = true; | ||
|
||
<template> | ||
<div id="lowercase">{{ this.lowercaseHandled }}</div> | ||
<div id="kebab">{{ this.kebabHandled }}</div> | ||
<div id="camel">{{ this.camelHandled }}</div> | ||
<div id="caps">{{ this.capsHandled }}</div> | ||
<div id="pascal">{{ this.pascalHandled }}</div> | ||
<ce-with-event | ||
id="wc" | ||
{{on 'lowercaseevent' this.handleLowercaseEvent}} | ||
{{on 'kebab-event' this.handleKebabEvent}} | ||
{{on 'camelEvent' this.handleCamelEvent}} | ||
{{on 'CAPSevent' this.handleCapsEvent}} | ||
{{on 'PascalEvent' this.handlePascalEvent}} | ||
/> | ||
</template> | ||
} |
This file contains hidden or 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,3 @@ | ||
import loadConfigFromMeta from "@embroider/config-meta-loader"; | ||
NullVoxPopuli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export default loadConfigFromMeta("ember-cee-app"); |
This file contains hidden or 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,9 @@ | ||
import EmberRouter from '@ember/routing/router'; | ||
import config from 'ember-cee-app/config/environment'; | ||
|
||
export default class Router extends EmberRouter { | ||
location = config.locationType; | ||
rootURL = config.rootURL; | ||
} | ||
|
||
Router.map(function () {}); |
This file contains hidden or 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,9 @@ | ||
import Route from 'ember-route-template'; | ||
NullVoxPopuli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export default Route( | ||
<template> | ||
Hello! | ||
|
||
{{outlet}} | ||
</template> | ||
) |
This file contains hidden or 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,42 @@ | ||
const { | ||
babelCompatSupport, | ||
templateCompatSupport, | ||
} = require("@embroider/compat/babel"); | ||
NullVoxPopuli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
module.exports = { | ||
plugins: [ | ||
[ | ||
"babel-plugin-ember-template-compilation", | ||
{ | ||
compilerPath: "ember-source/dist/ember-template-compiler.js", | ||
enableLegacyModules: [ | ||
"ember-cli-htmlbars", | ||
"ember-cli-htmlbars-inline-precompile", | ||
"htmlbars-inline-precompile", | ||
], | ||
transforms: [...templateCompatSupport()], | ||
}, | ||
], | ||
[ | ||
"module:decorator-transforms", | ||
{ | ||
runtime: { | ||
import: require.resolve("decorator-transforms/runtime-esm"), | ||
}, | ||
}, | ||
], | ||
[ | ||
"@babel/plugin-transform-runtime", | ||
{ | ||
absoluteRuntime: __dirname, | ||
useESModules: true, | ||
regenerator: false, | ||
}, | ||
], | ||
...babelCompatSupport(), | ||
], | ||
|
||
generatorOpts: { | ||
compact: false, | ||
}, | ||
}; |
NullVoxPopuli marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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 @@ | ||
{"schemaVersion":"1.0.0","packages":[{"name":"@embroider/app-blueprint","version":"0.11.0","blueprints":[{"name":"@embroider/app-blueprint","isBaseBlueprint":true,"options":["--package-manager pnpm"]}]}]} |
NullVoxPopuli marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,48 @@ | ||
"use strict"; | ||
|
||
module.exports = function (environment) { | ||
const ENV = { | ||
modulePrefix: "ember-cee-app", | ||
environment, | ||
rootURL: "/", | ||
locationType: "history", | ||
EmberENV: { | ||
EXTEND_PROTOTYPES: false, | ||
FEATURES: { | ||
// Here you can enable experimental features on an ember canary build | ||
// e.g. EMBER_NATIVE_DECORATOR_SUPPORT: true | ||
}, | ||
}, | ||
|
||
APP: { | ||
// Here you can pass flags/options to your application instance | ||
// when it is created | ||
}, | ||
}; | ||
|
||
if (environment === "development") { | ||
// ENV.APP.LOG_RESOLVER = true; | ||
// ENV.APP.LOG_ACTIVE_GENERATION = true; | ||
// ENV.APP.LOG_TRANSITIONS = true; | ||
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true; | ||
// ENV.APP.LOG_VIEW_LOOKUPS = true; | ||
} | ||
|
||
if (environment === "test") { | ||
// Testem prefers this... | ||
ENV.locationType = "none"; | ||
|
||
// keep test console output quieter | ||
ENV.APP.LOG_ACTIVE_GENERATION = false; | ||
ENV.APP.LOG_VIEW_LOOKUPS = false; | ||
|
||
ENV.APP.rootElement = "#ember-testing"; | ||
ENV.APP.autoboot = false; | ||
} | ||
|
||
if (environment === "production") { | ||
// here you can enable a production-specific feature | ||
} | ||
|
||
return ENV; | ||
}; |
NullVoxPopuli marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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,7 @@ | ||
{ | ||
"application-template-wrapper": false, | ||
"default-async-observers": true, | ||
"jquery-integration": false, | ||
"template-only-glimmer-components": true, | ||
"no-implicit-route-model": true | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.