JSFiddle - React, Tailwind, and code Playground

by enyojs

JavaScript

// Reminders:
// owner -> $
// container -> controls 
// controlParent -> children 

var MultipleControlParentSupport = {
    name: "MultipleControlParentSupport",
    // controlParents: {
    //     components: "client",
    //     headerComponents: "header"
    // },
    initComponents: enyo.inherit(function (sup) {
		return function() {
			sup.apply(this, arguments);
            for (var cbName in this.controlParents) {
                var instanceControlParent = this.$[this.controlParents[cbName]];
                if (this.multiKindComponents && this.multiKindComponents[cbName]) {
                    this.createChrome(
                        this.multiKindComponents[cbName], 
                        {instanceControlParent: instanceControlParent}
                    );
                }
                if (this[cbName]) {
                    this.createClientComponents(
                        this[cbName],
                        {instanceControlParent: instanceControlParent}
                    );
                }
            }
		};
	}),
	createChrome: function(inComponents, inOpts) {
		this.createComponents(inComponents, enyo.mixin({isChrome: true}, inOpts));
	},
	createClientComponents: function(inComponents, inOpts) {
		this.createComponents(inComponents, enyo.mixin({owner: this.getInstanceOwner()}, inOpts));
	},
    addChild: enyo.inherit(function (sup) {
		return function(inChild, inBefore) {
            if (inChild.instanceControlParent) {
                inChild.instanceControlParent.addChild(inChild);
            } else {
    			sup.apply(this, arguments);
            }
        };
	}),
    /*
    statics: {
        subclass: function(ctor, props) {
        	var proto = ctor.prototype;
            if (true) debugger;
            if (props.controlParents) {
                // We'll let users put the legacy components->controlParent mapping in the new
                // controlParents block, but we'll assign that back to the legacy controlParentName
 ...