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

scaife-skeleton

v0.10.0

Published

Quickly build Scaife reading environments

Downloads

29

Readme

Scaife Skeleton

front-end layout library for Scaife readers

CircleCI

This repository is part of the Scaife Viewer project, an open-source ecosystem for building rich online reading environments.

This is the foundation for any Scaife reader. It consists of two main skeleton types, FixedSkeleton and EditableSkeleton.

  1. In the FixedSkeleton case, you the site developer, pre-determine and decide what widgets will belong to the layout.
  2. With the EditableSkeleton, you, as the site developer, only provide the options of possible widgets and the user of the reader selects the layout at runtime.

Installation

yarn add scaife-skeleton

or

npm install scaife-skeleton

Requirements

Your project must be using Vuex even if your reader doesn't require a store directly since the skeleton uses it.

Usage

After installation, you'll first want to hook up the store:

In your store.js (or wherever you are setting up your store):

import Vue from 'vue';
import Vuex from 'vuex';

import createStore from 'scaife-skeleton';

Vue.use(Vuex);

const skeletonStore = createStore();

export default new Vuex.Store({
  modules: {
    [skeletonStore.namespace]: skeletonStore.store,
  },
});

Using the FixedSkeleton

The use of the skeleton components is intended to be within components that are full screen, perhaps in one that has a navbar at top. Often this means a top level App.vue component.

<template>
  <div id="app">
    <FixedSkeleton
      :main-widget="mainWidget"
      :left-widgets="leftWidgets"
      :right-widgets="rightWidgets"
    />
  </div>
</template>

<script>
  // import widgets that you want in your project
  import TextSelectionWidget from './morphgnt/widgets/TextSelectionWidget.vue';
  import AnalysisWidget from './morphgnt/widgets/AnalysisWidget.vue';
  import ReaderWidget from './morphgnt/widgets/ReaderWidget.vue';
  import TocWidget from './morphgnt/widgets/TocWidget.vue';
  import TextSizeWidget from './reader/widgets/TextSizeWidget.vue';
  import TextWidthWidget from './reader/widgets/TextWidthWidget.vue';

  export default {
  name: 'app',
  components: {
    FixedSkeleton,
  },
  computed: {
    mainWidget() {
      return ReaderWidget;
    },
    leftWidgets() {
      return [
        TextSelectionWidget,
        TocWidget,
      ];
    },
    rightWidgets() {
      return [
        TextSizeWidget,
        TextWidthWidget,
        AnalysisWidget,
      ];
    },
  }
</script>

Using the EditableSkeleton

For editable skeletons, the process is a bit different. Your top level component is really simple:

<template>
  <EditableSkeleton />
</template>

To tell scaife-skeleton about the available widgets, you pass in a list at Vue startup time in your main.js file:

import Vue from 'vue';
import SkeletonPlugin from 'scaife-skeleton';

import App from './App.vue';
import store from './store';
import router from './router';
import widgets from './widgets';

Vue.config.productionTip = false;

Vue.use(SkeletonPlugin, { widgets });

new Vue({
  store,
  router,
  render: h => h(App),
}).$mount('#app');

Where your widgets.js file looks like something like:

import ReaderWidget from './reader/ReaderWidget.vue';
import TextSizeWidget from './text-size/TextSizeWidget.vue';
import TextWidthWidget from './text-width/TextWidthWidget.vue';

import BookInfoWidget from './morphgnt/BookInfoWidget.vue';
import BookSelectWidget from './morphgnt/BookSelectWidget.vue';
import InterlinearWidget from './morphgnt/InterlinearWidget.vue';
import PassageWidget from './morphgnt/PassageWidget.vue';
import SelectablePassageWidget from './morphgnt/SelectablePassageWidget.vue';

const widgets = [
  ReaderWidget,
  TextSizeWidget,
  TextWidthWidget,

  BookInfoWidget,
  BookSelectWidget,
  InterlinearWidget,
  PassageWidget,
  SelectablePassageWidget,
];

export default widgets;

Adding Additional Icons

You can provide your own icons by passing in an iconMap option when adding the plugin:

import { faAddressBook } from '@fortawesome/free-solid-svg-icons/faAddressBook';

const iconMap = [ faAddressBook ].reduce((map, obj) => {
  map[obj.iconName] = obj;
  return map;
}, {});

Vue.use(SkeletonPlugin, { widgets, iconMap });

Then you can use the globally installed <Icon> component in your widget:

<Icon name="address-book" />

Development

This repo has a series of demos to facilitate the development of scaife-skeleton.

Running the project

yarn run serve

or

npm run serve

Linting and testing

yarn run lint
yarn run test

or

npm run lint
npm run test

Prettier

yarn run prettier:check
yarn run prettier:fix

or

npm run prettier:check
npm run prettier:fix

Packaging

yarn run package

or

npm run package