lunchboxjs
lunchboxjs copied to clipboard
Expanded `extend` options
troika-three-text
(github) recommends calling sync
after any layout-changing properties, but this isn't done automatically when extending in Lunchbox.
Current:
import { extend } from 'lunchboxjs'
import { Text } from 'troika-three-text'
extend('troika-text', Text);
creates:
<!-- `text` attribute works, but not `fontSize` -->
<troika-text text="Example" fontSize="1"></troika-text>
Desired:
import { extend } from 'lunchboxjs'
import { Text } from 'troika-three-text'
extend('troika-text', Text, {
// generic callback that fires when any attribute is changed -
// used to call `sync` automatically here
onAttributeChanged: (key: string, value: string, instance: Text) => {
instance.sync()
}
});