New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@theorem/react

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@theorem/react - npm Package Compare versions

Comparing version 3.3.0 to 4.0.0

dist/bin/license/getDependencies.d.ts

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# 4.0.0
- Breaking: removed default Spinner looks
- routing: initRouting takes a few options to customize
- routing: handle download links correctly
- routing: scroll to top on navigation
# 3.3.0

@@ -2,0 +9,0 @@

9

dist/routing/clicks.d.ts

@@ -1,1 +0,8 @@

export declare function handleLinkClicks(f: (url: URL) => void): () => void;
import { navigate } from "./navigate";
export declare type ClickCallback = (params: {
event: MouseEvent;
link: HTMLLinkElement;
navigate: typeof navigate;
url: URL;
}) => void;
export declare function handleLinkClicks(f: ClickCallback): () => void;

@@ -0,1 +1,2 @@

import { navigate } from "./navigate";
function findLink(el) {

@@ -22,2 +23,4 @@ if (!el || !("tagName" in el))

return;
if (link.hasAttribute("download"))
return;
var url = new URL(link.href);

@@ -27,4 +30,8 @@ // External links including other procols like mailto

return;
e.preventDefault();
f(url);
f({
event: e,
link: link,
navigate: navigate,
url: url,
});
};

@@ -31,0 +38,0 @@ document.addEventListener("click", handler);

@@ -1,1 +0,6 @@

export declare function initRouting(): void;
import { ClickCallback } from "./clicks";
export declare function initRouting(options?: {
handleCleaning?: boolean;
handleClicks?: boolean | ClickCallback;
handleScrolling?: boolean;
}): void;

35

dist/routing/init.js

@@ -13,20 +13,31 @@ import { handleLinkClicks } from "./clicks";

}
function initClicks() {
handleLinkClicks(navigate);
export function initRouting(options) {
if (options === void 0) { options = {}; }
var _a = options.handleCleaning, handleCleaning = _a === void 0 ? true : _a, _b = options.handleClicks, handleClicks = _b === void 0 ? true : _b, _c = options.handleScrolling, handleScrolling = _c === void 0 ? true : _c;
if (handleCleaning)
initClean();
if (handleClicks)
handleLinkClicks(typeof handleClicks === "function"
? handleClicks
: function (params) {
params.event.preventDefault();
params.navigate(params.url);
});
if (handleScrolling)
initScrolling();
}
export function initRouting() {
initClean();
initClicks();
initScrolling();
}
function initScrolling() {
window.addEventListener("popstate", function () {
function getTargetElement() {
var hash = location.hash;
if (!hash)
return;
var el = document.querySelector(hash);
if (!el)
return;
el.scrollIntoView();
return document.querySelector(hash);
}
window.addEventListener("popstate", function () {
var el = getTargetElement();
if (el)
el.scrollIntoView();
else
window.scrollTo(0, 0);
});
}
import { ReactNode } from "react";
declare type Props = {
children?: ReactNode;
children: ReactNode;
delayed?: boolean;

@@ -5,0 +5,0 @@ fullScreen?: boolean;

@@ -14,3 +14,2 @@ var __assign = (this && this.__assign) || function () {

import { useEffect, useState } from "react";
import NanoSpinner from "react-nano-spinner";
import { useRerender, useRerenderEvery } from "../useRerender";

@@ -20,3 +19,3 @@ var delayedTimeout = 1000;

var children = props.children, delayed = props.delayed, fullScreen = props.fullScreen, timeoutMs = props.timeoutMs;
var contents = children || _jsx(NanoSpinner, {}, void 0);
var contents = children;
useRerenderEvery(1000);

@@ -23,0 +22,0 @@ var rerender = useRerender();

{
"name": "@theorem/react",
"version": "3.3.0",
"description": "Theorem React tools",
"peerDependencies": {
"react": "^17.0.1"
},
"scripts": {
"build": "rm -rf dist && NODE_ENV=production tsc --project tsconfig.build.json",
"format": "prettier --write '{docs,src,typings}/**/*.{js,json,md,ts,tsx}' '*.{js,json,md,ts,tsx}'",
"format-verify": "prettier --check '{docs,src,typings}/**/*.{js,json,md,ts,tsx}' '*.{js,json,md,ts,tsx}'",
"bin-license": "ts-node -T --project bin/tsconfig.json bin/license",
"build": "rm -rf dist && NODE_ENV=production tsc --project tsconfig.build.json && NODE_ENV=production tsc --project bin/tsconfig.json",
"format": "prettier --write '{bin,docs,src,typings}/**/*.{js,json,md,ts,tsx}' '*.{js,json,md,ts,tsx}'",
"format-verify": "prettier --check '{bin,docs,src,typings}/**/*.{js,json,md,ts,tsx}' '*.{js,json,md,ts,tsx}'",
"lint": "eslint --ext js,jsx,ts,tsx src",

@@ -17,10 +12,18 @@ "prepublishOnly": "npm run verify && npm run build",

"test": "ava",
"typecheck": "tsc --noEmit",
"typecheck": "tsc --noEmit && tsc --noEmit --project bin/tsconfig.json",
"verify": "npm run typecheck && npm run lint && npm run format-verify && npm run test"
},
"bin": {
"theorem-react-license-tool": "dist/bin/license/index.js"
},
"browser": "dist/index.js",
"description": "Theorem React tools",
"dependencies": {
"@types/color-convert": "^2.0.0",
"@types/findup-sync": "^2.0.2",
"color-convert": "^2.0.1",
"commander": "^2.20.3",
"findup-sync": "^4.0.0",
"license-checker-webpack-plugin": "=0.2.0",
"parse-css-color": "^0.1.2",
"react-nano-spinner": "^1.3.0",
"use-memo-one": "^1.1.1"

@@ -30,6 +33,7 @@ },

"@theorem/eslint-plugin": "^6.2.1",
"@types/license-checker-webpack-plugin": "^0.0.2",
"@types/react": "^17.0.0",
"@types/react-test-renderer": "^17.0.0",
"ava": "^3.13.0",
"eslint": "^7.14.0",
"eslint": "^7.15.0",
"prettier": "^2.2.1",

@@ -39,5 +43,4 @@ "react": "^17.0.1",

"ts-node": "^9.1.0",
"typescript": "^4.1.2"
"typescript": "^4.1.3"
},
"browser": "dist/index.js",
"engines": {

@@ -54,5 +57,10 @@ "node": ">=14.14.0",

"module": "dist/index.js",
"name": "@theorem/react",
"peerDependencies": {
"react": "^17.0.1"
},
"repository": "git@github.com:Theorem/react-tools.git",
"sideEffects": false,
"types": "dist/index.js"
"types": "dist/index.js",
"version": "4.0.0"
}
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