New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ngx-clip-path-editor

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-clip-path-editor

Angular component for editing CSS clip-paths on image elements

latest
Source
npmnpm
Version
1.1.1
Version published
Maintainers
1
Created
Source

NGX ClipPath Editor

ngx-clip-path-editor is an Angular component for editing a CSS clip-path visually within an image element. It is customizable, responsive, lightweight and heavily Change Detection optimized.

A demo can be found on Stackblitz.

About

If you've ever read a print magazine and compared the layout and style with typical websites you might have spotted some noticeable differences. When it comes to typography CSS got a lot of great features over the last couple of years. Furthermore, in terms of layout possibilities we are pretty much on par with print media nowadays. However, images on the web are typically just rectangular blocks and people barely get creative with fancy image layouts. This is the case because most editors don't cover options for stylizing pretty text flows around non-rectangular images - even though we already have the necessary technology.

Properties like clip-path and shape-outside are widely supported and grant us the opportunity to create fancy layouts that don't evoke the impression that we are just staring at a bunch of rectangular blocks.

Some years ago I tried using these properties within a blog and people truly appreciated the more dynamic text flows. However, manually adding these properties to images was a tedious process. That's the reason I decided to create an editor component for creating clip paths. With an easy-to-use component everyone can create better layouts in no time.

Prerequisites

  • Angular >= 14
  • RxJS 7

Inputs & Outputs

InputType-Description
srcstringRequiredSets the source of the image
maskstringOptionalA clip-path string. If the mask Input is set the string will be parsed and visualized.
disabledbooleanOptionalIf set to true no points can be added or removed.
visualizeMaskbooleanOptionalIf set to false the image background mask will not be shown.
visualizePathbooleanOptionalIf set to false the visualization of the path will not be shown.
visualizePointsbooleanOptionalIf set to false no points will be shown.

The OnChange Event gets triggered whenever a new point gets added, an old point gets removed or the window resizes. It emits a clip-path string.

Triggering clear will clear all points.

CSS Variables

The component makes heavy use of custom CSS properties which makes it easy to customize certain aspect via the Shadow DOM. The component also uses the BEM approach so conflicts shouldn't occur when running without ViewEncapsulation.

VariableDescription
--mask-opacityRegulates the opacity of the background mask
--mask-z-indexThe z-index value for the SVG element
--path-unitA base unit size for the path and points
--path-opacityThe default opacity for the path
--point-opacityThe default opacity for points

Keywords

angular

FAQs

Package last updated on 16 Jun 2022

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