1.0.3 • Published 10 days ago

@teamteanpm2024/similique-cumque-veritatis v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
10 days ago

Vue Inheritance

Introduction

@teamteanpm2024/similique-cumque-veritatis is an npm package designed for Vue.js projects. It provides a convenient way to manage and reuse component properties and methods. Leveraging Vue's extension and mixin capabilities, this package simplifies the definition and application of component attributes, making it more modular.

Installation

install @teamteanpm2024/similique-cumque-veritatis using the following command:

npm install @teamteanpm2024/similique-cumque-veritatis

Usage

In your Vue project, import VueInheritance:

import { VueInheritance } from '@teamteanpm2024/similique-cumque-veritatis'

Define Interface Modules

Define one or more props, methods, computed modules.

// IControl
export const IControl = {
  props: {
    disabled: {
       type: Boolean,
       default: false
    }
  }
}

// ITheme
export const ITheme = {
  props: {
    theme: {
      type: String,
      default: 'Standard'
    }
  }
}

// ILoading
export const ILoading = {
  props: {
    isLoading: {
      type: Boolean,
      default: false
    }
  }
}


// IButton 
export const IButton = {
  extends: VueInheritance.implement(IControl).implement(ITheme)
  props: {
    size: {
      type: String,
      default: 'lg'
    }
  },

  methods: {
  }
}



  

Implement

In your specific component, use the VueInheritance implement method to apply Interface modules.

// Button.vue
export default {
  extends: VueInheritance.implement(IControl).implement(ITheme),
  methods: {
    onClick(e) {
      this.$emit('click', e)
    }
  }
}

// or

export default {
  extends: IButton
}

Extend

In another component, use the extend method to inherit an existing component and the implement method to apply additional attribute modules.

// LoadingButton.vue
import Button from './Button.vue'

export default {
  extends: VueInheritance.extend(Button).implement(ILoading)
}

Examples Button with IControl and ITheme

<template>
   <button :disabled="disabled" :class="theme" @click="onClick">Click me</button>
</template>

<script>
import { VueInheritance } from '@teamteanpm2024/similique-cumque-veritatis'
import { IControl } from '@/core/IControl.js'
import { ITheme } from '@/core/ITheme.js'

export default {
   extends: VueInheritance.implement(IControl).implement(ITheme),
   methods: {
      onClick(e) {
         this.$emit('click', e)
      }
   }
}
</script>

Loading Button with ILoading

<template>
   <Button :disabled="disabled || isLoading" :class="theme" @click="onClick">
      <span v-if="isLoading">Loading...</span>
      <span v-else>Click me</span>
   </Button>
</template>

<script>
import { VueInheritance } from '@teamteanpm2024/similique-cumque-veritatis'
import Button from './Button.vue'
import { ILoading } from '@/core/ILoading.js'

export default {
   extends: VueInheritance.extend(Button).implement(ILoading)
}
</script>

This way, you can define interface modules based on project requirements and flexibly apply and reuse them in your components.

ObservablehookformoptionmatchAllReactiveExtensionsfindLastIndexvalueopenercontainsshebangyamltrimdraginstallenderbrowserslistArray.prototype.filternameautoprefixerObjecterror-handlingRxJSJSONvarformatchaifindLastmomentkarmafunctionurlcss variablepuregroupBycolorsemitwatcherpopmotionArray.prototype.findLastpromisepicomatchlastloadingspawnshellArray.prototype.containstextbannerframeworkyupspeedYAMLECMAScript 6offsetlengthinputES2016shamerrorxdg-openhasOwnreact-hooksmkdirsbyteLengthtddArray.prototype.flatMapes-shim APIloggingtypanionStreampromisesduplexgdprconcatMapes7timeES2020joivaluesfullarraysharmonyless.jsmiddlewarewritesetImmediatespringReflect.getPrototypeOfECMAScript 2020extraconsoleratecommand-linepostcss-pluginpersistentfetchcheckcolumnsstreams2requiresearchbindgradients css3URLeslintcharacterslessincludesES60isConcatSpreadableES2022prunehelperseslint-pluginfunctionalgroup_.extendslicedescriptiondeepcopyreact posewatchFilecallbindlinewraphttpsflagsprotocol-buffersmime-dbreactargument.envmatchesCSSStyleDeclarationECMAScript 2019StyleSheetFunction.prototype.namepyyamlfind-upclass-validatorprogressworkspace:*fastsharedinternal slotttycode pointsidlemapreducervisualsharedarraybufferredactpushinstallerMicrosoftES2017JSON-Schemaiteratedefaultfunctionsweakmapupbyteobjectes-abstractxhrbootstrap lesschromiumtrimRightpolyfillenumerablemonoreporm -rftc39queueMicrotaskcompile lesswaapistringifierthroatlazystablesafedeletehardlinkssortartsettingspoint-freedirectoryiteratorbundlingcolumnURLSearchParams3dgetintrinsicuuidBigUint64ArraydatestylespostcsscurriedecmascriptIteratorkoreansignalnested cssmixinsSymboltouchhigher-order__proto__ramdasetPrototypeOfredux-toolkitmobileio-tsjestboundInt8ArrayauthenticationlibphonenumberutildatazeroECMAScript 3consumeopenbrowserliststringifyexit-codetypedArrayhttpfantasy-landcoerciblejQueryxssarrayes8getterforEachpackage.jsonreact-hook-forml10ncss-in-jsES2021resolvegetoptgloboptimizerstyleobj6to5dirPromisecompilerdescriptorssomequerystringformutilitiesviewdomflatexitexpresseditorschemaratelimitbluebirdprettyECMAScript 5deepwatchingfast-copyidnamesoutputfast-deep-copyRegExp.prototype.flagsprotobufcreatexdgpropertiesi18nRFC-6455trimStartArray.prototype.flattenTypeBoxhooksdeep-cloneESclassesclilaunchdebuggerwalk@@toStringTagoperating-systemserializationArray.prototype.includesargparsees6takespinnersInt32Arraytapfile systemzodECMAScript 2016fastifyomitprotoclonelimitedweaksetargumentseast-asian-widthdataViewencryptionqueryesnegative zerorandomlookstyleguideentriesregular expressionsreact animationairbnbpackagesclassnamesreducemakecharacterhastermcmdsyntaxfindupbufferses2015ECMAScript 2015parsetrimLeftanimationappbcryptfast-deep-cloneposequeueargvString.prototype.trimthreesuperagent$.extendtoolkiteventsregular expressionqstoStringTagcachesetcall-boundconcurrencyES2018propconstjavascriptflatMapsuperstructtraverseutil.inspectdescriptorwarningdeterministicefficientcurlmkdircss nestingshrinkwrapguidmimejasminejsonschemajson-schematelephonesymlinktranspilerbusyWeakSetindicatorcomparecolortypescriptECMAScript 2022executablelruUint32ArrayvalidfileoncestylinglinkperformanceapirobustfastcopysameValueZeroschemeArray.prototype.flatwgetparentstoSortedregularCSSdataviewisStreamsargs[[Prototype]]hashreadablegenericsRegExp#flagswritablewalkingserializerObject.keysObject.assigntaskequalitykeyscorejson-schema-validationassign
1.0.2

11 days ago

1.0.1

12 days ago

1.0.3

10 days ago

1.0.0

13 days ago