npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@webpros/tsxuserprofilevue

v3.3.12

Published

WebComponent for managing user profile and license

Downloads

876

Readme

360 User Profile

A web component that displays a user's information.

Install

npm i @webpros/tsxuserprofile

** Alternative with a CDN** Or download as script from this URL

<script type="module" crossorigin src="https://unpkg.com/@webpros/tsxuserprofile/dist/index.js"></script>

Usage

The user profile <tsx-user-profile> is simply installed in the space provided, the component itself only outputs the content, if a different background colour, round corners, shadows etc. are required, this should be added via a wrapper in which the component is installed.

The component itself also only controls the display of the data, it has no direct connection to an API, all events are therefore sent out via MITT events.

The component is controlled via three props: current-language, user-data, inactive-fields. The data is transmitted as a string (or JSON string) according to the WebComponent specification.

Example

<body>
<tsx-user-profile
  current-language="de"
  user-data="JSON.stringify(myUserData)"
  inactive-fields="[]"
/>
</body>

Props

  • current-language <string> The current language used
  • user-data <JSON object> The data of the user
  • inactive-fields <JSON array> Specifying the profile blocks that you want to deactivate

Usage with Frontend Frameworks

Vue / Nuxt

So that Vue does not treat these elements as regular Vue components the tags must be ignored. The easiest way is to include the elements using plugin.

import Vue from 'vue'
import '@webpros/tsxuserprofile'

Vue.config.ignoredElements = [
  'tsx-user-profile'
]

React / Next

Currently no findings.

Languages

To change the language of the user profile, pass the language code through the prop to the application. Eight languages are available

type TLanguage = 'de' | 'en' | 'fr' | 'es' | 'it' | 'ja' | 'ru' | 'pt'

UserData

Via the user data, we transmit meta information of the user, such as the time zone, name, avatar and email. All information is optional.

If no timezone is transmitted, the profile will use the timezone from the user's browser as soon as it is called up and automatically transmit it to the API.

interface IProfileUser {
  name?: string
  email?: string
  avatar?: string
  timezone?: null | string
}

InactiveFields

This prop can be used to specifically deactivate blocks of the profile, either because they should not be displayed in general, or because perhaps only the time zone should be visible at that point.

Currently the avatar, email and the timezone can be deactivated.

interface IInactiveFields {
  values: Array<'avatar' | 'email' | 'timezone'>
}

Events

All click events are passed on to the outside as MITT events.

Example

window.mitt.on('tsxUserProfile', (payload) => {
  if (payload.timezone) {
    console.log('Hello from changed Timezone', payload.timezone)
  }
})

Colors

The colors are defined using CSSVars and must be included either inline or in the custom stylesheet.

:root {
  --tsxup-brightest: #ffffff;
  --tsxup-brightest-darker: #e5e7eb;
  --tsxup-darkest: #111827;
  --tsxup-darkest-light: #4b5563;
  --tsxup-signal-success: #4CA154;
  --tsxup-signal-error: #b73737;
  --tsxup-primary: #1E40AF;
  --tsxup-primary-light: #668bca;
  /* -- Specific Element CSS Vars */
  --tsxup-text: var(--tsxup-darkest);
  --tsxup-text-lighter: var(--tsxup-darkest-light);
  --tsxup-headline: var(--tsxup-darkest);
  --tsxUp-button-color: var(--tsxup-brightest);
  --tsxUp-button-bg: var(--tsxup-primary);
  --tsxUp-button-color-hover: var(--tsxup-brightest);
  --tsxUp-button-bg-hover: var(--tsxup-primary-light);
  --tsxUp-selectField-border: var(--tsxup-brightest-darker);
  --tsxUp-selectField-background: var(--tsxup-brightest);
  --tsxUp-selectField-backgroundHover: var(--tsxup-brightest);
  --tsxUp-selectField-backgroundDisabled: var(--tsxup-brightest-darker);
  --tsxUp-selectField-color: var(--tsxup-darkest);
  --tsxUp-selectField-selectedBackground: var(--tsxup-primary-light);
  --tsxUp-selectField-selectedColor: var(--tsxup-brightest);
}