hmans / three-elements

Web Components-powered custom HTML elements for building Three.js-powered games and interactive experiences. 🎉
https://three-elements.hmans.co
MIT License
398 stars 14 forks source link

Align property & attribute assignments #65

Closed hmans closed 3 years ago

hmans commented 3 years ago

What's in this PR?

Open questions / to decide / todo:

COMPLEMENTARY KITTEN:

image

CodyJasonBennett commented 3 years ago

Would it be preferable to explore a syntax like <three-scene camera-id="#camera" />?

hmans commented 3 years ago

Would it be preferable to explore a syntax like <three-scene camera-id="#camera" />?

I was going with that first, but it clashes with the heuristics that are already in place. In this example, right now camera-id would translate to a cameraId property on the wrapped object. If we handle -id suffixes ourselves, we would face a problem if there ever is a Three.js property named *Id that we need to set.

Prefix directives solve this cleanly because they don't clash with any existing heuristics or systems. The part where I'm not convinced that they're a good idea is that I wasn't planning on going all "frameworky" with three-elements, and this is definitely a step into that direction.