New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@joskii/jlayout

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@joskii/jlayout

It uses the [LUME Kiwi](https://github.com/lume/kiwi) library to do the actual constraint on layout.

  • 0.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

JLayout

It uses the LUME Kiwi library to do the actual constraint on layout.

Example

    <div component-name="container">
        <div component-name="subcontainer">
        </div>
    </div>
function keyGen(key) {
    return `[component-name="${key}"]`
}
const container = new JLayout({
    root: document.querySelector(keyGen('container')),
    getChild(root, component) {
        return root.querySelector(keyGen(component));
    },
});
container.setConstraint([
    {
        "component": "subcontainer",
        "left": [
            "=0"
        ],
        "right": [
            "=0"
        ],
        "top": [
            "=0"
        ],
        "height": [
            "=subcontainer.width*0.781"
        ]
    }
])
container.reflow();
container.scheduleResize();

Documentation

Constraint Dimension

  • left
  • right
  • top
  • bottom
  • width (Supports "intrisic")
  • height (Supports "intrisic")
  • centerX
  • centerY

Constraint DSL

constraint = <RelationExpression>

<RelationExpression> = <Relation> <Expression>

<Relation> = "=" | ">=" | "<="

<Expression> = <part>(<operator><part>)*

<operator> = "+" | "-" | "*" | "/"

<part> = <ParentViewAttribute> | <ViewAttribute> | Number

<ParentViewAttribute> = "|"

<ViewAttribute> = <ViewName>.<dimension>

<ViewName> = String

<dimension> = "left" | "right" | "top" | "bottom" | "width" | "height" | "centerX" | "centerY"

Constraint pattern

"intrisic": The dimension is determined by the interior of the component

API Documentation

JLayout

The layout control class.

new JLayout(configs)

Construct a new JLayout.

  • configs
    • root: Element,
    • getChild(root: Element, component: String): Element

jlayout.setConstraint(constraints)

Set constraint on layout.

jlayout.reflow()

Apply constraints.

jlayout.scheduleResize()

Apply transform on time.

jlayout.setConstraintOnView(name, dimension, constraint)

Set constraint on element in layout.

FAQs

Package last updated on 01 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc