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

bam-ui

v0.0.28

Published

目前只製作 vue 模式,引用預設使用 vue component.

Downloads

5

Readme

Bam-Ui

目前只製作 vue 模式,引用預設使用 vue component.

Dialog

支援多視窗開啟.自動校正定位.拖拉移動.拖拉調整視窗大小等功能。採用含式自動產生並灌入核心來建立畫面,有更好的依賴管理。

基本範例

main.ts

import { createApp } from 'vue';
import App from './App.vue';
import 'bam-ui/style';

createApp(App).mount('#app');

App.vue

<script setup lang="ts">
  import DialogView from '@/components/DialogView.vue';
  import { BamDialog, createDialog, useDialog } from 'bam-ui/vue';

  const onOpenDialog = async () => {
    const dialog = useDialog();
    const frame = await dialog.openFrame(() => DialogView);
  };
</script>

<template>
  <div id="app">
    <div class="main">
      <button type="button" @click="onOpenDialog">打開</button>
    </div>
    <bam-dialog />
  </div>
</template>

@/components/DialogView.vue

<script setup lang="ts">
  import { PropType } from 'vue';
  import { useDialog, BamFrameResize, BamFrameDraggable, FrameData, FrameMethods } from 'bam-ui/vue';
  const props = defineProps({
    frameData: {
      required: true,
      type: Object as PropType<FrameData>,
    },
    frameMethods: {
      required: true,
      type: Object as PropType<FrameMethods>,
    },
    frameProps: {
      type: Object as PropType<unknown>,
      default: () => ({}),
    },
  });

  const dialog = useDialog();
  const onClose = () => dialog.closeFrame(props.data.id);
</script>

<template>
  <div class="view">
    <bam-frame-resize>
      <div style="padding: 1rem;">
        <button @click="onClose">關閉</button>
        <bam-frame-draggable>拖拉</bam-frame-draggable>
      </div>
    </bam-frame-resize>
  </div>
</template>

API

createDialog

  • Description

產生 Dialog class,包含操作介面和狀態.本身不帶 Proxy,所以不具備響應能力,不可直接操作其屬性。放入 BamDialog 之中,可以對其代理及管理。

  • Interface:
function createDialog<View>(options: DialogOptions<View>): Dialog<View>;

interface DialogOptions<View> {
  name?: number | string | symbol;
  hook?: DialogHookParam;
  isBackgroundMask?: boolean;
  backgroundMask?: string;
}

interface DialogHookParam {
  mount?: Function;
  unmount?: Function;
  update?: Function;
  bgclick?: Function;
}

type View = DefineComponent;

useDialog

  • Description:

呼叫 Dialog 介面,可以使用內部的方法和狀態。該呼叫方式已被 vue 代理,可以直接對其操作,也不需要使用任何 ref 其封裝,也可直接丟入 component 處理,但是必須先行使用 createDialog 產生過。參數可選擇給或不給,如果產生多個 Dialog 時,createDialog 預設取用最後建立的,或是取用 Dialog.id 給予參數來精確選取。

  • Interface:
function createDialog<View>(id?: symbol): Dialog;

Dialog.prototype.openFrame

  • Description

打開 Dialog 的視窗,可以傳遞參數。也可以在打開後取得 Promise,於關閉時取回 Frame 並取用內部數值,以將參數回應給外層。

  • Interface:
function openFrame<View>(frame: OpenFrameOptions<View> | Frame<View>): Promise<Frame<View>>;

interface OpenFrameOptions<View> {
  view: View;
  props?: object;
  hook?: FrameHookParam;
  position?: FramePosition;
  isOverLimit?: boolean;
  isDraggable?: boolean;
  isResizable?: boolean;
  isFull?: boolean;
  width?: string;
  height?: string;
}

type FramePosition = 'auto' | 'center' | { top: number | string; left: number | string };

interface FrameHookParam {
  mount?: Function;
  unmount?: Function;
  update?: Function;
  bgclick?: Function;
  dragstart?: Function;
  dragover?: Function;
  dragend?: Function;
  touchstart?: Function;
  touchmove?: Function;
  touchend?: Function;
}