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

pxy_webcommonui

v0.1.14

Published

common ui components for pxy cloudrending.

Downloads

21

Readme

PXY Common WebUI


English 中文


  • Joystick component, fro virtual joystick UI, when config larksr object to this component, auto send operate command to cloud rendering.

Quick Start

Install

  1. npm
npm i pxy_webcommonui
  1. plain html
<script src="pxy_webcommonui.min.js"></script>

Use

Pacakge Name

  1. import ./test/App.tsx
import PxyCommonUI from 'pxy_webcommonui';
const { 
  Joystick, 
  KJoystickEvents,
  KJoystickSubTypes
} = PxyCommonUI;
  1. Plain html import to global object pxy_webcommonui, use new pxy_webcommonui.Joystick({...config}) to create, see./sample-plain-html/source/index.html

Joystick Component

Use import as exp:

this.joystick = new Joystick({
    // root html element. 
    rootElement: this.uiContainerRef.current, 

    // Option,larksr object,create with larksr websdk
    // If set auto send operate command to cloud, or use callback joystickstart joystickmove joystickend.
    // npm https://www.npmjs.com/package/larksr_websdk
    // doc https://github.com/pingxingyun/lark_sr_websdk_demos
    // demos https://pingxingyun.github.io/webclient_sdk/
    larksr: this.larksr,

    // Option subType  1 wasd  2 updownleftright 3 joystick 0 none
    // Joystick type
    // 1 Keyboard WASD key
    // 2 Keyboard UpDownLeftRight Key
    // 3 Joystick
    // 0 None
    // 默认为 1
    subType: 1,

    // Option, component position
    // If not set use parent position.
    position: {
        top: 150,
        left: 100,
    },

    // Option, component size
    // If not set use parent html element size.
    size: {
        width: 200, 
        height: 200,
    },

    // Option, component center point size.
    // Default = total width 25%
    centerSize: {
        width: 100,
        height: 100,
    },

    // Option,extral style css.
    extralJoystickStyle: 'background-color: red;',

    // Option, extral center point css style.
    extralCenterStyle: 'background-color: #fff;',

    // Option, background url. set within css prop background-image
    joystickBackgroundUrl: "",

    // Option,center point background url,set within css prop background-image
    centerBackgroundUrl: "",

    // Option,send command interval.
    repeatTimeout: 10,
});

Destory Joystick:

// Destory joystick DOM element.
this.joystick.destroy();

Listen event.

this.joystick.on(KJoystickEvents.EVENTS_JOYSTICK_START, function(e) {
    console.log("joystickstart", e.detail);
});
this.joystick.on(KJoystickEvents.EVENTS_JOSYTICK_MOVE, function(e) {
    console.log("joystickmove", e.detail);
});
this.joystick.on(KJoystickEvents.EVENTS_JOYSTICK_END, function(e) {
    console.log("joystickend", e.detail);
});

Generally two way to use this component. Use fixd position size or parent html element position size.

Other

/**
 * Refresh component size.
 */
public resize()
/**
 * Show component.
 */
public show()
/**
 * Hide component.
 */
public hide()

Send command (WASD) and Joystick touch position.

Keyboard Component

Use import as exp:

this.keyboard = new Keyboard({
    // root html element. 
    rootElement: this.uiKeyboardRef.current, 
    
    // must set larksr object
    larksr: this.larksr,

    // zh en
    language: 'En',

    theme: 'dark'
});
// show virtual keyboard
this.keyboard.show();

// hide virtual keyboard
this.keyboard.hide();

Listen event for input text.

this.keyboard.on('keyboardVal', function(e) {
    console.log('e',e.detail);
});

Debug

  1. Running test, config ./test/App.tsx larksr object.
yarn run dev

  1. Release
yarn run dist