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

@rpldy/shared-ui

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpldy/shared-ui - npm Package Compare versions

Comparing version 0.15.0 to 0.16.0

lib/cjs/hocs/createRequestUpdateHoc.js

48

lib/cjs/index.js

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

get: function () {
return _utils.generateUploaderEventHook;
return _hooksUtils.generateUploaderEventHook;
}

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

get: function () {
return _utils.generateUploaderEventHookWithState;
return _hooksUtils.generateUploaderEventHookWithState;
}

@@ -110,2 +110,14 @@ });

});
Object.defineProperty(exports, "useBatchErrorListener", {
enumerable: true,
get: function () {
return _eventListenerHooks.useBatchErrorListener;
}
});
Object.defineProperty(exports, "useBatchFinalizeListener", {
enumerable: true,
get: function () {
return _eventListenerHooks.useBatchFinalizeListener;
}
});
Object.defineProperty(exports, "useBatchFinishListener", {

@@ -195,2 +207,8 @@ enumerable: true,

});
Object.defineProperty(exports, "withBatchStartUpdate", {
enumerable: true,
get: function () {
return _withBatchStartUpdate.default;
}
});
Object.defineProperty(exports, "withRequestPreSendUpdate", {

@@ -203,26 +221,30 @@ enumerable: true,

var _eventListenerHooks = require("./eventListenerHooks");
var _eventListenerHooks = require("./hooks/eventListenerHooks");
var _utils = require("./utils");
var _hooksUtils = require("./hooks/hooksUtils");
var _uploadyVersion = require("./uploadyVersion");
var _NoDomUploady = _interopRequireDefault(require("./NoDomUploady"));
var _assertContext = _interopRequireDefault(require("./assertContext"));
var _useUploadOptions = _interopRequireDefault(require("./useUploadOptions"));
var _UploadyContext = _interopRequireWildcard(require("./UploadyContext"));
var _useAbortItem = _interopRequireDefault(require("./useAbortItem"));
var _useUploadOptions = _interopRequireDefault(require("./hooks/useUploadOptions"));
var _useAbortBatch = _interopRequireDefault(require("./useAbortBatch"));
var _useAbortItem = _interopRequireDefault(require("./hooks/useAbortItem"));
var _useAbortAll = _interopRequireDefault(require("./useAbortAll"));
var _useAbortBatch = _interopRequireDefault(require("./hooks/useAbortBatch"));
var _NoDomUploady = _interopRequireDefault(require("./NoDomUploady"));
var _useAbortAll = _interopRequireDefault(require("./hooks/useAbortAll"));
var _UploadyContext = _interopRequireWildcard(require("./UploadyContext"));
var _useUploadyContext = _interopRequireDefault(require("./hooks/useUploadyContext"));
var _withRequestPreSendUpdate = _interopRequireDefault(require("./withRequestPreSendUpdate"));
var _withRequestPreSendUpdate = _interopRequireDefault(require("./hocs/withRequestPreSendUpdate"));
var _useUploadyContext = _interopRequireDefault(require("./useUploadyContext"));
var _withBatchStartUpdate = _interopRequireDefault(require("./hocs/withBatchStartUpdate"));
var _uploadyVersion = require("./uploadyVersion");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -229,0 +251,0 @@

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

var _useUploader = _interopRequireDefault(require("./useUploader"));
var _useUploader = _interopRequireDefault(require("./hooks/useUploader"));

@@ -17,0 +17,0 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

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

const getVersion = () => "0.15.0" || "";
const getVersion = () => "0.16.0" || "";

@@ -16,0 +16,0 @@ exports.getVersion = getVersion;

@@ -6,6 +6,4 @@ "use strict";

});
exports.markAsUploadOptionsComponent = exports.logWarning = exports.getIsUploadOptionsComponent = exports.generateUploaderEventHookWithState = exports.generateUploaderEventHook = void 0;
exports.markAsUploadOptionsComponent = exports.logWarning = exports.getIsUploadOptionsComponent = void 0;
var _react = require("react");
var _shared = require("@rpldy/shared");

@@ -15,57 +13,2 @@

var _useUploadyContext = _interopRequireDefault(require("./useUploadyContext"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const useEventEffect = (event, fn) => {
const context = (0, _useUploadyContext.default)();
const {
on,
off
} = context;
(0, _react.useEffect)(() => {
on(event, fn);
return () => {
off(event, fn);
};
}, [event, fn, on, off]);
};
const generateUploaderEventHookWithState = (event, stateCalculator) => (fn, id) => {
const [eventState, setEventState] = (0, _react.useState)(null);
const eventCallback = (0, _react.useCallback)(function (eventObj) {
if (!id || eventObj.id === id) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
setEventState(stateCalculator(eventObj, ...args));
if (fn) {
fn(eventObj, ...args);
}
}
}, [fn, id]);
useEventEffect(event, eventCallback);
return eventState;
};
exports.generateUploaderEventHookWithState = generateUploaderEventHookWithState;
const generateUploaderEventHook = function (event) {
let canScope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
return (fn, id) => {
const eventCallback = (0, _react.useCallback)(function (eventObj) {
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
return fn && (!canScope || !id || eventObj.id === id) ? fn(eventObj, ...args) : undefined;
}, [fn, id]);
useEventEffect(event, eventCallback);
};
};
exports.generateUploaderEventHook = generateUploaderEventHook;
const logWarning = (condition, msg) => {

@@ -72,0 +15,0 @@ if (!(0, _shared.isProduction)() && !condition) {

@@ -1,12 +0,14 @@

export { useBatchAddListener, useBatchStartListener, useBatchProgressListener, useBatchFinishListener, useBatchCancelledListener, useBatchAbortListener, useItemStartListener, useItemFinishListener, useItemProgressListener, useItemCancelListener, useItemErrorListener, useItemAbortListener, useItemFinalizeListener, useRequestPreSend, useAllAbortListener } from "./eventListenerHooks";
export { generateUploaderEventHook, generateUploaderEventHookWithState, logWarning, markAsUploadOptionsComponent, getIsUploadOptionsComponent } from "./utils";
export { useBatchAddListener, useBatchStartListener, useBatchProgressListener, useBatchFinishListener, useBatchCancelledListener, useBatchAbortListener, useBatchErrorListener, useBatchFinalizeListener, useItemStartListener, useItemFinishListener, useItemProgressListener, useItemCancelListener, useItemErrorListener, useItemAbortListener, useItemFinalizeListener, useRequestPreSend, useAllAbortListener } from "./hooks/eventListenerHooks";
export { logWarning, markAsUploadOptionsComponent, getIsUploadOptionsComponent } from "./utils";
export { generateUploaderEventHook, generateUploaderEventHookWithState } from "./hooks/hooksUtils";
export { getVersion as getUploadyVersion } from "./uploadyVersion";
export { default as NoDomUploady } from "./NoDomUploady";
export { default as assertContext } from "./assertContext";
export { default as useUploadOptions } from "./useUploadOptions";
export { default as useAbortItem } from "./useAbortItem";
export { default as useAbortBatch } from "./useAbortBatch";
export { default as useAbortAll } from "./useAbortAll";
export { default as NoDomUploady } from "./NoDomUploady";
export { default as UploadyContext, createContextApi } from "./UploadyContext";
export { default as withRequestPreSendUpdate } from "./withRequestPreSendUpdate";
export { default as useUploadyContext, default as useUploady } from "./useUploadyContext";
export { getVersion as getUploadyVersion } from "./uploadyVersion";
export { default as useUploadOptions } from "./hooks/useUploadOptions";
export { default as useAbortItem } from "./hooks/useAbortItem";
export { default as useAbortBatch } from "./hooks/useAbortBatch";
export { default as useAbortAll } from "./hooks/useAbortAll";
export { default as useUploadyContext, default as useUploady } from "./hooks/useUploadyContext";
export { default as withRequestPreSendUpdate } from "./hocs/withRequestPreSendUpdate";
export { default as withBatchStartUpdate } from "./hocs/withBatchStartUpdate";
import React, { useMemo } from "react";
import { logger } from "@rpldy/shared";
import UploadyContext, { createContextApi } from "./UploadyContext";
import useUploader from "./useUploader";
import useUploader from "./hooks/useUploader";

@@ -6,0 +6,0 @@ const NoDomUploady = props => {

import { hasWindow } from "@rpldy/shared";
export const GLOBAL_VERSION_SYM = Symbol.for("_rpldy-version_");
const getVersion = () => "0.15.0" || "";
const getVersion = () => "0.16.0" || "";

@@ -6,0 +6,0 @@ const getRegisteredVersion = () => {

@@ -1,53 +0,4 @@

import { useEffect, useState, useCallback } from "react";
import { isProduction } from "@rpldy/shared";
import { UPLOAD_OPTIONS_COMP } from "./consts";
import useUploadyContext from "./useUploadyContext";
const useEventEffect = (event, fn) => {
const context = useUploadyContext();
const {
on,
off
} = context;
useEffect(() => {
on(event, fn);
return () => {
off(event, fn);
};
}, [event, fn, on, off]);
};
const generateUploaderEventHookWithState = (event, stateCalculator) => (fn, id) => {
const [eventState, setEventState] = useState(null);
const eventCallback = useCallback(function (eventObj) {
if (!id || eventObj.id === id) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
setEventState(stateCalculator(eventObj, ...args));
if (fn) {
fn(eventObj, ...args);
}
}
}, [fn, id]);
useEventEffect(event, eventCallback);
return eventState;
};
const generateUploaderEventHook = function (event) {
let canScope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
return (fn, id) => {
const eventCallback = useCallback(function (eventObj) {
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
return fn && (!canScope || !id || eventObj.id === id) ? fn(eventObj, ...args) : undefined;
}, [fn, id]);
useEventEffect(event, eventCallback);
};
};
const logWarning = (condition, msg) => {

@@ -70,2 +21,2 @@ if (!isProduction() && !condition) {

export { generateUploaderEventHook, generateUploaderEventHookWithState, logWarning, markAsUploadOptionsComponent, getIsUploadOptionsComponent };
export { logWarning, markAsUploadOptionsComponent, getIsUploadOptionsComponent };
{
"version": "0.15.0",
"version": "0.16.0",
"name": "@rpldy/shared-ui",

@@ -21,4 +21,4 @@ "description": "internal set of utils+types for react-uploady UI",

"dependencies": {
"@rpldy/shared": "^0.15.0",
"@rpldy/uploader": "^0.15.0"
"@rpldy/shared": "^0.16.0",
"@rpldy/uploader": "^0.16.0"
},

@@ -35,3 +35,3 @@ "devDependencies": {

},
"gitHead": "7909b3aacc4afd229e4bc6810da8560be19706b2"
"gitHead": "d48d97673222581b5da36fafa1bd859945775c4c"
}

@@ -64,4 +64,7 @@ import * as React from "react";

type BatchStartHook = (cb: (batch: Batch, items: BatchItem[], options: CreateOptions) =>
{ items?: BatchItem[]; options?: CreateOptions } | boolean | void) => void;
export const useBatchAddListener: BatchCancellableEventHook;
export const useBatchStartListener: BatchCancellableEventHook;
export const useBatchStartListener: BatchStartHook;
export const useBatchProgressListener: BatchEventHookWithState;

@@ -71,2 +74,4 @@ export const useBatchFinishListener: BatchEventHook;

export const useBatchAbortListener: BatchEventHook;
export const useBatchErrorListener: BatchEventHook;
export const useBatchFinalizeListener: BatchEventHook;

@@ -83,3 +88,6 @@ export const useItemStartListener: ItemCancellableEventHook;

export type PreSendData = { items: BatchItem[]; options: CreateOptions };
export interface PreSendData {
items: BatchItem[];
options: CreateOptions;
}

@@ -133,6 +141,12 @@ export type PreSendResponse = { items?: BatchItem[]; options?: CreateOptions };

export interface BatchStartData extends PreSendData {
batch: Batch;
}
export type RequestUpdater = (data?: boolean | { items?: BatchItem[], options?: CreateOptions }) => void;
export interface WithRequestPreSendUpdateWrappedProps {
id: string;
updateRequest: (data?: boolean | { items?: BatchItem[]; options?: CreateOptions }) => void;
requestData: PreSendData;
updateRequest: RequestUpdater;
requestData: BatchStartData;
}

@@ -143,4 +157,7 @@

export const withBatchStartUpdate: <P extends WithRequestPreSendUpdateProps>(Comp: React.FC<P> | React.ComponentType<P>) =>
React.FC<Omit<P, "updateRequest" | "requestData">>;
export const markAsUploadOptionsComponent: (Component: React.ComponentType<unknown>) => void;
export const getIsUploadOptionsComponent: (Component: React.ComponentType<unknown>) => boolean;

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