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

carousel-lit

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

carousel-lit - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

35

dist/carousel-lit.cjs.js

@@ -25,2 +25,3 @@ 'use strict';

////////////////////////////////////////////////////////////////////////////////
// React context for both state and dispatch

@@ -62,3 +63,4 @@ var StateContext = React.createContext({});

}
};
}; ////////////////////////////////////////////////////////////////////////////////
/**

@@ -73,3 +75,4 @@ * <ContextProvider>

initialState = _ref$initialState === void 0 ? {} : _ref$initialState,
children = _ref.children;
children = _ref.children,
middleware = _ref.middleware;

@@ -80,8 +83,18 @@ var _React$useReducer = React.useReducer(reducer, initialState),

var enhancedDispatch = React.useCallback(function applyMiddleware(dispatch, middleware) {
return function (action) {
dispatch(action);
if (typeof middleware === 'function') {
middleware(action);
}
};
}(dispatch, middleware), []);
return React.createElement(StateContext.Provider, {
value: state
}, React.createElement(DispatchContext.Provider, {
value: dispatch
value: enhancedDispatch
}, children));
};
}; ////////////////////////////////////////////////////////////////////////////////
/**

@@ -99,3 +112,4 @@ * useState exposes the current app state from context

return context;
}
} ////////////////////////////////////////////////////////////////////////////////
/**

@@ -250,6 +264,15 @@ * useDispatch exposes the current dispatch function from context

_ref$offset = _ref.offset,
offset = _ref$offset === void 0 ? 0 : _ref$offset;
offset = _ref$offset === void 0 ? 0 : _ref$offset,
onInitialize = _ref.onInitialize;
return core.jsx(ContextProvider, {
initialState: {
offset: offset
},
middleware: function middleware(action) {
if (typeof onInitialize === 'function' && action.type === ActionType.INITIALIZE) {
onInitialize({
contentWidth: action.payload.contentWidth || 0,
trackHeight: action.payload.trackHeight || 0
});
}
}

@@ -256,0 +279,0 @@ }, core.jsx("div", {

@@ -19,2 +19,3 @@ import _extends from '@babel/runtime/helpers/esm/extends';

////////////////////////////////////////////////////////////////////////////////
// React context for both state and dispatch

@@ -56,3 +57,4 @@ var StateContext = React.createContext({});

}
};
}; ////////////////////////////////////////////////////////////////////////////////
/**

@@ -67,3 +69,4 @@ * <ContextProvider>

initialState = _ref$initialState === void 0 ? {} : _ref$initialState,
children = _ref.children;
children = _ref.children,
middleware = _ref.middleware;

@@ -74,8 +77,18 @@ var _React$useReducer = React.useReducer(reducer, initialState),

var enhancedDispatch = React.useCallback(function applyMiddleware(dispatch, middleware) {
return function (action) {
dispatch(action);
if (typeof middleware === 'function') {
middleware(action);
}
};
}(dispatch, middleware), []);
return React.createElement(StateContext.Provider, {
value: state
}, React.createElement(DispatchContext.Provider, {
value: dispatch
value: enhancedDispatch
}, children));
};
}; ////////////////////////////////////////////////////////////////////////////////
/**

@@ -93,3 +106,4 @@ * useState exposes the current app state from context

return context;
}
} ////////////////////////////////////////////////////////////////////////////////
/**

@@ -244,6 +258,15 @@ * useDispatch exposes the current dispatch function from context

_ref$offset = _ref.offset,
offset = _ref$offset === void 0 ? 0 : _ref$offset;
offset = _ref$offset === void 0 ? 0 : _ref$offset,
onInitialize = _ref.onInitialize;
return jsx(ContextProvider, {
initialState: {
offset: offset
},
middleware: function middleware(action) {
if (typeof onInitialize === 'function' && action.type === ActionType.INITIALIZE) {
onInitialize({
contentWidth: action.payload.contentWidth || 0,
trackHeight: action.payload.trackHeight || 0
});
}
}

@@ -250,0 +273,0 @@ }, jsx("div", {

4

dist/types/context.d.ts

@@ -19,6 +19,7 @@ import React from 'react';

}
interface ReducerAction {
export interface ReducerAction {
type: ActionType;
payload?: any;
}
declare type Middleware<T> = (action: T) => void;
/**

@@ -30,2 +31,3 @@ * <ContextProvider>

initialState?: ReducerState;
middleware?: Middleware<ReducerAction>;
}>;

@@ -32,0 +34,0 @@ /**

/// <reference types="react" />
export declare type OnInitializePayload = {
contentWidth: number;
trackHeight: number;
};
export interface CarouselProps {
offset?: number;
onInitialize?: (payload: OnInitializePayload) => void;
}

@@ -5,0 +10,0 @@ export interface Entry<T> {

{
"name": "carousel-lit",
"version": "0.1.0",
"version": "0.2.0",
"author": "Joel Voss <mail@joelvoss.com>",

@@ -42,3 +42,3 @@ "license": "MIT",

"@types/raf-schd": "4.0.0",
"@types/react": "16.9.22",
"@types/react": "16.9.23",
"@types/react-dom": "16.9.5",

@@ -45,0 +45,0 @@ "@types/smoothscroll-polyfill": "^0.3.1",

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