Sha256: 08df493281abe8c9b8f0e6bb4c3835702842ddf3fed7dd04a723c6493231202e

Contents?: true

Size: 473 Bytes

Versions: 35

Compression:

Stored size: 473 Bytes

Contents

import { getData } from "@helpers/alpine";
import { nameFunction } from "@helpers/lang";

function CocoComponent(name, fn) {
  const func = nameFunction(name, (...args) => {
    const data = fn(...args);

    Object.defineProperties(data, {
      $parent: {
        get() {
          return getData(this.$root.parentElement);
        },
      },
    });

    data.$options = {};

    return data;
  });

  func.component = true;
  return func;
}

export { CocoComponent };

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
coveragebook_components-0.14.0 app/assets/js/base/coco.js
coveragebook_components-0.13.1 app/assets/js/base/coco.js
coveragebook_components-0.13.0 app/assets/js/base/coco.js
coveragebook_components-0.12.2 app/assets/js/shared/coco.js
coveragebook_components-0.12.1 app/assets/js/shared/coco.js
coveragebook_components-0.12.0 app/assets/js/shared/coco.js
coveragebook_components-0.11.0 app/assets/js/shared/coco.js
coveragebook_components-0.10.1.beta.2 app/assets/js/shared/coco.js
coveragebook_components-0.10.1.beta.1 app/assets/js/shared/coco.js
coveragebook_components-0.10.1.beta.0 app/assets/js/shared/coco.js
coveragebook_components-0.10.0 app/assets/js/coco.js
coveragebook_components-0.9.1 app/assets/js/coco.js
coveragebook_components-0.9.0 app/assets/js/coco.js
coveragebook_components-0.8.9 app/assets/js/coco.js
coveragebook_components-0.8.8 app/assets/js/coco.js
coveragebook_components-0.8.7 app/assets/js/coco.js
coveragebook_components-0.8.6 app/assets/js/coco.js
coveragebook_components-0.8.5 app/assets/js/coco.js
coveragebook_components-0.8.4 app/assets/js/coco.js
coveragebook_components-0.8.3 app/assets/js/coco.js