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

General documentation fixes (link to parent: CanJS#4116, Component#264, and Component#270) #288

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

michaelzcheng
Copy link

General documentation fixes related to multiple issues

@@ -273,6 +273,36 @@ Changes `<hello-world>Hi There</hello-world>` into:
<hello-world><h1>Hi There</h1></hello-world>
```

Essentially, the children of the component tag will be treated as it's [can-component/content],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's => its

@@ -273,6 +273,36 @@ Changes `<hello-world>Hi There</hello-world>` into:
<hello-world><h1>Hi There</h1></hello-world>
```

Essentially, the children of the component tag will be treated as it's [can-component/content],
to be rendered wherever the tag is provided in the component view.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the <content> tag.

(You might want to be explicit about which tag).

Essentially, the children of the component tag will be treated as it's [can-component/content],
to be rendered wherever the tag is provided in the component view.

If no view is provided to a Component, it will render it's content naively.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you trying to say:

If no LIGHT DOM is provided to a component, it will render the element's LIGHT DOM?

We don't call the LIGHT DOM a view. The view is the component's view property.

By natively it sounds to me like something the BROWSER apis would just do.

Also it's => its

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think maybe it's more accurate to say if there is no view property on a Component, that Component will simply render its LIGHT_DOM

<can-el>Here's my content!</can-el>
```

or you can render viewModel properties using magic tags like : `<can-el>{{hovMessage}}</can-el>`, which renders like:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can't do this without leakScope.

docs/content.md Outdated
@@ -35,3 +35,29 @@ Component.extend( {
view: "<h1><content>Hi There!</content></h1>"
} );
```

The children of `<content>` can be used as a default value for rendering in the case that no content is passed.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of "no content is passed", I think we probably should introduce the LIGHT_DOM and SHADOW_DOM concepts?

Or for CanJS, maybe these should be shadow view and light view?

docs/content.md Outdated
```js
Component.extend( {
tag: "my-tag",
view: stache( "<h1><content>Hello world</content></h1>" )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets remove the stache() part.

docs/content.md Outdated

`<my-tag>Hello friend</my-tag>` will render:

```html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be cool if these were @codepen-able examples:

<my-tag>Hello Friend</my-tag>
<script type="module">
import {Component} from "can";

...
</script>

docs/view.md Outdated

### Omitting view entirely

If the user does not provide a view property,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe:

If the component does not contain a view property ...


```js
Component.extend({
tag: "my-greeting",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra tab here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this is showing up in Github, it doesn't show on my local text editor

- Show an example of using leakScope to render LIGHT_DOM with a component’s VM
- Rename the example component tags (anything with can-* looks like it’s from CanJS)
- Various grammar fixes

```js
Component.extend({
leakScope: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@justinbmeyer I see your comment here about this only working with leakScope: #288 (comment)

But this definitely works without leakScope right now: https://codepen.io/anon/pen/wxEdyr

Is it a bug? Here’s the issue I originally filed about this: #270

@@ -244,6 +244,7 @@ reference to the viewModel instance and modify it. This can be seen in the
following example:

@demo demos/can-component/accordion.html
@codepen
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these should work as of this PR: canjs/canjs#4388

- Add a link to the can-slot and can-template docs
- Fix the grammar

Closes #264
@chasenlehara
Copy link
Member

@michaelzcheng I added a few commits to clean up the docs/examples you added. 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants