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 🙏

© 2025 – Pkg Stats / Ryan Hefner

angular2-desktop

v0.1.8

Published

angular2-desktop

Readme

Angular2Desktop

The library is built on angular 6, tested with latest chrome and firefox versions. It emulates a desktop environment.

demo

Requirements

angular6+, jquery, lodash, interactjs,font awesome

Install

$ npm install angular2-desktop
$ npm i jquery
$ npm i interactjs
$ npm @fortawesome/fontawesome-free

Configure app

add css snippet in your global style:

html, body {
  height: 100%;
  width: 100%;
  min-width: 1024px;
  min-height: 100% !important;
  margin: 0;
  padding: 0;
}

add libraries to your angular.json

"styles": [
              "src/styles.css",
              "node_modules/@fortawesome/fontawesome-free/css/all.css"
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.min.js",
              "node_modules/lodash/lodash.min.js",
              "node_modules/interactjs/dist/interact.min.js"
    
            ]

Usage

Defining applications / specifying entry components

Using a2d-desktop-application

(initialize event sends the app component as parameter)

<a2d-desktop-application
  id="'new_application'"
  title="'new_application'"
  [singleInstanceMode]="false"
  [open]="true"
  [x]="300"
  [y]="300"
  [width]="300"
  [height]="300"
  (initialize)="initialize($event)"
  [component]="TestapplicationComponent">

</a2d-desktop-application>

Manually using ClientService

In your app.component define applications :

 let myGreatApp = new DesktopApplication();
   myGreatApp.component = TestapplicationComponent;
   myGreatApp.id = 'mygreatapp';
   myGreatApp.title = 'mygreatapp';
   myGreatApp.defaultWindowParams = new WindowParams(
     null,
     100,
     100,
     200,
     200,
     'mygreatapp'
   );

make sure to provide WindowComponent and your application's entry component in the entry components of your app module. entryComponents:[WindowComponent,TestapplicationComponent]

Opening Applications

Using "a2d-shortcut" directive

example:

<button
       type="button"
       style="position:absolute;top:100px"
       a2dShortCut
       (initialize)="initializeComponent($event)"
       [appId]="'mygreatapp'">i am a custom button</button>

using "a2d-desktop-shortcut" component

example:

 <a2d-desktop-shortcut
      [appId]="'myotherapp'"
      [x]="20"
      [y]="20"
      [width]="100"
      [height]="50"
      [color]="'transparent'"
      [title]="'some link'"></a2d-desktop-shortcut>

Via "A2dClientService"

example:

  this.desktopService
      .createWindow<TestapplicationComponent>('mygreatapp',(component: TestapplicationComponent)=>{
        component.param1 = '2';
     },true)

or

   this.desktopService
           .createWindow<TestapplicationComponent>('mygreatapp',(component: TestapplicationComponent)=>{
             component.param1 = '2';
           })
           .then(windowId => {
             this.desktopService.openWindow(windowId);
           });
           

Defining windows

You might also want to specify windows directly in the markup.(see examples)

<a2d-window
    [id]="'firefox'"
    [appId]="'firefox'"
    [title]="'firefox'"
    [state]="WindowState.NORMAL"
    [dockPosition]="DockPosition.LEFT"
    [x]="400"
    [y]="400"
    [showWindowBtns]="true"
    [alwaysOnTop]="false"
    [showCloseBtnOnly]="false"
    [showDockingTools]="true"
    [width]="400"
    [height]="400">
    <div class="body">
      <button>Some Btn</button>
    </div>
  </a2d-window>

Desktop Areas

Angular Desktop lets you specify areas in the desktop as placeholders for your html code

  • Desktop area -- provide a div inside a2d-desktop with class "desktop"

  • bars -- provide a div inside a2d-desktop with class "bar-left","bar-top","bar-right" or "bar-bottom"

##Full example:

<a2d-desktop>
<div class="desktop">
  <a2d-desktop-shortcut
    [appId]="'myotherapp'"
    [x]="20"
    [y]="20"
    [width]="100"
    [height]="50"
    [color]="'transparent'"
    [title]="'some link'"></a2d-desktop-shortcut>
  <a2d-desktop-shortcut
    [appId]="'mygreatapp'"
    [x]="200"
    [y]="20"
    [width]="50"
    [height]="50"
    [title]="'firefox'"
    [icon]="'/assets/images/icons/firefox.png'"></a2d-desktop-shortcut>
  <a2d-desktop-shortcut
    [appId]="'justAnotherApp'"
    [x]="400"
    [y]="20"
    [width]="50"
    [height]="50"
    [title]="'justAnotherApp'"></a2d-desktop-shortcut>
  <button
    type="button"
    style="position:absolute;top:100px"
    a2dShortCut
    (initialize)="initializeComponent($event)"
    [appId]="'mygreatapp'">open single instance pp</button>

  <button
    type="button"
    style="position:absolute;top:200px"
    a2dShortCut
    (initialize)="initializeComponent($event)"
    [linkId]="'some_link'"
    [windowTitle]="'testTitle'"
    [appId]="'justAnotherApp'">multiple instance app but shortcut attached to one window</button>
  <button
    type="button"
    style="position:absolute;top:250px"
    a2dShortCut
    (initialize)="initializeComponent($event)"
    [appId]="'justAnotherApp'">multiple instance app</button>
</div>
<div class="bar-top">
  <a2d-task-bar></a2d-task-bar>
</div>
<div class="bar-left">

  <a2d-shortcut [appId]="'mygreatapp'" [icon]="'/assets/images/icons/firefox.png'"></a2d-shortcut>
  <a2d-shortcut [appId]="'myotherapp'" [icon]="'/assets/images/icons/gmail.png'"></a2d-shortcut>

</div>
<a2d-desktop-application
  id="'new_application'"
  title="'new_application'"
  [singleInstanceMode]="false"
  [open]="true"
  [x]="300"
  [y]="300"
  [width]="300"
  [height]="300"
  (initialize)="initialize($event)"
  [component]="TestapplicationComponent">

</a2d-desktop-application>
</a2d-desktop>

Options

  • a2d-desktop

    • dockPosition: dock position of the window(when the window in docked state)
    export enum DockPosition {
      TOP_LEFT=1,
      TOP=2,
      TOP_RIGHT=3,
      BOTTOM_LEFT=4,
      BOTTOM=5,
      BOTTOM_RIGHT=6,
      LEFT=7,
      RIGHT=8
    }
    
    • x: pixels left from the window container
    • y: pixels top from the window container
    • width: width in pixels
    • height: height in pixels
    • alwaysOnTop: keep the window on top
    • showWindowBtns: hide/show the buttons in the header
    • showCloseBtnOnly
    • showDockingTools: turn on/off docking user interaction
    • showHeader: show/hide the window header
  • a2d-shortcut

    • windowId: the id of the window the shortcut is related to
    • icon: the url for the icon image

Styling/Themes

example theme:

@import "variables";
@import "utils";

.angular2-desktop {
  background: url("/assets/images/ubuntu-wallpaper.jpg") no-repeat center center fixed;
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

.window-header {
  background-color: theme-color('background');
  @include text-color();
}

.window-body {
  background-color: theme-color('primary');
  border-left: 2px solid theme-color('background');
  border-right: 2px solid theme-color('background');
  border-bottom: 1px solid theme-color('background');
}

.window-btn {
  background-image: linear-gradient(theme-color('background', 'light'), darken(theme-color('background', 'light'), 10%));
  border: 1px solid theme-color('background', 'dark');
  color: theme-color('background');
  &.danger {
    background-color: theme-color('accent');
  }
}

.bar-container {
  background-color: transparent ;
  color: theme-color('foreground');
}

.taskbar-entry {
  span {
    color: theme-color("foreground");
  }
  &.active {
    background-color: theme-color("accent");
  }
  &:hover {
    background-color: theme-color("background");
  }

}

.bar-dummy {
  background-color: black;
  opacity: 0.3;
}

.preview-rect {
  background-color: theme-color('background');
  opacity: 0.5;
}

.shortcut {
  .circle {
    background-color: theme-color('accent');
  }

  &:hover {
    background-color: theme-color('background');
    cursor: pointer;
  }

}
.desktop-shortcut {
  .fill {
  
    &:hover {
      background-color: black;
      opacity: 0.1;
      cursor: pointer;
    }
  }



}

Next Steps

Resolve conflicts with bootstrap css Define applications in markup instead of using the service css style tweaks