How to use @pluginjs/template - 10 common examples

To help you get started, we’ve selected a few @pluginjs/template examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pluginjs / pluginjs / modules / video-picker / src / main.js View on Github external
build() {
    addClass(this.classes.INPUT, this.element)
    this.$wrap = wrap(
      `<div class="${this.classes.NAMESPACE} ${this.classes.WRAP}"></div>`,
      this.element
    )

    if (this.options.theme) {
      addClass(this.classes.THEME, this.$wrap)
    }

    this.TRIGGER = new Trigger(this)

    this.$dropdown = parseHTML(
      template.compile(this.options.templates.dropdown())({
        classes: this.classes
      })
    )
    this.$action = parseHTML(
      template.compile(this.options.templates.previewContent())({
        classes: this.classes
      })
    )
    this.$videoPreview = parseHTML(
      template.compile(this.options.templates.videoPreview())({
        classes: this.classes
      })
    )
    this.$wrap.append(this.$dropdown)
    // set Aspect Ratio
    const sourceData = []
github pluginjs / pluginjs / modules / icon-picker / src / main.js View on Github external
buildPack(pack) {
    if (!this.packTemplate) {
      this.packTemplate = templateEngine.compile(
        this.options.templates.pack.call(this)
      )
    }

    const $pack = parseHTML(
      this.packTemplate({
        classes: this.classes,
        pack
      })
    )

    pack.__dom = $pack
    pack.__items = {}

    if (pack.classifiable === false) {
      each(pack.icons, (name, label) => {
github pluginjs / pluginjs / modules / list / src / main.js View on Github external
build() {
    addClass(this.classes.ELEMENT, this.element)

    this.$wrapper = wrap(
      `<div class="${this.classes.WRAPPER}"></div>`,
      this.element
    )

    if (this.options.theme) {
      addClass(this.getThemeClass(), this.$wrapper)
    }

    this.$list = appendTo(
      template.compile(this.options.templates.container())({
        classes: this.classes
      }),
      this.$wrapper
    )

    this.buildItems()
  }
github pluginjs / pluginjs / modules / auto-complete / src / main.js View on Github external
buildItem(item) {
    if (!this.itemTemplate) {
      this.itemTemplate = templateEngine.compile(
        this.options.templates.item.call(this)
      )
    }
    const nvalue = this.setMatchItem(item)
    const $item = parseHTML(
      this.itemTemplate({
        classes: this.classes,
        item,
        value: this.getItemValue(item),
        label: nvalue
      })
    )

    return $item
  }
github pluginjs / pluginjs / modules / hotspots / src / main.js View on Github external
createHotspots() {
    const template = templateEngine.compile(
      this.options.templates.hotspot.call(this)
    )
    const iconTemplate = templateEngine.compile(
      this.options.templates.icon.call(this)
    )
    const textTemplate = templateEngine.compile(
      this.options.templates.text.call(this)
    )
    const dotTemplate = templateEngine.compile(
      this.options.templates.dot.call(this)
    )
    const numberTemplate = templateEngine.compile(
      this.options.templates.number.call(this)
    )

    let html = ''
    let label = ''
    let type = ''

    this.options.data.forEach(item => {
      type = item.type ? item.type : this.options.type
      switch (type) {
        case 'icon':
          label = iconTemplate({
            classes: this.classes,
            icon: item.icon ? item.icon : this.options.icon
          })
          break
github pluginjs / pluginjs / modules / gradient-picker / src / main.js View on Github external
createEl(tempName, options) {
    return parseHTML(
      template.compile(this.options.templates[tempName]())(options)
    )
  }
github pluginjs / pluginjs / modules / infinite / src / main.js View on Github external
throwError(error) {
    this.resolveLoading()

    if (!this.$error) {
      this.$error = parseHTML(
        template.compile(this.options.templates.error(error))({
          classes: this.classes,
          errorText: this.translate('errorText')
        })
      )
    }

    insertBefore(this.$error, this.$last)

    if (this.options.trigger === 'button') {
      this.$button.remove()
    }

    this.trigger(EVENTS.ERROR, error)
    this.enter('error')
  }
github pluginjs / pluginjs / modules / offset / src / main.js View on Github external
createEl(tempName, options) {
    return parseHTML(
      template.compile(this.options.templates[tempName]())(options)
    )
  }
github pluginjs / pluginjs / modules / link-picker / src / internal.js View on Github external
initialize() {
    const html = template.compile(this.instance.options.internal.template())({
      classes: this.instance.classes,
      field: this.instance.getClassName(
        this.instance.classes.NAMESPACE,
        'internal'
      ),
      internal: this.instance.translate('internal')
    })
    this.$wrap = parseHTML(html)
    this.$content = query(`.${this.instance.classes.FIELDCONTENT}`, this.$wrap)
    this.element = query(
      `.${this.instance.classes.CASCADERTRIGGER}`,
      this.$content
    )
    this.CASCADER = Cascader.of(this.element, {
      source: this.instance.options.internalValue,
      keyboard: true,
github pluginjs / pluginjs / modules / modal / src / main.js View on Github external
if (this.options.title !== '') {
      title = templateEngine.render(this.options.templates.title.call(this), {
        classes: this.classes
      })
    }

    if (this.options.content !== '') {
      content = templateEngine.render(
        this.options.templates.content.call(this),
        { classes: this.classes }
      )
    }

    if (this.options.buttons) {
      buttons = templateEngine.render(
        this.options.templates.buttons.call(this),
        { classes: this.classes }
      )
    }

    if (this.options.icon) {
      icon = templateEngine.render(this.options.templates.icon.call(this), {
        classes: this.classes,
        iconClass: this.getIconClass()
      })
      this.$icon = parseHTML(icon)
    }

    const html = templateEngine.render(this.options.template.call(this), {
      classes: this.classes,
      overlay,

@pluginjs/template

A workflow for modern frontend development.

GPL-3.0
Latest version published 2 years ago

Package Health Score

46 / 100
Full package analysis

Similar packages