Giter Site home page Giter Site logo

ankha's Introduction

Ankha

A generic data inspection component.

Contents

Usage

Add ankha as a dependency to your project.clj file:

[ankha "0.1.4"]

For the current development version use:

[ankha "0.1.5-SNAPSHOT"]

Require ankha.core somewhere in your project.

(ns example
  (:require [om.core :as om :include-macros true]
            [ankha.core :as ankha]))

Next mount the ankha/inspector component with some data.

(om/root
 ankha/inspector
 {:points [{:x 1 :y 0}
		   {:x 0 :y 1}
		   {:x -1 :y 0}
	       {:x 0 :y -1}]}
 {:target (js/document.getElementById "example")})

Refresh your browser to so see something similar to the following.

-{
	:points -[
				-{
					:x 1
					:y 0
				}
				-{
					:x 0
					:y 1
				}
				-{
					:x -1
					:y 0
				}
				-{
					:x 0
					:y -1
				}
			]
}

The ankha/inspector is compatible with all Clojure data structures including record types, JavaScript objects and arrays, and all primitive types such as strings, numbers, and so forth.

Example

To see an example with more data, clone the repository for this project and from it's root run

$ lein build-example

then open examples/a/index.html.

Styling with CSS

By default ankha only adds a minimum amount of styling to the output. You can use the stylesheet in examples/a/ankha.css for a better experience.

Extending the Inspector

Ankha provides inspection for all Clojure data types (including records), and JavaScript Arrays and Objects. You may want to provide special handling for your own custom data type, override Ankha's existing implementations, or even types you don't control. To do this simply implement Ankha's IInspect protocol.

(extend-protocol ankha/IInspect
  User
  (-inspect [this]
    (dom/span #js {:className "record user"}
	  (dom/span nil "First name: " (:first-name this))
	  " "
	  (dom/span nil "Last name: " (:last-name this)))))

Your implementation must return a value capable of being rendered by React or Om.

Support

Right now only known to work with recent versions of Om (>= 0.5) and ClojureScript (>= 0.0-2156).

ankha's People

Contributors

benmoss avatar noprompt avatar rigdern avatar

Watchers

 avatar

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.