Code Monkey home page Code Monkey logo

patterns's Introduction

Patterns

Build Status

Patterns is a toolkit that enables designers to build rich interactive prototypes without the need for writing any JavaScript. All functionality is triggered by classes and other attributes in the HTML, without abusing the HTML as a programming language. Accessibility, SEO and well structured HTML are core values of Patterns.

Changelog

See the Changelog at GitHub.

Browser support

Patterns aims to support at least the two latest major versions of all popular browsers:

  • Apple Safari
  • Google Chrome
  • Firefox

Other browser version may work too, but are not actively tested against.

Development installation requirements

Make sure, you have these requirements installed:

- Node.js ( https://nodejs.org/en/ )
- yarn ( https://yarnpkg.com/ )
- make
- git

On OSX you need gnu-tar instead of tar (GNU tar supports the --transform option). Please install it with e.g. brew install gnu-tar.

Development installation

The following commands will generate a bundle.min.js file in the dist directory which contains Patterns and all its dependencies:

git clone git://github.com/Patternslib/Patterns.git
cd Patterns
make

Alternatively, you can download a bundle at patternslib.com.

Layout

The individual patterns are located in their own folders in ./src/pat/.

Each pattern folder contains some or all of the following files:

  • index.html which contains HTML markup that shows a demonstration of the pattern.
  • documentation.md which is a Markdown file that documents the pattern's purpose, how to use it and how to configure it.
  • A javascript file which implements the pattern's functionality.
  • A Sass (.scss) file which provides the CSS associated with the pattern.

To generate CSS files from the pattern's included Sass files, type make all_css and the css files will be generated in the same location as the Sass files.

You'll need to have a Sass compiler installed.

How to demo patterns

To demo the patterns, simply type make serve to install the necessary dependencies and to start a simple Node.js HTTP server.

You can then visit http://localhost:4001 to see a site with demos.

Alternatively, patterns can also be demoed through the Patternslib.com website, which is open-source. The code and setup instructions are here.

Contributing fixes

To develop on Patterns, clone the repository and set it's push-url to your fork:

git remote set-url --push origin <url_to_your_fork>

Create a branch for the feature/bug you are working on:

git checkout -b <feature>

For inclusion use either a GitHub pull request or create a ticket with a url to your external repository.

Please read our contribution notes and read our code style guide.

Running tests

The simplest way to run the tests are to use make:

make check

This will install all required npm and bower packages and run the tests.

Debugging tests

Eventually add to tests:

import "core-js/stable";
import "regenerator-runtime/runtime";

Then:

node --inspect-brk node_modules/.bin/jest --runInBand ./src/pat/tooltip/tooltip.test.js

Connect in chrome via:

chrome://inspect

You can pass Jest any parameter it accepts, like -t TESTPATTERN::

node --inspect-brk node_modules/.bin/jest --runInBand ./src/pat/tooltip/tooltip.test.js -t will.be.closed.when

Enabling log messages

To facilitate debugging you can change the default log level through the URL query string by adding loglevel options.

  • http://www.example.com/?loglevel=DEBUG changes the default log level to DEBUG.
  • http://www.example.com/?loglevel-inject=DEBUG changes the log level for just the inject pattern to DEBUG.
  • http://www.example.com/?loglevel=ERROR&loglevel-inject=INFO changes the standard log level error, but enables messages at the INFO level for the inject pattern.

Bundle build analyzation

https://survivejs.com/webpack/optimizing/build-analysis/ https://formidable.com/blog/2018/finding-webpack-duplicates-with-inspectpack-plugin/

Build the stats.json file:

yarn build:stats

Check dependency tree and why which package was included: https://www.npmjs.com/package/whybundled

whybundled stats.json

Visualize dependency tree and analyze bundle size: https://www.npmjs.com/package/webpack-bundle-analyzer

webpack-bundle-analyzer stats.json

Organisations and projects which use Patternslib

  • Overstroom ik?, a website which informs Dutch citizens of their risk of flooding. It was introduced and highly praised by the Dutch minister of infrastructure and environment, Melanie Schultz.
  • OiRA, an online risk assessment tool, created for the Occupational Health and Safety Agency (OSHA) of the European Union.
  • Staralliance uses Patternslib in their intranet.
  • Plone CMS via Mockup, which is built upon Patternslib.
  • Quaive Intranet uses Patternslib.

Interactive HTML/CSS prototypes made with Patternslib

  • The Patternslib.com website uses Patternslib and is based upon a prototype, which can be found here.

patterns's People

Contributors

adamtheturtle avatar ale-rt avatar chaoflow avatar cillianderoiste avatar ckirchhoff avatar cornae avatar coroa avatar dependabot[bot] avatar djowett avatar domenkozar avatar durko avatar frontendplace avatar fulv avatar garbas avatar ggozad avatar gyst avatar hsermeno avatar janga1997 avatar jcbrand avatar lukasgraf avatar mrtango avatar pilz avatar pysailor avatar regebro avatar reinhardt avatar thet avatar vangheem avatar wichert avatar witekdev avatar zv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

patterns's Issues

Carousel jump to pattern

what we need in my opinion is a script that.

  1. scans for elements with .carousel on it.
  2. bind jCarousel to that element
  3. scan the IDs on the LI items within the carousel.
  4. look for any href values that start with # in it. For instance a href="#foo" and see if foo matches with any of the ID values used on the carousel items.
  5. Apply the jump-to pattern to those a href's.

Additionally, it would be handy to translate any Patterns style parameters the user could put as jCarousel parameters. Then the pattern could become part of Patterns.

Injection: Inherit classes/ID

Injection passes on the ID and classes of the source element. I would like to have this not as a default, but as an option instead.

investigate automatic testing

We needs automated tests and a testrunner, qunit in combination with jquery might do the job. Maybe there are better frameworks.

rich editor integration

Aloha has been selected as first candidate. License allows us to stay BSD-like while Aloha changes need to be AGPLed. We want a custom menu bar instead of the floating "nervous" ;) default.

CSS Selectors for setclass pattern

Would be great if a user could use any CSS selector for the identifier part of the string.

So instead of 'id='foo'' in the identifier part of the string, the user could use '#foo' instead.

Or '.foo' for all elements with a class 'foo'.

Or for instance 'body' to target the body tag.

Injection: no source ID

In case there is no source ID present, injection should inject the complete content of the body tag of the source HTML.

Closing tooltips

All click triggered tooltips should close when user clicks outside the tooltip area. Except for sticky tooltips.

AJAX Tooltip bleeding

Tooltip is going out of whack on out-of-the-box.html. Click on the coloured triangle that's folded around the corner of the document and a tooltip should open.

I think this is because of the element Which remains their also after injection and it appears that the content for the injection is injected IN the progress element instead of replacing it.

History manager

Basic functionality: Reverse injection history step by step.

Tooltips do not go away

I'm testing the tooltips in a data entry system and we are seeing that tooltips do not disappear when needed. Possible reasons:

  • user moves mouse out of trigger area before tooltip is shown. This can easily happen with AJAX-loaded tooltips. Due to the way the code works internally the mouseleave event is never noticed and the tooltip will never be removed.
  • if screen space is very small the tooltip may be placed above the triggering element, effectively hiding the triggering element

fullcalendar year view

on the long run we need a year view.

@cornae: how happy are you with fullcalendars markup? Do you have a (way) simpler markup in mind. Currently fullcalendar is not doing much for us. We should consider writing something ourselves, iff the markup sucks anyway.

Otherwise people are talking about fullcalendar year view.

Auto complete and multi select

Rationale

Currently we are challenged by 3 UI problems that could be solved with one pattern.

  1. The need for selects with a placeholder value without abusing an option for it
  2. The need for an auto complete pattern
  3. The need for a user friend multi select pattern

Suggested by @chaoflow to use the library http://harvesthq.github.com/chosen/

Markup

Suggested markup:

<select data-placeholder="Choose a country…">

Tooltip positioning

Tooltip positioning of the first tooltip on the tooltip demo page is broken. It appears in front of the trigger element instead of pointing at it.

groupby pattern - thought in progress

All elements are loaded, setting/changing the data-groupby attribute results in regrouping:

<foo data-group-titles="a=GroupA!b=GroupB>
  <bar data-groupable="g1=a!g2=a">  1  </bar>
  <bar data-groupable="g1=a!g2=b">  2  </bar>
  <bar data-groupable="g1=b!g2=a">  3  </bar>
  <bar data-groupable="g1=b!g2=b">  4  </bar>
  <bar data-groupable="g1=a!g2=a">  5  </bar>
  <bar data-groupable="g1=a!g2=b">  6  </bar>
  <bar data-groupable="g1=b!g2=a">  7  </bar>
  <bar data-groupable="g1=b!g2=b">  8  </bar>
</foo>

data-groupby is set by setattribute from somwhere or was set while loading:

<foo data-group-titles="a=GroupA!b=GroupB" data-groupby="g2:#g2_template g1:#g1_template">
  <x>
    <y>
  <bar data-groupable="g1=a!g2=a">  1  </bar>
  <bar data-groupable="g1=a!g2=a">  5  </bar>
    </y>
  </x>
  <x>
    <y>
  <bar data-groupable="g1=b!g2=a">  3  </bar>
  <bar data-groupable="g1=b!g2=a">  7  </bar>
    </y>
  </x>
  <x>
    <y>  
  <bar data-groupable="g1=a!g2=b">  2  </bar>
  <bar data-groupable="g1=a!g2=b">  6  </bar>
    </y>
  </x>
  <x>
    <y>  
  <bar data-groupable="g1=b!g2=b">  4  </bar>
  <bar data-groupable="g1=b!g2=b">  8  </bar>
    </y>
  </x>
</foo>

Invalid submodule

While doing a

git submodule update --init --recursive

I got this error

Clone of '[email protected]:chaoflow/jquery.mutation-events.git' into submodule path 'src/lib/jquery.mutations' failed

Which seems like the submodule was not registered in the usual git:// protocol.

Investigate fancybox alternatives

The current version of fancybox is no longer open source. We should look for an alternative with a permissive (MIT/BSD-style) license to replace it.

Tooltips — Injection

Currently tooltips don't work with injection. The following HTML should launch a tooltip based on injected content:

<a href="balloon-contents.html" data-injection="#myTip.tooltip"></a>

review collapsible pattern

I reworked collapsible:

  • pattern as jquery plugin
$('.some').collapsible()
$('.come').open() 
$('.come').close(0) 
$('.come').toggle()  
  • pattern triggered via markup
  • free the pattern code from generic stuff now handled in patterns
  • use demo/collapsible.html as base for jasmine-jquery tests

Please review/comment the approach.

Class current

Automatic set of class current on A or LI items containing an A that has an href pointing the item the user has last navigated to is missing in new data-inject.

The pattern is triggered by the class .navigation on for instance an UL or a NAV element.

(documentation) structure

Thoughts about documentation structure.

For each pattern there are / will be:

  • a documentation page
  • a demo page
  • a file implementing the pattern
  • a library module for more complex patterns
  • a test file
  • test fixtures for the test
  • auto-generated API documentation

The documentation page should show example markup. Maybe we can fully include the demo page for that purpose. But maybe it's also worthwhile to write small additional snippets.

Anyway there needs to be a mode to see the demo markup in source and below interpreted. This could be a pattern sourcedemo. If put on an element it will create something like:

<div class="sourcedemo">
  <div class="source">
    Previous content of the div in a quoted (with syntax highlighting) fashion
  </div>
  <div class="demo">
    Previous content of the div
  </div
</div>

.navigation and .current

Currently patterns puts a class 'current' on every LI that has an anchor in it with an href value equal to the URL of the page when the LI is a descendent of a tag with the class 'navigation'. It would be very helpful that  — in case no LI tag is available — the class would be set on the anchor tag instead.

Example of application:

<nav class="navigation tabs">
   <a href="project-landing.html#document-body#buttons-contextual" data-injection="#document-body#buttons-contextual" class="home current" title="Home">Home</a>
   <a href="project-landing.html#sidebar-content" data-injection="#sidebar-content" class="documents" title="Documents">Documents</a>
</nav>

configure file for e.g logging

we need a way to easily configure aspects of patterns, e.g. loglevels

for deployment we would include a different file than for development

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.