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

web-atoms-core

v1.1.117

Published

Web Atoms Core

Downloads

1,157

Readme

Action Status npm version codecov

Web-Atoms Core

Web Atoms Core is a UI abstraction framework along with powerful MVVM pattern to design modern web and mobile applications.

Xamarin.Forms Features

  1. Use VS Code to develop Xamarin.Forms
  2. Write TypeScript instead of C#
  3. Write TSX (JSX) instead of Xaml
  4. Live hot reload for published app

Web Features

  1. Abstract Atom Component
  2. Abstract Device API (Browser Service, Message Broadcast)
  3. Theme and styles support without CSS
  4. One time, One way and Two way binding support
  5. Simple dependency Injection
  6. In built simple unit testing framework
  7. UMD module support
  8. Full featured MVVM Framework with powerful validation

Folder structure

  1. All views for web must be placed under "web" folder inside "src" folder.
  2. All views for Xamarin Forms must be placed under "xf" folder inside "src" folder.

Example folder structure

src
+--images
|  +--AddButton.svg
|
+--view-Models
|  +--TaskListViewModel.ts
|  +--TaskEditorViewModel.ts
|
+--web
|  +--tasks
|     +--TaskListView.tsx
|     +--TaskEditorView.tsx
|
+--xf
   +--tasks
      +--TaskListView.tsx
      +--TaskEditorView.tsx 

Example View Model


export class UserListViewModel extends AtomViewModel {

    public user: any;

    public list: IUser[];

    public search: string = null;

    /// Dependency Injection
    @Inject
    private listService: ListService;

    /// @validate decorator will process this accessor
    /// in a way that it will always return null till
    /// you call this.isValid. After this.isValid is 
    /// called, it will display an error if data is invalid
    @Validate
    public get errorName(): string {
        return this.user.name ? "" : "Name cannot be empty";
    }

    /// You can bind UI element to this field, @watch decorator
    /// will process this accessor in a way that UI element bound
    /// to this field will automatically update whenever any of
    /// fields referenced in this method is updated anywhere else
    @Watch
    public get name(): string {
        return `${this.user.firstName} ${this.user.lastName}`;
    }

    /// this will be called immediately after the view model 
    /// has been initialized
    /// this will refresh automatically when `this.search` is updated
    /// refresh will work for all (this.*.*.*) properties at any level
    @Load({ init: true, watch: true })
    public async loadItems(ct: CancelToken): Promise<void> {
        this.list = await this.listService.loadItems(this.search, ct);
    }

    /// this will validate all accessors before executing the action
    /// and display success message if action was successful
    @Action({ validate: true, success: "Added successfully" })
    public async addNew(): Promise<any> {
        ... 
    }

}

Web Controls

  1. AtomComboBox (wrapper for SELECT element)
  2. AtomControl (base class for all other controls)
  3. AtomItemsControl
  4. AtomListBox
  5. AtomPageView (control browser that hosts other control referenced by url)
  6. AtomWindow

Services

  1. WindowService - to host AtomWindow and retrieve result
  2. RestService - RetroFit kind of service for simple ajax
  3. BrowserService - An abstract navigation service for Web and Xamarin

Development guidelines

  1. Use TypeScript module pattern
  2. Do not use namespace
  3. Organize single module in single TypeScript file
  4. Import only required module and retain naming convention
  5. Do not define any default export
  6. No Atom.get and Atom.set
  7. Do not use underscore _ anywhere, not in field name not in get/set
  8. Do not use set_name method name, instead use get name() and set name(v: T) syntax for properties.

How to run unit tests?

  1. Import test class src\test.ts
  2. Run node .\dist\test.js

How to get code coverage?

  1. Install istanbul, npm install istanbul --save-dev
  2. Install remap-istanbul, npm install remap-istanbul
  3. Cover Run, .\node_modules\.bin\istanbul.cmd cover .\dist\test.js
  4. Report Run, .\node_modules\.bin\remap-istanbul -i .\coverage\coverage.json -t html -o html-report
  5. Open generated html-report on browser