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

codelabs-react

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codelabs-react - npm Package Compare versions

Comparing version 1.8.2 to 1.9.0

9

dist/components.js

@@ -120,4 +120,9 @@ "use strict";

function ListItem(_ref12) {
var children = _ref12.children;
return /*#__PURE__*/_react["default"].createElement("li", null, children);
var children = _ref12.children,
magnitude = _ref12.magnitude;
return /*#__PURE__*/_react["default"].createElement("ul", {
style: {
marginLeft: "".concat(magnitude - 36, "px")
}
}, /*#__PURE__*/_react["default"].createElement("li", null, children));
}

@@ -124,0 +129,0 @@

@@ -25,3 +25,3 @@ "use strict";

test("Extract parses the document", function () {
var tree = _extract["default"].parse(_document.content, _document1607876232180Inline.inlineObjects);
var tree = _extract["default"].parse(_document.body.content, _document1607876232180Inline.inlineObjects);

@@ -28,0 +28,0 @@ expect(tree).toMatchSnapshot();

@@ -48,4 +48,3 @@ "use strict";

function parseParagraph(paragraph, images) {
return {
type: getParagraphType(paragraph),
return _objectSpread(_objectSpread({}, getParagraphDetails(paragraph)), {}, {
content: paragraph.elements.map(function (element) {

@@ -76,3 +75,3 @@ var _element$textRun;

})
};
});
}

@@ -124,3 +123,3 @@

function getParagraphType(paragraph) {
function getParagraphDetails(paragraph) {
var mapping = {

@@ -136,4 +135,6 @@ NORMAL_TEXT: "p",

try {
if (paragraph.paragraphStyle.spacingMode === "COLLAPSE_LISTS" || paragraph.paragraphStyle.indentStart) {
return "li";
if (paragraph.paragraphStyle.indentStart) {
return _objectSpread({
type: "li"
}, paragraph.paragraphStyle.indentStart);
}

@@ -144,6 +145,10 @@ } catch (ex) {// do nothing

try {
return mapping[paragraph.paragraphStyle.namedStyleType];
return {
type: mapping[paragraph.paragraphStyle.namedStyleType]
};
} catch (e) {
// defaults to p
return "p";
return {
type: "p"
};
}

@@ -150,0 +155,0 @@ }

@@ -98,3 +98,3 @@ "use strict";

li: function li(props) {
return /*#__PURE__*/_react["default"].createElement(ListItemComponent, null, props.children);
return /*#__PURE__*/_react["default"].createElement(ListItemComponent, props, props.children);
},

@@ -165,3 +165,3 @@ infobox: function infobox(props) {

return /*#__PURE__*/_react["default"].createElement(Tag, null, node.content.map(function (element, elementIndex) {
return /*#__PURE__*/_react["default"].createElement(Tag, node, node.content.map(function (element, elementIndex) {
if (!element) return;

@@ -168,0 +168,0 @@ key = "".concat(key, "-").concat(elementIndex);

{
"name": "codelabs-react",
"version": "1.8.2",
"version": "1.9.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -73,5 +73,5 @@ # codelabs-react

- [ ] Image support
- [x] Image support
- [ ] YouTube support
- [ ] Per-step time estimation
- [ ] Feedback links

@@ -101,4 +101,8 @@ import React from "react";

export function ListItem({ children }) {
return <li>{children}</li>;
export function ListItem({ children, magnitude }) {
return (
<ul style={{ marginLeft: `${magnitude - 36}px` }}>
<li>{children}</li>
</ul>
);
}

@@ -105,0 +109,0 @@

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

import { content } from "../stories/document-1607876232180.json";
import { body } from "../stories/document-1607876232180.json";
import { inlineObjects } from "../stories/document-1607876232180-inline.json";

@@ -21,3 +21,3 @@ import Extract from "./extract";

test("Extract parses the document", () => {
const tree = Extract.parse(content, inlineObjects);
const tree = Extract.parse(body.content, inlineObjects);
expect(tree).toMatchSnapshot();

@@ -24,0 +24,0 @@ });

@@ -31,3 +31,3 @@ const infoColor = { red: 0.8509804, green: 0.91764706, blue: 0.827451 };

return {
type: getParagraphType(paragraph),
...getParagraphDetails(paragraph),
content: paragraph.elements.map((element) => {

@@ -141,3 +141,3 @@ // TODO(): add image support

function getParagraphType(paragraph) {
function getParagraphDetails(paragraph) {
const mapping = {

@@ -153,7 +153,7 @@ NORMAL_TEXT: "p",

try {
if (
paragraph.paragraphStyle.spacingMode === "COLLAPSE_LISTS" ||
paragraph.paragraphStyle.indentStart
) {
return "li";
if (paragraph.paragraphStyle.indentStart) {
return {
type: "li",
...paragraph.paragraphStyle.indentStart,
};
}

@@ -165,6 +165,8 @@ } catch (ex) {

try {
return mapping[paragraph.paragraphStyle.namedStyleType];
return {
type: mapping[paragraph.paragraphStyle.namedStyleType],
};
} catch (e) {
// defaults to p
return "p";
return { type: "p" };
}

@@ -171,0 +173,0 @@ }

@@ -74,3 +74,5 @@ import React, { useState } from "react";

h6: (props) => <H6Component>{props.children}</H6Component>,
li: (props) => <ListItemComponent>{props.children}</ListItemComponent>,
li: (props) => (
<ListItemComponent {...props}>{props.children}</ListItemComponent>
),
infobox: (props) => <InfoBoxComponent>{props.children}</InfoBoxComponent>,

@@ -136,3 +138,3 @@ warningbox: (props) => (

return (
<Tag>
<Tag {...node}>
{node.content.map((element, elementIndex) => {

@@ -139,0 +141,0 @@ if (!element) return;

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