Skip to content
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

[doc beta] ember-views & ember-glimmer rfc176 & doc updates #16168

Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions broccoli/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function getFeatures(isDebug) {
}

features['descriptor-trap'] = isDebug;
features['mandatory-getter'] = isDebug;
features['mandatory-setter'] = isDebug;
features['ember-glimmer-detect-backtracking-rerender'] = isDebug;

Expand Down
2 changes: 1 addition & 1 deletion features.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"ember-glimmer-named-arguments": true,
"ember-glimmer-remove-application-template-wrapper": null,
"ember-glimmer-template-only-components": null,
"ember-metal-es5-getters": null,
"ember-metal-es5-getters": true,
"ember-routing-router-service": true,
"ember-engines-mount-params": true,
"ember-module-unification": null,
Expand Down
10 changes: 5 additions & 5 deletions packages/ember-glimmer/lib/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export const BOUNDS = symbol('BOUNDS');
representation. If the value becomes `false` or `undefined` the class name
will be removed.
Both `classNames` and `classNameBindings` are concatenated properties. See
[EmberObject](/api/classes/Ember.Object.html) documentation for more
[EmberObject](/api/ember/release/classes/EmberObject) documentation for more
information about concatenated properties.

## HTML Attributes
Expand Down Expand Up @@ -429,12 +429,12 @@ export const BOUNDS = symbol('BOUNDS');

Updates to the property of an attribute binding will result in automatic
update of the HTML attribute in the component's rendered HTML representation.
`attributeBindings` is a concatenated property. See [EmberObject](/api/classes/Ember.Object.html)
`attributeBindings` is a concatenated property. See [EmberObject](/api/ember/release/classes/EmberObject)
documentation for more information about concatenated properties.

## Layouts

See [Ember.Templates.helpers.yield](/api/classes/Ember.Templates.helpers.html#method_yield)
See [Ember.Templates.helpers.yield](/api/ember/release/classes/Ember.Templates.helpers/methods/yield?anchor=yield)
for more information.

Layout can be used to wrap content in a component. In addition
Expand Down Expand Up @@ -490,14 +490,14 @@ export const BOUNDS = symbol('BOUNDS');

### `{{action}}` Helper

See [Ember.Templates.helpers.action](/api/classes/Ember.Templates.helpers.html#method_action).
See [Ember.Templates.helpers.action](/api/ember/release/classes/Ember.Templates.helpers/methods/action?anchor=action).

### Event Names

All of the event handling approaches described above respond to the same set
of events. The names of the built-in events are listed below. (The hash of
built-in events exists in `Ember.EventDispatcher`.) Additional, custom events
can be registered by using `Ember.Application.customEvents`.
can be registered by using `Application.customEvents`.

Touch events:

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-glimmer/lib/components/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import layout from '../templates/empty';
The internal class used to create text inputs when the `{{input}}`
helper is used with `type` of `checkbox`.

See [Ember.Templates.helpers.input](/api/classes/Ember.Templates.helpers.html#method_input) for usage details.
See [Ember.Templates.helpers.input](/api/ember/release/classes/Ember.Templates.helpers/methods/input?anchor=input) for usage details.

## Direct manipulation of `checked`

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-glimmer/lib/components/link-to.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
{{/link-to}}
```

See [LinkComponent](/api/classes/Ember.LinkComponent.html) for a
See [LinkComponent](/api/ember/release/classes/LinkComponent) for a
complete list of overrideable properties. Be sure to also
check out inherited properties of `LinkComponent`.

Expand Down
6 changes: 3 additions & 3 deletions packages/ember-glimmer/lib/components/text_area.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ import layout from '../templates/empty';
{{textarea focus-out="alertMessage"}}
```

See more about [Text Support Actions](/api/classes/Ember.TextArea.html)
See more about [Text Support Actions](/api/ember/release/classes/TextArea)

### Extension

Expand All @@ -190,7 +190,7 @@ import layout from '../templates/empty';
itself extends `Component`. Expect isolated component semantics, not
legacy 1.x view semantics (like `controller` being present).

See more about [Ember components](/api/classes/Ember.Component.html)
See more about [Ember components](/api/ember/release/classes/Component)

@method textarea
@for Ember.Templates.helpers
Expand All @@ -202,7 +202,7 @@ import layout from '../templates/empty';
The internal class used to create textarea element when the `{{textarea}}`
helper is used.

See [Ember.Templates.helpers.textarea](/api/classes/Ember.Templates.helpers.html#method_textarea) for usage details.
See [Ember.Templates.helpers.textarea](/api/ember/release/classes/Ember.Templates.helpers/methods/textarea?anchor=textarea) for usage details.

## Layout and LayoutName properties

Expand Down
2 changes: 1 addition & 1 deletion packages/ember-glimmer/lib/components/text_field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function canSetTypeOfInput(type: string) {
The internal class used to create text inputs when the `{{input}}`
helper is used with `type` of `text`.

See [Ember.Templates.helpers.input](/api/classes/Ember.Templates.helpers.html#method_input) for usage details.
See [Ember.Templates.helpers.input](/api/ember/release/classes/Ember.Templates.helpers/methods/input?anchor=input) for usage details.

## Layout and LayoutName properties

Expand Down
6 changes: 3 additions & 3 deletions packages/ember-glimmer/lib/helpers/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const ACTION = symbol('ACTION');

Closure actions curry both their scope and any arguments. When invoked, any
additional arguments are added to the already curried list.
Actions should be invoked using the [sendAction](/api/classes/Ember.Component.html#method_sendAction)
Actions should be invoked using the [sendAction](/api/ember/release/classes/Component/methods/sendAction?anchor=sendAction)
method. The first argument to `sendAction` is the action to be called, and
additional arguments are passed to the action function. This has interesting
properties combined with currying of arguments. For example:
Expand Down Expand Up @@ -208,7 +208,7 @@ export const ACTION = symbol('ACTION');

If you need the default handler to trigger you should either register your
own event handler, or use event methods on your view class. See
["Responding to Browser Events"](/api/classes/Ember.Component#responding-to-browser-events)
["Responding to Browser Events"](/api/ember/release/classes/Component)
in the documentation for `Component` for more information.

### Specifying DOM event type
Expand All @@ -223,7 +223,7 @@ export const ACTION = symbol('ACTION');
</div>
```

See ["Event Names"](/api/classes/Ember.Component#event-names) for a list of
See ["Event Names"](/api/ember/release/classes/Component) for a list of
acceptable DOM event names.

### Specifying whitelisted modifier keys
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-glimmer/lib/helpers/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { CachedReference } from '../utils/references';

/**
The `{{component}}` helper lets you add instances of `Component` to a
template. See [Component](/api/classes/Ember.Component.html) for
template. See [Component](/api/ember/release/classes/Component) for
additional information on how a `Component` functions.
`{{component}}`'s primary use is for cases where you want to dynamically
change which type of component is rendered as the state of your application
Expand Down
6 changes: 3 additions & 3 deletions packages/ember-glimmer/lib/helpers/loc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { helper } from '../helper';
import { String as StringUtils } from 'ember-runtime';

/**
Calls [loc](/api/classes/Ember.String.html#method_loc) with the
Calls [loc](/api/ember/release/classes/String/methods/loc?anchor=loc) with the
provided string. This is a convenient way to localize text within a template.
For example:

Expand All @@ -29,13 +29,13 @@ import { String as StringUtils } from 'ember-runtime';
</div>
```

See [Ember.String.loc](/api/classes/Ember.String.html#method_loc) for how to
See [String.loc](/api/ember/release/classes/String/methods/loc?anchor=loc) for how to
set up localized string references.

@method loc
@for Ember.Templates.helpers
@param {String} str The string to format.
@see {Ember.String#loc}
@see {String#loc}
@public
*/
export default helper(function (params) {
Expand Down
6 changes: 3 additions & 3 deletions packages/ember-glimmer/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@
)}}></span>
```

Ember's built-in helpers are described under the [Ember.Templates.helpers](/api/classes/Ember.Templates.helpers.html)
Ember's built-in helpers are described under the [Ember.Templates.helpers](/api/ember/release/classes/Ember.Templates.helpers)
namespace. Documentation on creating custom helpers can be found under
[Helper](/api/classes/Ember.Helper.html).
[Helper](/api/ember/release/classes/Helper).

### Invoking a Component

Ember components represent state to the UI of an application. Further
reading on components can be found under [Component](/api/classes/Ember.Component.html).
reading on components can be found under [Component](/api/ember/release/classes/Component).

@module @ember/component
@main @ember/component
Expand Down
6 changes: 3 additions & 3 deletions packages/ember-glimmer/lib/syntax/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function buildSyntax(type: string, params: any[], hash: any, builder: any) {
/**
The `{{input}}` helper lets you create an HTML `<input />` component.
It causes an `TextField` component to be rendered. For more info,
see the [TextField](/api/classes/Ember.TextField.html) docs and
see the [TextField](/api/ember/release/classes/TextField) docs and
the [templates guide](https://emberjs.com/guides/templates/input-helpers/).

```handlebars
Expand Down Expand Up @@ -83,7 +83,7 @@ function buildSyntax(type: string, params: any[], hash: any, builder: any) {
```handlebars
{{input focus-out="alertMessage"}}
```
See more about [Text Support Actions](/api/classes/Ember.TextField.html)
See more about [Text Support Actions](/api/ember/release/classes/TextField)

### Extending `TextField`

Expand All @@ -103,7 +103,7 @@ function buildSyntax(type: string, params: any[], hash: any, builder: any) {
Keep in mind when writing `TextField` subclasses that `TextField`
itself extends `Component`. Expect isolated component semantics, not
legacy 1.x view semantics (like `controller` being present).
See more about [Ember components](/api/classes/Ember.Component.html)
See more about [Ember components](/api/ember/release/classes/Component)

### Checkbox

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -889,9 +889,10 @@ moduleFor('Components test: curly components', class extends RenderingTest {
// This is testing the scenario where you import a template and
// set it to the layout property:
//
// import Component from '@ember/component';
// import layout from './template';
//
// export default Ember.Component.extend({
// export default Component.extend({
// layout
// });
let hello = compile('Hello');
Expand Down
1 change: 1 addition & 0 deletions packages/ember-metal/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export {
} from './meta';
export { default as Cache } from './cache';
export {
PROXY_CONTENT,
_getPath,
get,
getWithDefault
Expand Down
2 changes: 1 addition & 1 deletion packages/ember-metal/lib/property_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function propertyDidChange(obj, keyName, _meta) {
notifyObservers(obj, keyName, meta);
}

if (obj[PROPERTY_DID_CHANGE]) {
if (PROPERTY_DID_CHANGE in obj) {
obj[PROPERTY_DID_CHANGE](keyName);
}

Expand Down
22 changes: 20 additions & 2 deletions packages/ember-metal/lib/property_get.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
*/

import { assert } from 'ember-debug';
import { DESCRIPTOR_TRAP, EMBER_METAL_ES5_GETTERS } from 'ember/features';
import { HAS_NATIVE_PROXY, symbol } from 'ember-utils';
import { DESCRIPTOR_TRAP, EMBER_METAL_ES5_GETTERS, MANDATORY_GETTER } from 'ember/features';
import { isPath } from './path_cache';
import { isDescriptor, isDescriptorTrap, DESCRIPTOR, descriptorFor } from './meta';

Expand All @@ -13,6 +14,23 @@ const ALLOWABLE_TYPES = {
string: true
};

export const PROXY_CONTENT = symbol('PROXY_CONTENT');

export function getPossibleMandatoryProxyValue(obj, keyName) {
if (MANDATORY_GETTER && EMBER_METAL_ES5_GETTERS && HAS_NATIVE_PROXY) {
let content = obj[PROXY_CONTENT];
if (content === undefined) {
return obj[keyName];
} else {
/* global Reflect */
return Reflect.get(content, keyName, obj);
}
} else {
return obj[keyName];
}
}


// ..........................................................
// GET AND SET
//
Expand Down Expand Up @@ -72,7 +90,7 @@ export function get(obj, keyName) {
}

if (!EMBER_METAL_ES5_GETTERS || descriptor === undefined) {
value = obj[keyName];
value = getPossibleMandatoryProxyValue(obj, keyName);

if (DESCRIPTOR_TRAP && isDescriptorTrap(value)) {
descriptor = value[DESCRIPTOR];
Expand Down
4 changes: 2 additions & 2 deletions packages/ember-metal/lib/property_set.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { toString } from 'ember-utils';
import { assert, Error as EmberError } from 'ember-debug';
import { _getPath as getPath } from './property_get';
import { getPossibleMandatoryProxyValue, _getPath as getPath } from './property_get';
import {
propertyWillChange,
propertyDidChange
Expand Down Expand Up @@ -62,7 +62,7 @@ export function set(obj, keyName, value, tolerant) {
}
}

let currentValue = obj[keyName];
let currentValue = getPossibleMandatoryProxyValue(obj, keyName);

if (DESCRIPTOR_TRAP && isDescriptorTrap(currentValue)) {
currentValue = currentValue[DESCRIPTOR];
Expand Down
Loading