Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@arc-core-components/amp-document-boilerplate

Package Overview
Dependencies
Maintainers
11
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arc-core-components/amp-document-boilerplate - npm Package Compare versions

Comparing version 0.2.6-beta.1 to 0.2.7-beta.0

70

build/index.js

@@ -21,6 +21,13 @@ "use strict";

/**
* @func Style
* @desc Create AMP styles
* @param {String|Object} children - styles to inject
* @param {Object[]} props - any other props
* @return {Object} styles for AMP
*/
function Style(_ref) {
var children = _ref.children,
props = (0, _objectWithoutProperties2.default)(_ref, ["children"]);
return _react.default.createElement("style", (0, _extends2.default)({}, props, {
props = (0, _objectWithoutProperties2["default"])(_ref, ["children"]);
return _react["default"].createElement("style", (0, _extends2["default"])({}, props, {
dangerouslySetInnerHTML: {

@@ -35,35 +42,74 @@ __html: children

};
/**
* @func AmpBoilerplateStyle
* @desc Create AMP styles boilerplate
* @return {Object} styles required for AMP code base
*/
function AmpBoilerplateStyle() {
return _react.default.createElement(Style, {
return _react["default"].createElement(Style, {
"amp-boilerplate": ""
}, "body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}");
}
/**
* @func AmpNoScript
* @desc Create AMP styles boilerplate when javascript is disabled
* @return {Object} styles that remove all amp boilerplate and animations
*/
function AmpNoScript() {
return _react.default.createElement("noscript", null, _react.default.createElement(Style, {
return _react["default"].createElement("noscript", null, _react["default"].createElement(Style, {
"amp-boilerplate": ""
}, "body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}"));
}
/**
* @func Html
* @desc Returns an html tag with all props passed to it
* @param {Object} props - the properties to pass to the HTML tag
* @return {Object} decorated html tag
*/
function Html(props) {
return _react.default.createElement("html", (0, _extends2.default)({
var lang = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "en";
var filteredProps = props;
var language = lang;
if (filteredProps.lang) {
language = filteredProps.lang;
delete filteredProps.lang;
}
return _react["default"].createElement("html", (0, _extends2["default"])({
amp: ""
}, props));
}, filteredProps, {
lang: language
}));
}
Html.propType = {
lang: _propTypes.string
};
/**
* @func BaseMarkup
* @desc Create the basic AMP markup
* @param {String} canonicalUrl - the canonicalURL for the defaut meta data
* @return {Object} default metadata including canonical URL and AMP base markup
*/
function BaseMarkup(_ref2) {
var canonicalUrl = _ref2.canonicalUrl;
return _react.default.createElement(_react.Fragment, null, _react.default.createElement("meta", {
return _react["default"].createElement(_react.Fragment, null, _react["default"].createElement("meta", {
charSet: "utf-8"
}), _react.default.createElement("meta", {
}), _react["default"].createElement("meta", {
name: "viewport",
content: "width=device-width,minimum-scale=1,initial-scale=1"
}), _react.default.createElement("script", {
}), _react["default"].createElement("script", {
async: true,
src: "https://cdn.ampproject.org/v0.js"
}), _react.default.createElement("link", {
}), _react["default"].createElement("link", {
rel: "canonical",
href: canonicalUrl
}), _react.default.createElement(AmpBoilerplateStyle, null), _react.default.createElement(AmpNoScript, null));
}), _react["default"].createElement(AmpBoilerplateStyle, null), _react["default"].createElement(AmpNoScript, null));
}

@@ -74,2 +120,2 @@

};
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInVua25vd24iXSwibmFtZXMiOlsiU3R5bGUiLCJjaGlsZHJlbiIsInByb3BzIiwiX19odG1sIiwicHJvcFR5cGVzIiwic3RyaW5nIiwiaXNSZXF1aXJlZCIsIkFtc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bmMgc3JjPVwiaHR0cHM6Ly9jZG4uYW1wcHJvamVjdC5vcmcvdjAuanNcIiAvPlxuICAgICAgPGxpbmsgcmVsPVwiY2Fub25pY2FsXCIgaHJlZj17Y2Fub25pY2FsVXJsfSAvPlxuICAgICAgPEFtcEJvaWxlcnBsYXRlU3R5bGUgLz5cbiAgICAgIDxBbXBOb1NjcmlwdCAvPlxuICAgIDwvRnJhZ21lbnQ+XG4gICk7XG59XG5cbkJhc2VNYXJrdXAucHJvcFR5cGVzID0ge1xuICBjYW5vbmljYWxVcmw6IHN0cmluZy5pc1JlcXVpcmVkLFxufTtcbiJdfQ==

8

package.json
{
"name": "@arc-core-components/amp-document-boilerplate",
"version": "0.2.6-beta.1",
"version": "0.2.7-beta.0",
"description": "AMP document boilerplate components",

@@ -13,4 +13,4 @@ "main": "build/index.js",

"peerDependencies": {
"prop-types": "^15.6.2",
"react": "^16.6.3"
"prop-types": ">=15",
"react": ">=16.2"
},

@@ -23,3 +23,3 @@ "publishConfig": {

},
"gitHead": "0d213faaa0515cd4e1a01b78c31cb7ea7e1064e0"
"gitHead": "81a47fc866eca96ac1a20025c5570f4d03d567af"
}
import React, { Fragment } from "react";
import { string } from "prop-types";
/**
* @func Style
* @desc Create AMP styles
* @param {String|Object} children - styles to inject
* @param {Object[]} props - any other props
* @return {Object} styles for AMP
*/
function Style({ children, ...props }) {

@@ -9,5 +16,10 @@ return <style {...props} dangerouslySetInnerHTML={{ __html: children }} />;

Style.propTypes = {
children: string.isRequired
children: string.isRequired,
};
/**
* @func AmpBoilerplateStyle
* @desc Create AMP styles boilerplate
* @return {Object} styles required for AMP code base
*/
function AmpBoilerplateStyle() {

@@ -23,2 +35,7 @@ return (

/**
* @func AmpNoScript
* @desc Create AMP styles boilerplate when javascript is disabled
* @return {Object} styles that remove all amp boilerplate and animations
*/
function AmpNoScript() {

@@ -36,6 +53,30 @@ return (

export function Html(props) {
return <html amp="" {...props} />;
/**
* @func Html
* @desc Returns an html tag with all props passed to it
* @param {Object} props - the properties to pass to the HTML tag
* @return {Object} decorated html tag
*/
export function Html(props, lang = "en") {
const filteredProps = props;
let language = lang;
if (filteredProps.lang) {
language = filteredProps.lang;
delete filteredProps.lang;
}
return <html amp="" {...filteredProps} lang={language} />;
}
Html.propType = {
lang: string,
};
/**
* @func BaseMarkup
* @desc Create the basic AMP markup
* @param {String} canonicalUrl - the canonicalURL for the defaut meta data
* @return {Object} default metadata including canonical URL and AMP base markup
*/
export function BaseMarkup({ canonicalUrl }) {

@@ -58,3 +99,3 @@ return (

BaseMarkup.propTypes = {
canonicalUrl: string.isRequired
canonicalUrl: string.isRequired,
};

@@ -17,3 +17,3 @@ import React from "react";

expect(
TestRenderer.create(<BaseMarkup canonicalUrl="/" />).toJSON()
TestRenderer.create(<BaseMarkup canonicalUrl="/" />).toJSON(),
).toMatchSnapshot();

@@ -32,3 +32,3 @@ });

<body />
</Html>
</Html>,
);

@@ -38,6 +38,6 @@ expect(

`<!doctype html>
${renderedDocument}`
).status
${renderedDocument}`,
).status,
).toBe("PASS");
});
});

Sorry, the diff of this file is not supported yet

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