@tamagui/adapt 1.15.13 → 1.15.15
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/Adapt.js.map
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Adapt.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n MediaQueryKey,\n isTouchable,\n isWeb,\n useIsomorphicLayoutEffect,\n withStaticProperties,\n} from '@tamagui/core'\nimport { createContext, createElement, useContext, useMemo, useState } from 'react'\n\ntype MediaQueryKeyString = MediaQueryKey extends string ? MediaQueryKey : never\n\nexport type AdaptProps = {\n when?: MediaQueryKeyString\n platform?: 'native' | 'web' | 'touch'\n children?: any\n}\n\ntype When = MediaQueryKeyString | boolean | null\n\ntype Component = (props: any) => any\ntype AdaptParentContextI = {\n Contents: Component\n setWhen: (when: When) => any\n}\n\nexport const AdaptParentContext = createContext<AdaptParentContextI | null>(null)\n\n// forward props\nexport const AdaptContents = (props: any) => {\n const context = useContext(AdaptParentContext)\n if (!context?.Contents) {\n throw new Error('Adapt not supported by this component')\n }\n return createElement(context.Contents, props)\n}\n\nAdaptContents['shouldForwardSpace'] = true\n\nexport const useAdaptParent = ({\n Contents,\n}: {\n Contents: AdaptParentContextI['Contents']\n}) => {\n const [when, setWhen] = useState<When>(null)\n\n const AdaptProvider = useMemo(() => {\n const context: AdaptParentContextI = {\n Contents,\n setWhen,\n }\n\n function AdaptProviderView(props: { children?: any }) {\n return (\n <AdaptParentContext.Provider value={context}>\n {props.children}\n </AdaptParentContext.Provider>\n )\n }\n\n return AdaptProviderView\n }, [Contents])\n\n return {\n AdaptProvider,\n when,\n }\n}\n\nexport const Adapt = withStaticProperties(\n function Adapt({ platform, when, children }: AdaptProps) {\n const context = useContext(AdaptParentContext)\n\n let enabled = !platform\n if (platform === 'touch') enabled = isTouchable\n if (platform === 'native') enabled = !isWeb\n if (platform === 'web') enabled = isWeb\n\n useIsomorphicLayoutEffect(() => {\n if (!enabled) return\n context?.setWhen((when || enabled) as When)\n }, [when, context, enabled])\n\n if (!enabled) {\n return null\n }\n\n return children\n },\n {\n Contents: AdaptContents,\n }\n)\n"],
|
|
5
4
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqDQ;AArDR,kBAMO;AACP,mBAA4E;AAkBrE,MAAM,yBAAqB,4BAA0C,IAAI;AAGzE,MAAM,gBAAgB,CAAC,UAAe;AAC3C,QAAM,cAAU,yBAAW,kBAAkB;AAC7C,MAAI,EAAC,mCAAS,WAAU;AACtB,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AACA,aAAO,4BAAc,QAAQ,UAAU,KAAK;AAC9C;AAEA,cAAc,oBAAoB,IAAI;AAE/B,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AACF,MAEM;AACJ,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAe,IAAI;AAE3C,QAAM,oBAAgB,sBAAQ,MAAM;AAClC,UAAM,UAA+B;AAAA,MACnC;AAAA,MACA;AAAA,IACF;AAEA,aAAS,kBAAkB,OAA2B;AACpD,aACE,4CAAC,mBAAmB,UAAnB,EAA4B,OAAO,SACjC,gBAAM,UACT;AAAA,IAEJ;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,YAAQ;AAAA,EACnB,SAASA,OAAM,EAAE,UAAU,MAAM,SAAS,GAAe;AACvD,UAAM,cAAU,yBAAW,kBAAkB;AAE7C,QAAI,UAAU,CAAC;AACf,QAAI,aAAa;AAAS,gBAAU;AACpC,QAAI,aAAa;AAAU,gBAAU,CAAC;AACtC,QAAI,aAAa;AAAO,gBAAU;AAElC,+CAA0B,MAAM;AAC9B,UAAI,CAAC;AAAS;AACd,yCAAS,QAAS,QAAQ;AAAA,IAC5B,GAAG,CAAC,MAAM,SAAS,OAAO,CAAC;AAE3B,QAAI,CAAC,SAAS;AACZ,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,UAAU;AAAA,EACZ;AACF;",
|
|
6
5
|
"names": ["Adapt"]
|
|
7
6
|
}
|
package/dist/cjs/index.js.map
CHANGED
package/dist/esm/Adapt.js.map
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Adapt.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n MediaQueryKey,\n isTouchable,\n isWeb,\n useIsomorphicLayoutEffect,\n withStaticProperties,\n} from '@tamagui/core'\nimport { createContext, createElement, useContext, useMemo, useState } from 'react'\n\ntype MediaQueryKeyString = MediaQueryKey extends string ? MediaQueryKey : never\n\nexport type AdaptProps = {\n when?: MediaQueryKeyString\n platform?: 'native' | 'web' | 'touch'\n children?: any\n}\n\ntype When = MediaQueryKeyString | boolean | null\n\ntype Component = (props: any) => any\ntype AdaptParentContextI = {\n Contents: Component\n setWhen: (when: When) => any\n}\n\nexport const AdaptParentContext = createContext<AdaptParentContextI | null>(null)\n\n// forward props\nexport const AdaptContents = (props: any) => {\n const context = useContext(AdaptParentContext)\n if (!context?.Contents) {\n throw new Error('Adapt not supported by this component')\n }\n return createElement(context.Contents, props)\n}\n\nAdaptContents['shouldForwardSpace'] = true\n\nexport const useAdaptParent = ({\n Contents,\n}: {\n Contents: AdaptParentContextI['Contents']\n}) => {\n const [when, setWhen] = useState<When>(null)\n\n const AdaptProvider = useMemo(() => {\n const context: AdaptParentContextI = {\n Contents,\n setWhen,\n }\n\n function AdaptProviderView(props: { children?: any }) {\n return (\n <AdaptParentContext.Provider value={context}>\n {props.children}\n </AdaptParentContext.Provider>\n )\n }\n\n return AdaptProviderView\n }, [Contents])\n\n return {\n AdaptProvider,\n when,\n }\n}\n\nexport const Adapt = withStaticProperties(\n function Adapt({ platform, when, children }: AdaptProps) {\n const context = useContext(AdaptParentContext)\n\n let enabled = !platform\n if (platform === 'touch') enabled = isTouchable\n if (platform === 'native') enabled = !isWeb\n if (platform === 'web') enabled = isWeb\n\n useIsomorphicLayoutEffect(() => {\n if (!enabled) return\n context?.setWhen((when || enabled) as When)\n }, [when, context, enabled])\n\n if (!enabled) {\n return null\n }\n\n return children\n },\n {\n Contents: AdaptContents,\n }\n)\n"],
|
|
5
4
|
"mappings": "AAqDQ;AArDR;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe,eAAe,YAAY,SAAS,gBAAgB;AAkBrE,MAAM,qBAAqB,cAA0C,IAAI;AAGzE,MAAM,gBAAgB,CAAC,UAAe;AAC3C,QAAM,UAAU,WAAW,kBAAkB;AAC7C,MAAI,EAAC,mCAAS,WAAU;AACtB,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AACA,SAAO,cAAc,QAAQ,UAAU,KAAK;AAC9C;AAEA,cAAc,oBAAoB,IAAI;AAE/B,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AACF,MAEM;AACJ,QAAM,CAAC,MAAM,OAAO,IAAI,SAAe,IAAI;AAE3C,QAAM,gBAAgB,QAAQ,MAAM;AAClC,UAAM,UAA+B;AAAA,MACnC;AAAA,MACA;AAAA,IACF;AAEA,aAAS,kBAAkB,OAA2B;AACpD,aACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,SACjC,gBAAM,UACT;AAAA,IAEJ;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,QAAQ;AAAA,EACnB,SAASA,OAAM,EAAE,UAAU,MAAM,SAAS,GAAe;AACvD,UAAM,UAAU,WAAW,kBAAkB;AAE7C,QAAI,UAAU,CAAC;AACf,QAAI,aAAa;AAAS,gBAAU;AACpC,QAAI,aAAa;AAAU,gBAAU,CAAC;AACtC,QAAI,aAAa;AAAO,gBAAU;AAElC,8BAA0B,MAAM;AAC9B,UAAI,CAAC;AAAS;AACd,yCAAS,QAAS,QAAQ;AAAA,IAC5B,GAAG,CAAC,MAAM,SAAS,OAAO,CAAC;AAE3B,QAAI,CAAC,SAAS;AACZ,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,UAAU;AAAA,EACZ;AACF;",
|
|
6
5
|
"names": ["Adapt"]
|
|
7
6
|
}
|
package/dist/esm/Adapt.mjs.map
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Adapt.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n MediaQueryKey,\n isTouchable,\n isWeb,\n useIsomorphicLayoutEffect,\n withStaticProperties,\n} from '@tamagui/core'\nimport { createContext, createElement, useContext, useMemo, useState } from 'react'\n\ntype MediaQueryKeyString = MediaQueryKey extends string ? MediaQueryKey : never\n\nexport type AdaptProps = {\n when?: MediaQueryKeyString\n platform?: 'native' | 'web' | 'touch'\n children?: any\n}\n\ntype When = MediaQueryKeyString | boolean | null\n\ntype Component = (props: any) => any\ntype AdaptParentContextI = {\n Contents: Component\n setWhen: (when: When) => any\n}\n\nexport const AdaptParentContext = createContext<AdaptParentContextI | null>(null)\n\n// forward props\nexport const AdaptContents = (props: any) => {\n const context = useContext(AdaptParentContext)\n if (!context?.Contents) {\n throw new Error('Adapt not supported by this component')\n }\n return createElement(context.Contents, props)\n}\n\nAdaptContents['shouldForwardSpace'] = true\n\nexport const useAdaptParent = ({\n Contents,\n}: {\n Contents: AdaptParentContextI['Contents']\n}) => {\n const [when, setWhen] = useState<When>(null)\n\n const AdaptProvider = useMemo(() => {\n const context: AdaptParentContextI = {\n Contents,\n setWhen,\n }\n\n function AdaptProviderView(props: { children?: any }) {\n return (\n <AdaptParentContext.Provider value={context}>\n {props.children}\n </AdaptParentContext.Provider>\n )\n }\n\n return AdaptProviderView\n }, [Contents])\n\n return {\n AdaptProvider,\n when,\n }\n}\n\nexport const Adapt = withStaticProperties(\n function Adapt({ platform, when, children }: AdaptProps) {\n const context = useContext(AdaptParentContext)\n\n let enabled = !platform\n if (platform === 'touch') enabled = isTouchable\n if (platform === 'native') enabled = !isWeb\n if (platform === 'web') enabled = isWeb\n\n useIsomorphicLayoutEffect(() => {\n if (!enabled) return\n context?.setWhen((when || enabled) as When)\n }, [when, context, enabled])\n\n if (!enabled) {\n return null\n }\n\n return children\n },\n {\n Contents: AdaptContents,\n }\n)\n"],
|
|
5
4
|
"mappings": "AAqDQ;AArDR;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe,eAAe,YAAY,SAAS,gBAAgB;AAkBrE,MAAM,qBAAqB,cAA0C,IAAI;AAGzE,MAAM,gBAAgB,CAAC,UAAe;AAC3C,QAAM,UAAU,WAAW,kBAAkB;AAC7C,MAAI,EAAC,mCAAS,WAAU;AACtB,UAAM,IAAI,MAAM,uCAAuC;AAAA,EACzD;AACA,SAAO,cAAc,QAAQ,UAAU,KAAK;AAC9C;AAEA,cAAc,oBAAoB,IAAI;AAE/B,MAAM,iBAAiB,CAAC;AAAA,EAC7B;AACF,MAEM;AACJ,QAAM,CAAC,MAAM,OAAO,IAAI,SAAe,IAAI;AAE3C,QAAM,gBAAgB,QAAQ,MAAM;AAClC,UAAM,UAA+B;AAAA,MACnC;AAAA,MACA;AAAA,IACF;AAEA,aAAS,kBAAkB,OAA2B;AACpD,aACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,SACjC,gBAAM,UACT;AAAA,IAEJ;AAEA,WAAO;AAAA,EACT,GAAG,CAAC,QAAQ,CAAC;AAEb,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,QAAQ;AAAA,EACnB,SAASA,OAAM,EAAE,UAAU,MAAM,SAAS,GAAe;AACvD,UAAM,UAAU,WAAW,kBAAkB;AAE7C,QAAI,UAAU,CAAC;AACf,QAAI,aAAa;AAAS,gBAAU;AACpC,QAAI,aAAa;AAAU,gBAAU,CAAC;AACtC,QAAI,aAAa;AAAO,gBAAU;AAElC,8BAA0B,MAAM;AAC9B,UAAI,CAAC;AAAS;AACd,yCAAS,QAAS,QAAQ;AAAA,IAC5B,GAAG,CAAC,MAAM,SAAS,OAAO,CAAC;AAE3B,QAAI,CAAC,SAAS;AACZ,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT;AAAA,EACA;AAAA,IACE,UAAU;AAAA,EACZ;AACF;",
|
|
6
5
|
"names": ["Adapt"]
|
|
7
6
|
}
|
package/dist/esm/index.js.map
CHANGED
package/dist/esm/index.mjs.map
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/adapt",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.15",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@tamagui/core": "1.15.
|
|
29
|
+
"@tamagui/core": "1.15.15"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@tamagui/build": "1.15.
|
|
32
|
+
"@tamagui/build": "1.15.15"
|
|
33
33
|
},
|
|
34
34
|
"publishConfig": {
|
|
35
35
|
"access": "public"
|