node_modules ignore

This commit is contained in:
oier committed 2025-05-08 23:43:47 +02:00
1 parent e19d52f172
commit 4574544c9f
65041 files changed
+10593536

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
# `react-context`
## Installation
```sh
$ yarn add @radix-ui/react-context
# or
$ npm install @radix-ui/react-context
```
## Usage
This is an internal utility, not intended for public usage.
+26
View File
@@ -0,0 +1,26 @@
import * as React from "react";
export function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType): readonly [{
(props: ContextValueType & {
children: React.ReactNode;
}): JSX.Element;
displayName: string;
}, (consumerName: string) => ContextValueType];
export type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
export interface CreateScope {
scopeName: string;
(): ScopeHook;
}
export function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType | undefined) => readonly [{
(props: ContextValueType & {
scope: Scope<ContextValueType>;
children: React.ReactNode;
}): JSX.Element;
displayName: string;
}, (consumerName: string, scope: Scope<ContextValueType | undefined>) => ContextValueType], CreateScope];
//# sourceMappingURL=index.d.ts.map
+26
View File
@@ -0,0 +1,26 @@
import * as React from "react";
export function createContext<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType): readonly [{
(props: ContextValueType & {
children: React.ReactNode;
}): JSX.Element;
displayName: string;
}, (consumerName: string) => ContextValueType];
export type Scope<C = any> = {
[scopeName: string]: React.Context<C>[];
} | undefined;
type ScopeHook = (scope: Scope) => {
[__scopeProp: string]: Scope;
};
export interface CreateScope {
scopeName: string;
(): ScopeHook;
}
export function createContextScope(scopeName: string, createContextScopeDeps?: CreateScope[]): readonly [<ContextValueType extends object | null>(rootComponentName: string, defaultContext?: ContextValueType | undefined) => readonly [{
(props: ContextValueType & {
scope: Scope<ContextValueType>;
children: React.ReactNode;
}): JSX.Element;
displayName: string;
}, (consumerName: string, scope: Scope<ContextValueType | undefined>) => ContextValueType], CreateScope];
//# sourceMappingURL=index.d.ts.map
+1
View File
@@ -0,0 +1 @@
{"mappings":";AAEA,8BAAuB,gBAAgB,SAAS,MAAM,GAAG,IAAI,EAC3D,iBAAiB,EAAE,MAAM,EACzB,cAAc,CAAC,EAAE,gBAAgB;YAIR,gBAAgB,GAAG;QAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;KAAE;;kBAQvC,MAAM,uBAUzC;AAMD,kBAAW,CAAC,GAAG,GAAG,IAAI;IAAE,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,CAAC,CAAC,EAAE,CAAA;CAAE,GAAG,SAAS,CAAC;AAC9E,iBAAiB,CAAC,KAAK,EAAE,KAAK,KAAK;IAAE,CAAC,WAAW,EAAE,MAAM,GAAG,KAAK,CAAA;CAAE,CAAC;AACpE;IACE,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,SAAS,CAAC;CACf;AAED,mCAA4B,SAAS,EAAE,MAAM,EAAE,sBAAsB,GAAE,WAAW,EAAO,yEAQlE,MAAM;;;kBAQ+C,MAAM,SAAS;;;kBAUrD,MAAM,iFAgC3C","sources":["packages/react/context/src/packages/react/context/src/createContext.tsx","packages/react/context/src/packages/react/context/src/index.ts","packages/react/context/src/index.ts"],"sourcesContent":[null,null,"export { createContext, createContextScope } from './createContext';\nexport type { CreateScope, Scope } from './createContext';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
+133
View File
@@ -0,0 +1,133 @@
var $4O1Ne$react = require("react");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "createContext", () => $dec3cc0142d4f286$export$fd42f52fd3ae1109);
$parcel$export(module.exports, "createContextScope", () => $dec3cc0142d4f286$export$50c7b4e9d9f19c1);
function $dec3cc0142d4f286$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
const Context = /*#__PURE__*/ $4O1Ne$react.createContext(defaultContext);
function Provider(props) {
const { children: children , ...context } = props; // Only re-memoize when prop values change
// eslint-disable-next-line react-hooks/exhaustive-deps
const value = $4O1Ne$react.useMemo(()=>context
, Object.values(context));
return /*#__PURE__*/ $4O1Ne$react.createElement(Context.Provider, {
value: value
}, children);
}
function useContext(consumerName) {
const context = $4O1Ne$react.useContext(Context);
if (context) return context;
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + 'Provider';
return [
Provider,
useContext
];
}
/* -------------------------------------------------------------------------------------------------
* createContextScope
* -----------------------------------------------------------------------------------------------*/ function $dec3cc0142d4f286$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
let defaultContexts = [];
/* -----------------------------------------------------------------------------------------------
* createContext
* ---------------------------------------------------------------------------------------------*/ function $dec3cc0142d4f286$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
const BaseContext = /*#__PURE__*/ $4O1Ne$react.createContext(defaultContext);
const index = defaultContexts.length;
defaultContexts = [
...defaultContexts,
defaultContext
];
function Provider(props) {
const { scope: scope , children: children , ...context } = props;
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
// eslint-disable-next-line react-hooks/exhaustive-deps
const value = $4O1Ne$react.useMemo(()=>context
, Object.values(context));
return /*#__PURE__*/ $4O1Ne$react.createElement(Context.Provider, {
value: value
}, children);
}
function useContext(consumerName, scope) {
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
const context = $4O1Ne$react.useContext(Context);
if (context) return context;
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + 'Provider';
return [
Provider,
useContext
];
}
/* -----------------------------------------------------------------------------------------------
* createScope
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
const scopeContexts = defaultContexts.map((defaultContext)=>{
return /*#__PURE__*/ $4O1Ne$react.createContext(defaultContext);
});
return function useScope(scope) {
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
return $4O1Ne$react.useMemo(()=>({
[`__scope${scopeName}`]: {
...scope,
[scopeName]: contexts
}
})
, [
scope,
contexts
]);
};
};
createScope.scopeName = scopeName;
return [
$dec3cc0142d4f286$export$fd42f52fd3ae1109,
$dec3cc0142d4f286$var$composeContextScopes(createScope, ...createContextScopeDeps)
];
}
/* -------------------------------------------------------------------------------------------------
* composeContextScopes
* -----------------------------------------------------------------------------------------------*/ function $dec3cc0142d4f286$var$composeContextScopes(...scopes) {
const baseScope = scopes[0];
if (scopes.length === 1) return baseScope;
const createScope1 = ()=>{
const scopeHooks = scopes.map((createScope)=>({
useScope: createScope(),
scopeName: createScope.scopeName
})
);
return function useComposedScopes(overrideScopes) {
const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope: useScope , scopeName: scopeName })=>{
// We are calling a hook inside a callback which React warns against to avoid inconsistent
// renders, however, scoping doesn't have render side effects so we ignore the rule.
// eslint-disable-next-line react-hooks/rules-of-hooks
const scopeProps = useScope(overrideScopes);
const currentScope = scopeProps[`__scope${scopeName}`];
return {
...nextScopes,
...currentScope
};
}, {});
return $4O1Ne$react.useMemo(()=>({
[`__scope${baseScope.scopeName}`]: nextScopes1
})
, [
nextScopes1
]);
};
};
createScope1.scopeName = baseScope.scopeName;
return createScope1;
}
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"mappings":";;;;;;;;ACAA;AAEA,SAASA,yCAAT,CACEG,iBADF,EAEEC,cAFF,EAGE;IACA,MAAMC,OAAO,GAAA,aAAGH,CAAAA,0BAAA,CAAkDE,cAAlD,CAAhB,AAAA;IAEA,SAASE,QAAT,CAAkBC,KAAlB,EAA2E;QACzE,MAAM,EATV,UASYC,QAAF,CAAA,EAAY,GAAGC,OAAH,EAAZ,G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2BC,cAA3B,EAA2C;YAChD,MAAMC,WAAU,GAAGH,UAAU,CAACI,MAAX,CAAkB,CAACD,UAAD,EAAa,EAlHxD,UAkH0DR,QAAF,CAAA,EAlHxD,WAkHoEV,SAAAA,CAAAA,EAAzB,GAAyC;gBAC5E,0FAAA;gBACA,oFAAA;gBACA,sDAAA;gBACA,MAAMoB,UAAU,GAAGV,QAAQ,CAACO,cAAD,CAA3B,AAAA;gBACA,MAAMI,YAAY,GAAGD,UAAU,CAAE,CAAA,OAAA,EAASpB,SAAU,CAAA,CAArB,CAA/B,AAAA;gBACA,OAAO;oBAAE,GAAGkB,UAAL;oBAAiB,GAAGG,YAAH;iBAAxB,CAAO;aANU,EAOhB,EAPgB,CAAnB,AAOC;YAED,OAAOtC,oBAAA,CAAc,IAAO,CAAA;oBAAE,CAAE,CAAA,OAAA,EAAS+B,SAAS,CAACd,SAAU,CAAA,CAA/B,CAAA,EAAmCkB,WAAnC;iBAAT,CAAA;YAAd,EAAyE;gBAACA,WAAD;aAAzE,CAAP,CAA4B;SAV9B,CAWC;KAjBH,AAkBC;IAEDX,YAAW,CAACP,SAAZ,GAAwBc,SAAS,CAACd,SAAlC,CAAAO;IACA,OAAOA,YAAP,CAAA;CACD;;ADjID","sources":["packages/react/context/src/index.ts","packages/react/context/src/createContext.tsx"],"sourcesContent":["export { createContext, createContextScope } from './createContext';\nexport type { CreateScope, Scope } from './createContext';\n","import * as React from 'react';\n\nfunction createContext<ContextValueType extends object | null>(\n rootComponentName: string,\n defaultContext?: ContextValueType\n) {\n const Context = React.createContext<ContextValueType | undefined>(defaultContext);\n\n function Provider(props: ContextValueType & { children: React.ReactNode }) {\n const { children, ...context } = props;\n // Only re-memoize when prop values change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const value = React.useMemo(() => context, Object.values(context)) as ContextValueType;\n return <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n function useContext(consumerName: string) {\n const contexLine truncated
+128
View File
@@ -0,0 +1,128 @@
import {createContext as $3bkAK$createContext, useMemo as $3bkAK$useMemo, createElement as $3bkAK$createElement, useContext as $3bkAK$useContext} from "react";
function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
const Context = /*#__PURE__*/ $3bkAK$createContext(defaultContext);
function Provider(props) {
const { children: children , ...context } = props; // Only re-memoize when prop values change
// eslint-disable-next-line react-hooks/exhaustive-deps
const value = $3bkAK$useMemo(()=>context
, Object.values(context));
return /*#__PURE__*/ $3bkAK$createElement(Context.Provider, {
value: value
}, children);
}
function useContext(consumerName) {
const context = $3bkAK$useContext(Context);
if (context) return context;
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + 'Provider';
return [
Provider,
useContext
];
}
/* -------------------------------------------------------------------------------------------------
* createContextScope
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
let defaultContexts = [];
/* -----------------------------------------------------------------------------------------------
* createContext
* ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
const BaseContext = /*#__PURE__*/ $3bkAK$createContext(defaultContext);
const index = defaultContexts.length;
defaultContexts = [
...defaultContexts,
defaultContext
];
function Provider(props) {
const { scope: scope , children: children , ...context } = props;
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
// eslint-disable-next-line react-hooks/exhaustive-deps
const value = $3bkAK$useMemo(()=>context
, Object.values(context));
return /*#__PURE__*/ $3bkAK$createElement(Context.Provider, {
value: value
}, children);
}
function useContext(consumerName, scope) {
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
const context = $3bkAK$useContext(Context);
if (context) return context;
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
}
Provider.displayName = rootComponentName + 'Provider';
return [
Provider,
useContext
];
}
/* -----------------------------------------------------------------------------------------------
* createScope
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
const scopeContexts = defaultContexts.map((defaultContext)=>{
return /*#__PURE__*/ $3bkAK$createContext(defaultContext);
});
return function useScope(scope) {
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
return $3bkAK$useMemo(()=>({
[`__scope${scopeName}`]: {
...scope,
[scopeName]: contexts
}
})
, [
scope,
contexts
]);
};
};
createScope.scopeName = scopeName;
return [
$c512c27ab02ef895$export$fd42f52fd3ae1109,
$c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
];
}
/* -------------------------------------------------------------------------------------------------
* composeContextScopes
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
const baseScope = scopes[0];
if (scopes.length === 1) return baseScope;
const createScope1 = ()=>{
const scopeHooks = scopes.map((createScope)=>({
useScope: createScope(),
scopeName: createScope.scopeName
})
);
return function useComposedScopes(overrideScopes) {
const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope: useScope , scopeName: scopeName })=>{
// We are calling a hook inside a callback which React warns against to avoid inconsistent
// renders, however, scoping doesn't have render side effects so we ignore the rule.
// eslint-disable-next-line react-hooks/rules-of-hooks
const scopeProps = useScope(overrideScopes);
const currentScope = scopeProps[`__scope${scopeName}`];
return {
...nextScopes,
...currentScope
};
}, {});
return $3bkAK$useMemo(()=>({
[`__scope${baseScope.scopeName}`]: nextScopes1
})
, [
nextScopes1
]);
};
};
createScope1.scopeName = baseScope.scopeName;
return createScope1;
}
export {$c512c27ab02ef895$export$fd42f52fd3ae1109 as createContext, $c512c27ab02ef895$export$50c7b4e9d9f19c1 as createContextScope};
//# sourceMappingURL=index.mjs.map
+1
View File
@@ -0,0 +1 @@
{"mappings":";;ACAA;AAEA,SAASA,yCAAT,CACEG,iBADF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AM,CAACJ,GAAP,CAAYF,CAAAA,WAAD,GAAkB,CAAA;gBAC9CG,QAAQ,EAAEH,WAAW,EADyB;gBAE9CP,SAAS,EAAEO,WAAW,CAACP,SAAvBA;aAF4B,CAAA;QAAX,CAAnB,AAAgD;QAKhD,OAAO,SAASgB,iBAAT,CAA2BC,cAA3B,EAA2C;YAChD,MAAMC,WAAU,GAAGH,UAAU,CAACI,MAAX,CAAkB,CAACD,UAAD,EAAa,EAlHxD,UAkH0DR,QAAF,CAAA,EAlHxD,WAkHoEV,SAAAA,CAAAA,EAAzB,GAAyC;gBAC5E,0FAAA;gBACA,oFAAA;gBACA,sDAAA;gBACA,MAAMoB,UAAU,GAAGV,QAAQ,CAACO,cAAD,CAA3B,AAAA;gBACA,MAAMI,YAAY,GAAGD,UAAU,CAAE,CAAA,OAAA,EAASpB,SAAU,CAAA,CAArB,CAA/B,AAAA;gBACA,OAAO;oBAAE,GAAGkB,UAAL;oBAAiB,GAAGG,YAAH;iBAAxB,CAAO;aANU,EAOhB,EAPgB,CAAnB,AAOC;YAED,OAAOtC,cAAA,CAAc,IAAO,CAAA;oBAAE,CAAE,CAAA,OAAA,EAAS+B,SAAS,CAACd,SAAU,CAAA,CAA/B,CAAA,EAAmCkB,WAAnC;iBAAT,CAAA;YAAd,EAAyE;gBAACA,WAAD;aAAzE,CAAP,CAA4B;SAV9B,CAWC;KAjBH,AAkBC;IAEDX,YAAW,CAACP,SAAZ,GAAwBc,SAAS,CAACd,SAAlC,CAAAO;IACA,OAAOA,YAAP,CAAA;CACD;;ADjID","sources":["packages/react/context/src/index.ts","packages/react/context/src/createContext.tsx"],"sourcesContent":["export { createContext, createContextScope } from './createContext';\nexport type { CreateScope, Scope } from './createContext';\n","import * as React from 'react';\n\nfunction createContext<ContextValueType extends object | null>(\n rootComponentName: string,\n defaultContext?: ContextValueType\n) {\n const Context = React.createContext<ContextValueType | undefined>(defaultContext);\n\n function Provider(props: ContextValueType & { children: React.ReactNode }) {\n const { children, ...context } = props;\n // Only re-memoize when prop values change\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const value = React.useMemo(() => context, Object.values(context)) as ContextValueType;\n return <Context.Provider value={value}>{children}</Context.Provider>;\n }\n\n function useContext(consumerName: string) {\n const context = React.Line truncated
+50
View File
@@ -0,0 +1,50 @@
{
"name": "@radix-ui/react-context",
"version": "1.0.1",
"license": "MIT",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
},
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"scripts": {
"clean": "rm -rf dist",
"version": "yarn version"
},
"peerDependencies": {
"@types/react": "*",
"react": "^16.8 || ^17.0 || ^18.0"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"dependencies": {
"@babel/runtime": "^7.13.10"
}
}