Add yet-another-react-lightbox package and update .gitignore to exclude node_modules

This commit is contained in:
IGNY8 VPS (Salman)
2025-11-12 18:50:30 +00:00
parent bd2a5570a9
commit c92f4a5edd
9304 changed files with 29 additions and 2008667 deletions

View File

@@ -1,12 +0,0 @@
/// <reference types="react" />
import type { DragDropManager } from 'dnd-core';
/**
* The React context type
*/
export interface DndContextType {
dragDropManager: DragDropManager | undefined;
}
/**
* Create the React Context
*/
export declare const DndContext: import("react").Context<DndContextType>;

View File

@@ -1,8 +0,0 @@
import { createContext } from 'react';
/**
* Create the React Context
*/ export const DndContext = createContext({
dragDropManager: undefined
});
//# sourceMappingURL=DndContext.js.map

View File

@@ -1 +0,0 @@
{"version":3,"sources":["../../src/core/DndContext.ts"],"sourcesContent":["import type { DragDropManager } from 'dnd-core'\nimport { createContext } from 'react'\n\n/**\n * The React context type\n */\nexport interface DndContextType {\n\tdragDropManager: DragDropManager | undefined\n}\n\n/**\n * Create the React Context\n */\nexport const DndContext = createContext<DndContextType>({\n\tdragDropManager: undefined,\n})\n"],"names":["createContext","DndContext","dragDropManager","undefined"],"mappings":"AACA,SAASA,aAAa,QAAQ,OAAO,CAAA;AASrC;;GAEG,CACH,OAAO,MAAMC,UAAU,GAAGD,aAAa,CAAiB;IACvDE,eAAe,EAAEC,SAAS;CAC1B,CAAC,CAAA"}

View File

@@ -1,16 +0,0 @@
import type { BackendFactory, DragDropManager } from 'dnd-core';
import type { FC, ReactNode } from 'react';
export declare type DndProviderProps<BackendContext, BackendOptions> = {
children?: ReactNode;
manager: DragDropManager;
} | {
backend: BackendFactory;
children?: ReactNode;
context?: BackendContext;
options?: BackendOptions;
debugMode?: boolean;
};
/**
* A React component that provides the React-DnD context
*/
export declare const DndProvider: FC<DndProviderProps<unknown, unknown>>;

View File

@@ -1,94 +0,0 @@
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = _objectWithoutPropertiesLoose(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for(i = 0; i < sourceSymbolKeys.length; i++){
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for(i = 0; i < sourceKeys.length; i++){
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
import { jsx as _jsx } from "react/jsx-runtime";
import { createDragDropManager } from 'dnd-core';
import { memo, useEffect } from 'react';
import { DndContext } from './DndContext.js';
let refCount = 0;
const INSTANCE_SYM = Symbol.for('__REACT_DND_CONTEXT_INSTANCE__');
var DndProvider = /*#__PURE__*/ memo(function DndProvider(_param) {
var { children } = _param, props = _objectWithoutProperties(_param, [
"children"
]);
const [manager, isGlobalInstance] = getDndContextValue(props) // memoized from props
;
/**
* If the global context was used to store the DND context
* then where theres no more references to it we should
* clean it up to avoid memory leaks
*/ useEffect(()=>{
if (isGlobalInstance) {
const context = getGlobalContext();
++refCount;
return ()=>{
if (--refCount === 0) {
context[INSTANCE_SYM] = null;
}
};
}
return;
}, []);
return /*#__PURE__*/ _jsx(DndContext.Provider, {
value: manager,
children: children
});
});
/**
* A React component that provides the React-DnD context
*/ export { DndProvider, };
function getDndContextValue(props) {
if ('manager' in props) {
const manager = {
dragDropManager: props.manager
};
return [
manager,
false
];
}
const manager = createSingletonDndContext(props.backend, props.context, props.options, props.debugMode);
const isGlobalInstance = !props.context;
return [
manager,
isGlobalInstance
];
}
function createSingletonDndContext(backend, context = getGlobalContext(), options, debugMode) {
const ctx = context;
if (!ctx[INSTANCE_SYM]) {
ctx[INSTANCE_SYM] = {
dragDropManager: createDragDropManager(backend, context, options, debugMode)
};
}
return ctx[INSTANCE_SYM];
}
function getGlobalContext() {
return typeof global !== 'undefined' ? global : window;
}
//# sourceMappingURL=DndProvider.js.map

View File

@@ -1 +0,0 @@
{"version":3,"sources":["../../src/core/DndProvider.tsx"],"sourcesContent":["import type { BackendFactory, DragDropManager } from 'dnd-core'\nimport { createDragDropManager } from 'dnd-core'\nimport type { FC, ReactNode } from 'react'\nimport { memo, useEffect } from 'react'\n\nimport { DndContext } from './DndContext.js'\n\nexport type DndProviderProps<BackendContext, BackendOptions> =\n\t| {\n\t\t\tchildren?: ReactNode\n\t\t\tmanager: DragDropManager\n\t }\n\t| {\n\t\t\tbackend: BackendFactory\n\t\t\tchildren?: ReactNode\n\t\t\tcontext?: BackendContext\n\t\t\toptions?: BackendOptions\n\t\t\tdebugMode?: boolean\n\t }\n\nlet refCount = 0\nconst INSTANCE_SYM = Symbol.for('__REACT_DND_CONTEXT_INSTANCE__')\n\n/**\n * A React component that provides the React-DnD context\n */\nexport const DndProvider: FC<DndProviderProps<unknown, unknown>> = memo(\n\tfunction DndProvider({ children, ...props }) {\n\t\tconst [manager, isGlobalInstance] = getDndContextValue(props) // memoized from props\n\t\t/**\n\t\t * If the global context was used to store the DND context\n\t\t * then where theres no more references to it we should\n\t\t * clean it up to avoid memory leaks\n\t\t */\n\t\tuseEffect(() => {\n\t\t\tif (isGlobalInstance) {\n\t\t\t\tconst context = getGlobalContext()\n\t\t\t\t++refCount\n\n\t\t\t\treturn () => {\n\t\t\t\t\tif (--refCount === 0) {\n\t\t\t\t\t\tcontext[INSTANCE_SYM] = null\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn\n\t\t}, [])\n\n\t\treturn <DndContext.Provider value={manager}>{children}</DndContext.Provider>\n\t},\n)\n\nfunction getDndContextValue(props: DndProviderProps<unknown, unknown>) {\n\tif ('manager' in props) {\n\t\tconst manager = { dragDropManager: props.manager }\n\t\treturn [manager, false]\n\t}\n\n\tconst manager = createSingletonDndContext(\n\t\tprops.backend,\n\t\tprops.context,\n\t\tprops.options,\n\t\tprops.debugMode,\n\t)\n\tconst isGlobalInstance = !props.context\n\n\treturn [manager, isGlobalInstance]\n}\n\nfunction createSingletonDndContext<BackendContext, BackendOptions>(\n\tbackend: BackendFactory,\n\tcontext: BackendContext = getGlobalContext(),\n\toptions: BackendOptions,\n\tdebugMode?: boolean,\n) {\n\tconst ctx = context as any\n\tif (!ctx[INSTANCE_SYM]) {\n\t\tctx[INSTANCE_SYM] = {\n\t\t\tdragDropManager: createDragDropManager(\n\t\t\t\tbackend,\n\t\t\t\tcontext,\n\t\t\t\toptions,\n\t\t\t\tdebugMode,\n\t\t\t),\n\t\t}\n\t}\n\treturn ctx[INSTANCE_SYM]\n}\n\ndeclare const global: any\nfunction getGlobalContext() {\n\treturn typeof global !== 'undefined' ? global : (window as any)\n}\n"],"names":["createDragDropManager","memo","useEffect","DndContext","refCount","INSTANCE_SYM","Symbol","for","DndProvider","children","props","manager","isGlobalInstance","getDndContextValue","context","getGlobalContext","Provider","value","dragDropManager","createSingletonDndContext","backend","options","debugMode","ctx","global","window"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAASA,qBAAqB,QAAQ,UAAU,CAAA;AAEhD,SAASC,IAAI,EAAEC,SAAS,QAAQ,OAAO,CAAA;AAEvC,SAASC,UAAU,QAAQ,iBAAiB,CAAA;AAe5C,IAAIC,QAAQ,GAAG,CAAC;AAChB,MAAMC,YAAY,GAAGC,MAAM,CAACC,GAAG,CAAC,gCAAgC,CAAC;IAKpDC,WAAW,iBAA2CP,IAAI,CACtE,SAASO,WAAW,CAAC,MAAsB,EAAE;QAAxB,EAAEC,QAAQ,CAAA,EAAY,GAAtB,MAAsB,EAAPC,KAAK,4BAApB,MAAsB;QAApBD,UAAQ;;IAC9B,MAAM,CAACE,OAAO,EAAEC,gBAAgB,CAAC,GAAGC,kBAAkB,CAACH,KAAK,CAAC,CAAC,sBAAsB;IAAvB;IAC7D;;;;KAIG,CACHR,SAAS,CAAC,IAAM;QACf,IAAIU,gBAAgB,EAAE;YACrB,MAAME,OAAO,GAAGC,gBAAgB,EAAE;Y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AAAQ,CAAA;CAC/D"}

View File

@@ -1,10 +0,0 @@
import type { FC } from 'react';
import type { ConnectDragPreview } from '../types/index.js';
export interface DragPreviewImageProps {
connect: ConnectDragPreview;
src: string;
}
/**
* A utility for rendering a drag preview image
*/
export declare const DragPreviewImage: FC<DragPreviewImageProps>;

View File

@@ -1,23 +0,0 @@
import { memo, useEffect } from 'react';
/**
* A utility for rendering a drag preview image
*/ export const DragPreviewImage = memo(function DragPreviewImage({ connect , src }) {
useEffect(()=>{
if (typeof Image === 'undefined') return;
let connected = false;
const img = new Image();
img.src = src;
img.onload = ()=>{
connect(img);
connected = true;
};
return ()=>{
if (connected) {
connect(null);
}
};
});
return null;
});
//# sourceMappingURL=DragPreviewImage.js.map

View File

@@ -1 +0,0 @@
{"version":3,"sources":["../../src/core/DragPreviewImage.ts"],"sourcesContent":["import type { FC } from 'react'\nimport { memo, useEffect } from 'react'\n\nimport type { ConnectDragPreview } from '../types/index.js'\n\nexport interface DragPreviewImageProps {\n\tconnect: ConnectDragPreview\n\tsrc: string\n}\n/**\n * A utility for rendering a drag preview image\n */\nexport const DragPreviewImage: FC<DragPreviewImageProps> = memo(\n\tfunction DragPreviewImage({ connect, src }) {\n\t\tuseEffect(() => {\n\t\t\tif (typeof Image === 'undefined') return\n\n\t\t\tlet connected = false\n\t\t\tconst img = new Image()\n\t\t\timg.src = src\n\t\t\timg.onload = () => {\n\t\t\t\tconnect(img)\n\t\t\t\tconnected = true\n\t\t\t}\n\t\t\treturn () => {\n\t\t\t\tif (connected) {\n\t\t\t\t\tconnect(null)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\n\t\treturn null\n\t},\n)\n"],"names":["memo","useEffect","DragPreviewImage","connect","src","Image","connected","img","onload"],"mappings":"AACA,SAASA,IAAI,EAAEC,SAAS,QAAQ,OAAO,CAAA;AAQvC;;GAEG,CACH,OAAO,MAAMC,gBAAgB,GAA8BF,IAAI,CAC9D,SAASE,gBAAgB,CAAC,EAAEC,OAAO,CAAA,EAAEC,GAAG,CAAA,EAAE,EAAE;IAC3CH,SAAS,CAAC,IAAM;QACf,IAAI,OAAOI,KAAK,KAAK,WAAW,EAAE,OAAM;QAExC,IAAIC,SAAS,GAAG,KAAK;QACrB,MAAMC,GAAG,GAAG,IAAIF,KAAK,EAAE;QACvBE,GAAG,CAACH,GAAG,GAAGA,GAAG;QACbG,GAAG,CAACC,MAAM,GAAG,IAAM;YAClBL,OAAO,CAACI,GAAG,CAAC;YACZD,SAAS,GAAG,IAAI;SAChB;QACD,OAAO,IAAM;YACZ,IAAIA,SAAS,EAAE;gBACdH,OAAO,CAAC,IAAI,CAAC;aACb;SACD,CAAA;KACD,CAAC;IAEF,OAAO,IAAI,CAAA;CACX,CACD,CAAA"}

View File

@@ -1,3 +0,0 @@
export * from './DndContext.js';
export * from './DndProvider.js';
export * from './DragPreviewImage.js';

View File

@@ -1,5 +0,0 @@
export * from './DndContext.js';
export * from './DndProvider.js';
export * from './DragPreviewImage.js';
//# sourceMappingURL=index.js.map

View File

@@ -1 +0,0 @@
{"version":3,"sources":["../../src/core/index.ts"],"sourcesContent":["export * from './DndContext.js'\nexport * from './DndProvider.js'\nexport * from './DragPreviewImage.js'\n"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA"}