idk
This commit is contained in:
parent
d9cf50eec1
commit
bb9b300d6f
9 changed files with 83 additions and 31 deletions
|
|
@ -1,11 +1,28 @@
|
|||
import { Type } from "../index.js"
|
||||
import { Properties } from "../types/properties/components.js"
|
||||
import { Binding } from "../types/properties/value.js"
|
||||
|
||||
export function FormatProperties(properties: any) {
|
||||
const property_bags: Record<Binding, any> = {}
|
||||
|
||||
for (const key in properties) {
|
||||
const value = properties[key]
|
||||
|
||||
if (key.startsWith("#")) {
|
||||
property_bags[<Binding>key] = value
|
||||
delete properties[key]
|
||||
}
|
||||
}
|
||||
|
||||
if (properties.anchor) {
|
||||
properties.anchor_from = properties.anchor_to = properties.anchor
|
||||
delete properties.anchor
|
||||
}
|
||||
|
||||
if (Object.keys(property_bags))
|
||||
if (properties.property_bags) {
|
||||
properties.property_bags = { ...property_bags, ...properties.property_bags }
|
||||
} else {
|
||||
properties.property_bags = property_bags
|
||||
}
|
||||
|
||||
return properties
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue