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

@neil585456525/vue-content-selector

v0.1.5

Published

A vue-component that select the html element position and inject content visually!

Downloads

3

Readme

vue-content-selector

A vue-component that select the html element position and inject content visually!

online preview

demo gif

Overview

Why ?

If you have created any website add-on like a share-like-button or a advertisement window, that will be inserted into user's website. This tool can help your users to select and feel a good position for your content!

Roadmap

  • [x] Basic componet usage
  • [x] Modify position appearance
  • [ ] Add unit-testing
  • [ ] Add e2e-testing
  • [ ] List and select parent element
  • [ ] Mobile preview mode

Installation and Usage

Installation

npm install @neil585456525/vue-content-selector

Usage

import { createApp } from "vue";
import VueContentSelector from "@neil585456525/vue-content-selector";
import App from "./App.vue";

createApp(App).use(VueContentSelector).mount("#app");
<template>
  <div>
    <vue-content-selector>
      # things you want to dynamic injected
      <custom-content />
    </vue-content-selector>
  </div>
</template>

Api

Props

  • isWidgetInShadow

    • type: Boolean
    • default: true

    Should widget component rendered in shawdow dom, which can encapsulate css style. It will be convenient when injecte into customer pages.

  • widgetStyleInShadow

    • type: String

    When widget component in shawdow dom, it will encapsulate global css style. You can provide the css string to override the style, it will auto inject into shadow.

  • isContentInShadow

    • type: Boolean
    • default: false

    Let injected-contnet component rendered in shawdow dom.

  • contentStyleInShadow

    • type: String

    Auto injected-contnet style into shadow.

  • baseZIndex

    • type: Number

    Set the widget base-z-index, it also affect positionSelecter logic.

Emits

  • onHoverChanged()

    • parameters: hovered element
    • type: Element

    Triggers when select hovered element changes

  • onPositionSelected()

    • parameters: hovered element
    • type: Element

    Triggers when select sucessed

  • onCanceled()

    Triggers when click cancel button

Discussion

This project is trying to build a library to select the html element position and inject content visually in any website! To achieve this there are a number of primary problems should be solved as bellow.

  1. Isolate css from the original page.
  • Using shadow dom and custom webpack style-loader config to dynamic inject style into the shadow root. I don't using iframe as my solution because I want it can easily communicate with page runtime, and it's also can deploy more smoothly.
  1. Selecting page element with the cursor, but don't trigger the element event, also try to optimize the performence as possible.
  • Oringinal I used dynamic event binding when any elememnt that cursor hovered, but it can't prevent the original element hover and click behavior, and will cause some performence problem, so I come out another solution. Using an invisible mask and using elementFromPoint API to reach this effect, this can solve both problems.

Development

In root folder :

yarn intall
yarn dev

Then in /example folder

yarn install
yarn serve