/* Copyright 2017 - present Ziadin Givan Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. https://github.com/givanz/Vvvebjs */ Vvveb.ComponentsGroup['Elements'] = [ "elements/svg-icon" ]; Vvveb.Components.extend("_base","elements/svg-icon", { nodes: ["svg"], name: "Svg Icon", image: "icons/star.svg", html: ` `, properties: [{ name: "Icon", key: "icon", inline:true, inputtype: HtmlListSelectInput, onChange:function(element, value, input, component) { var newElement = $(value); let attributes = element.prop("attributes"); //keep old svg size and colors $.each(attributes, function() { if (this.name == "viewBox") return; newElement.attr(this.name, this.value); }); element.replaceWith(newElement); return newElement; }, data: { url: Vvveb.baseUrl + "../../resources/svg/icons/{value}/index.html", clickElement:"li", insertElement:"svg", elements: 'Loading ...', options: [{ value: "eva-icons", text: "Eva icons" }, { value: "ionicons", text: "IonIcons" }, { value: "linea", text: "Linea" }, { value: "remix-icon", text: "RemixIcon" }, { value: "unicons", text: "Unicons" }, { value: "clarity-icons", text: "Clarity icons" }, { value: "jam-icons", text: "Jam icons" }, { value: "ant-design-icons", text: "Ant design icons" }, { value: "themify", text: "Themify" }, { value: "css.gg", text: "Css.gg" }, { value: "olicons", text: "Olicons" }, { value: "open-iconic", text: "Open iconic" }, { value: "boxicons", text: "Box icons" }, { value: "elegant-font", text: "Elegant font" }, { value: "dripicons", text: "Dripicons" }, { value: "feather", text: "Feather" }, { value: "coreui-icons", text: "Coreui icons" }, { value: "heroicons", text: "Heroicons" }, { value: "iconoir", text: "Iconoir" }, { value: "iconsax", text: "Iconsax" }, { value: "ikonate", text: "Ikonate" }, { value: "tabler-icons", text: "Tabler icons" }, { value: "octicons", text: "Octicons" }, { value: "system-uicons", text: "System-uicons" }, { value: "font-awesome", text: "FontAwesome" }, { value: "pe-icon-7-stroke", text: "Pixeden icon 7 stroke" }, { value: "77_essential_icons", text: "77 essential icons" }, { value: "150-outlined-icons", text: "150 outlined icons" }, { value: "material-design", text: "Material Design" }] }, }, { name: "Width", key: "width", htmlAttr: "width", inputtype: RangeInput, data:{ max: 640, min:6, step:1 } }, { name: "Height", key: "height", htmlAttr: "height", inputtype: RangeInput, data:{ max: 640, min:6, step:1 } }, { name: "Stroke width", key: "stroke-width", htmlAttr: "stroke-width", inputtype: RangeInput, data:{ max: 512, min:1, step:1 } },{ key: "svg_style_header", inputtype: SectionInput, name:false, //sort: base_sort++, section: style_section, data: {header:"Svg colors"}, }, { name: "Fill Color", key: "fill", //sort: base_sort++, col:4, inline:true, section: style_section, htmlAttr: "fill", inputtype: ColorInput, },{ name: "Color", key: "color", //sort: base_sort++, col:4, inline:true, section: style_section, htmlAttr: "color", inputtype: ColorInput, },{ name: "Stroke", key: "Stroke", //sort: base_sort++, col:4, inline:true, section: style_section, htmlAttr: "color", inputtype: ColorInput, }] }); Vvveb.Components.add("elements/svg-element", { nodes: ["path", "line", "polyline", "polygon", "rect", "circle", "ellipse", "g"], name: "Svg element", image: "icons/star.svg", html: ``, properties: [{ name: "Fill Color", key: "fill", //sort: base_sort++, col:4, inline:true, section: style_section, htmlAttr: "fill", inputtype: ColorInput, },{ name: "Color", key: "color", //sort: base_sort++, col:4, inline:true, section: style_section, htmlAttr: "color", inputtype: ColorInput, },{ name: "Stroke", key: "Stroke", //sort: base_sort++, col:4, inline:true, section: style_section, htmlAttr: "color", inputtype: ColorInput, }, { name: "Stroke width", key: "stroke-width", htmlAttr: "stroke-width", inputtype: RangeInput, data:{ max: 512, min:1, step:1 } }] });