Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libraries/__shared__/webcomponents/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
"name": "webcomponents",
"version": "1.0.0",
"description": "",
"main": "xfoo.js",
"type": "module",
"exports": {
"./*": "./src/*.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
Expand Down
19 changes: 19 additions & 0 deletions libraries/ember/.editorconfig
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
7 changes: 7 additions & 0 deletions libraries/ember/.ember-cli
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
}
25 changes: 25 additions & 0 deletions libraries/ember/.gitignore
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/
13 changes: 13 additions & 0 deletions libraries/ember/.prettierignore
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/
8 changes: 8 additions & 0 deletions libraries/ember/.stylelintignore
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/
5 changes: 5 additions & 0 deletions libraries/ember/.stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

module.exports = {
extends: ["stylelint-config-standard", "stylelint-prettier/recommended"],
};
5 changes: 5 additions & 0 deletions libraries/ember/.template-lintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use strict";

module.exports = {
extends: "recommended",
};
3 changes: 3 additions & 0 deletions libraries/ember/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ignore_dirs": ["dist"]
}
13 changes: 13 additions & 0 deletions libraries/ember/app/app.js
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';
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);
149 changes: 149 additions & 0 deletions libraries/ember/app/components/cee-scenarios.gjs
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>
}
3 changes: 3 additions & 0 deletions libraries/ember/app/config/environment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import loadConfigFromMeta from "@embroider/config-meta-loader";

export default loadConfigFromMeta("ember-cee-app");
9 changes: 9 additions & 0 deletions libraries/ember/app/router.js
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 () {});
9 changes: 9 additions & 0 deletions libraries/ember/app/templates/application.gjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Route from 'ember-route-template';

export default Route(
<template>
Hello!

{{outlet}}
</template>
)
42 changes: 42 additions & 0 deletions libraries/ember/babel.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const {
babelCompatSupport,
templateCompatSupport,
} = require("@embroider/compat/babel");

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,
},
};
1 change: 1 addition & 0 deletions libraries/ember/config/ember-cli-update.json
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"]}]}]}
48 changes: 48 additions & 0 deletions libraries/ember/config/environment.js
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;
};
7 changes: 7 additions & 0 deletions libraries/ember/config/optional-features.json
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
}
Loading