Size: a a a

Веб-компоненты

2019 June 07

АР

Алексей Родионов in Веб-компоненты
Так-то, по идее, веб-компоненты интероперабельны. То есть можно юзать компоненты Stencil в проекте на Lit, и наоборот.
источник

АР

Алексей Родионов in Веб-компоненты
Я так понимаю, Stencil более opionated, чем Lit? Несёт в себе некие паттерны (типа как фреймворки) по сравнению с Lit, которая является низкоуровневой библиотекой?
источник

IF

Infant Frontender in Веб-компоненты
Алексей Родионов
Я так понимаю, Stencil более opionated, чем Lit? Несёт в себе некие паттерны (типа как фреймворки) по сравнению с Lit, которая является низкоуровневой библиотекой?
Да. Там помимо этого все на JSX
источник

IF

Infant Frontender in Веб-компоненты
А кто-то использовал https://github.com/hybridsjs/hybrids ?
источник

АР

Алексей Родионов in Веб-компоненты
Infant Frontender
Да. Там помимо этого все на JSX
Но нет проблем с проперти и эвентами как в реакте?
источник

IF

Infant Frontender in Веб-компоненты
Алексей Родионов
Но нет проблем с проперти и эвентами как в реакте?
Особо не писал на реакте. На стенциле только что-то простое
источник

АР

Алексей Родионов in Веб-компоненты
Infant Frontender
Особо не писал на реакте. На стенциле только что-то простое
Handling data
React passes all data to Custom Elements in the form of HTML attributes. For primitive data this is fine, but the system breaks down when passing rich data, like objects or arrays. In these instances you end up with stringified values like some-attr="[object Object]" which can't actually be used.

Handling events
Because React implements its own synthetic event system, it cannot listen for DOM events coming from Custom Elements without the use of a workaround. Developers will need to reference their Custom Elements using a ref and manually attach event listeners with addEventListener. This makes working with Custom Elements cumbersome.
источник

AS

Alexander Shershnev in Веб-компоненты
контрибьютер стенсил: https://twitter.com/manucorporat/status/1136763868045336578
источник

IF

Infant Frontender in Веб-компоненты
Алексей Родионов
Handling data
React passes all data to Custom Elements in the form of HTML attributes. For primitive data this is fine, but the system breaks down when passing rich data, like objects or arrays. In these instances you end up with stringified values like some-attr="[object Object]" which can't actually be used.

Handling events
Because React implements its own synthetic event system, it cannot listen for DOM events coming from Custom Elements without the use of a workaround. Developers will need to reference their Custom Elements using a ref and manually attach event listeners with addEventListener. This makes working with Custom Elements cumbersome.
Если не забуду, то проверю
источник

AS

Alexander Shershnev in Веб-компоненты
плюс они тришейкают рантайм "Since Stencil is able to statically analyze the source of every component, the compiler is able to apply heavy optimizations and only include exactly what the components require."
источник

AS

Alexander Shershnev in Веб-компоненты
и оптимизировали сборку
источник

AS

Alexander Shershnev in Веб-компоненты
"Stencil One uses a new bundling algorithm inspired by “word embedding”, a popular Machine Learning technique. It allows us to pack components more efficiently, therefore reducing the network throughput and round-trips. In order to do this, we generate a N-dimensional vector space where each component represents a coordinate. These coordinates are generated based on the previous static analysis of how components depend on each other. Later, the components that are located close enough in the vectorial space are bundled together. A blog post explaining this technique will be coming soon!"
источник

AS

Alexander Shershnev in Веб-компоненты
"In addition, all the metadata collected by the compiler and the dependency graph generated by rollup can be used to automatically create “modulepreload” links, reducing the amount of network round-trips required to download all the JS in the critical path to zero. This drastically reduces the Time-To-Interactive of apps built with Stencil."
источник

АР

Алексей Родионов in Веб-компоненты
> not all vdom implementations are the same.

Вот это точно подмечено, кстати.
источник

АР

Алексей Родионов in Веб-компоненты
И что, DX у JSX выше, чем у template literals?
источник

IF

Infant Frontender in Веб-компоненты
Alexander Shershnev
"Stencil One uses a new bundling algorithm inspired by “word embedding”, a popular Machine Learning technique. It allows us to pack components more efficiently, therefore reducing the network throughput and round-trips. In order to do this, we generate a N-dimensional vector space where each component represents a coordinate. These coordinates are generated based on the previous static analysis of how components depend on each other. Later, the components that are located close enough in the vectorial space are bundled together. A blog post explaining this technique will be coming soon!"
Они обещали подробнее написать об этом. Не знаете, есть ли статья про этот алгоритм?
источник

AS

Alexander Shershnev in Веб-компоненты
Infant Frontender
Они обещали подробнее написать об этом. Не знаете, есть ли статья про этот алгоритм?
пока нет
источник

IF

Infant Frontender in Веб-компоненты
Alexander Shershnev
пока нет
Походу есть, но только презентация с js conf: https://github.com/manucorporat/talk-stencil-build-time-approach/blob/master/stencil-build-time-approach.pdf
источник

АР

Алексей Родионов in Веб-компоненты
И было бы здорово, если бы они вскрыли все детали реализации, чем их VDOM отличается от реактовского.
источник

АР

Алексей Родионов in Веб-компоненты
Интересно, есть подвижки у HTML Template Instantiation?
источник