Initial Commit

This commit is contained in:
David Stone
2024-11-30 18:24:12 -07:00
commit e8f7955c1c
5432 changed files with 1397750 additions and 0 deletions

46
assets/js/fields.js Normal file
View File

@ -0,0 +1,46 @@
/* global Vue */
if (typeof window.Vue !== 'undefined') {
/**
* Registers the ColorPicker component.
*
* @since 2.0.0
*/
Vue.component('colorPicker', {
props: ['value'],
template: '<input type="text">',
mounted() {
const vm = this;
$(this.$el)
.val(this.value)
.wpColorPicker({
width: 200,
defaultColor: this.value,
change(event, ui) {
// emit change event on color change using mouse
vm.$emit('input', ui.color.toString());
},
});
},
watch: {
value(value) {
// update value
$(this.$el).wpColorPicker('color', value);
},
},
destroyed() {
$(this.$el).off().wpColorPicker('destroy'); // (!) Not tested
},
});
} // end if;