@tamagui/web 1.111.0 → 1.111.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/helpers/createStyledContext.js +8 -7
- package/dist/cjs/helpers/createStyledContext.js.map +1 -1
- package/dist/cjs/helpers/createStyledContext.native.js +8 -7
- package/dist/cjs/helpers/createStyledContext.native.js.map +2 -2
- package/dist/esm/helpers/createStyledContext.js +8 -7
- package/dist/esm/helpers/createStyledContext.js.map +1 -1
- package/dist/esm/helpers/createStyledContext.mjs +8 -8
- package/dist/esm/helpers/createStyledContext.mjs.map +1 -1
- package/dist/esm/helpers/createStyledContext.native.js +8 -7
- package/dist/esm/helpers/createStyledContext.native.js.map +2 -2
- package/dist/esm/helpers/createStyledContext.native.mjs +8 -8
- package/dist/esm/helpers/createStyledContext.native.mjs.map +1 -1
- package/package.json +11 -11
- package/src/helpers/createStyledContext.tsx +11 -7
- package/types/helpers/createStyledContext.d.ts.map +1 -1
|
@@ -27,7 +27,12 @@ __export(createStyledContext_exports, {
|
|
|
27
27
|
module.exports = __toCommonJS(createStyledContext_exports);
|
|
28
28
|
var import_react = __toESM(require("react")), import_objectIdentityKey = require("./objectIdentityKey"), import_jsx_runtime = require("react/jsx-runtime");
|
|
29
29
|
function createStyledContext(defaultValues) {
|
|
30
|
-
const OGContext = import_react.default.createContext(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map()
|
|
30
|
+
const OGContext = import_react.default.createContext(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map();
|
|
31
|
+
function getOrCreateScopedContext(scope) {
|
|
32
|
+
let ScopedContext = scopedContexts.get(scope);
|
|
33
|
+
return ScopedContext || (ScopedContext = import_react.default.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), ScopedContext;
|
|
34
|
+
}
|
|
35
|
+
const Provider = ({
|
|
31
36
|
children,
|
|
32
37
|
scope,
|
|
33
38
|
...values
|
|
@@ -38,13 +43,9 @@ function createStyledContext(defaultValues) {
|
|
|
38
43
|
...values
|
|
39
44
|
}), [(0, import_objectIdentityKey.objectIdentityKey)(values)]);
|
|
40
45
|
let Provider2 = OGProvider;
|
|
41
|
-
|
|
42
|
-
let ScopedContext = scopedContexts.get(scope);
|
|
43
|
-
ScopedContext || (ScopedContext = import_react.default.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
|
|
44
|
-
}
|
|
45
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value: next, children });
|
|
46
|
+
return scope && (Provider2 = getOrCreateScopedContext(scope).Provider), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value: next, children });
|
|
46
47
|
}, useStyledContext = (scope) => {
|
|
47
|
-
const context = scope ?
|
|
48
|
+
const context = scope ? getOrCreateScopedContext(scope) : OGContext;
|
|
48
49
|
return import_react.default.useContext(context);
|
|
49
50
|
};
|
|
50
51
|
return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/createStyledContext.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAGlB,2BAAkC,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB,2BAGlB,2BAAkC,gCAmDvB;AAjCJ,SAAS,oBACd,eAC6B;AAC7B,QAAM,YAAY,aAAAA,QAAM,cAAwC,aAAa,GACvE,aAAa,UAAU,UACvB,UAAU,WACV,iBAAiB,oBAAI,IAA+C;AAE1E,WAAS,yBAAyB,OAAe;AAC/C,QAAI,gBAAgB,eAAe,IAAI,KAAK;AAC5C,WAAK,kBACH,gBAAgB,aAAAA,QAAM,cAAwC,aAAa,GAC3E,eAAe,IAAI,OAAO,aAAa,IAElC;AAAA,EACT;AAEA,QAAM,WAAW,CAAC;AAAA,IAChB;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,MAA8D;AAC5D,UAAM,OAAO,aAAAA,QAAM,QAAQ,OAClB;AAAA;AAAA,MAEL,GAAG;AAAA,MACH,GAAG;AAAA,IACL,IACC,KAAC,4CAAkB,MAAM,CAAC,CAAC;AAC9B,QAAIC,YAAW;AACf,WAAI,UACFA,YAAW,yBAAyB,KAAK,EAAE,WAEtC,4CAACA,WAAA,EAAS,OAAO,MAAO,UAAS;AAAA,EAC1C,GAGM,mBAAmB,CAAC,UAAmB;AAC3C,UAAM,UAAU,QAAQ,yBAAyB,KAAK,IAAI;AAC1D,WAAO,aAAAD,QAAM,WAAW,OAAQ;AAAA,EAClC;AAGA,iBAAQ,WAAW,UACnB,QAAQ,QAAQ,eAChB,QAAQ,UAAU,WAClB,QAAQ,mBAAmB,kBAEpB;AACT;",
|
|
5
5
|
"names": ["React", "Provider"]
|
|
6
6
|
}
|
|
@@ -28,7 +28,12 @@ __export(createStyledContext_exports, {
|
|
|
28
28
|
module.exports = __toCommonJS(createStyledContext_exports);
|
|
29
29
|
var import_jsx_runtime = require("react/jsx-runtime"), import_react = __toESM(require("react")), import_objectIdentityKey = require("./objectIdentityKey");
|
|
30
30
|
function createStyledContext(defaultValues) {
|
|
31
|
-
var OGContext = /* @__PURE__ */ import_react.default.createContext(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map()
|
|
31
|
+
var OGContext = /* @__PURE__ */ import_react.default.createContext(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map();
|
|
32
|
+
function getOrCreateScopedContext(scope) {
|
|
33
|
+
var ScopedContext = scopedContexts.get(scope);
|
|
34
|
+
return ScopedContext || (ScopedContext = /* @__PURE__ */ import_react.default.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), ScopedContext;
|
|
35
|
+
}
|
|
36
|
+
var Provider = function(param) {
|
|
32
37
|
var { children, scope, ...values } = param, next = import_react.default.useMemo(function() {
|
|
33
38
|
return {
|
|
34
39
|
// this ! is a workaround for ts error
|
|
@@ -38,16 +43,12 @@ function createStyledContext(defaultValues) {
|
|
|
38
43
|
}, [
|
|
39
44
|
(0, import_objectIdentityKey.objectIdentityKey)(values)
|
|
40
45
|
]), Provider2 = OGProvider;
|
|
41
|
-
|
|
42
|
-
var ScopedContext = scopedContexts.get(scope);
|
|
43
|
-
ScopedContext || (ScopedContext = /* @__PURE__ */ import_react.default.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
|
|
44
|
-
}
|
|
45
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, {
|
|
46
|
+
return scope && (Provider2 = getOrCreateScopedContext(scope).Provider), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, {
|
|
46
47
|
value: next,
|
|
47
48
|
children
|
|
48
49
|
});
|
|
49
50
|
}, useStyledContext = function(scope) {
|
|
50
|
-
var context = scope ?
|
|
51
|
+
var context = scope ? getOrCreateScopedContext(scope) : OGContext;
|
|
51
52
|
return import_react.default.useContext(context);
|
|
52
53
|
};
|
|
53
54
|
return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/Users/n8/tamagui/code/core/web/src/helpers/createStyledContext.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAkB,2BAGlB,2BAAkC;AAkB3B,SAASA,oBACdC,eAA4B;AAE5B,MAAMC,YAAYC,6BAAAA,QAAMC,cAAwCH,aAAAA,GAC1DI,aAAaH,UAAUI,UACvBC,UAAUL,WACVM,iBAAiB,oBAAIC,IAAAA,
|
|
5
|
-
"names": ["createStyledContext", "defaultValues", "OGContext", "React", "createContext", "OGProvider", "Provider", "Context", "scopedContexts", "Map", "
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAAA,eAAkB,2BAGlB,2BAAkC;AAkB3B,SAASA,oBACdC,eAA4B;AAE5B,MAAMC,YAAYC,6BAAAA,QAAMC,cAAwCH,aAAAA,GAC1DI,aAAaH,UAAUI,UACvBC,UAAUL,WACVM,iBAAiB,oBAAIC,IAAAA;AAE3B,WAASC,yBAAyBC,OAAa;AAC7C,QAAIC,gBAAgBJ,eAAeK,IAAIF,KAAAA;AACvC,WAAKC,kBACHA,gBAAgBT,6BAAAA,QAAMC,cAAwCH,aAAAA,GAC9DO,eAAeM,IAAIH,OAAOC,aAAAA,IAErBA;EACT;AAEA,MAAMN,WAAW,SAAA,OAAA;QAAC,EAChBS,UACAJ,OACA,GAAGK,OAAAA,IACoD,OACjDC,OAAOd,aAAAA,QAAMe,QAAQ,WAAA;AACzB,aAAO;;QAEL,GAAGjB;QACH,GAAGe;MACL;IACF,GAAG;UAACG,4CAAkBH,MAAAA;KAAQ,GAC1BV,YAAWD;AACf,WAAIM,UACFL,YAAWI,yBAAyBC,KAAAA,EAAOL,WAEtC,uCAAAc,KAACd,WAAAA;MAASe,OAAOJ;;;EAC1B,GAGMK,mBAAmB,SAACX,OAAAA;AACxB,QAAMY,UAAUZ,QAAQD,yBAAyBC,KAAAA,IAAST;AAC1D,WAAOC,aAAAA,QAAMqB,WAAWD,OAAAA;EAC1B;AAGAhB,iBAAQD,WAAWA,UACnBC,QAAQkB,QAAQxB,eAChBM,QAAQgB,UAAUrB,WAClBK,QAAQe,mBAAmBA,kBAEpBf;AACT;",
|
|
5
|
+
"names": ["createStyledContext", "defaultValues", "OGContext", "React", "createContext", "OGProvider", "Provider", "Context", "scopedContexts", "Map", "getOrCreateScopedContext", "scope", "ScopedContext", "get", "set", "children", "values", "next", "useMemo", "objectIdentityKey", "_jsx", "value", "useStyledContext", "context", "useContext", "props"]
|
|
6
6
|
}
|
|
@@ -2,7 +2,12 @@ import React from "react";
|
|
|
2
2
|
import { objectIdentityKey } from "./objectIdentityKey";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
function createStyledContext(defaultValues) {
|
|
5
|
-
const OGContext = React.createContext(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map()
|
|
5
|
+
const OGContext = React.createContext(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map();
|
|
6
|
+
function getOrCreateScopedContext(scope) {
|
|
7
|
+
let ScopedContext = scopedContexts.get(scope);
|
|
8
|
+
return ScopedContext || (ScopedContext = React.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), ScopedContext;
|
|
9
|
+
}
|
|
10
|
+
const Provider = ({
|
|
6
11
|
children,
|
|
7
12
|
scope,
|
|
8
13
|
...values
|
|
@@ -13,13 +18,9 @@ function createStyledContext(defaultValues) {
|
|
|
13
18
|
...values
|
|
14
19
|
}), [objectIdentityKey(values)]);
|
|
15
20
|
let Provider2 = OGProvider;
|
|
16
|
-
|
|
17
|
-
let ScopedContext = scopedContexts.get(scope);
|
|
18
|
-
ScopedContext || (ScopedContext = React.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
|
|
19
|
-
}
|
|
20
|
-
return /* @__PURE__ */ jsx(Provider2, { value: next, children });
|
|
21
|
+
return scope && (Provider2 = getOrCreateScopedContext(scope).Provider), /* @__PURE__ */ jsx(Provider2, { value: next, children });
|
|
21
22
|
}, useStyledContext = (scope) => {
|
|
22
|
-
const context = scope ?
|
|
23
|
+
const context = scope ? getOrCreateScopedContext(scope) : OGContext;
|
|
23
24
|
return React.useContext(context);
|
|
24
25
|
};
|
|
25
26
|
return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/createStyledContext.tsx"],
|
|
4
|
-
"mappings": "AAAA,OAAO,WAAW;AAGlB,SAAS,yBAAyB;
|
|
4
|
+
"mappings": "AAAA,OAAO,WAAW;AAGlB,SAAS,yBAAyB;AAmDvB;AAjCJ,SAAS,oBACd,eAC6B;AAC7B,QAAM,YAAY,MAAM,cAAwC,aAAa,GACvE,aAAa,UAAU,UACvB,UAAU,WACV,iBAAiB,oBAAI,IAA+C;AAE1E,WAAS,yBAAyB,OAAe;AAC/C,QAAI,gBAAgB,eAAe,IAAI,KAAK;AAC5C,WAAK,kBACH,gBAAgB,MAAM,cAAwC,aAAa,GAC3E,eAAe,IAAI,OAAO,aAAa,IAElC;AAAA,EACT;AAEA,QAAM,WAAW,CAAC;AAAA,IAChB;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,MAA8D;AAC5D,UAAM,OAAO,MAAM,QAAQ,OAClB;AAAA;AAAA,MAEL,GAAG;AAAA,MACH,GAAG;AAAA,IACL,IACC,CAAC,kBAAkB,MAAM,CAAC,CAAC;AAC9B,QAAIA,YAAW;AACf,WAAI,UACFA,YAAW,yBAAyB,KAAK,EAAE,WAEtC,oBAACA,WAAA,EAAS,OAAO,MAAO,UAAS;AAAA,EAC1C,GAGM,mBAAmB,CAAC,UAAmB;AAC3C,UAAM,UAAU,QAAQ,yBAAyB,KAAK,IAAI;AAC1D,WAAO,MAAM,WAAW,OAAQ;AAAA,EAClC;AAGA,iBAAQ,WAAW,UACnB,QAAQ,QAAQ,eAChB,QAAQ,UAAU,WAClB,QAAQ,mBAAmB,kBAEpB;AACT;",
|
|
5
5
|
"names": ["Provider"]
|
|
6
6
|
}
|
|
@@ -5,8 +5,12 @@ function createStyledContext(defaultValues) {
|
|
|
5
5
|
const OGContext = React.createContext(defaultValues),
|
|
6
6
|
OGProvider = OGContext.Provider,
|
|
7
7
|
Context = OGContext,
|
|
8
|
-
scopedContexts = /* @__PURE__ */new Map()
|
|
9
|
-
|
|
8
|
+
scopedContexts = /* @__PURE__ */new Map();
|
|
9
|
+
function getOrCreateScopedContext(scope) {
|
|
10
|
+
let ScopedContext = scopedContexts.get(scope);
|
|
11
|
+
return ScopedContext || (ScopedContext = React.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), ScopedContext;
|
|
12
|
+
}
|
|
13
|
+
const Provider = ({
|
|
10
14
|
children,
|
|
11
15
|
scope,
|
|
12
16
|
...values
|
|
@@ -17,17 +21,13 @@ function createStyledContext(defaultValues) {
|
|
|
17
21
|
...values
|
|
18
22
|
}), [objectIdentityKey(values)]);
|
|
19
23
|
let Provider2 = OGProvider;
|
|
20
|
-
|
|
21
|
-
let ScopedContext = scopedContexts.get(scope);
|
|
22
|
-
ScopedContext || (ScopedContext = React.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
|
|
23
|
-
}
|
|
24
|
-
return /* @__PURE__ */jsx(Provider2, {
|
|
24
|
+
return scope && (Provider2 = getOrCreateScopedContext(scope).Provider), /* @__PURE__ */jsx(Provider2, {
|
|
25
25
|
value: next,
|
|
26
26
|
children
|
|
27
27
|
});
|
|
28
28
|
},
|
|
29
29
|
useStyledContext = scope => {
|
|
30
|
-
const context = scope ?
|
|
30
|
+
const context = scope ? getOrCreateScopedContext(scope) : OGContext;
|
|
31
31
|
return React.useContext(context);
|
|
32
32
|
};
|
|
33
33
|
return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","objectIdentityKey","jsx","createStyledContext","defaultValues","OGContext","createContext","OGProvider","Provider","Context","scopedContexts","Map","
|
|
1
|
+
{"version":3,"names":["React","objectIdentityKey","jsx","createStyledContext","defaultValues","OGContext","createContext","OGProvider","Provider","Context","scopedContexts","Map","getOrCreateScopedContext","scope","ScopedContext","get","set","children","values","next","useMemo","Provider2","value","useStyledContext","context","useContext","props"],"sources":["../../../src/helpers/createStyledContext.tsx"],"sourcesContent":[null],"mappings":"AAAA,OAAOA,KAAA,MAAW;AAGlB,SAASC,iBAAA,QAAyB;AAmDvB,SAAAC,GAAA;AAjCJ,SAASC,oBACdC,aAAA,EAC6B;EAC7B,MAAMC,SAAA,GAAYL,KAAA,CAAMM,aAAA,CAAwCF,aAAa;IACvEG,UAAA,GAAaF,SAAA,CAAUG,QAAA;IACvBC,OAAA,GAAUJ,SAAA;IACVK,cAAA,GAAiB,mBAAIC,GAAA,CAA+C;EAE1E,SAASC,yBAAyBC,KAAA,EAAe;IAC/C,IAAIC,aAAA,GAAgBJ,cAAA,CAAeK,GAAA,CAAIF,KAAK;IAC5C,OAAKC,aAAA,KACHA,aAAA,GAAgBd,KAAA,CAAMM,aAAA,CAAwCF,aAAa,GAC3EM,cAAA,CAAeM,GAAA,CAAIH,KAAA,EAAOC,aAAa,IAElCA,aAAA;EACT;EAEA,MAAMN,QAAA,GAAWA,CAAC;MAChBS,QAAA;MACAJ,KAAA;MACA,GAAGK;IACL,MAA8D;MAC5D,MAAMC,IAAA,GAAOnB,KAAA,CAAMoB,OAAA,CAAQ,OAClB;QAAA;QAEL,GAAGhB,aAAA;QACH,GAAGc;MACL,IACC,CAACjB,iBAAA,CAAkBiB,MAAM,CAAC,CAAC;MAC9B,IAAIG,SAAA,GAAWd,UAAA;MACf,OAAIM,KAAA,KACFQ,SAAA,GAAWT,wBAAA,CAAyBC,KAAK,EAAEL,QAAA,GAEtC,eAAAN,GAAA,CAACmB,SAAA;QAASC,KAAA,EAAOH,IAAA;QAAOF;MAAA,CAAS;IAC1C;IAGMM,gBAAA,GAAoBV,KAAA,IAAmB;MAC3C,MAAMW,OAAA,GAAUX,KAAA,GAAQD,wBAAA,CAAyBC,KAAK,IAAIR,SAAA;MAC1D,OAAOL,KAAA,CAAMyB,UAAA,CAAWD,OAAQ;IAClC;EAGA,OAAAf,OAAA,CAAQD,QAAA,GAAWA,QAAA,EACnBC,OAAA,CAAQiB,KAAA,GAAQtB,aAAA,EAChBK,OAAA,CAAQe,OAAA,GAAUnB,SAAA,EAClBI,OAAA,CAAQc,gBAAA,GAAmBA,gBAAA,EAEpBd,OAAA;AACT","ignoreList":[]}
|
|
@@ -2,7 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { objectIdentityKey } from "./objectIdentityKey";
|
|
4
4
|
function createStyledContext(defaultValues) {
|
|
5
|
-
var OGContext = /* @__PURE__ */ React.createContext(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map()
|
|
5
|
+
var OGContext = /* @__PURE__ */ React.createContext(defaultValues), OGProvider = OGContext.Provider, Context = OGContext, scopedContexts = /* @__PURE__ */ new Map();
|
|
6
|
+
function getOrCreateScopedContext(scope) {
|
|
7
|
+
var ScopedContext = scopedContexts.get(scope);
|
|
8
|
+
return ScopedContext || (ScopedContext = /* @__PURE__ */ React.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), ScopedContext;
|
|
9
|
+
}
|
|
10
|
+
var Provider = function(param) {
|
|
6
11
|
var { children, scope, ...values } = param, next = React.useMemo(function() {
|
|
7
12
|
return {
|
|
8
13
|
// this ! is a workaround for ts error
|
|
@@ -12,16 +17,12 @@ function createStyledContext(defaultValues) {
|
|
|
12
17
|
}, [
|
|
13
18
|
objectIdentityKey(values)
|
|
14
19
|
]), Provider2 = OGProvider;
|
|
15
|
-
|
|
16
|
-
var ScopedContext = scopedContexts.get(scope);
|
|
17
|
-
ScopedContext || (ScopedContext = /* @__PURE__ */ React.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
|
|
18
|
-
}
|
|
19
|
-
return /* @__PURE__ */ _jsx(Provider2, {
|
|
20
|
+
return scope && (Provider2 = getOrCreateScopedContext(scope).Provider), /* @__PURE__ */ _jsx(Provider2, {
|
|
20
21
|
value: next,
|
|
21
22
|
children
|
|
22
23
|
});
|
|
23
24
|
}, useStyledContext = function(scope) {
|
|
24
|
-
var context = scope ?
|
|
25
|
+
var context = scope ? getOrCreateScopedContext(scope) : OGContext;
|
|
25
26
|
return React.useContext(context);
|
|
26
27
|
};
|
|
27
28
|
return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/Users/n8/tamagui/code/core/web/src/helpers/createStyledContext.tsx"],
|
|
4
|
-
"mappings": ";AAAA,OAAOA,WAAW;AAGlB,SAASC,yBAAyB;AAkB3B,SAASC,oBACdC,eAA4B;AAE5B,MAAMC,YAAYJ,sBAAMK,cAAwCF,aAAAA,GAC1DG,aAAaF,UAAUG,UACvBC,UAAUJ,WACVK,iBAAiB,oBAAIC,IAAAA,
|
|
5
|
-
"names": ["React", "objectIdentityKey", "createStyledContext", "defaultValues", "OGContext", "createContext", "OGProvider", "Provider", "Context", "scopedContexts", "Map", "
|
|
4
|
+
"mappings": ";AAAA,OAAOA,WAAW;AAGlB,SAASC,yBAAyB;AAkB3B,SAASC,oBACdC,eAA4B;AAE5B,MAAMC,YAAYJ,sBAAMK,cAAwCF,aAAAA,GAC1DG,aAAaF,UAAUG,UACvBC,UAAUJ,WACVK,iBAAiB,oBAAIC,IAAAA;AAE3B,WAASC,yBAAyBC,OAAa;AAC7C,QAAIC,gBAAgBJ,eAAeK,IAAIF,KAAAA;AACvC,WAAKC,kBACHA,gBAAgBb,sBAAMK,cAAwCF,aAAAA,GAC9DM,eAAeM,IAAIH,OAAOC,aAAAA,IAErBA;EACT;AAEA,MAAMN,WAAW,SAAA,OAAA;QAAC,EAChBS,UACAJ,OACA,GAAGK,OAAAA,IACoD,OACjDC,OAAOlB,MAAMmB,QAAQ,WAAA;AACzB,aAAO;;QAEL,GAAGhB;QACH,GAAGc;MACL;IACF,GAAG;MAAChB,kBAAkBgB,MAAAA;KAAQ,GAC1BV,YAAWD;AACf,WAAIM,UACFL,YAAWI,yBAAyBC,KAAAA,EAAOL,WAEtC,qBAACA,WAAAA;MAASa,OAAOF;;;EAC1B,GAGMG,mBAAmB,SAACT,OAAAA;AACxB,QAAMU,UAAUV,QAAQD,yBAAyBC,KAAAA,IAASR;AAC1D,WAAOJ,MAAMuB,WAAWD,OAAAA;EAC1B;AAGAd,iBAAQD,WAAWA,UACnBC,QAAQgB,QAAQrB,eAChBK,QAAQc,UAAUlB,WAClBI,QAAQa,mBAAmBA,kBAEpBb;AACT;",
|
|
5
|
+
"names": ["React", "objectIdentityKey", "createStyledContext", "defaultValues", "OGContext", "createContext", "OGProvider", "Provider", "Context", "scopedContexts", "Map", "getOrCreateScopedContext", "scope", "ScopedContext", "get", "set", "children", "values", "next", "useMemo", "value", "useStyledContext", "context", "useContext", "props"]
|
|
6
6
|
}
|
|
@@ -5,8 +5,12 @@ function createStyledContext(defaultValues) {
|
|
|
5
5
|
var OGContext = /* @__PURE__ */React.createContext(defaultValues),
|
|
6
6
|
OGProvider = OGContext.Provider,
|
|
7
7
|
Context = OGContext,
|
|
8
|
-
scopedContexts = /* @__PURE__ */new Map()
|
|
9
|
-
|
|
8
|
+
scopedContexts = /* @__PURE__ */new Map();
|
|
9
|
+
function getOrCreateScopedContext(scope) {
|
|
10
|
+
var ScopedContext = scopedContexts.get(scope);
|
|
11
|
+
return ScopedContext || (ScopedContext = /* @__PURE__ */React.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), ScopedContext;
|
|
12
|
+
}
|
|
13
|
+
var Provider = function (param) {
|
|
10
14
|
var {
|
|
11
15
|
children,
|
|
12
16
|
scope,
|
|
@@ -20,17 +24,13 @@ function createStyledContext(defaultValues) {
|
|
|
20
24
|
};
|
|
21
25
|
}, [objectIdentityKey(values)]),
|
|
22
26
|
Provider2 = OGProvider;
|
|
23
|
-
|
|
24
|
-
var ScopedContext = scopedContexts.get(scope);
|
|
25
|
-
ScopedContext || (ScopedContext = /* @__PURE__ */React.createContext(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
|
|
26
|
-
}
|
|
27
|
-
return /* @__PURE__ */_jsx(Provider2, {
|
|
27
|
+
return scope && (Provider2 = getOrCreateScopedContext(scope).Provider), /* @__PURE__ */_jsx(Provider2, {
|
|
28
28
|
value: next,
|
|
29
29
|
children
|
|
30
30
|
});
|
|
31
31
|
},
|
|
32
32
|
useStyledContext = function (scope) {
|
|
33
|
-
var context = scope ?
|
|
33
|
+
var context = scope ? getOrCreateScopedContext(scope) : OGContext;
|
|
34
34
|
return React.useContext(context);
|
|
35
35
|
};
|
|
36
36
|
return Context.Provider = Provider, Context.props = defaultValues, Context.context = OGContext, Context.useStyledContext = useStyledContext, Context;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["jsx","_jsx","React","objectIdentityKey","createStyledContext","defaultValues","OGContext","createContext","OGProvider","Provider","Context","scopedContexts","Map","
|
|
1
|
+
{"version":3,"names":["jsx","_jsx","React","objectIdentityKey","createStyledContext","defaultValues","OGContext","createContext","OGProvider","Provider","Context","scopedContexts","Map","getOrCreateScopedContext","scope","ScopedContext","get","set","param","children","values","next","useMemo","Provider2","value","useStyledContext","context","useContext"],"sources":["../../../src/helpers/createStyledContext.tsx"],"sourcesContent":[null],"mappings":"AAAA,SAAOA,GAAA,IAAAC,IAAW;AAGlB,OAAAC,KAAS;AAmDE,SAAAC,iBAAA;AAjCJ,SAASC,oBACdC,aAAA,EAC6B;EAC7B,IAAAC,SAAM,kBAAkBJ,KAAA,CAAwCK,aAAa,CAAAF,aACvE;IAAaG,UAAU,GAAAF,SACvB,CAAAG,QAAU;IAAAC,OACV,GAAAJ,SAAA;IAAAK,cAAiB,kBAAmD,IAAAC,GAAA;EAE1E,SAASC,yBAAyBC,KAAA,EAAe;IAC/C,IAAIC,aAAA,GAAgBJ,cAAA,CAAeK,GAAA,CAAIF,KAAK;IAC5C,OAAKC,aAAA,KACHA,aAAA,GAAgB,eAAMb,KAAwC,CAAAK,aAAa,CAC3EF,aAAA,GAAeM,cAAW,CAAAM,GAAA,CAAAH,KAAa,EAAAC,aAElC,IAAAA,aAAA;EACT;EAEA,IAAAN,QAAM,YAAAA,CAAYS,KAAA;MAChB;UAAAC,QAAA;UAAAL,KAAA;UAAA,GAAAM;QAAA,IAAAF,KAAA;QAAAG,IAAA,GAAAnB,KAAA,CAAAoB,OAAA;UACA;YACG;YACyD,GAAAjB,aAAA;YAC5D,GAAMe;UACG;QAAA,GAEL,CACAjB,iBAAG,CAAAiB,MAAA,EACL;QACCG,SAAC,GAAAf,UAAkB;MACtB,OAAIM,KAAA,KAAWS,SAAA,GAAAV,wBAAA,CAAAC,KAAA,EAAAL,QAAA,kBAAAR,IAAA,CAAAsB,SAAA;QACfC,KAAI,EAAAH,IAAA;QAOAF;MACJ;IACA;IAAAM,gBAAa,YAAAA,CAAWX,KAAQ;MAClC,IAAAY,OAAA,GAAAZ,KAAA,GAAAD,wBAAA,CAAAC,KAAA,IAAAR,SAAA;MAGA,OAAAJ,KAAA,CAAQyB,UAAA,CAAWD,OAAA;IAMrB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/web",
|
|
3
|
-
"version": "1.111.
|
|
3
|
+
"version": "1.111.2",
|
|
4
4
|
"source": "src/index.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"reset.css"
|
|
28
28
|
],
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/compose-refs": "1.111.
|
|
31
|
-
"@tamagui/constants": "1.111.
|
|
32
|
-
"@tamagui/helpers": "1.111.
|
|
33
|
-
"@tamagui/normalize-css-color": "1.111.
|
|
34
|
-
"@tamagui/timer": "1.111.
|
|
35
|
-
"@tamagui/types": "1.111.
|
|
36
|
-
"@tamagui/use-did-finish-ssr": "1.111.
|
|
37
|
-
"@tamagui/use-event": "1.111.
|
|
38
|
-
"@tamagui/use-force-update": "1.111.
|
|
30
|
+
"@tamagui/compose-refs": "1.111.2",
|
|
31
|
+
"@tamagui/constants": "1.111.2",
|
|
32
|
+
"@tamagui/helpers": "1.111.2",
|
|
33
|
+
"@tamagui/normalize-css-color": "1.111.2",
|
|
34
|
+
"@tamagui/timer": "1.111.2",
|
|
35
|
+
"@tamagui/types": "1.111.2",
|
|
36
|
+
"@tamagui/use-did-finish-ssr": "1.111.2",
|
|
37
|
+
"@tamagui/use-event": "1.111.2",
|
|
38
|
+
"@tamagui/use-force-update": "1.111.2"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@tamagui/build": "1.111.
|
|
41
|
+
"@tamagui/build": "1.111.2",
|
|
42
42
|
"@testing-library/react": "^16.0.0",
|
|
43
43
|
"csstype": "^3.0.10",
|
|
44
44
|
"typescript": "^5.5.2",
|
|
@@ -27,6 +27,15 @@ export function createStyledContext<VariantProps extends Record<string, any>>(
|
|
|
27
27
|
const Context = OGContext as any as StyledContext<VariantProps>
|
|
28
28
|
const scopedContexts = new Map<string, Context<VariantProps | undefined>>()
|
|
29
29
|
|
|
30
|
+
function getOrCreateScopedContext(scope: string) {
|
|
31
|
+
let ScopedContext = scopedContexts.get(scope)
|
|
32
|
+
if (!ScopedContext) {
|
|
33
|
+
ScopedContext = React.createContext<VariantProps | undefined>(defaultValues)
|
|
34
|
+
scopedContexts.set(scope, ScopedContext)
|
|
35
|
+
}
|
|
36
|
+
return ScopedContext!
|
|
37
|
+
}
|
|
38
|
+
|
|
30
39
|
const Provider = ({
|
|
31
40
|
children,
|
|
32
41
|
scope,
|
|
@@ -41,19 +50,14 @@ export function createStyledContext<VariantProps extends Record<string, any>>(
|
|
|
41
50
|
}, [objectIdentityKey(values)])
|
|
42
51
|
let Provider = OGProvider
|
|
43
52
|
if (scope) {
|
|
44
|
-
|
|
45
|
-
if (!ScopedContext) {
|
|
46
|
-
ScopedContext = React.createContext<VariantProps | undefined>(defaultValues)
|
|
47
|
-
scopedContexts.set(scope, ScopedContext)
|
|
48
|
-
}
|
|
49
|
-
Provider = ScopedContext.Provider
|
|
53
|
+
Provider = getOrCreateScopedContext(scope).Provider
|
|
50
54
|
}
|
|
51
55
|
return <Provider value={next}>{children}</Provider>
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
// use consumerComponent just to give a better error message
|
|
55
59
|
const useStyledContext = (scope?: string) => {
|
|
56
|
-
const context = scope ?
|
|
60
|
+
const context = scope ? getOrCreateScopedContext(scope) : OGContext
|
|
57
61
|
return React.useContext(context!) as VariantProps
|
|
58
62
|
}
|
|
59
63
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createStyledContext.d.ts","sourceRoot":"","sources":["../../src/helpers/createStyledContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIxE,MAAM,MAAM,aAAa,CAAC,KAAK,SAAS,MAAM,GAAG,GAAG,IAAI,IAAI,CAC1D,OAAO,CAAC,KAAK,CAAC,EACd,UAAU,CACX,GAAG;IACF,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IACvB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,QAAQ,EAAE,uBAAuB,CAC/B,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG;QAC3B,QAAQ,CAAC,EAAE,SAAS,CAAA;QACpB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CACF,CAAA;IAED,gBAAgB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,KAAK,CAAA;CAC5C,CAAA;AAED,wBAAgB,mBAAmB,CAAC,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1E,aAAa,CAAC,EAAE,YAAY,GAC3B,aAAa,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"createStyledContext.d.ts","sourceRoot":"","sources":["../../src/helpers/createStyledContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,uBAAuB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAIxE,MAAM,MAAM,aAAa,CAAC,KAAK,SAAS,MAAM,GAAG,GAAG,IAAI,IAAI,CAC1D,OAAO,CAAC,KAAK,CAAC,EACd,UAAU,CACX,GAAG;IACF,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;IACvB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,QAAQ,EAAE,uBAAuB,CAC/B,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG;QAC3B,QAAQ,CAAC,EAAE,SAAS,CAAA;QACpB,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CACF,CAAA;IAED,gBAAgB,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,KAAK,CAAA;CAC5C,CAAA;AAED,wBAAgB,mBAAmB,CAAC,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC1E,aAAa,CAAC,EAAE,YAAY,GAC3B,aAAa,CAAC,YAAY,CAAC,CA+C7B;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,GAAG;KAAG,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM;CAAE,CAAA"}
|