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

@sebgroup/ng-magic-iframe

v1.0.2

Published

[![Build Status](https://travis-ci.com/sebgroup/ng-magic-iframe.svg?token=tzrdkWGEu776AVobzRhp&branch=master)](https://travis-ci.com/sebgroup/ng-magic-iframe) [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http:

Downloads

58

Readme

SEB Magic Iframe

Build Status Commitizen friendly semantic-release

Install with npm

npm install @sebgroup/ng-magic-iframe --save

Add to app.modules

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';
import { NgMagicIframeModule } from '@sebgroup/ng-magic-iframe';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgMagicIframeModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Allow synthetic default imports

If you run into the following error: @types/element-resize-detector/index"' has no default export you need to allow synthetic default imports as the type definitions for element-resize-detector, which this library depends on, has no default export declared. In tsconfig.json in your root project folder, set allowSyntheticDefaultImports to true:

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowSyntheticDefaultImports" : true,
    ...
}

Usage

Basic

<seb-ng-magic-iframe [source]="'/assets/first-page.html'"></seb-ng-magic-iframe>

Advanced

<seb-ng-magic-iframe [source]="'/assets/first-page.html'"
                     [styles]="'body { background: white; }'"
                     [styleUrls]="['/assets/css/external-stylesheet.css', '/assets/css/fonts.css']"
                     [autoResize]="false"
                     [resizeDebounceMillis]="0"
                     (iframeEvent)="foo($event)">
                     <!-- PLACEHOLDER FOR LOADING CONTENT -->
</seb-ng-magic-iframe>

Configuration and options

@Inputs

|@Input|Description|Default| |:-----|:-----------|:-------------------| |source| Path to iframe content source.| n/a | |styles| Apply/inject inline styles to the iframe (Optional).| n/a | |styleUrls| Add one or more stylesheets to the iframe, note that the iframe won't be visible until they've loaded (Optional).| n/a | |autoResize| Auto resize the iframe when the inner content changes height (Optional).| true | |resizeDebounceMillis| Debounce time in milliseconds for resize event to prevent race condition (Optional).| 50 |

@Outputs

|@Output|Description| |:-----|:-----------| |iframeEvent| Listen for state changes in iframe, see list of events below.|

Iframe events

|@Input |Description| |:--------------------------------|:-----------| | iframe-click | Event emitted when element inside iframe has been clicked. | iframe-keyup | Event emitted when keyup event emitted inside iframe. | iframe-unloaded | Event emitted when iframe triggers unload event (url in iframe changes). | iframe-styles-added | Emitted when styles have been added. | iframe-stylesheet-load | Emitted when external stylesheets start loading. | iframe-stylesheet-loaded | Emitted when external stylesheets have finished loading. | iframe-all-stylesheets-loaded | Emitted when all external stylesheets have finished loading (only emitted if more than one external stylesheets). | iframe-loaded | Emitted when iframe has finished loading (including optional styles and/or stylesheets). | iframe-loaded-with-errors | Emitted when iframe has encountered errors after loading (usually related to CORS and inability to access iframe content). | iframe-resized | Emitted when the iframe changes size.

Custom content loader

SEB Magic iframe uses content projection together with ng-content to show custom content while the iframe is loading. Simply add your own component or markup like this:

<seb-ng-magic-iframe [source]="'/assets/first-page.html'">
  <div class="skeleton-loader"></div> <!-- replace with your own code -->
</seb-ng-magic-iframe>

Run locally

  • Clone the repository
  • Run npm install
  • Run npm start and navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.