(this.#propertyDefinition.fromJS) { properties.unshift({ name: "name", value: `"${this.#propertyDefinition.name}"`, }); } for (const { name, value } of properties) { // XXX: We could use the TextPropertyEditor here. // Pros: // - we'd get the similar markup, so styling would be easier // - the value would be properly parsed so our various swatches and popups would work // out of the box // - rule view filtering would also work out of the box // Cons: // - it is quite tied with the Rules view regular rule, which mean we'd have // to modify it to accept registered properties. const element = createChild(this.propertyList, "div", { role: "listitem", }); const container = createChild(element, "div", { class: "ruleview-propertycontainer", }); createChild(container, "span", { class: "ruleview-rule-indent clipboard-only", textContent: INDENT_STR, }); const nameContainer = createChild(container, "span", { class: "ruleview-namecontainer", }); createChild(nameContainer, "span", { class: "ruleview-propertyname theme-fg-color3", textContent: name, }); appendText(nameContainer, ": "); // Create a span that will hold the property and semicolon. // Use this span to create a slightly larger click target // for the value. const valueContainer = createChild(container, "span", { class: "ruleview-propertyvaluecontainer", }); // Property value, editable when focused. Changes to the // property value are applied as they are typed, and reverted // if the user presses escape. createChild(valueContainer, "span", { class: "ruleview-propertyvalue theme-fg-color1", textContent: value, }); appendText(valueContainer, this.#propertyDefinition.fromJS ? "," : ";"); this.propertyList.appendChild(element); } } } module.exports = RegisteredPropertyEditor; PK