lunchboxjs icon indicating copy to clipboard operation
lunchboxjs copied to clipboard

Expanded `extend` options

Open doxel-sander opened this issue 8 months ago • 0 comments

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()
  }
});

doxel-sander avatar Jun 28 '24 15:06 doxel-sander