-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Discuss Web Components integration #4963
Comments
Changed the title to be less confrontational, hope we can get some good discussion in here. |
While I generally understand your concern, why would one create a separate TableRowComponent? Or is this just a bad example? |
@philrykoff Generally web applications are structured using components and with Web Components you are encouraged to encapsulate the shared content within a Shadow Root. This example is absolutely real world, you cannot inject a When structuring tables you want this: <table>
<tr is="some-custom-row"></tr>
</table> You cannot do this: <table>
<div class="some-custom-row">
<some-custom-row></some-custom-row>
</div>
</table> |
Looks like <table>
<some-custom-row>
<td>
<td>
</some-custom-row>
</table>
<style>
some-custom-row {
display: table-row;
}
</style> This displays correctly and will be styled nicely by Semantic UI. Issues will occur once you decide to make I'm going to investigate generating Web Components for Semantic UI. Would be nice to have a UI Toolkit for diffHTML (the tool I'm working on) and this way I could simply extend from import { html } from 'diffhtml';
import { WebComponent, PropTypes } from 'diffhtml-components';
import { SemanticUITableRow } from 'diffhtml-semantic-ui';
class DevtoolsTransactionRow extends SemanticUITableRow {
static propTypes = {
index: PropTypes.number,
transaction: PropTypes.shape({
patches: PropTypes.shape({
TREE_OPS: PropTypes.array,
}),
}),
}
render() {
const { index, transaction } = this.props;
const { patches } = transaction;
const { TREE_OPS} = patches;
const stats = { insert: 0, replace: 0, remove: 0 };
TREE_OPS.forEach(patchset => {
if (patchset.INSERT_BEFORE) {
stats.insert += patchset.INSERT_BEFORE.length;
}
if (patchset.REPLACE_CHILD) {
stats.replace += patchset.REPLACE_CHILD.length;
}
if (patchset.REMOVE_CHILD) {
stats.remove += patchset.REMOVE_CHILD.length;
}
});
return html`
<td>${String(index + 1)}</td>
<td class="center aligned"><strong>${stats.insert}</strong></td>
<td class="center aligned"><strong>${stats.replace}</strong></td>
<td class="center aligned"><strong>${stats.remove}</strong></td>
`;
}
}
customElements.define('devtools-transaction-row', DevtoolsTransactionRow); This would be automatically styled, next pass could be maybe making them stateful w/ the JS. |
I took a look into the official React bindings and it appears those components use flat class names. Since I'm working on diffHTML/React integration, I'm going to see if this prior work can solve my issue inside the Shadow DOM. |
What if you use something like this:
That should allow you to substitute the pieces of the full block that you want to be configurable. I'm planning on prototyping this out further under the superfly-css organization. |
Here's an example: SUIT-CSS Button Component |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions. |
Please don't close this. Web Components would be a nice way to specify the Semantic-UI behavior in a standard way that would work in frameworks such as React, Vue, Angular, etc. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions. |
I would still consider this one to be relevant. |
14 months from last commit is almost equal to dead. There is some resurrection in React version, but that one does not seems to use web components also. |
I understand that as an early adopter using technology like Web Components, I cannot expect the existing tooling I'm accustomed to, to "just work". Although in the case of Semantic UI, I'm worried that its current design decisions do not align with the future of isolation and custom elements in the web via Web Components.
Example: You are building a data grid and want to separate the table from the row via components. So you have the following two components:
Once rendered the DOM Tree looks something like:
The problem may not be immediately obvious, but as styles do not cross the shadow boundary and the way that Semantic UI forfeits explicit class names for element names, means that it's pretty much impossible to get this to work:
How can we get these styles into the Shadow Root?
Does the project/community have thoughts on this fundamental design problem?
The text was updated successfully, but these errors were encountered: