Describe every value kind in one table instead of spreading it over the code
A kind like colour or texture used to be spelled out in five parallel lists, its port type, its empty value, its glyph, its label and its list tag - 22 literal places for texture alone. core/properties/kinds.ts now holds one row per kind and the rest is derived from it, so adding a kind is one row. The five literal nodes collapse into literals.ts, the six kind menus into one helper. Number, Text, Boolean is now the one order everywhere; the variable and port menus used to list Boolean before Text. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8a7185948d
commit
3ed8b68ecf
39 files changed
+699
-565
No files matched your search
@@ -56,7 +56,7 @@ export const propertiesOf = (objectType, objectBehavior) => ({
|
||||
|
||||
/**
|
||||
* A behavior variable declaration. `fields` is the shape of a `struct`; a `list` declares nothing,
|
||||
* its items each carry their own kind (a colour as `colorItem`).
|
||||
* its items each carry their own kind (a colour or a texture as `tagged`).
|
||||
*/
|
||||
export const variable = (key, kind, value, fields) => ({
|
||||
key,
|
||||
@@ -69,8 +69,8 @@ export const variable = (key, kind, value, fields) => ({
|
||||
/** A struct field declaration. */
|
||||
export const field = (key, kind = 'number') => ({ key, kind });
|
||||
|
||||
/** A colour as a list item: inside a list, 0xRRGGBB would otherwise be a plain number. */
|
||||
export const colorItem = (color) => ({ $color: color });
|
||||
|
||||
/** A picture as a list item – a texture, one of its frames or an animation, all one id. */
|
||||
export const textureItem = (id) => ({ $texture: id });
|
||||
/**
|
||||
* A list item of a kind JSON cannot show: inside a list a colour would be a plain number and a
|
||||
* texture id a plain text, so it wears its kind as a tag – `{ $color: 0xff0000 }`.
|
||||
*/
|
||||
export const tagged = (kind, value) => ({ [`$${kind}`]: value });
|
||||
Reference in new issue
Block a user