You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Easy way to serialize all host component attributes/props in JavaScript #104
Adding something like a "props" object that contains them all would be a big help here too, as it would at least let us do it manually. I tried using "this" but of course that has loads of other stuff on it so didn't work.
A new webc.attributes object and webc.renderAttributes() function will now be available to transforms (e.g. webc:type="js" and webc:type="render"). For consistency these will also be available (though less usefully) in dynamic attributes and @html/webc:if.
Activity
ascorbic commentedon Feb 14, 2023
Adding something like a "props" object that contains them all would be a big help here too, as it would at least let us do it manually. I tried using "this" but of course that has loads of other stuff on it so didn't work.
zachleat commentedon Feb 16, 2023
A new
webc.attributesobject andwebc.renderAttributes()function will now be available to transforms (e.g.webc:type="js"andwebc:type="render"). For consistency these will also be available (though less usefully) in dynamic attributes and@html/webc:if.zachleat commentedon Feb 16, 2023
Related test has a usage example, notably this will not render private props:
https://github.com/11ty/webc/blob/06768af3fb20b1d416276f2f07ac3865a4f3a80c/test/issue-104-test.js
https://github.com/11ty/webc/blob/06768af3fb20b1d416276f2f07ac3865a4f3a80c/test/stubs/issue-104/component.webc
Will ship with WebC v0.9.0
ascorbic commentedon Feb 17, 2023
Perfect! Thank you
zachleat commentedon Feb 22, 2023
Docs for this will live at https://www.11ty.dev/docs/languages/webc/#extra-data-for-javascript-render-functions