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

flex-wrap-layout

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flex-wrap-layout - npm Package Compare versions

Comparing version 0.10.2 to 0.11.0

15

dist/detectWrappedElements.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.detectWrappedElements = void 0;
// [jQuery.position() equivalent is wrong](https://github.com/HubSpot/youmightnotneedjquery/issues/172)
function getTopPosition(el) {

@@ -10,10 +9,3 @@ const { top } = el.getBoundingClientRect();

}
// [How to detect CSS flex wrap event](https://stackoverflow.com/q/40012428)
function detectWrappedElements(rootElement, wrapChildrenClassName, nextIsWrappedClassName, hasChildWrappedClassName) {
// For each child of .wrap-children
// - find its previous sibling
// - check if its previous sibling is at the same top position
// - if not, add .next-is-wrapped
// - if same position, remove .next-is-wrapped
// [...HTMLCollection] vs Array.from(HTMLCollection): the latter doesn't need downlevelIteration with IE
const parents = Array.from(rootElement.getElementsByClassName(wrapChildrenClassName));

@@ -31,4 +23,2 @@ if (rootElement.classList.contains(wrapChildrenClassName))

if (top > prevTop) {
// There is no way to CSS style an element given a match on its next sibling
// [Is there a "previous sibling" CSS selector?](https://stackoverflow.com/q/1817792)
prev.classList.add(nextIsWrappedClassName);

@@ -40,4 +30,2 @@ }

}
// If the next sibling has been removed since the last run,
// .next-is-wrapped may be present and we need to remove it
if (child.nextElementSibling === null) {

@@ -49,7 +37,4 @@ child.classList.remove(nextIsWrappedClassName);

const containsChildNextIsWrapped = rootElement.getElementsByClassName(nextIsWrappedClassName).length > 0;
// IE does not support toggle() second argument
// https://developer.mozilla.org/en-US/docs/Web/API/Element/classList#Browser_compatibility
//rootEl.classList.toggle(hasChildWrappedClassName, containsChildNextIsWrapped);
rootElement.classList[containsChildNextIsWrapped ? 'add' : 'remove'](hasChildWrappedClassName);
}
exports.detectWrappedElements = detectWrappedElements;

13

dist/DevTools.js
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -25,3 +29,2 @@ if (k2 === undefined) k2 = k;

const useDetectWrappedElements_1 = require("./useDetectWrappedElements");
// https://github.com/mobxjs/mobx-react-devtools/blob/6.1.1/src/Panel/styles/index.js
const panel = {

@@ -51,4 +54,2 @@ display: 'inline-block',

exports.useDevTools = useDevTools;
// http://web.archive.org/web/20191213203807/https://inventingwithmonster.io/20190207-break-the-rules-of-react-hooks/
// https://mattperry.is/writing-code/how-to-break-the-rules-of-react-hooks
function DetectWrappedElements({ detectWrappedElementsRef }) {

@@ -61,5 +62,3 @@ (0, useDetectWrappedElements_1.useDetectWrappedElements)(detectWrappedElementsRef);

const { showBorders, setShowBorders, detectWrappedElements, setDetectWrappedElements, flexFill, setFlexFill } = context;
return (
// eslint-disable-next-line react/jsx-props-no-spreading
react_1.default.createElement("div", { style: { ...panel }, ...otherProps },
return (react_1.default.createElement("div", { style: { ...panel }, ...otherProps },
detectWrappedElements && (react_1.default.createElement(DetectWrappedElements, { detectWrappedElementsRef: detectWrappedElementsRef })),

@@ -66,0 +65,0 @@ react_1.default.createElement("label", { title: "Dotted line: growing block, solid line: fixed block" },

@@ -6,15 +6,8 @@ "use strict";

try {
// https://stackoverflow.com/q/1818474
window.dispatchEvent(new Event('resize'));
}
catch {
// FIXME Event constructor is not supported by IE
// https://github.com/zloirock/core-js/issues/354
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#polyfill
// https://github.com/lifaon74/events-polyfill/blob/bc989dc00fb90a42ae9c012c309d48710dec2589/event-constructor-polyfill.js#L11-L28
// https://github.com/kumarharsh/custom-event-polyfill/blob/v1.0.7/polyfill.js
// http://youmightnotneedjquery.com/#trigger_native
const event = document.createEvent('Event');
const bubbles = false; // Default is false for new Event()
const cancelable = false; // Default is false for new Event()
const bubbles = false;
const cancelable = false;
event.initEvent('resize', bubbles, cancelable);

@@ -21,0 +14,0 @@ window.dispatchEvent(event);

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k;

@@ -20,3 +20,2 @@ "use strict";

const children = rootElement.getElementsByClassName(exports.nextIsWrappedClassName);
// https://stackoverflow.com/q/22270664#comment33829207_22270685
while (children.length > 0) {

@@ -23,0 +22,0 @@ children[0].classList.remove(exports.nextIsWrappedClassName);

{
"name": "flex-wrap-layout",
"version": "0.10.2",
"repository": {
"type": "git",
"url": "https://github.com/tkrotoff/flex-wrap-layout.git"
},
"version": "0.11.0",
"description": "Experiments with flexbox layout",
"repository": "github:tkrotoff/flex-wrap-layout",
"license": "MIT",

@@ -14,4 +11,3 @@ "keywords": [

],
"main": "dist/cjs/index.js",
"module": "dist/index.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",

@@ -24,7 +20,7 @@ "files": [

"scripts": {
"clean": "rm -rf dist examples/build",
"clean": "rm -rf dist examples/build coverage",
"clean:all": "npm run clean && rm -rf node_modules package-lock.json examples/node_modules examples/package-lock.json",
"build:esnext": "tsc --project tsconfig.dist.json --outDir dist --declaration true",
"build:cjs": "tsc --project tsconfig.dist.json --outDir dist/cjs",
"build": "npm run clean && npm run build:esnext && npm run build:cjs",
"build": "npm run clean && npm run build:dts && npm run build:cjs",
"build:dts": "tsc --project tsconfig.dist.json --declaration --emitDeclarationOnly --outDir dist",
"build:cjs": "tsc --project tsconfig.dist.json --removeComments --module commonjs --outDir dist",
"npm:install:examples": "cd examples && npm install",

@@ -40,3 +36,3 @@ "build:examples": "cd examples && ./node_modules/.bin/webpack --mode=development",

"precommit": "lint-staged --verbose",
"prepush": "npm run build:esnext && npm run build:examples && npm run test && npm run test:examples",
"prepush": "npm run build:cjs && npm run build:examples && npm run test && npm run test:examples",
"prepublishOnly": "npm run clean && npm run build",

@@ -50,32 +46,33 @@ "publish:beta": "npm version 0.10.0-beta.1 && npm publish --tag next --dry-run",

"devDependencies": {
"@testing-library/react": "^12.1.2",
"@types/jest": "^27.0.3",
"@types/react-dom": "^17.0.11",
"@typescript-eslint/eslint-plugin": "^5.7.0",
"@typescript-eslint/parser": "^5.7.0",
"eslint": "^8.4.1",
"eslint-config-airbnb": "^19.0.2",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.3",
"eslint-plugin-jest": "^25.3.0",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-playwright": "^0.6.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.27.1",
"eslint-plugin-react-hooks": "^4.3.0",
"@testing-library/react": "^13.3.0",
"@types/jest": "^28.1.4",
"@types/react-dom": "^18.0.6",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"eslint": "^8.19.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.5.3",
"eslint-plugin-jsx-a11y": "^6.6.0",
"eslint-plugin-playwright": "^0.9.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react": "^7.30.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-unicorn": "^39.0.0",
"husky": "^7.0.4",
"jest": "^27.4.5",
"lint-staged": "^12.1.2",
"prettier": "^2.5.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"stylelint": "^14.1.0",
"eslint-plugin-unicorn": "^43.0.1",
"husky": "^8.0.1",
"jest": "^28.1.2",
"jest-environment-jsdom": "^28.1.2",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"stylelint": "^14.9.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-twbs-bootstrap": "^3.0.0",
"stylelint-config-twbs-bootstrap": "^4.0.0",
"stylelint-prettier": "^2.0.0",
"ts-jest": "^27.1.1",
"typescript": "^4.5.4"
"ts-jest": "^28.0.5",
"typescript": "^4.7.4"
}
}
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