diff --git a/.yarnrc.yml b/.yarnrc.yml index d9c1804c..94d24444 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -19,3 +19,5 @@ plugins: spec: "@yarnpkg/plugin-workspace-tools" yarnPath: .yarn/releases/yarn-3.5.0.cjs + +nmHoistingLimits: none \ No newline at end of file diff --git a/apps/expo/package.json b/apps/expo/package.json index 5b94aafc..b5643d00 100644 --- a/apps/expo/package.json +++ b/apps/expo/package.json @@ -30,7 +30,7 @@ "@tamagui/babel-plugin": "1.15.14", "@types/react": "^18.0.15", "babel-plugin-transform-inline-environment-variables": "^0.4.4", - "typescript": "^5.0.3" + "typescript": "^5.0.4" }, "scripts": { "start": "expo start -c", diff --git a/apps/next/package.json b/apps/next/package.json index 7ac389b9..06c78dd9 100644 --- a/apps/next/package.json +++ b/apps/next/package.json @@ -14,6 +14,8 @@ "app": "*", "next": "13.2.4", "raf": "^3.4.1", + "react": "^18.2.0", + "react-dom": "^18.2.0", "react-native": "^0.71.6", "react-native-web": "^0.18.12", "react-native-web-lite": "1.15.14" diff --git a/apps/storybook-react/.storybook/main.ts b/apps/storybook-react/.storybook/main.ts index 920cb0c5..31afd44f 100644 --- a/apps/storybook-react/.storybook/main.ts +++ b/apps/storybook-react/.storybook/main.ts @@ -6,7 +6,7 @@ const config: StorybookConfig = { stories: [ // '../stories/**/*.stories.@(js|jsx|ts|tsx|mdx)', '../../../packages/app/**/*.stories.@(js|jsx|ts|tsx|mdx)', - // '../../../packages/core/stories/**/*.stories.@(js|jsx|ts|tsx|mdx)', + '../../../packages/core/stories/**/*.stories.@(js|jsx|ts|tsx|mdx)', // '../../../packages/form/**/*.stories.@(js|jsx|ts|tsx|mdx)', // '../../../packages/date/**/*.stories.@(js|jsx|ts|tsx|mdx)', // '../../../packages/rich-text/**/*.stories.@(js|jsx|ts|tsx|mdx)', @@ -28,15 +28,15 @@ const config: StorybookConfig = { name: '@storybook/addon-react-native-web', options: { modulesToTranspile: [ - 'solito', - 'react-native-web', - 'expo-linking', - 'expo-constants', - 'expo-modules-core', - 'react-i18next', - 'expo-document-picker', - 'expo-av', - 'expo-asset', + // 'solito', + // 'react-native-web', + // 'expo-linking', + // 'expo-constants', + // 'expo-modules-core', + // 'react-i18next', + // 'expo-document-picker', + // 'expo-av', + // 'expo-asset', ], babelPlugins: [ diff --git a/apps/storybook-react/package.json b/apps/storybook-react/package.json index 97623cb8..68d59b45 100644 --- a/apps/storybook-react/package.json +++ b/apps/storybook-react/package.json @@ -13,7 +13,9 @@ "dependencies": { "app": "*", "react": "^18.2.0", - "react-dom": "^18.2.0" + "react-dom": "^18.2.0", + "react-native": "^0.71.6", + "react-native-web": "0.18.12" }, "devDependencies": { "@fontsource/inter": "^4.5.14", @@ -27,6 +29,6 @@ "@storybook/react": "^7.0.5", "@storybook/testing-library": "^0.1.0", "storybook": "^7.0.5", - "typescript": "5.0.3" + "typescript": "5.0.4" } } diff --git a/apps/tests/package.json b/apps/tests/package.json index 9e3b95a5..5342036b 100644 --- a/apps/tests/package.json +++ b/apps/tests/package.json @@ -18,7 +18,7 @@ "babel-jest": "^28.1.3", "jest": "^28.1.3", "jest-expo": "^46.0.1", - "typescript": "^5.0.3" + "typescript": "^5.0.4" }, "author": "", "license": "ISC" diff --git a/package.json b/package.json index 661ebb4a..7d0837f7 100644 --- a/package.json +++ b/package.json @@ -37,10 +37,9 @@ "esbuild": "0.17.17", "react": "18.2.0", "react-dom": "18.2.0", - "react-refresh": "^0.14.0", - "react-native-web": "^0.18.9", - "@babel/runtime": "7.21.0", - "@babel/core": "7.21.4" + "react-refresh": "0.14.0", + "react-native-web": "0.18.12", + "typescript": "5.0.4" }, "dependencies": { "@babel/runtime": "^7.18.9" @@ -52,7 +51,7 @@ "eslint": "^8.21.0", "prettier": "^2.7.1", "turbo": "^1.8.8", - "typescript": "^5.0.3" + "typescript": "^5.0.4" }, "packageManager": "yarn@3.5.0" } diff --git a/packages/link/node_modules/solito/README.md b/packages/link/node_modules/solito/README.md deleted file mode 100644 index d3bd3953..00000000 --- a/packages/link/node_modules/solito/README.md +++ /dev/null @@ -1,25 +0,0 @@ -![og (4)](https://user-images.githubusercontent.com/13172299/158270455-69bf1044-28ec-476c-b9c5-06ea818a2191.png) - - -A library dedicated to unifying React Native with Next.js, primarily focused on navigation. - -```sh -yarn add solito -``` - -Solito is a replacement for my popular `expo-next-react-navigation` library. Consider this the next-generation version, with a brand new API and approach. - -## Docs & Examples - -- 📚 [Documentation](https://solito.dev) -- 🦄 [Installation](https://solito.dev/install) -- 🐬 [Examples](/~https://github.com/nandorojo/solito/tree/master/example-monorepos/blank) - -## Why - -Watch Fernando Rojo's [talk from Next.js Conf 2021](https://www.youtube.com/watch?v=0lnbdRweJtA) to learn more about using React Native with Next.js. - -## Contributing - -- Add gitmoji: `yarn global add gitmoji-cli` or `npm i -g gitmoji-cli` -- Run `yarn` diff --git a/packages/link/node_modules/solito/build/helpers/merge-refs.d.ts b/packages/link/node_modules/solito/build/helpers/merge-refs.d.ts deleted file mode 100644 index 6f1ed0ca..00000000 --- a/packages/link/node_modules/solito/build/helpers/merge-refs.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -/// -export declare function mergeRefs(refs: Array | React.LegacyRef>): React.RefCallback; diff --git a/packages/link/node_modules/solito/build/helpers/merge-refs.js b/packages/link/node_modules/solito/build/helpers/merge-refs.js deleted file mode 100644 index e4e1a5ba..00000000 --- a/packages/link/node_modules/solito/build/helpers/merge-refs.js +++ /dev/null @@ -1,15 +0,0 @@ -// credit: /~https://github.com/gregberge/react-merge-refs/blob/main/src/index.tsx -export function mergeRefs(refs) { - return (value) => { - refs.forEach((ref) => { - if (typeof ref === 'function') { - ref(value); - } - else if (ref != null) { - ; - ref.current = value; - } - }); - }; -} -//# sourceMappingURL=merge-refs.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/helpers/merge-refs.js.map b/packages/link/node_modules/solito/build/helpers/merge-refs.js.map deleted file mode 100644 index decf3dd5..00000000 --- a/packages/link/node_modules/solito/build/helpers/merge-refs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"merge-refs.js","sourceRoot":"","sources":["../../src/helpers/merge-refs.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,MAAM,UAAU,SAAS,CACvB,IAA2D;IAE3D,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACnB,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;gBAC7B,GAAG,CAAC,KAAK,CAAC,CAAA;aACX;iBAAM,IAAI,GAAG,IAAI,IAAI,EAAE;gBACtB,CAAC;gBAAC,GAAwC,CAAC,OAAO,GAAG,KAAK,CAAA;aAC3D;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAA;AACH,CAAC","sourcesContent":["// credit: /~https://github.com/gregberge/react-merge-refs/blob/main/src/index.tsx\nexport function mergeRefs(\n refs: Array | React.LegacyRef>\n): React.RefCallback {\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === 'function') {\n ref(value)\n } else if (ref != null) {\n ;(ref as React.MutableRefObject).current = value\n }\n })\n }\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/helpers/use-stable-callback.d.ts b/packages/link/node_modules/solito/build/helpers/use-stable-callback.d.ts deleted file mode 100644 index f85a99ca..00000000 --- a/packages/link/node_modules/solito/build/helpers/use-stable-callback.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a - * prop or avoid re-executing effects when passed as a dependency - */ -declare function useStableCallback any>(callback: T | undefined): T; -export { useStableCallback }; diff --git a/packages/link/node_modules/solito/build/helpers/use-stable-callback.js b/packages/link/node_modules/solito/build/helpers/use-stable-callback.js deleted file mode 100644 index 9ec56410..00000000 --- a/packages/link/node_modules/solito/build/helpers/use-stable-callback.js +++ /dev/null @@ -1,15 +0,0 @@ -import { useRef, useMemo, useEffect } from 'react'; -/** - * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a - * prop or avoid re-executing effects when passed as a dependency - */ -function useStableCallback(callback) { - const callbackRef = useRef(callback); - useEffect(() => { - callbackRef.current = callback; - }); - // /~https://github.com/facebook/react/issues/19240 - return useMemo(() => ((...args) => callbackRef.current?.(...args)), []); -} -export { useStableCallback }; -//# sourceMappingURL=use-stable-callback.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/helpers/use-stable-callback.js.map b/packages/link/node_modules/solito/build/helpers/use-stable-callback.js.map deleted file mode 100644 index d8956b73..00000000 --- a/packages/link/node_modules/solito/build/helpers/use-stable-callback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-stable-callback.js","sourceRoot":"","sources":["../../src/helpers/use-stable-callback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAElD;;;GAGG;AACH,SAAS,iBAAiB,CACxB,QAAuB;IAEvB,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;IAEpC,SAAS,CAAC,GAAG,EAAE;QACb,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF,iDAAiD;IACjD,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAM,EAAE,EAAE,CAAC,CAAA;AAC9E,CAAC;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAA","sourcesContent":["import { useRef, useMemo, useEffect } from 'react'\n\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */\nfunction useStableCallback any>(\n callback: T | undefined\n): T {\n const callbackRef = useRef(callback)\n\n useEffect(() => {\n callbackRef.current = callback\n })\n\n // /~https://github.com/facebook/react/issues/19240\n return useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, [])\n}\n\nexport { useStableCallback }\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/author/index.d.ts b/packages/link/node_modules/solito/build/image/author/index.d.ts deleted file mode 100644 index 6201ed5d..00000000 --- a/packages/link/node_modules/solito/build/image/author/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export type { SolitoImageProps } from '../image.types'; -export * from '../create-solito-image'; -export * from '../use-solito-image'; diff --git a/packages/link/node_modules/solito/build/image/author/index.js b/packages/link/node_modules/solito/build/image/author/index.js deleted file mode 100644 index 84c8b65e..00000000 --- a/packages/link/node_modules/solito/build/image/author/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export * from '../create-solito-image'; -export * from '../use-solito-image'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/author/index.js.map b/packages/link/node_modules/solito/build/image/author/index.js.map deleted file mode 100644 index ec1de4d0..00000000 --- a/packages/link/node_modules/solito/build/image/author/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/image/author/index.ts"],"names":[],"mappings":"AAEA,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA","sourcesContent":["export type { SolitoImageProps } from '../image.types'\n\nexport * from '../create-solito-image'\nexport * from '../use-solito-image'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/context.d.ts b/packages/link/node_modules/solito/build/image/context.d.ts deleted file mode 100644 index f83d6df9..00000000 --- a/packages/link/node_modules/solito/build/image/context.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ContextType } from 'react'; -declare const SolitoImageContext: import("react").Context>; -export declare const SolitoImageProvider: ({ children, ...rest }: { - children: React.ReactNode; -} & Partial) => JSX.Element; -export declare const useSolitoImageContext: () => Partial; -export {}; diff --git a/packages/link/node_modules/solito/build/image/context.js b/packages/link/node_modules/solito/build/image/context.js deleted file mode 100644 index 802eed86..00000000 --- a/packages/link/node_modules/solito/build/image/context.js +++ /dev/null @@ -1,14 +0,0 @@ -import { jsx as _jsx } from "react/jsx-runtime"; -import { createContext, useContext, useState } from 'react'; -import { imageConfigDefault } from './helpers'; -const SolitoImageContext = createContext(imageConfigDefault); -export const SolitoImageProvider = ({ children, ...rest }) => { - const parent = useContext(SolitoImageContext); - const [context] = useState(() => ({ - ...parent, - ...rest, - })); - return (_jsx(SolitoImageContext.Provider, { value: context, children: children }, void 0)); -}; -export const useSolitoImageContext = () => useContext(SolitoImageContext); -//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/context.js.map b/packages/link/node_modules/solito/build/image/context.js.map deleted file mode 100644 index 84b70b4d..00000000 --- a/packages/link/node_modules/solito/build/image/context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/image/context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAe,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAExE,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAE9C,MAAM,kBAAkB,GACtB,aAAa,CAAqC,kBAAkB,CAAC,CAAA;AAEvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAClC,QAAQ,EACR,GAAG,IAAI,EAGiC,EAAE,EAAE;IAC5C,MAAM,MAAM,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAA;IAC7C,MAAM,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;QAChC,GAAG,MAAM;QACT,GAAG,IAAI;KACR,CAAC,CAAC,CAAA;IAEH,OAAO,CACL,KAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,YACxC,QAAQ,WACmB,CAC/B,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,CAAA","sourcesContent":["import { ContextType, createContext, useContext, useState } from 'react'\n\nimport { imageConfigDefault } from './helpers'\n\nconst SolitoImageContext =\n createContext>(imageConfigDefault)\n\nexport const SolitoImageProvider = ({\n children,\n ...rest\n}: {\n children: React.ReactNode\n} & ContextType) => {\n const parent = useContext(SolitoImageContext)\n const [context] = useState(() => ({\n ...parent,\n ...rest,\n }))\n\n return (\n \n {children}\n \n )\n}\n\nexport const useSolitoImageContext = () => useContext(SolitoImageContext)\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/create-solito-image.d.ts b/packages/link/node_modules/solito/build/image/create-solito-image.d.ts deleted file mode 100644 index 3de74bd4..00000000 --- a/packages/link/node_modules/solito/build/image/create-solito-image.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import React, { ComponentType } from 'react'; -import { SolitoImageProps } from './image.types'; -import { useSolitoImage } from './use-solito-image'; -export declare function createSolitoImage>>(Component: C): React.ForwardRefExoticComponent>>; diff --git a/packages/link/node_modules/solito/build/image/create-solito-image.js b/packages/link/node_modules/solito/build/image/create-solito-image.js deleted file mode 100644 index 6404948f..00000000 --- a/packages/link/node_modules/solito/build/image/create-solito-image.js +++ /dev/null @@ -1,9 +0,0 @@ -import { createElement, forwardRef } from 'react'; -import { useSolitoImage } from './use-solito-image'; -export function createSolitoImage(Component) { - return forwardRef(function Img(props, ref) { - const imageProps = useSolitoImage(props); - return createElement(Component, { ...imageProps, ref }); - }); -} -//# sourceMappingURL=create-solito-image.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/create-solito-image.js.map b/packages/link/node_modules/solito/build/image/create-solito-image.js.map deleted file mode 100644 index 6fd31418..00000000 --- a/packages/link/node_modules/solito/build/image/create-solito-image.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"create-solito-image.js","sourceRoot":"","sources":["../../src/image/create-solito-image.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAiB,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGvE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,UAAU,iBAAiB,CAE/B,SAAY;IACZ,OAAO,UAAU,CAAwC,SAAS,GAAG,CACnE,KAAK,EACL,GAAG;QAEH,MAAM,UAAU,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;QACxC,OAAO,aAAa,CAAC,SAAS,EAAE,EAAE,GAAG,UAAU,EAAE,GAAG,EAAS,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;AACJ,CAAC","sourcesContent":["import React, { ComponentType, createElement, forwardRef } from 'react'\n\nimport { SolitoImageProps } from './image.types'\nimport { useSolitoImage } from './use-solito-image'\n\nexport function createSolitoImage<\n C extends ComponentType>\n>(Component: C) {\n return forwardRef, SolitoImageProps>(function Img(\n props,\n ref\n ) {\n const imageProps = useSolitoImage(props)\n return createElement(Component, { ...imageProps, ref } as any)\n })\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/default-loader.d.ts b/packages/link/node_modules/solito/build/image/default-loader.d.ts deleted file mode 100644 index 332ff64e..00000000 --- a/packages/link/node_modules/solito/build/image/default-loader.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ImageConfigComplete } from './types'; -export declare type ImageLoaderProps = { - src: string; - width: number; - quality?: number; -}; -export declare type ImageLoaderPropsWithConfig = ImageLoaderProps & { - config: Readonly; -}; -export declare function defaultLoader({ config, src, width, quality, }: ImageLoaderPropsWithConfig): string; diff --git a/packages/link/node_modules/solito/build/image/default-loader.js b/packages/link/node_modules/solito/build/image/default-loader.js deleted file mode 100644 index f34f075f..00000000 --- a/packages/link/node_modules/solito/build/image/default-loader.js +++ /dev/null @@ -1,33 +0,0 @@ -export function defaultLoader({ config, src, width, quality, }) { - if (process.env.NODE_ENV !== 'production') { - const missingValues = []; - // these should always be provided but make sure they are - if (!src) - missingValues.push('src'); - if (!width) - missingValues.push('width'); - if (missingValues.length > 0) { - throw new Error(`Solito Image requires ${missingValues.join(', ')} to be provided. Make sure you pass them as props to the \`solito/image\` component. Received: ${JSON.stringify({ src, width, quality })}`); - } - if (src.startsWith('/') && !config.nextJsURL) { - throw new Error(`[solito/image] Please add the "nextJsURL" prop to your to use relative paths. - -Error due to image source "${src}".`); - } - } - if (src.startsWith('/') && src.endsWith('.svg')) { - // relative SVG paths are raw - return `${config.nextJsURL}${src}`; - } - if (src.startsWith('http')) { - return src; - } - if (src.startsWith('file://')) { - return src; - } - return `${config.nextJsURL}${config.path}?url=${encodeURIComponent(src)}&w=${width}&q=${quality || 75}`; -} -// We use this to determine if the import is the default loader -// or a custom loader defined by the user in next.config.js -// defaultLoader.__next_img_default = true -//# sourceMappingURL=default-loader.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/default-loader.js.map b/packages/link/node_modules/solito/build/image/default-loader.js.map deleted file mode 100644 index c6f717fb..00000000 --- a/packages/link/node_modules/solito/build/image/default-loader.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"default-loader.js","sourceRoot":"","sources":["../../src/image/default-loader.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,aAAa,CAAC,EAC5B,MAAM,EACN,GAAG,EACH,KAAK,EACL,OAAO,GACoB;IAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,MAAM,aAAa,GAAG,EAAE,CAAA;QAExB,yDAAyD;QACzD,IAAI,CAAC,GAAG;YAAE,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACnC,IAAI,CAAC,KAAK;YAAE,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAEvC,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,MAAM,IAAI,KAAK,CACb,yBAAyB,aAAa,CAAC,IAAI,CACzC,IAAI,CACL,kGAAkG,IAAI,CAAC,SAAS,CAC/G,EAAE,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,CACxB,EAAE,CACJ,CAAA;SACF;QAED,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;YAC5C,MAAM,IAAI,KAAK,CACb;;6BAEqB,GAAG,IAAI,CAC7B,CAAA;SACF;KACF;IAED,IAAI,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAC/C,6BAA6B;QAC7B,OAAO,GAAG,MAAM,CAAC,SAAS,GAAG,GAAG,EAAE,CAAA;KACnC;IAED,IAAI,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QAC1B,OAAO,GAAG,CAAA;KACX;IAED,IAAI,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;QAC7B,OAAO,GAAG,CAAA;KACX;IAED,OAAO,GAAG,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,IAAI,QAAQ,kBAAkB,CAChE,GAAG,CACJ,MAAM,KAAK,MAAM,OAAO,IAAI,EAAE,EAAE,CAAA;AACnC,CAAC;AAED,+DAA+D;AAC/D,2DAA2D;AAC3D,0CAA0C","sourcesContent":["import { Platform } from 'react-native'\nimport { ImageConfigComplete } from './types'\n\nexport type ImageLoaderProps = {\n src: string\n width: number\n quality?: number\n}\n\nexport type ImageLoaderPropsWithConfig = ImageLoaderProps & {\n config: Readonly\n}\n\nexport function defaultLoader({\n config,\n src,\n width,\n quality,\n}: ImageLoaderPropsWithConfig): string {\n if (process.env.NODE_ENV !== 'production') {\n const missingValues = []\n\n // these should always be provided but make sure they are\n if (!src) missingValues.push('src')\n if (!width) missingValues.push('width')\n\n if (missingValues.length > 0) {\n throw new Error(\n `Solito Image requires ${missingValues.join(\n ', '\n )} to be provided. Make sure you pass them as props to the \\`solito/image\\` component. Received: ${JSON.stringify(\n { src, width, quality }\n )}`\n )\n }\n\n if (src.startsWith('/') && !config.nextJsURL) {\n throw new Error(\n `[solito/image] Please add the \"nextJsURL\" prop to your to use relative paths.\n \nError due to image source \"${src}\".`\n )\n }\n }\n\n if (src.startsWith('/') && src.endsWith('.svg')) {\n // relative SVG paths are raw\n return `${config.nextJsURL}${src}`\n }\n\n if (src.startsWith('http')) {\n return src\n }\n\n if (src.startsWith('file://')) {\n return src\n }\n\n return `${config.nextJsURL}${config.path}?url=${encodeURIComponent(\n src\n )}&w=${width}&q=${quality || 75}`\n}\n\n// We use this to determine if the import is the default loader\n// or a custom loader defined by the user in next.config.js\n// defaultLoader.__next_img_default = true\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/expo/image.d.ts b/packages/link/node_modules/solito/build/image/expo/image.d.ts deleted file mode 100644 index bbe836ee..00000000 --- a/packages/link/node_modules/solito/build/image/expo/image.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -import { Image } from 'expo-image'; -import { SolitoImageProps } from '../image.types'; -declare const SolitoImage: import("react").ForwardRefExoticComponent>; -export default SolitoImage; diff --git a/packages/link/node_modules/solito/build/image/expo/image.js b/packages/link/node_modules/solito/build/image/expo/image.js deleted file mode 100644 index d721f671..00000000 --- a/packages/link/node_modules/solito/build/image/expo/image.js +++ /dev/null @@ -1,12 +0,0 @@ -import { jsx as _jsx } from "react/jsx-runtime"; -import { Image } from 'expo-image'; -import { forwardRef } from 'react'; -import { useSolitoImage } from '../use-solito-image'; -const SolitoImage = forwardRef(function Img(props, ref) { - const { onLoadingComplete, resizeMode = 'contain', ...imageProps } = useSolitoImage(props); - return (_jsx(Image, { ...imageProps, placeholder: props.placeholder === 'blur' ? props.blurDataURL : undefined, resizeMode: resizeMode, onLoad: onLoadingComplete && ((e) => onLoadingComplete(e.source)), ref: ref, - // @ts-expect-error expo-image has weird types - style: imageProps.style, contentPosition: props.contentPosition }, void 0)); -}); -export default SolitoImage; -//# sourceMappingURL=image.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/expo/image.js.map b/packages/link/node_modules/solito/build/image/expo/image.js.map deleted file mode 100644 index 94302875..00000000 --- a/packages/link/node_modules/solito/build/image/expo/image.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../src/image/expo/image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGlC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,WAAW,GAAG,UAAU,CAA0B,SAAS,GAAG,CAClE,KAAK,EACL,GAAG;IAEH,MAAM,EACJ,iBAAiB,EACjB,UAAU,GAAG,SAAS,EACtB,GAAG,UAAU,EACd,GAAG,cAAc,CAAC,KAAK,CAAC,CAAA;IAEzB,OAAO,CACL,KAAC,KAAK,OACA,UAAU,EACd,WAAW,EAAE,KAAK,CAAC,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,EACzE,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,iBAAiB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EACjE,GAAG,EAAE,GAAG;QACR,8CAA8C;QAC9C,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,eAAe,EAAE,KAAK,CAAC,eAAe,WACtC,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,WAAW,CAAA","sourcesContent":["import { Image } from 'expo-image'\nimport { forwardRef } from 'react'\n\nimport { SolitoImageProps } from '../image.types'\nimport { useSolitoImage } from '../use-solito-image'\n\nconst SolitoImage = forwardRef(function Img(\n props,\n ref\n) {\n const {\n onLoadingComplete,\n resizeMode = 'contain',\n ...imageProps\n } = useSolitoImage(props)\n\n return (\n onLoadingComplete(e.source))}\n ref={ref}\n // @ts-expect-error expo-image has weird types\n style={imageProps.style}\n contentPosition={props.contentPosition}\n />\n )\n})\n\nexport default SolitoImage\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/expo/image.web.d.ts b/packages/link/node_modules/solito/build/image/expo/image.web.d.ts deleted file mode 100644 index 979ba7dd..00000000 --- a/packages/link/node_modules/solito/build/image/expo/image.web.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// -import { Image } from 'react-native'; -import { SolitoImageProps } from '../image.types'; -declare const SolitoImage: import("react").ForwardRefExoticComponent>; -export default SolitoImage; diff --git a/packages/link/node_modules/solito/build/image/expo/image.web.js b/packages/link/node_modules/solito/build/image/expo/image.web.js deleted file mode 100644 index c46a7f65..00000000 --- a/packages/link/node_modules/solito/build/image/expo/image.web.js +++ /dev/null @@ -1,114 +0,0 @@ -import NextImage from 'next/image'; -import { forwardRef } from 'react'; -import { StyleSheet } from 'react-native'; -// @ts-expect-error missing types -import { unstable_createElement } from 'react-native-web'; -// import useElementLayout from 'react-native-web/dist/modules/useElementLayout' -// import { mergeRefs } from '../../helpers/merge-refs' -import { useSolitoImageContext } from '../context'; -const SolitoImage = forwardRef(function SolitoImage({ resizeMode = 'contain', fill, style, onLayout, ...props }, ref) { - const { loader } = useSolitoImageContext(); - // add back onLayout when this is solved: /~https://github.com/vercel/next.js/discussions/43267 - // const localRef = useRef(null) - // useElementLayout( - // // /~https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/View/index.js#L88 - // localRef, - // onLayout - // ) - return unstable_createElement(NextImage, { - ...props, - // ref: mergeRefs([ref, localRef]), - loader: props.loader ?? loader, - fill, - style: [ - fill && StyleSheet.absoluteFill, - { - objectFit: objectFitFromResizeMode(resizeMode), - objectPosition: getObjectPositionFromContentPositionObject(resolveContentPosition(props.contentPosition)), - }, - style, - ], - }); -}); -export default SolitoImage; -// FORKED FROM EXPO IMAGE -/** - * It resolves a stringified form of the `contentPosition` prop to an object, - * which is the only form supported in the native code. - * - * /~https://github.com/expo/expo/blob/baea6e76d0c6f865885aa2fb1c8f7732c119c300/packages/expo-image/src/utils.ts#L53 - */ -function resolveContentPosition(contentPosition) { - if (typeof contentPosition === 'string') { - const contentPositionStringMappings = { - center: { top: '50%', left: '50%' }, - top: { top: 0, left: '50%' }, - right: { top: '50%', right: 0 }, - bottom: { bottom: 0, left: '50%' }, - left: { top: '50%', left: 0 }, - 'top center': { top: 0, left: '50%' }, - 'top right': { top: 0, right: 0 }, - 'top left': { top: 0, left: 0 }, - 'right center': { top: '50%', right: 0 }, - 'right top': { top: 0, right: 0 }, - 'right bottom': { bottom: 0, right: 0 }, - 'bottom center': { bottom: 0, left: '50%' }, - 'bottom right': { bottom: 0, right: 0 }, - 'bottom left': { bottom: 0, left: 0 }, - 'left center': { top: '50%', left: 0 }, - 'left top': { top: 0, left: 0 }, - 'left bottom': { bottom: 0, left: 0 }, - }; - const contentPositionObject = contentPositionStringMappings[contentPosition]; - if (!contentPositionObject) { - console.warn(`[expo-image]: Content position "${contentPosition}" is invalid`); - return contentPositionStringMappings.center; - } - return contentPositionObject; - } - return contentPosition ?? { top: '50%', left: '50%' }; -} -function ensureUnit(value) { - const trimmedValue = String(value).trim(); - if (trimmedValue.endsWith('%')) { - return trimmedValue; - } - return `${trimmedValue}px`; -} -function getObjectPositionFromContentPositionObject(contentPosition) { - const resolvedPosition = { ...contentPosition }; - if (!resolvedPosition) { - return '50% 50%'; - } - if (resolvedPosition.top == null && resolvedPosition.bottom == null) { - resolvedPosition.top = '50%'; - } - if (resolvedPosition.left == null && resolvedPosition.right == null) { - resolvedPosition.left = '50%'; - } - return (['top', 'bottom', 'left', 'right'] - .map((key) => { - if (key in resolvedPosition) { - return `${key} ${ensureUnit(resolvedPosition[key])}`; - } - return ''; - }) - .join(' ') || '50% 50%'); -} -// END FORKED FROM EXPO IMAGE -const objectFitFromResizeMode = (resizeMode) => { - if (resizeMode === 'cover') { - return 'cover'; - } - if (resizeMode === 'contain') { - return 'contain'; - } - if (resizeMode === 'stretch') { - return 'fill'; - } - if (resizeMode === 'center') { - return 'none'; - } - throw new Error(`[solito/image] Invalid resizeMode: ${resizeMode}`); -}; -//# sourceMappingURL=image.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/expo/image.web.js.map b/packages/link/node_modules/solito/build/image/expo/image.web.js.map deleted file mode 100644 index 7c2097e1..00000000 --- a/packages/link/node_modules/solito/build/image/expo/image.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"image.web.js","sourceRoot":"","sources":["../../../src/image/expo/image.web.tsx"],"names":[],"mappings":"AAOA,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAA0B,UAAU,EAAE,MAAM,cAAc,CAAA;AACjE,iCAAiC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AAEzD,gFAAgF;AAChF,uDAAuD;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAGlD,MAAM,WAAW,GAAG,UAAU,CAA0B,SAAS,WAAW,CAC1E,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAC3D,GAAG;IAEH,MAAM,EAAE,MAAM,EAAE,GAAG,qBAAqB,EAAE,CAAA;IAC1C,6FAA6F;IAC7F,uCAAuC;IACvC,oBAAoB;IACpB,uHAAuH;IACvH,cAAc;IACd,aAAa;IACb,IAAI;IACJ,OAAO,sBAAsB,CAAC,SAAS,EAAE;QACvC,GAAG,KAAK;QACR,mCAAmC;QACnC,MAAM,EAAE,KAAK,CAAC,MAAM,IAAI,MAAM;QAC9B,IAAI;QACJ,KAAK,EAAE;YACL,IAAI,IAAI,UAAU,CAAC,YAAY;YAC/B;gBACE,SAAS,EAAE,uBAAuB,CAAC,UAAU,CAAC;gBAC9C,cAAc,EAAE,0CAA0C,CACxD,sBAAsB,CAAC,KAAK,CAAC,eAAe,CAAC,CAC9C;aACF;Y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OAAO,CACJ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAW;SAC1C,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACX,IAAI,GAAG,IAAI,gBAAgB,EAAE;YAC3B,OAAO,GAAG,GAAG,IAAI,UAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,EAAE,CAAA;SACrD;QACD,OAAO,EAAE,CAAA;IACX,CAAC,CAAC;SACD,IAAI,CAAC,GAAG,CAAC,IAAI,SAAS,CAC1B,CAAA;AACH,CAAC;AACD,6BAA6B;AAE7B,MAAM,uBAAuB,GAAG,CAAC,UAA2B,EAAE,EAAE;IAC9D,IAAI,UAAU,KAAK,OAAO,EAAE;QAC1B,OAAO,OAAO,CAAA;KACf;IACD,IAAI,UAAU,KAAK,SAAS,EAAE;QAC5B,OAAO,SAAS,CAAA;KACjB;IACD,IAAI,UAAU,KAAK,SAAS,EAAE;QAC5B,OAAO,MAAM,CAAA;KACd;IACD,IAAI,UAAU,KAAK,QAAQ,EAAE;QAC3B,OAAO,MAAM,CAAA;KACd;IAED,MAAM,IAAI,KAAK,CAAC,sCAAsC,UAAU,EAAE,CAAC,CAAA;AACrE,CAAC,CAAA","sourcesContent":["// Add client directive once we implement onLayout\nimport {\n ImageContentPosition,\n ImageContentPositionObject,\n ImageContentPositionString,\n ImageContentPositionValue,\n} from 'expo-image'\nimport NextImage from 'next/image'\nimport { forwardRef } from 'react'\nimport { Image, ImageResizeMode, StyleSheet } from 'react-native'\n// @ts-expect-error missing types\nimport { unstable_createElement } from 'react-native-web'\n\n// import useElementLayout from 'react-native-web/dist/modules/useElementLayout'\n// import { mergeRefs } from '../../helpers/merge-refs'\nimport { useSolitoImageContext } from '../context'\nimport { SolitoImageProps } from '../image.types'\n\nconst SolitoImage = forwardRef(function SolitoImage(\n { resizeMode = 'contain', fill, style, onLayout, ...props },\n ref\n) {\n const { loader } = useSolitoImageContext()\n // add back onLayout when this is solved: /~https://github.com/vercel/next.js/discussions/43267\n // const localRef = useRef(null)\n // useElementLayout(\n // // /~https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/View/index.js#L88\n // localRef,\n // onLayout\n // )\n return unstable_createElement(NextImage, {\n ...props,\n // ref: mergeRefs([ref, localRef]),\n loader: props.loader ?? loader,\n fill,\n style: [\n fill && StyleSheet.absoluteFill,\n {\n objectFit: objectFitFromResizeMode(resizeMode),\n objectPosition: getObjectPositionFromContentPositionObject(\n resolveContentPosition(props.contentPosition)\n ),\n },\n style,\n ],\n })\n})\n\nexport default SolitoImage\n\n// FORKED FROM EXPO IMAGE\n\n/**\n * It resolves a stringified form of the `contentPosition` prop to an object,\n * which is the only form supported in the native code.\n *\n * /~https://github.com/expo/expo/blob/baea6e76d0c6f865885aa2fb1c8f7732c119c300/packages/expo-image/src/utils.ts#L53\n */\nfunction resolveContentPosition(\n contentPosition?: ImageContentPosition\n): ImageContentPositionObject {\n if (typeof contentPosition === 'string') {\n const contentPositionStringMappings: Record<\n ImageContentPositionString,\n ImageContentPositionObject\n > = {\n center: { top: '50%', left: '50%' },\n top: { top: 0, left: '50%' },\n right: { top: '50%', right: 0 },\n bottom: { bottom: 0, left: '50%' },\n left: { top: '50%', left: 0 },\n 'top center': { top: 0, left: '50%' },\n 'top right': { top: 0, right: 0 },\n 'top left': { top: 0, left: 0 },\n 'right center': { top: '50%', right: 0 },\n 'right top': { top: 0, right: 0 },\n 'right bottom': { bottom: 0, right: 0 },\n 'bottom center': { bottom: 0, left: '50%' },\n 'bottom right': { bottom: 0, right: 0 },\n 'bottom left': { bottom: 0, left: 0 },\n 'left center': { top: '50%', left: 0 },\n 'left top': { top: 0, left: 0 },\n 'left bottom': { bottom: 0, left: 0 },\n }\n const contentPositionObject = contentPositionStringMappings[contentPosition]\n\n if (!contentPositionObject) {\n console.warn(\n `[expo-image]: Content position \"${contentPosition}\" is invalid`\n )\n return contentPositionStringMappings.center\n }\n return contentPositionObject\n }\n return contentPosition ?? { top: '50%', left: '50%' }\n}\nfunction ensureUnit(value: string | number) {\n const trimmedValue = String(value).trim()\n if (trimmedValue.endsWith('%')) {\n return trimmedValue\n }\n return `${trimmedValue}px`\n}\n\ntype KeysOfUnion = T extends T ? keyof T : never\n\nfunction getObjectPositionFromContentPositionObject(\n contentPosition?: ImageContentPositionObject\n): string {\n const resolvedPosition = { ...contentPosition } as Record<\n KeysOfUnion,\n ImageContentPositionValue\n >\n if (!resolvedPosition) {\n return '50% 50%'\n }\n if (resolvedPosition.top == null && resolvedPosition.bottom == null) {\n resolvedPosition.top = '50%'\n }\n if (resolvedPosition.left == null && resolvedPosition.right == null) {\n resolvedPosition.left = '50%'\n }\n\n return (\n (['top', 'bottom', 'left', 'right'] as const)\n .map((key) => {\n if (key in resolvedPosition) {\n return `${key} ${ensureUnit(resolvedPosition[key])}`\n }\n return ''\n })\n .join(' ') || '50% 50%'\n )\n}\n// END FORKED FROM EXPO IMAGE\n\nconst objectFitFromResizeMode = (resizeMode: ImageResizeMode) => {\n if (resizeMode === 'cover') {\n return 'cover'\n }\n if (resizeMode === 'contain') {\n return 'contain'\n }\n if (resizeMode === 'stretch') {\n return 'fill'\n }\n if (resizeMode === 'center') {\n return 'none'\n }\n\n throw new Error(`[solito/image] Invalid resizeMode: ${resizeMode}`)\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/expo/index.d.ts b/packages/link/node_modules/solito/build/image/expo/index.d.ts deleted file mode 100644 index f7b5c63a..00000000 --- a/packages/link/node_modules/solito/build/image/expo/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import SolitoImage from './image'; -export { SolitoImage }; -export { SolitoImageProvider } from '../context'; diff --git a/packages/link/node_modules/solito/build/image/expo/index.js b/packages/link/node_modules/solito/build/image/expo/index.js deleted file mode 100644 index 27c9b769..00000000 --- a/packages/link/node_modules/solito/build/image/expo/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import SolitoImage from './image'; -export { SolitoImage }; -export { SolitoImageProvider } from '../context'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/expo/index.js.map b/packages/link/node_modules/solito/build/image/expo/index.js.map deleted file mode 100644 index 8c4ee575..00000000 --- a/packages/link/node_modules/solito/build/image/expo/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/image/expo/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,SAAS,CAAA;AAEjC,OAAO,EAAE,WAAW,EAAE,CAAA;AAEtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA","sourcesContent":["import SolitoImage from './image'\n\nexport { SolitoImage }\n\nexport { SolitoImageProvider } from '../context'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/fast/fast.d.ts b/packages/link/node_modules/solito/build/image/fast/fast.d.ts deleted file mode 100644 index d42fb066..00000000 --- a/packages/link/node_modules/solito/build/image/fast/fast.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { ComponentProps } from 'react'; -import FastImage from 'react-native-fast-image'; -import { SolitoImageProps } from '../image.types'; -export default function SolitoFastImage(props: Omit & Pick, 'style' | 'resizeMode'>): JSX.Element; diff --git a/packages/link/node_modules/solito/build/image/fast/fast.js b/packages/link/node_modules/solito/build/image/fast/fast.js deleted file mode 100644 index fa7cb382..00000000 --- a/packages/link/node_modules/solito/build/image/fast/fast.js +++ /dev/null @@ -1,17 +0,0 @@ -import { jsx as _jsx } from "react/jsx-runtime"; -import FastImage from 'react-native-fast-image'; -import { useSolitoImage } from '../use-solito-image'; -export default function SolitoFastImage(props) { - const { source, resizeMode, onLoadingComplete, style, ...imageProps } = useSolitoImage(props); - return (_jsx(FastImage, { source: source && typeof source == 'object' && 'uri' in source - ? { - priority: props.priority ? 'high' : 'normal', - cache: 'web', - headers: source.headers, - uri: source.uri, - } - : source, resizeMode: props.resizeMode, onLoad: onLoadingComplete && ((e) => onLoadingComplete(e.nativeEvent)), - // @ts-expect-error this is fine - style: style, ...imageProps }, void 0)); -} -//# sourceMappingURL=fast.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/fast/fast.js.map b/packages/link/node_modules/solito/build/image/fast/fast.js.map deleted file mode 100644 index e2edb343..00000000 --- a/packages/link/node_modules/solito/build/image/fast/fast.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fast.js","sourceRoot":"","sources":["../../../src/image/fast/fast.tsx"],"names":[],"mappings":";AACA,OAAO,SAAS,MAAM,yBAAyB,CAAA;AAG/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,KACgE;IAEhE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,GACnE,cAAc,CAAC,KAAyB,CAAC,CAAA;IAE3C,OAAO,CACL,KAAC,SAAS,IACR,MAAM,EACJ,MAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,KAAK,IAAI,MAAM;YACpD,CAAC,CAAC;gBACE,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ;gBAC5C,KAAK,EAAE,KAAK;gBACZ,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,GAAG,EAAE,MAAM,CAAC,GAAG;aAChB;YACH,CAAC,CAAE,MAAiB,EAExB,UAAU,EAAE,KAAK,CAAC,UAAU,EAC5B,MAAM,EAAE,iBAAiB,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC;QACtE,gCAAgC;QAChC,KAAK,EAAE,KAAK,KACR,UAAU,WACd,CACH,CAAA;AACH,CAAC","sourcesContent":["import { ComponentProps } from 'react'\nimport FastImage from 'react-native-fast-image'\n\nimport { SolitoImageProps } from '../image.types'\nimport { useSolitoImage } from '../use-solito-image'\n\nexport default function SolitoFastImage(\n props: Omit &\n Pick, 'style' | 'resizeMode'>\n) {\n const { source, resizeMode, onLoadingComplete, style, ...imageProps } =\n useSolitoImage(props as SolitoImageProps)\n\n return (\n onLoadingComplete(e.nativeEvent))}\n // @ts-expect-error this is fine\n style={style}\n {...imageProps}\n />\n )\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/fast/fast.web.d.ts b/packages/link/node_modules/solito/build/image/fast/fast.web.d.ts deleted file mode 100644 index 64a616a2..00000000 --- a/packages/link/node_modules/solito/build/image/fast/fast.web.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from '../expo/image.web'; diff --git a/packages/link/node_modules/solito/build/image/fast/fast.web.js b/packages/link/node_modules/solito/build/image/fast/fast.web.js deleted file mode 100644 index 085ae7cf..00000000 --- a/packages/link/node_modules/solito/build/image/fast/fast.web.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from '../expo/image.web'; -//# sourceMappingURL=fast.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/fast/fast.web.js.map b/packages/link/node_modules/solito/build/image/fast/fast.web.js.map deleted file mode 100644 index 982757c5..00000000 --- a/packages/link/node_modules/solito/build/image/fast/fast.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"fast.web.js","sourceRoot":"","sources":["../../../src/image/fast/fast.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA","sourcesContent":["export { default } from '../expo/image.web'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/fast/index.d.ts b/packages/link/node_modules/solito/build/image/fast/index.d.ts deleted file mode 100644 index 2df17ede..00000000 --- a/packages/link/node_modules/solito/build/image/fast/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import SolitoImage from './fast'; -export { SolitoImage }; -export { SolitoImageProvider } from '../context'; diff --git a/packages/link/node_modules/solito/build/image/fast/index.js b/packages/link/node_modules/solito/build/image/fast/index.js deleted file mode 100644 index e8ffba21..00000000 --- a/packages/link/node_modules/solito/build/image/fast/index.js +++ /dev/null @@ -1,4 +0,0 @@ -import SolitoImage from './fast'; -export { SolitoImage }; -export { SolitoImageProvider } from '../context'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/fast/index.js.map b/packages/link/node_modules/solito/build/image/fast/index.js.map deleted file mode 100644 index a7f965e2..00000000 --- a/packages/link/node_modules/solito/build/image/fast/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/image/fast/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,QAAQ,CAAA;AAEhC,OAAO,EAAE,WAAW,EAAE,CAAA;AACtB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA","sourcesContent":["import SolitoImage from './fast'\n\nexport { SolitoImage }\nexport { SolitoImageProvider } from '../context'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/helpers.d.ts b/packages/link/node_modules/solito/build/image/helpers.d.ts deleted file mode 100644 index f6b67f04..00000000 --- a/packages/link/node_modules/solito/build/image/helpers.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { defaultLoader } from './default-loader'; -import { ImageConfig, ImageConfigComplete } from './types'; -export declare type ImageLoaderProps = { - src: string; - width: number; - quality?: number; -}; -declare type GenImgAttrsData = { - config: ImageConfig; - src: string; - unoptimized: boolean; - loader: typeof defaultLoader; - width?: number; - quality?: number; - sizes?: string; -}; -declare type GenImgAttrsResult = { - src: string; - srcSet: string | undefined; - sizes: string | undefined; -}; -export declare function getInt(x: unknown): number | undefined; -export declare function generateImgAttrs({ config, src, unoptimized, width, quality, sizes, loader, }: GenImgAttrsData): GenImgAttrsResult; -export declare const resolveSourceFromImgAttributes: ({ src, srcSet, sizes, dimensions, }: { - src: string; - srcSet?: string | undefined; - sizes?: string | undefined; - dimensions: { - width: number; - height: number; - }; -}) => { - uri: string; -}; -export declare const imageConfigDefault: ImageConfigComplete; -export {}; diff --git a/packages/link/node_modules/solito/build/image/helpers.js b/packages/link/node_modules/solito/build/image/helpers.js deleted file mode 100644 index 478a16de..00000000 --- a/packages/link/node_modules/solito/build/image/helpers.js +++ /dev/null @@ -1,174 +0,0 @@ -function getWidths({ deviceSizes, allSizes }, width, sizes) { - if (sizes) { - // Find all the "vw" percent sizes used in the sizes prop - const viewportWidthRe = /(^|\s)(1?\d?\d)vw/g; - const percentSizes = []; - for (let match; (match = viewportWidthRe.exec(sizes)); match) { - percentSizes.push(parseInt(match[2], 10)); - } - if (percentSizes.length) { - const smallestRatio = Math.min(...percentSizes) * 0.01; - return { - widths: allSizes.filter((s) => s >= deviceSizes[0] * smallestRatio), - kind: 'w', - }; - } - return { widths: allSizes, kind: 'w' }; - } - if (typeof width !== 'number') { - return { widths: deviceSizes, kind: 'w' }; - } - const widths = [ - ...new Set( - // > This means that most OLED screens that say they are 3x resolution, - // > are actually 3x in the green color, but only 1.5x in the red and - // > blue colors. Showing a 3x resolution image in the app vs a 2x - // > resolution image will be visually the same, though the 3x image - // > takes significantly more data. Even true 3x resolution screens are - // > wasteful as the human eye cannot see that level of detail without - // > something like a magnifying glass. - // https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html - [width, width * 2 /*, width * 3*/].map((w) => allSizes.find((p) => p >= w) || allSizes[allSizes.length - 1])), - ]; - return { widths, kind: 'x' }; -} -export function getInt(x) { - if (typeof x === 'number' || typeof x === 'undefined') { - return x; - } - if (typeof x === 'string' && /^[0-9]+$/.test(x)) { - return parseInt(x, 10); - } - return NaN; -} -export function generateImgAttrs({ config, src, unoptimized, width, quality, sizes, loader, }) { - if (unoptimized) { - return { src, srcSet: undefined, sizes: undefined }; - } - const { widths, kind } = getWidths(config, width, sizes); - const last = widths.length - 1; - return { - sizes: !sizes && kind === 'w' ? '100vw' : sizes, - srcSet: widths - .map((w, i) => `${loader({ src, quality, width: w, config })} ${kind === 'w' ? w : i + 1}${kind}`) - .join(', '), - // It's intended to keep `src` the last attribute because React updates - // attributes in order. If we keep `src` the first one, Safari will - // immediately start to fetch `src`, before `sizes` and `srcSet` are even - // updated by React. That causes multiple unnecessary requests if `srcSet` - // and `sizes` are defined. - // This bug cannot be reproduced in Chrome or Firefox. - src: loader({ quality, width: widths[last], src, config }), - }; -} -export const resolveSourceFromImgAttributes = ({ src, srcSet, sizes, dimensions, }) => { - try { - if (srcSet) { - const getVw = (size) => { - return (parseInt(size.replace('vw', ''), 10) * dimensions.width) / 100; - }; - const getPix = (size) => { - return parseInt(size.replace('px', ''), 10); - }; - const getVwOrPix = (size) => { - if (size.includes('vw')) { - return getVw(size); - } - return getPix(size); - }; - const getSize = (size) => { - if (size.includes(')')) { - return getVwOrPix(size.split(')')[1]); - } - if (size.endsWith('vw')) { - return getVw(size); - } - return getPix(size); - }; - const sizeSet = sizes?.split(',') ?? []; - let size = getSize(sizeSet[sizeSet.length - 1] || `100vw`); - for (let sizeChunk of sizeSet) { - sizeChunk = sizeChunk.trim(); - // regex to check for (min-width: or (max-width: - const mediaQueryRegex = /(\(min-width:|\(max-width:)/; - const mediaQueryCondition = mediaQueryRegex.test(sizeChunk); - if (mediaQueryCondition) { - // the string looks like this: (max-width: 600px) 480px - // extract pixels from media query, and then say if it's min or max-width - // finally, get the pixels to the right as the actual sizeValue - const minOrMax = sizeChunk.includes('min') ? 'min' : 'max'; - const heightOrWidth = sizeChunk.includes('-height') - ? 'height' - : 'width'; - const sizeString = sizeChunk - .replace(mediaQueryRegex, '') - .split(')')[1] - .trim(); - const mediaQuerySize = sizeString.includes('px') - ? parseInt(sizeString.replace('px', ''), 10) - : sizeString.includes('vw') - ? (parseInt(sizeString.replace('vw', ''), 10) / 100) * - dimensions.width - : null; - if (mediaQuerySize === null) { - throw new Error('[solito/image] Invalid condition passed to sizes (${sizes}). ${size} does not end in px or vw'); - } - let matches = false; - if (minOrMax === 'min') { - matches = dimensions[heightOrWidth] >= mediaQuerySize; - } - else if (minOrMax === 'max') { - matches = dimensions[heightOrWidth] <= mediaQuerySize; - } - if (matches) { - size = mediaQuerySize; - break; - } - } - } - const sources = srcSet.split(', ').map((source) => { - const [sourceUrl, size] = source.trim().split(' '); - if (size.endsWith('x')) { - // throw new Error( - // `[solito/image] srcSet does not support x descriptors, but it got "${size}" inside of ${srcSet}` - // ) - // TODO what is the right way to handle 1x, 2x sizes? - return { - sourceUrl, - size: parseInt(size.replace('x', ''), 10) * dimensions.width, // should this use image width? - }; - } - return { - sourceUrl, - size: parseInt(size.replace('w', ''), 10), - }; - }); - const firstSourceThatMatchesforSize = sources.find((source) => source.size >= size); - if (firstSourceThatMatchesforSize) { - return { uri: firstSourceThatMatchesforSize.sourceUrl }; - } - } - return { - uri: src, - }; - } - catch (e) { - throw new Error(`[solito/image] Error parsing srcSet & sizes: ${e?.message || 'unknown error.'}. ${JSON.stringify({ src, srcSet, sizes })}`); - } -}; -export const imageConfigDefault = { - deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840], - imageSizes: [16, 32, 48, 64, 96, 128, 256, 384], - path: '/_next/image', - // loader: 'default', - // loaderFile: '', - // domains: [], - // disableStaticImages: false, - // minimumCacheTTL: 60, - // formats: ['image/webp'], - // dangerouslyAllowSVG: false, - // contentSecurityPolicy: `script-src 'none'; frame-src 'none'; sandbox;`, - // remotePatterns: [], - // unoptimized: false, -}; -//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/helpers.js.map b/packages/link/node_modules/solito/build/image/helpers.js.map deleted file mode 100644 index 6485703e..00000000 --- a/packages/link/node_modules/solito/build/image/helpers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/image/helpers.ts"],"names":[],"mappings":"AAYA,SAAS,SAAS,CAChB,EAAE,WAAW,EAAE,QAAQ,EAAe,EACtC,KAAyB,EACzB,KAAy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CAAC,CAAA;YAEF,MAAM,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAChD,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAChC,CAAA;YAED,IAAI,6BAA6B,EAAE;gBACjC,OAAO,EAAE,GAAG,EAAE,6BAA6B,CAAC,SAAS,EAAE,CAAA;aACxD;SACF;QAED,OAAO;YACL,GAAG,EAAE,GAAG;SACT,CAAA;KACF;IAAC,OAAO,CAAM,EAAE;QACf,MAAM,IAAI,KAAK,CACb,gDACE,CAAC,EAAE,OAAO,IAAI,gBAChB,KAAK,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,CAC9C,CAAA;KACF;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAwB;IACrD,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;IAC1D,UAAU,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC/C,IAAI,EAAE,cAAc;IACpB,uBAAuB;IACvB,oBAAoB;IACpB,iBAAiB;IACjB,gCAAgC;IAChC,yBAAyB;IACzB,6BAA6B;IAC7B,gCAAgC;IAChC,4EAA4E;IAC5E,wBAAwB;IACxB,wBAAwB;CACzB,CAAA","sourcesContent":["import type NextImage from 'next/image'\nimport type { ImageResizeMode } from 'react-native'\nimport { defaultLoader } from './default-loader'\n\nimport { ImageConfig, ImageConfigComplete } from './types'\n\nexport type ImageLoaderProps = {\n src: string\n width: number\n quality?: number\n}\n\nfunction getWidths(\n { deviceSizes, allSizes }: ImageConfig,\n width: number | undefined,\n sizes: string | undefined\n): { widths: number[]; kind: 'w' | 'x' } {\n if (sizes) {\n // Find all the \"vw\" percent sizes used in the sizes prop\n const viewportWidthRe = /(^|\\s)(1?\\d?\\d)vw/g\n const percentSizes = []\n for (let match; (match = viewportWidthRe.exec(sizes)); match) {\n percentSizes.push(parseInt(match[2], 10))\n }\n if (percentSizes.length) {\n const smallestRatio = Math.min(...percentSizes) * 0.01\n return {\n widths: allSizes.filter((s) => s >= deviceSizes[0] * smallestRatio),\n kind: 'w',\n }\n }\n return { widths: allSizes, kind: 'w' }\n }\n if (typeof width !== 'number') {\n return { widths: deviceSizes, kind: 'w' }\n }\n\n const widths = [\n ...new Set(\n // > This means that most OLED screens that say they are 3x resolution,\n // > are actually 3x in the green color, but only 1.5x in the red and\n // > blue colors. Showing a 3x resolution image in the app vs a 2x\n // > resolution image will be visually the same, though the 3x image\n // > takes significantly more data. Even true 3x resolution screens are\n // > wasteful as the human eye cannot see that level of detail without\n // > something like a magnifying glass.\n // https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html\n [width, width * 2 /*, width * 3*/].map(\n (w) => allSizes.find((p) => p >= w) || allSizes[allSizes.length - 1]\n )\n ),\n ]\n return { widths, kind: 'x' }\n}\n\ntype GenImgAttrsData = {\n config: ImageConfig\n src: string\n unoptimized: boolean\n loader: typeof defaultLoader\n // | NonNullable['loader']>\n width?: number\n quality?: number\n sizes?: string\n}\n\ntype GenImgAttrsResult = {\n src: string\n srcSet: string | undefined\n sizes: string | undefined\n}\n\nexport function getInt(x: unknown): number | undefined {\n if (typeof x === 'number' || typeof x === 'undefined') {\n return x\n }\n if (typeof x === 'string' && /^[0-9]+$/.test(x)) {\n return parseInt(x, 10)\n }\n return NaN\n}\n\nexport function generateImgAttrs({\n config,\n src,\n unoptimized,\n width,\n quality,\n sizes,\n loader,\n}: GenImgAttrsData): GenImgAttrsResult {\n if (unoptimized) {\n return { src, srcSet: undefined, sizes: undefined }\n }\n\n const { widths, kind } = getWidths(config, width, sizes)\n const last = widths.length - 1\n\n return {\n sizes: !sizes && kind === 'w' ? '100vw' : sizes,\n srcSet: widths\n .map(\n (w, i) =>\n `${loader({ src, quality, width: w, config })} ${\n kind === 'w' ? w : i + 1\n }${kind}`\n )\n .join(', '),\n\n // It's intended to keep `src` the last attribute because React updates\n // attributes in order. If we keep `src` the first one, Safari will\n // immediately start to fetch `src`, before `sizes` and `srcSet` are even\n // updated by React. That causes multiple unnecessary requests if `srcSet`\n // and `sizes` are defined.\n // This bug cannot be reproduced in Chrome or Firefox.\n src: loader({ quality, width: widths[last], src, config }),\n }\n}\n\nexport const resolveSourceFromImgAttributes = ({\n src,\n srcSet,\n sizes,\n dimensions,\n}: {\n src: string\n srcSet?: string\n sizes?: string\n dimensions: {\n width: number\n height: number\n }\n}): { uri: string } => {\n try {\n if (srcSet) {\n const getVw = (size: string) => {\n return (parseInt(size.replace('vw', ''), 10) * dimensions.width) / 100\n }\n const getPix = (size: string) => {\n return parseInt(size.replace('px', ''), 10)\n }\n const getVwOrPix = (size: string) => {\n if (size.includes('vw')) {\n return getVw(size)\n }\n return getPix(size)\n }\n const getSize = (size: string): number => {\n if (size.includes(')')) {\n return getVwOrPix(size.split(')')[1])\n }\n if (size.endsWith('vw')) {\n return getVw(size)\n }\n return getPix(size)\n }\n\n const sizeSet = sizes?.split(',') ?? []\n\n let size = getSize(sizeSet[sizeSet.length - 1] || `100vw`)\n for (let sizeChunk of sizeSet) {\n sizeChunk = sizeChunk.trim()\n\n // regex to check for (min-width: or (max-width:\n const mediaQueryRegex = /(\\(min-width:|\\(max-width:)/\n const mediaQueryCondition = mediaQueryRegex.test(sizeChunk)\n\n if (mediaQueryCondition) {\n // the string looks like this: (max-width: 600px) 480px\n // extract pixels from media query, and then say if it's min or max-width\n // finally, get the pixels to the right as the actual sizeValue\n\n const minOrMax = sizeChunk.includes('min') ? 'min' : 'max'\n const heightOrWidth = sizeChunk.includes('-height')\n ? 'height'\n : 'width'\n\n const sizeString = sizeChunk\n .replace(mediaQueryRegex, '')\n .split(')')[1]\n .trim()\n\n const mediaQuerySize = sizeString.includes('px')\n ? parseInt(sizeString.replace('px', ''), 10)\n : sizeString.includes('vw')\n ? (parseInt(sizeString.replace('vw', ''), 10) / 100) *\n dimensions.width\n : null\n\n if (mediaQuerySize === null) {\n throw new Error(\n '[solito/image] Invalid condition passed to sizes (${sizes}). ${size} does not end in px or vw'\n )\n }\n\n let matches = false\n\n if (minOrMax === 'min') {\n matches = dimensions[heightOrWidth] >= mediaQuerySize\n } else if (minOrMax === 'max') {\n matches = dimensions[heightOrWidth] <= mediaQuerySize\n }\n\n if (matches) {\n size = mediaQuerySize\n break\n }\n }\n }\n\n const sources = srcSet.split(', ').map((source) => {\n const [sourceUrl, size] = source.trim().split(' ')\n\n if (size.endsWith('x')) {\n // throw new Error(\n // `[solito/image] srcSet does not support x descriptors, but it got \"${size}\" inside of ${srcSet}`\n // )\n\n // TODO what is the right way to handle 1x, 2x sizes?\n\n return {\n sourceUrl,\n size: parseInt(size.replace('x', ''), 10) * dimensions.width, // should this use image width?\n }\n }\n\n return {\n sourceUrl,\n size: parseInt(size.replace('w', ''), 10),\n }\n })\n\n const firstSourceThatMatchesforSize = sources.find(\n (source) => source.size >= size\n )\n\n if (firstSourceThatMatchesforSize) {\n return { uri: firstSourceThatMatchesforSize.sourceUrl }\n }\n }\n\n return {\n uri: src,\n }\n } catch (e: any) {\n throw new Error(\n `[solito/image] Error parsing srcSet & sizes: ${\n e?.message || 'unknown error.'\n }. ${JSON.stringify({ src, srcSet, sizes })}`\n )\n }\n}\n\nexport const imageConfigDefault: ImageConfigComplete = {\n deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],\n imageSizes: [16, 32, 48, 64, 96, 128, 256, 384],\n path: '/_next/image',\n // loader: 'default',\n // loaderFile: '',\n // domains: [],\n // disableStaticImages: false,\n // minimumCacheTTL: 60,\n // formats: ['image/webp'],\n // dangerouslyAllowSVG: false,\n // contentSecurityPolicy: `script-src 'none'; frame-src 'none'; sandbox;`,\n // remotePatterns: [],\n // unoptimized: false,\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/helpers.test.d.ts b/packages/link/node_modules/solito/build/image/helpers.test.d.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/packages/link/node_modules/solito/build/image/helpers.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/link/node_modules/solito/build/image/helpers.test.js b/packages/link/node_modules/solito/build/image/helpers.test.js deleted file mode 100644 index 7e2817e6..00000000 --- a/packages/link/node_modules/solito/build/image/helpers.test.js +++ /dev/null @@ -1,93 +0,0 @@ -import { resolveSourceFromImgAttributes } from './helpers'; -describe('resolveSourceFromImgAttributes', () => { - test('picks from max-width', () => { - expect(resolveSourceFromImgAttributes({ - dimensions: { - width: 100, - height: 100, - }, - srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`, - sizes: `(max-width: 600px) 480px, 800px`, - src: 'elva-fairy.jpg', - }).uri).toBe('elva-fairy-480w.jpg'); - }); - test('trims excess space', () => { - expect(resolveSourceFromImgAttributes({ - dimensions: { - width: 100, - height: 100, - }, - srcSet: `elva-fairy-480w.jpg 480w, - - elva-fairy-800w.jpg 800w`, - sizes: `(max-width: 600px) 480px, - 800px`, - src: 'elva-fairy.jpg', - }).uri).toBe('elva-fairy-480w.jpg'); - }); - test('picks from min-width', () => { - expect(resolveSourceFromImgAttributes({ - dimensions: { - width: 700, - height: 700, - }, - srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`, - sizes: `(min-width: 600px) 480px, 800px`, - src: 'elva-fairy.jpg', - }).uri).toBe('elva-fairy-480w.jpg'); - }); - test('100vw size is treated as dimensions width', () => { - expect(resolveSourceFromImgAttributes({ - dimensions: { - width: 700, - height: 700, - }, - srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`, - sizes: `100vw`, - src: 'elva-fairy.jpg', - }).uri).toBe('elva-fairy-800w.jpg'); - }); - test('100vw falls back to src', () => { - expect(resolveSourceFromImgAttributes({ - dimensions: { - width: 900, - height: 900, - }, - srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`, - sizes: `100vw`, - src: 'elva-fairy.jpg', - }).uri).toBe('elva-fairy.jpg'); - }); - test('falls back to last value in sizes', () => { - expect(resolveSourceFromImgAttributes({ - dimensions: { - width: 700, - height: 700, - }, - srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`, - sizes: `(max-width: 600px) 480px, 800px`, - src: 'elva-fairy.jpg', - }).uri).toBe('elva-fairy-800w.jpg'); - }); - test('uses src if missing rest', () => { - expect(resolveSourceFromImgAttributes({ - dimensions: { - width: 700, - height: 700, - }, - src: 'elva-fairy.jpg', - }).uri).toBe('elva-fairy.jpg'); - }); - test('throws for 1x, 2x', () => { - expect(() => resolveSourceFromImgAttributes({ - dimensions: { - width: 700, - height: 700, - }, - srcSet: `elva-fairy-480w.jpg 1x, elva-fairy-800w.jpg 2x`, - sizes: `(max-width: 600px) 480px, 800px`, - src: 'elva-fairy.jpg', - }).uri).toThrow(); - }); -}); -//# sourceMappingURL=helpers.test.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/helpers.test.js.map b/packages/link/node_modules/solito/build/image/helpers.test.js.map deleted file mode 100644 index ecea182e..00000000 --- a/packages/link/node_modules/solito/build/image/helpers.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"helpers.test.js","sourceRoot":"","sources":["../../src/image/helpers.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAA;AAE1D,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC9C,IAAI,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAChC,MAAM,CACJ,8BAA8B,CAAC;YAC7B,UAAU,EAAE;gBACV,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,GAAG;aACZ;YACD,MAAM,EAAE,oDAAoD;YAC5D,KAAK,EAAE,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ACZ;YACD,MAAM,EAAE,oDAAoD;YAC5D,KAAK,EAAE,OAAO;YACd,GAAG,EAAE,gBAAgB;SACtB,CAAC,CAAC,GAAG,CACP,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;IAC1B,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC7C,MAAM,CACJ,8BAA8B,CAAC;YAC7B,UAAU,EAAE;gBACV,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,GAAG;aACZ;YACD,MAAM,EAAE,oDAAoD;YAC5D,KAAK,EAAE,iCAAiC;YACxC,GAAG,EAAE,gBAAgB;SACtB,CAAC,CAAC,GAAG,CACP,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAA;IAC/B,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,0BAA0B,EAAE,GAAG,EAAE;QACpC,MAAM,CACJ,8BAA8B,CAAC;YAC7B,UAAU,EAAE;gBACV,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,GAAG;aACZ;YACD,GAAG,EAAE,gBAAgB;SACtB,CAAC,CAAC,GAAG,CACP,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;IAC1B,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAC7B,MAAM,CACJ,GAAG,EAAE,CACH,8BAA8B,CAAC;YAC7B,UAAU,EAAE;gBACV,KAAK,EAAE,GAAG;gBACV,MAAM,EAAE,GAAG;aACZ;YACD,MAAM,EAAE,gDAAgD;YACxD,KAAK,EAAE,iCAAiC;YACxC,GAAG,EAAE,gBAAgB;SACtB,CAAC,CAAC,GAAG,CACT,CAAC,OAAO,EAAE,CAAA;IACb,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { resolveSourceFromImgAttributes } from './helpers'\n\ndescribe('resolveSourceFromImgAttributes', () => {\n test('picks from max-width', () => {\n expect(\n resolveSourceFromImgAttributes({\n dimensions: {\n width: 100,\n height: 100,\n },\n srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`,\n sizes: `(max-width: 600px) 480px, 800px`,\n src: 'elva-fairy.jpg',\n }).uri\n ).toBe('elva-fairy-480w.jpg')\n })\n\n test('trims excess space', () => {\n expect(\n resolveSourceFromImgAttributes({\n dimensions: {\n width: 100,\n height: 100,\n },\n srcSet: `elva-fairy-480w.jpg 480w, \n \n elva-fairy-800w.jpg 800w`,\n sizes: `(max-width: 600px) 480px, \n 800px`,\n src: 'elva-fairy.jpg',\n }).uri\n ).toBe('elva-fairy-480w.jpg')\n })\n\n test('picks from min-width', () => {\n expect(\n resolveSourceFromImgAttributes({\n dimensions: {\n width: 700,\n height: 700,\n },\n srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`,\n sizes: `(min-width: 600px) 480px, 800px`,\n src: 'elva-fairy.jpg',\n }).uri\n ).toBe('elva-fairy-480w.jpg')\n })\n\n test('100vw size is treated as dimensions width', () => {\n expect(\n resolveSourceFromImgAttributes({\n dimensions: {\n width: 700,\n height: 700,\n },\n srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`,\n sizes: `100vw`,\n src: 'elva-fairy.jpg',\n }).uri\n ).toBe('elva-fairy-800w.jpg')\n })\n\n test('100vw falls back to src', () => {\n expect(\n resolveSourceFromImgAttributes({\n dimensions: {\n width: 900,\n height: 900,\n },\n srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`,\n sizes: `100vw`,\n src: 'elva-fairy.jpg',\n }).uri\n ).toBe('elva-fairy.jpg')\n })\n\n test('falls back to last value in sizes', () => {\n expect(\n resolveSourceFromImgAttributes({\n dimensions: {\n width: 700,\n height: 700,\n },\n srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`,\n sizes: `(max-width: 600px) 480px, 800px`,\n src: 'elva-fairy.jpg',\n }).uri\n ).toBe('elva-fairy-800w.jpg')\n })\n\n test('uses src if missing rest', () => {\n expect(\n resolveSourceFromImgAttributes({\n dimensions: {\n width: 700,\n height: 700,\n },\n src: 'elva-fairy.jpg',\n }).uri\n ).toBe('elva-fairy.jpg')\n })\n\n test('throws for 1x, 2x', () => {\n expect(\n () =>\n resolveSourceFromImgAttributes({\n dimensions: {\n width: 700,\n height: 700,\n },\n srcSet: `elva-fairy-480w.jpg 1x, elva-fairy-800w.jpg 2x`,\n sizes: `(max-width: 600px) 480px, 800px`,\n src: 'elva-fairy.jpg',\n }).uri\n ).toThrow()\n })\n})\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/image.types.d.ts b/packages/link/node_modules/solito/build/image/image.types.d.ts deleted file mode 100644 index d53d48b5..00000000 --- a/packages/link/node_modules/solito/build/image/image.types.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/// -import { ImageContentPosition } from 'expo-image'; -import type NextImage from 'next/image'; -import type { ImageStyle, ImageProps } from 'react-native'; -export declare type AccessibilityProp = key extends `aria-${string}` ? key : key extends `accessibility${Capitalize}` ? key : never; -declare type NextImageProps = React.ComponentProps; -export declare type SolitoImageProps = Pick | 'alt' | 'blurDataURL' | 'placeholder' | 'loader' | 'priority' | 'loading' | 'sizes' | 'quality' | 'crossOrigin' | 'referrerPolicy' | 'quality' | 'unoptimized'> & { - style?: ImageStyle; -} & ({ - src: string; - height: number; - width: number; - fill?: false; -} | { - src: string; - height?: number; - width?: number; - fill: true; -} | { - src: Exclude | number; - height?: number; - width?: number; - fill?: boolean; -}) & Pick> & { - onLoadingComplete?: (info: { - height: number; - width: number; - }) => void; - fill?: boolean; - contentPosition?: ImageContentPosition; -}; -export {}; diff --git a/packages/link/node_modules/solito/build/image/image.types.js b/packages/link/node_modules/solito/build/image/image.types.js deleted file mode 100644 index fb8b999c..00000000 --- a/packages/link/node_modules/solito/build/image/image.types.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=image.types.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/image.types.js.map b/packages/link/node_modules/solito/build/image/image.types.js.map deleted file mode 100644 index 15870df1..00000000 --- a/packages/link/node_modules/solito/build/image/image.types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"image.types.js","sourceRoot":"","sources":["../../src/image/image.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ImageContentPosition } from 'expo-image'\nimport type NextImage from 'next/image'\nimport type { ImageStyle, ImageProps } from 'react-native'\n\nexport type AccessibilityProp = key extends `aria-${string}`\n ? key\n : key extends `accessibility${Capitalize}`\n ? key\n : never\n\ntype NextImageProps = React.ComponentProps\n\nexport type SolitoImageProps = Pick<\n NextImageProps,\n | AccessibilityProp\n | 'alt'\n | 'blurDataURL'\n | 'placeholder'\n | 'loader'\n | 'priority'\n | 'loading'\n | 'sizes'\n | 'quality'\n | 'crossOrigin'\n | 'referrerPolicy'\n | 'quality'\n | 'unoptimized'\n> & {\n style?: ImageStyle\n} & (\n | {\n src: string\n height: number\n width: number\n fill?: false\n }\n | {\n src: string\n height?: number\n width?: number\n fill: true\n }\n | {\n src: Exclude | number\n height?: number\n width?: number\n fill?: boolean\n }\n ) &\n Pick<\n ImageProps,\n 'onLayout' | 'resizeMode' | AccessibilityProp\n > & {\n onLoadingComplete?: (info: { height: number; width: number }) => void\n fill?: boolean\n contentPosition?: ImageContentPosition\n }\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/image.types.test.d.ts b/packages/link/node_modules/solito/build/image/image.types.test.d.ts deleted file mode 100644 index cb0ff5c3..00000000 --- a/packages/link/node_modules/solito/build/image/image.types.test.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/link/node_modules/solito/build/image/image.types.test.js b/packages/link/node_modules/solito/build/image/image.types.test.js deleted file mode 100644 index 167f6181..00000000 --- a/packages/link/node_modules/solito/build/image/image.types.test.js +++ /dev/null @@ -1,28 +0,0 @@ -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const test = [ - { - src: '', - height: 100, - width: 100, - alt: '', - }, - { - unoptimized: true, - src: '', - height: 100, - width: 100, - alt: '', - }, - { - src: null, - height: 100, - width: 100, - alt: '', - }, - { - src: 1, - alt: '', - }, -]; -export {}; -//# sourceMappingURL=image.types.test.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/image.types.test.js.map b/packages/link/node_modules/solito/build/image/image.types.test.js.map deleted file mode 100644 index 81e6c8df..00000000 --- a/packages/link/node_modules/solito/build/image/image.types.test.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"image.types.test.js","sourceRoot":"","sources":["../../src/image/image.types.test.ts"],"names":[],"mappings":"AAMA,6DAA6D;AAC7D,MAAM,IAAI,GAA4B;IACpC;QACE,GAAG,EAAE,EAAE;QACP,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,GAAG;QACV,GAAG,EAAE,EAAE;KACR;IACD;QACE,WAAW,EAAE,IAAI;QACjB,GAAG,EAAE,EAAE;QACP,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,GAAG;QACV,GAAG,EAAE,EAAE;KACR;IACD;QACE,GAAG,EAAE,IAAqD;QAC1D,MAAM,EAAE,GAAG;QACX,KAAK,EAAE,GAAG;QACV,GAAG,EAAE,EAAE;KACR;IACD;QACE,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,EAAE;KACR;CACF,CAAA","sourcesContent":["import type NextImage from 'next/image'\n\nimport { SolitoImageProps } from './image.types'\n\ntype NextImageProps = React.ComponentProps\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst test: Array = [\n {\n src: '',\n height: 100,\n width: 100,\n alt: '',\n },\n {\n unoptimized: true,\n src: '',\n height: 100,\n width: 100,\n alt: '',\n },\n {\n src: null as any as Exclude,\n height: 100,\n width: 100,\n alt: '',\n },\n {\n src: 1,\n alt: '',\n },\n]\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/types.d.ts b/packages/link/node_modules/solito/build/image/types.d.ts deleted file mode 100644 index 6b79ca5c..00000000 --- a/packages/link/node_modules/solito/build/image/types.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -export declare type ImageConfigComplete = { - deviceSizes: number[]; - imageSizes: number[]; - /** - * Example: `https://beatgig.com` or `http://localhost:3000` - * - * This is the URL to your Next.js app, used on iOS & Android to resolve relative URLs. - * - * For example, if you have `public/image.png` in your Next.js app, and your URL is `https://beatgig.com`, - * then you can use `` and it will get the image from the next.js site. - * - * Docs: https://solito.dev/usage/image#solitoimageprovider- - */ - nextJsURL?: `http:${string}` | `https:${string}`; - /** - * You probably shouldn't touch this. It's only used on native to get your images. - * - * Default: `'/_next/image'`. You must set nextJsURL for this to work. - */ - path?: string; - loader?: (info: { - src: string; - width: number; - quality: number; - }) => string; -}; -export declare type ImageConfig = ImageConfigComplete & { - allSizes: number[]; -}; diff --git a/packages/link/node_modules/solito/build/image/types.js b/packages/link/node_modules/solito/build/image/types.js deleted file mode 100644 index 718fd38a..00000000 --- a/packages/link/node_modules/solito/build/image/types.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/types.js.map b/packages/link/node_modules/solito/build/image/types.js.map deleted file mode 100644 index e8ba9e6a..00000000 --- a/packages/link/node_modules/solito/build/image/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/image/types.ts"],"names":[],"mappings":"","sourcesContent":["export type ImageConfigComplete = {\n deviceSizes: number[]\n imageSizes: number[]\n /**\n * Example: `https://beatgig.com` or `http://localhost:3000`\n *\n * This is the URL to your Next.js app, used on iOS & Android to resolve relative URLs.\n *\n * For example, if you have `public/image.png` in your Next.js app, and your URL is `https://beatgig.com`,\n * then you can use `` and it will get the image from the next.js site.\n *\n * Docs: https://solito.dev/usage/image#solitoimageprovider-\n */\n nextJsURL?: `http:${string}` | `https:${string}`\n /**\n * You probably shouldn't touch this. It's only used on native to get your images.\n *\n * Default: `'/_next/image'`. You must set nextJsURL for this to work.\n */\n path?: string\n loader?: (info: { src: string; width: number; quality: number }) => string\n}\n\nexport type ImageConfig = ImageConfigComplete & {\n allSizes: number[]\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/use-solito-image.d.ts b/packages/link/node_modules/solito/build/image/use-solito-image.d.ts deleted file mode 100644 index 30b834f4..00000000 --- a/packages/link/node_modules/solito/build/image/use-solito-image.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ImageStyle } from 'expo-image'; -import { ImageProps } from 'react-native'; -import { SolitoImageProps } from './image.types'; -export declare type UseSolitoImage = Pick | 'progressiveRenderingEnabled' | 'source' | 'accessible' | 'onLayout'> & { - onLoadingComplete?: (info: { - height: number; - width: number; - }) => void; - style: Array; -}; -export declare function useSolitoImage({ src, loader, width, height, quality, crossOrigin, referrerPolicy, alt, fill, onLoadingComplete, loading, priority, placeholder, blurDataURL, sizes, style, onLayout, unoptimized, ...props }: SolitoImageProps): UseSolitoImage; diff --git a/packages/link/node_modules/solito/build/image/use-solito-image.js b/packages/link/node_modules/solito/build/image/use-solito-image.js deleted file mode 100644 index 39edf743..00000000 --- a/packages/link/node_modules/solito/build/image/use-solito-image.js +++ /dev/null @@ -1,107 +0,0 @@ -import { useMemo, useSyncExternalStore } from 'react'; -import { Dimensions, StyleSheet } from 'react-native'; -import { useSolitoImageContext } from './context'; -import { defaultLoader } from './default-loader'; -import { generateImgAttrs, getInt, imageConfigDefault, resolveSourceFromImgAttributes, } from './helpers'; -export function useSolitoImage({ src, loader, width, height, quality = 75, crossOrigin, referrerPolicy, alt, fill, onLoadingComplete, loading, priority, placeholder, blurDataURL, sizes, style, onLayout, unoptimized, ...props }) { - const contextConfig = useSolitoImageContext(); - const config = useMemo(() => { - const c = { ...imageConfigDefault, ...contextConfig }; - const allSizes = [...c.deviceSizes, ...c.imageSizes].sort((a, b) => a - b); - const deviceSizes = c.deviceSizes.sort((a, b) => a - b); - return { ...c, allSizes, deviceSizes }; - }, [contextConfig]); - const headers = {}; - if (crossOrigin === 'use-credentials') { - headers['Access-Control-Allow-Credentials'] = 'true'; - } - if (referrerPolicy != null) { - headers['Referrer-Policy'] = referrerPolicy; - } - const uri = useSyncExternalStore((callback) => { - const subscription = Dimensions.addEventListener('change', callback); - return () => subscription?.remove(); - }, () => { - const dimensions = Dimensions.get('window'); - if (typeof src == 'string') { - const attrs = generateImgAttrs({ - src, - config, - loader: ({ config: _, ...opts }) => { - if (loader) { - return loader(opts); - } - if (config.loader) { - return config.loader({ - quality: Number(quality ?? 75), - src: opts.src, - width: opts.width, - }); - } - return defaultLoader({ ...opts, config }); - }, - unoptimized: Boolean(unoptimized), - quality: getInt(quality || 75), - sizes, - width: getInt(width || 400), - }); - const { uri } = resolveSourceFromImgAttributes({ - ...attrs, - dimensions, - }); - return uri; - } - return undefined; - }); - const source = useMemo(() => { - const headers = {}; - if (crossOrigin === 'use-credentials') { - headers['Access-Control-Allow-Credentials'] = 'true'; - } - if (referrerPolicy != null) { - headers['Referrer-Policy'] = referrerPolicy; - } - if (typeof uri == 'string') { - return { - uri, - height, - width, - headers, - cache: priority ? 'force-cache' : 'default', - }; - } - return src; - }, [uri, src, height, width, priority, referrerPolicy, crossOrigin]); - return { - ...props, - progressiveRenderingEnabled: true, - onLoadingComplete, - source, - accessible: Boolean(alt), - onLayout, - style: [ - fill - ? StyleSheet.absoluteFill - : { - height, - width, - }, - style, - ], - // adapter for older versions of RN - // /~https://github.com/facebook/react-native/blob/main/Libraries/Image/Image.android.js#L169-L194 - accessibilityLabel: props['aria-label'] ?? alt, - accessibilityState: { - busy: booleanish(props['aria-busy']), - checked: booleanish(props['aria-checked']), - disabled: booleanish(props['aria-disabled']), - expanded: booleanish(props['aria-expanded']), - selected: booleanish(props['aria-selected']), - }, - }; -} -function booleanish(value) { - // this should get upstreamed in RN - return (value === 'true' ? true : value === 'false' ? false : value); -} -//# sourceMappingURL=use-solito-image.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/image/use-solito-image.js.map b/packages/link/node_modules/solito/build/image/use-solito-image.js.map deleted file mode 100644 index af8d73fa..00000000 --- a/packages/link/node_modules/solito/build/image/use-solito-image.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-solito-image.js","sourceRoot":"","sources":["../../src/image/use-solito-image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAA;AACrD,OAAO,EAAc,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EACL,gBAAgB,EAChB,MAAM,EACN,kBAAkB,EAClB,8BAA8B,GAC/B,MAAM,WAAW,CAAA;AAgBlB,MAAM,UAAU,cAAc,CAAC,EAC7B,GAAG,EACH,MAAM,EACN,KAAK,EACL,MAAM,EACN,OAAO,GAAG,EAAE,EACZ,WAAW,EACX,cAAc,EACd,GAAG,EACH,IAAI,EACJ,iBAAiB,EACjB,OAAO,EACP,QAAQ,EACR,WAAW,EACX,WAAW,EACX,KAAK,EACL,KAAK,EACL,QAAQ,EACR,WAAW,EACX,GAAG,KAAK,EACS;IACjB,MAAM,aAAa,GAAG,qBAAqB,EAAE,CAAA;IAC7C,MAAM,MAAM,GAAG,OAAO,CAAc,GAAG,EAAE;QACvC,MAAM,CAAC,GAAG,EAAE,GAAG,kBAAkB,EAAE,GAAG,aAAa,EAAE,CAAA;QACrD,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QAC1E,MAAM,WAAW,GAAG,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAA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Y;gBACzB,CAAC,CAAC;oBACE,MAAM;oBACN,KAAK;iBACN;YACL,KAAK;SACC;QAER,mCAAmC;QACnC,gGAAgG;QAChG,kBAAkB,EAAE,KAAK,CAAC,YAAY,CAAC,IAAI,GAAG;QAC9C,kBAAkB,EAAE;YAClB,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;YACpC,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;YAC1C,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YAC5C,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;YAC5C,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;SAC7C;KACF,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CAAiC,KAAa;IAC/D,mCAAmC;IACnC,OAAO,CACL,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CACxB,CAAA;AACvC,CAAC","sourcesContent":["import { ImageStyle } from 'expo-image'\nimport { useMemo, useSyncExternalStore } from 'react'\nimport { ImageProps, Dimensions, StyleSheet } from 'react-native'\n\nimport { useSolitoImageContext } from './context'\nimport { defaultLoader } from './default-loader'\nimport {\n generateImgAttrs,\n getInt,\n imageConfigDefault,\n resolveSourceFromImgAttributes,\n} from './helpers'\nimport { SolitoImageProps } from './image.types'\nimport { ImageConfig } from './types'\n\nexport type UseSolitoImage = Pick<\n ImageProps,\n | Extract\n | 'progressiveRenderingEnabled'\n | 'source'\n | 'accessible'\n | 'onLayout'\n> & {\n onLoadingComplete?: (info: { height: number; width: number }) => void\n style: Array\n}\n\nexport function useSolitoImage({\n src,\n loader,\n width,\n height,\n quality = 75,\n crossOrigin,\n referrerPolicy,\n alt,\n fill,\n onLoadingComplete,\n loading,\n priority,\n placeholder,\n blurDataURL,\n sizes,\n style,\n onLayout,\n unoptimized,\n ...props\n}: SolitoImageProps): UseSolitoImage {\n const contextConfig = useSolitoImageContext()\n const config = useMemo(() => {\n const c = { ...imageConfigDefault, ...contextConfig }\n const allSizes = [...c.deviceSizes, ...c.imageSizes].sort((a, b) => a - b)\n const deviceSizes = c.deviceSizes.sort((a, b) => a - b)\n return { ...c, allSizes, deviceSizes }\n }, [contextConfig])\n\n const headers: { [key in string]: string } = {}\n if (crossOrigin === 'use-credentials') {\n headers['Access-Control-Allow-Credentials'] = 'true'\n }\n if (referrerPolicy != null) {\n headers['Referrer-Policy'] = referrerPolicy\n }\n\n const uri = useSyncExternalStore(\n (callback) => {\n const subscription = Dimensions.addEventListener('change', callback)\n\n return () => subscription?.remove()\n },\n () => {\n const dimensions = Dimensions.get('window')\n\n if (typeof src == 'string') {\n const attrs = generateImgAttrs({\n src,\n config,\n loader: ({ config: _, ...opts }) => {\n if (loader) {\n return loader(opts)\n }\n if (config.loader) {\n return config.loader({\n quality: Number(quality ?? 75),\n src: opts.src,\n width: opts.width,\n })\n }\n return defaultLoader({ ...opts, config })\n },\n unoptimized: Boolean(unoptimized),\n quality: getInt(quality || 75),\n sizes,\n width: getInt(width || 400),\n })\n const { uri } = resolveSourceFromImgAttributes({\n ...attrs,\n dimensions,\n })\n\n return uri\n }\n return undefined\n }\n )\n\n const source = useMemo(() => {\n const headers: { [key in string]: string } = {}\n if (crossOrigin === 'use-credentials') {\n headers['Access-Control-Allow-Credentials'] = 'true'\n }\n if (referrerPolicy != null) {\n headers['Referrer-Policy'] = referrerPolicy\n }\n if (typeof uri == 'string') {\n return {\n uri,\n height,\n width,\n headers,\n cache: priority ? 'force-cache' : 'default',\n }\n }\n return src as number\n }, [uri, src, height, width, priority, referrerPolicy, crossOrigin])\n\n return {\n ...props,\n progressiveRenderingEnabled: true,\n onLoadingComplete,\n source,\n accessible: Boolean(alt),\n onLayout,\n style: [\n fill\n ? StyleSheet.absoluteFill\n : {\n height,\n width,\n },\n style,\n ] as any,\n\n // adapter for older versions of RN\n // /~https://github.com/facebook/react-native/blob/main/Libraries/Image/Image.android.js#L169-L194\n accessibilityLabel: props['aria-label'] ?? alt,\n accessibilityState: {\n busy: booleanish(props['aria-busy']),\n checked: booleanish(props['aria-checked']),\n disabled: booleanish(props['aria-disabled']),\n expanded: booleanish(props['aria-expanded']),\n selected: booleanish(props['aria-selected']),\n },\n }\n}\n\nfunction booleanish(value?: Value) {\n // this should get upstreamed in RN\n return (\n value === 'true' ? true : value === 'false' ? false : value\n ) as Exclude\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/index.d.ts b/packages/link/node_modules/solito/build/index.d.ts deleted file mode 100644 index 29c1f3f0..00000000 --- a/packages/link/node_modules/solito/build/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './types/solito-page'; -export * from './middleware/provider'; -export * from './params'; diff --git a/packages/link/node_modules/solito/build/index.js b/packages/link/node_modules/solito/build/index.js deleted file mode 100644 index adbe5e13..00000000 --- a/packages/link/node_modules/solito/build/index.js +++ /dev/null @@ -1,4 +0,0 @@ -export * from './types/solito-page'; -export * from './middleware/provider'; -export * from './params'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/index.js.map b/packages/link/node_modules/solito/build/index.js.map deleted file mode 100644 index 5f34c86c..00000000 --- a/packages/link/node_modules/solito/build/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,cAAc,UAAU,CAAA","sourcesContent":["export * from './types/solito-page'\nexport * from './middleware/provider'\nexport * from './params'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/core.d.ts b/packages/link/node_modules/solito/build/link/core.d.ts deleted file mode 100644 index 3f4cc035..00000000 --- a/packages/link/node_modules/solito/build/link/core.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import type { ComponentProps, ComponentType } from 'react'; -import { NextLink } from './next-link'; -export declare type LinkCoreProps = { - children: React.ReactNode; -} & Omit, 'passHref' | 'replace' | 'legacyBehavior'> & ({ - replace?: false; - experimental?: undefined; -} | { - replace: true; - experimental?: { - nativeBehavior: 'stack-replace'; - isNestedNavigator: boolean; - }; -}); -declare function LinkCore({ children, href, as, componentProps, Component, replace, experimental, ...props }: LinkCoreProps & { - Component: ComponentType; - componentProps?: any; -}): JSX.Element; -export { LinkCore }; diff --git a/packages/link/node_modules/solito/build/link/core.js b/packages/link/node_modules/solito/build/link/core.js deleted file mode 100644 index 6c067f2c..00000000 --- a/packages/link/node_modules/solito/build/link/core.js +++ /dev/null @@ -1,37 +0,0 @@ -import { jsx as _jsx } from "react/jsx-runtime"; -import { Platform } from 'react-native'; -import { openURL } from './linking'; -import { NextLink } from './next-link'; -import { useLink } from './use-custom-link'; -function LinkCore({ children, href, as, componentProps, Component, replace, experimental, ...props }) { - if (Platform.OS === 'web') { - return (_jsx(NextLink, { ...props, replace: replace, href: href, as: as, passHref: true, legacyBehavior: true, children: _jsx(Component, { ...componentProps, children: children }, void 0) }, void 0)); - } - // eslint-disable-next-line react-hooks/rules-of-hooks - const linkTo = useLink({ - href, - as, - replace, - experimental, - }); - return (_jsx(Component, { accessibilityRole: "link", ...componentProps, onPress: (e) => { - componentProps?.onPress?.(e); - const link = as || href; - if (e?.defaultPrevented) - return; - // Handles external URLs - if (typeof link === 'string' && isAbsoluteUrl(link)) { - openURL(link); - } - else { - linkTo.onPress(e); - } - }, children: children }, void 0)); -} -// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1 -// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3 -const ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/; -// Source - /~https://github.com/vercel/next.js/blob/77b5f79a4dff453abb62346bf75b14d859539b81/packages/next/shared/lib/utils.ts#L313 -const isAbsoluteUrl = (url) => ABSOLUTE_URL_REGEX.test(url); -export { LinkCore }; -//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/core.js.map b/packages/link/node_modules/solito/build/link/core.js.map deleted file mode 100644 index 07a48796..00000000 --- a/packages/link/node_modules/solito/build/link/core.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/link/core.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAsB3C,SAAS,QAAQ,CAAC,EAChB,QAAQ,EACR,IAAI,EACJ,EAAE,EACF,cAAc,EACd,SAAS,EACT,OAAO,EACP,YAAY,EACZ,GAAG,KAAK,EAIT;IACC,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACzB,OAAO,CACL,KAAC,QAAQ,OACH,KAAK,EACT,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,EACN,QAAQ,QACR,cAAc,kBAEd,KAAC,SAAS,OAAK,cAAc,YAAG,QAAQ,WAAa,WAC5C,CACZ,CAAA;KACF;IACD,sDAAsD;IACtD,MAAM,MAAM,GAAG,OAAO,CAAC;QACrB,IAAI;QACJ,EAAE;QACF,OAAO;QACP,YAAY;KACb,CAAC,CAAA;IACF,OAAO,CACL,KAAC,SAAS,IACR,iBAAiB,EAAC,MAAM,KACpB,cAAc,EAClB,OAAO,EAAE,CAAC,CAAO,EAAE,EAAE;YACnB,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;YAC5B,MAAM,IAAI,GAAG,EAAE,IAAI,IAAI,CAAA;YACvB,IAAI,CAAC,EAAE,gBAAgB;gBAAE,OAAM;YAC/B,wBAAwB;YACxB,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE;gBACnD,OAAO,CAAC,IAAI,CAAC,CAAA;aACd;iBAAM;gBACL,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;aAClB;QACH,CAAC,YAEA,QAAQ,WACC,CACb,CAAA;AACH,CAAC;AAED,0DAA0D;AAC1D,gEAAgE;AAChE,MAAM,kBAAkB,GAAG,4BAA4B,CAAA;AACvD,kIAAkI;AAClI,MAAM,aAAa,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAEnE,OAAO,EAAE,QAAQ,EAAE,CAAA","sourcesContent":["import React from 'react'\nimport type { ComponentProps, ComponentType } from 'react'\nimport { Platform } from 'react-native'\n\nimport { openURL } from './linking'\nimport { NextLink } from './next-link'\nimport { useLink } from './use-custom-link'\n\nexport type LinkCoreProps = {\n children: React.ReactNode\n} & Omit<\n ComponentProps,\n 'passHref' | 'replace' | 'legacyBehavior'\n> &\n (\n | {\n replace?: false\n experimental?: undefined\n }\n | {\n replace: true\n experimental?: {\n nativeBehavior: 'stack-replace'\n isNestedNavigator: boolean\n }\n }\n )\n\nfunction LinkCore({\n children,\n href,\n as,\n componentProps,\n Component,\n replace,\n experimental,\n ...props\n}: LinkCoreProps & {\n Component: ComponentType\n componentProps?: any\n}) {\n if (Platform.OS === 'web') {\n return (\n \n {children}\n \n )\n }\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const linkTo = useLink({\n href,\n as,\n replace,\n experimental,\n })\n return (\n {\n componentProps?.onPress?.(e)\n const link = as || href\n if (e?.defaultPrevented) return\n // Handles external URLs\n if (typeof link === 'string' && isAbsoluteUrl(link)) {\n openURL(link)\n } else {\n linkTo.onPress(e)\n }\n }}\n >\n {children}\n \n )\n}\n\n// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1\n// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3\nconst ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\\d+\\-.]*?:/\n// Source - /~https://github.com/vercel/next.js/blob/77b5f79a4dff453abb62346bf75b14d859539b81/packages/next/shared/lib/utils.ts#L313\nconst isAbsoluteUrl = (url: string) => ABSOLUTE_URL_REGEX.test(url)\n\nexport { LinkCore }\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/index.d.ts b/packages/link/node_modules/solito/build/link/index.d.ts deleted file mode 100644 index 465b1aed..00000000 --- a/packages/link/node_modules/solito/build/link/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './core'; -export * from './text-link'; -export * from './link'; -export * from './use-custom-link'; diff --git a/packages/link/node_modules/solito/build/link/index.js b/packages/link/node_modules/solito/build/link/index.js deleted file mode 100644 index b014578c..00000000 --- a/packages/link/node_modules/solito/build/link/index.js +++ /dev/null @@ -1,5 +0,0 @@ -export * from './core'; -export * from './text-link'; -export * from './link'; -export * from './use-custom-link'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/index.js.map b/packages/link/node_modules/solito/build/link/index.js.map deleted file mode 100644 index 9fa82515..00000000 --- a/packages/link/node_modules/solito/build/link/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/link/index.tsx"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,mBAAmB,CAAA","sourcesContent":["export * from './core'\nexport * from './text-link'\nexport * from './link'\nexport * from './use-custom-link'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/link.d.ts b/packages/link/node_modules/solito/build/link/link.d.ts deleted file mode 100644 index 232e9c3e..00000000 --- a/packages/link/node_modules/solito/build/link/link.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// -import { ViewProps } from 'react-native'; -import { LinkCoreProps } from './core'; -declare type LinkProps = LinkCoreProps & { - viewProps?: ViewProps; -}; -declare function Link({ viewProps, ...props }: LinkProps): JSX.Element; -export { Link }; -export type { LinkProps }; diff --git a/packages/link/node_modules/solito/build/link/link.js b/packages/link/node_modules/solito/build/link/link.js deleted file mode 100644 index a41cc321..00000000 --- a/packages/link/node_modules/solito/build/link/link.js +++ /dev/null @@ -1,12 +0,0 @@ -'use client'; -import { jsx as _jsx } from "react/jsx-runtime"; -import { Platform, Pressable, View } from 'react-native'; -import { LinkCore } from './core'; -function Link({ viewProps, ...props }) { - return (_jsx(LinkCore, { ...props, Component: Platform.select({ - web: View, - default: Pressable, - }), componentProps: viewProps }, void 0)); -} -export { Link }; -//# sourceMappingURL=link.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/link.js.map b/packages/link/node_modules/solito/build/link/link.js.map deleted file mode 100644 index 86f12927..00000000 --- a/packages/link/node_modules/solito/build/link/link.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"link.js","sourceRoot":"","sources":["../../src/link/link.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AACZ,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAa,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnE,OAAO,EAAE,QAAQ,EAAiB,MAAM,QAAQ,CAAA;AAIhD,SAAS,IAAI,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAa;IAC9C,OAAO,CACL,KAAC,QAAQ,OACH,KAAK,EACT,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC;YACzB,GAAG,EAAE,IAAI;YACT,OAAO,EAAE,SAAgB;SAC1B,CAAC,EACF,cAAc,EAAE,SAAS,WACzB,CACH,CAAA;AACH,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAA","sourcesContent":["'use client'\nimport { Platform, Pressable, ViewProps, View } from 'react-native'\n\nimport { LinkCore, LinkCoreProps } from './core'\n\ntype LinkProps = LinkCoreProps & { viewProps?: ViewProps }\n\nfunction Link({ viewProps, ...props }: LinkProps) {\n return (\n \n )\n}\n\nexport { Link }\nexport type { LinkProps }\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/linking.d.ts b/packages/link/node_modules/solito/build/link/linking.d.ts deleted file mode 100644 index 92b2d02b..00000000 --- a/packages/link/node_modules/solito/build/link/linking.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const openURL: (url: string) => Promise; diff --git a/packages/link/node_modules/solito/build/link/linking.js b/packages/link/node_modules/solito/build/link/linking.js deleted file mode 100644 index d5d880b2..00000000 --- a/packages/link/node_modules/solito/build/link/linking.js +++ /dev/null @@ -1,3 +0,0 @@ -import { Linking } from 'react-native'; -export const openURL = (url) => Linking.openURL(url); -//# sourceMappingURL=linking.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/linking.js.map b/packages/link/node_modules/solito/build/link/linking.js.map deleted file mode 100644 index 67987b8d..00000000 --- a/packages/link/node_modules/solito/build/link/linking.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"linking.js","sourceRoot":"","sources":["../../src/link/linking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA","sourcesContent":["import { Linking } from 'react-native'\n\nexport const openURL = (url: string) => Linking.openURL(url)\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/linking.web.d.ts b/packages/link/node_modules/solito/build/link/linking.web.d.ts deleted file mode 100644 index 86eb98f1..00000000 --- a/packages/link/node_modules/solito/build/link/linking.web.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const openURL: (url: string) => void; diff --git a/packages/link/node_modules/solito/build/link/linking.web.js b/packages/link/node_modules/solito/build/link/linking.web.js deleted file mode 100644 index b4a6e099..00000000 --- a/packages/link/node_modules/solito/build/link/linking.web.js +++ /dev/null @@ -1,3 +0,0 @@ -// noop, not supported on web -export const openURL = (url) => { }; -//# sourceMappingURL=linking.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/linking.web.js.map b/packages/link/node_modules/solito/build/link/linking.web.js.map deleted file mode 100644 index eda6caf7..00000000 --- a/packages/link/node_modules/solito/build/link/linking.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"linking.web.js","sourceRoot":"","sources":["../../src/link/linking.web.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAE,EAAE,GAAE,CAAC,CAAA","sourcesContent":["// noop, not supported on web\nexport const openURL = (url: string) => {}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/next-link.d.ts b/packages/link/node_modules/solito/build/link/next-link.d.ts deleted file mode 100644 index 8cdb3403..00000000 --- a/packages/link/node_modules/solito/build/link/next-link.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -/// -/// -export declare const NextLink: import("react").ForwardRefExoticComponent, keyof { - href: string | import("url").UrlObject; - as?: (string | import("url").UrlObject) | undefined; - replace?: boolean | undefined; - scroll?: boolean | undefined; - shallow?: boolean | undefined; - passHref?: boolean | undefined; - prefetch?: boolean | undefined; - locale?: string | false | undefined; - legacyBehavior?: boolean | undefined; - onMouseEnter?: ((e: any) => void) | undefined; - onTouchStart?: ((e: any) => void) | undefined; - onClick?: ((e: any) => void) | undefined; -}> & { - href: string | import("url").UrlObject; - as?: (string | import("url").UrlObject) | undefined; - replace?: boolean | undefined; - scroll?: boolean | undefined; - shallow?: boolean | undefined; - passHref?: boolean | undefined; - prefetch?: boolean | undefined; - locale?: string | false | undefined; - legacyBehavior?: boolean | undefined; - onMouseEnter?: ((e: any) => void) | undefined; - onTouchStart?: ((e: any) => void) | undefined; - onClick?: ((e: any) => void) | undefined; -} & { - children?: import("react").ReactNode; -} & import("react").RefAttributes>; diff --git a/packages/link/node_modules/solito/build/link/next-link.js b/packages/link/node_modules/solito/build/link/next-link.js deleted file mode 100644 index 652af315..00000000 --- a/packages/link/node_modules/solito/build/link/next-link.js +++ /dev/null @@ -1,5 +0,0 @@ -import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime"; -export const NextLink = (() => { - return _jsx(_Fragment, {}, void 0); -}); -//# sourceMappingURL=next-link.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/next-link.js.map b/packages/link/node_modules/solito/build/link/next-link.js.map deleted file mode 100644 index 7d585cab..00000000 --- a/packages/link/node_modules/solito/build/link/next-link.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"next-link.js","sourceRoot":"","sources":["../../src/link/next-link.tsx"],"names":[],"mappings":";AAEA,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAG,EAAE;IAC5B,OAAO,2BAAK,CAAA;AACd,CAAC,CAAuB,CAAA","sourcesContent":["import type Link from 'next/link'\n\nexport const NextLink = (() => {\n return <>\n}) as any as typeof Link\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/next-link.web.d.ts b/packages/link/node_modules/solito/build/link/next-link.web.d.ts deleted file mode 100644 index 0be69b36..00000000 --- a/packages/link/node_modules/solito/build/link/next-link.web.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default as NextLink } from 'next/link'; diff --git a/packages/link/node_modules/solito/build/link/next-link.web.js b/packages/link/node_modules/solito/build/link/next-link.web.js deleted file mode 100644 index 14e77332..00000000 --- a/packages/link/node_modules/solito/build/link/next-link.web.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default as NextLink } from 'next/link'; -//# sourceMappingURL=next-link.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/next-link.web.js.map b/packages/link/node_modules/solito/build/link/next-link.web.js.map deleted file mode 100644 index c8bda485..00000000 --- a/packages/link/node_modules/solito/build/link/next-link.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"next-link.web.js","sourceRoot":"","sources":["../../src/link/next-link.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAA","sourcesContent":["export { default as NextLink } from 'next/link'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/text-link.d.ts b/packages/link/node_modules/solito/build/link/text-link.d.ts deleted file mode 100644 index 1ee2570e..00000000 --- a/packages/link/node_modules/solito/build/link/text-link.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// -import { TextProps } from 'react-native'; -import { LinkCoreProps } from './core'; -declare type TextLinkProps = LinkCoreProps & { - textProps?: TextProps; -}; -declare function TextLink({ textProps, ...props }: TextLinkProps): JSX.Element; -export { TextLink }; -export type { TextLinkProps }; diff --git a/packages/link/node_modules/solito/build/link/text-link.js b/packages/link/node_modules/solito/build/link/text-link.js deleted file mode 100644 index c906fbb7..00000000 --- a/packages/link/node_modules/solito/build/link/text-link.js +++ /dev/null @@ -1,9 +0,0 @@ -'use client'; -import { jsx as _jsx } from "react/jsx-runtime"; -import { Text } from 'react-native'; -import { LinkCore } from './core'; -function TextLink({ textProps, ...props }) { - return (_jsx(LinkCore, { ...props, Component: Text, componentProps: { selectable: false, ...textProps } }, void 0)); -} -export { TextLink }; -//# sourceMappingURL=text-link.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/text-link.js.map b/packages/link/node_modules/solito/build/link/text-link.js.map deleted file mode 100644 index 64d5a302..00000000 --- a/packages/link/node_modules/solito/build/link/text-link.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"text-link.js","sourceRoot":"","sources":["../../src/link/text-link.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AACZ,OAAO,EAAa,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,QAAQ,EAAiB,MAAM,QAAQ,CAAA;AAIhD,SAAS,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAiB;IACtD,OAAO,CACL,KAAC,QAAQ,OACH,KAAK,EACT,SAAS,EAAE,IAAI,EACf,cAAc,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,SAAS,EAAE,WACnD,CACH,CAAA;AACH,CAAC;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA","sourcesContent":["'use client'\nimport { TextProps, Text } from 'react-native'\n\nimport { LinkCore, LinkCoreProps } from './core'\n\ntype TextLinkProps = LinkCoreProps & { textProps?: TextProps }\n\nfunction TextLink({ textProps, ...props }: TextLinkProps) {\n return (\n \n )\n}\n\nexport { TextLink }\nexport type { TextLinkProps }\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/use-custom-link.d.ts b/packages/link/node_modules/solito/build/link/use-custom-link.d.ts deleted file mode 100644 index 7b1880a2..00000000 --- a/packages/link/node_modules/solito/build/link/use-custom-link.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -/// -import { GestureResponderEvent } from 'react-native'; -import { LinkCoreProps } from './core'; -export declare type UseLinkProps = Pick; -export declare function useLink({ href, as, shallow, scroll, replace, experimental, }: UseLinkProps): { - accessibilityRole: "link"; - onPress: (e?: import("react").MouseEvent | GestureResponderEvent | undefined) => void; - href: string; -}; diff --git a/packages/link/node_modules/solito/build/link/use-custom-link.js b/packages/link/node_modules/solito/build/link/use-custom-link.js deleted file mode 100644 index 795bcacf..00000000 --- a/packages/link/node_modules/solito/build/link/use-custom-link.js +++ /dev/null @@ -1,45 +0,0 @@ -import { Platform } from 'react-native'; -import { useRouter } from '../router'; -export function useLink({ href, as, shallow, scroll, replace, experimental, }) { - const router = useRouter(); - // /~https://github.com/react-navigation/react-navigation/blob/main/packages/native/src/useLinkProps.tsx#L64 - const onPress = (e) => { - let shouldHandle = false; - if (Platform.OS !== 'web' || !e) { - shouldHandle = e ? !e.defaultPrevented : true; - } - else if (!e.defaultPrevented && // onPress prevented default - // @ts-expect-error: these properties exist on web, but not in React Native - !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && // ignore clicks with modifier keys - // @ts-expect-error: these properties exist on web, but not in React Native - (e.button == null || e.button === 0) && // ignore everything but left clicks - // @ts-expect-error: these properties exist on web, but not in React Native - [undefined, null, '', 'self'].includes(e.currentTarget?.target) // let browser handle "target=_blank" etc. - ) { - e.preventDefault(); - shouldHandle = true; - } - if (shouldHandle) { - if (href === '#') { - // this is a way on web to stay on the same page - // useful for conditional hrefs - return; - } - if (replace) { - router.replace(href, as, { shallow, scroll, experimental }); - } - else { - router.push(href, as, { - shallow, - scroll, - }); - } - } - }; - return { - accessibilityRole: 'link', - onPress, - href: router.parseNextPath(as || href), - }; -} -//# sourceMappingURL=use-custom-link.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/link/use-custom-link.js.map b/packages/link/node_modules/solito/build/link/use-custom-link.js.map deleted file mode 100644 index 0bf9f230..00000000 --- a/packages/link/node_modules/solito/build/link/use-custom-link.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-custom-link.js","sourceRoot":"","sources":["../../src/link/use-custom-link.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyB,QAAQ,EAAE,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAQrC,MAAM,UAAU,OAAO,CAAC,EACtB,IAAI,EACJ,EAAE,EACF,OAAO,EACP,MAAM,EACN,OAAO,EACP,YAAY,GACC;IACb,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,0GAA0G;IAC1G,MAAM,OAAO,GAAG,CACd,CAA2E,EAC3E,EAAE;QACF,IAAI,YAAY,GAAG,KAAK,CAAA;QAExB,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,EAAE;YAC/B,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAA;SAC9C;aAAM,IACL,CAAC,CAAC,CAAC,gBAAgB,IAAI,4BAA4B;YACnD,2EAA2E;YAC3E,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,mCAAmC;YAC1F,2EAA2E;YAC3E,CAAC,CAAC,CAAC,MAAM,IAAI,IAAI,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,oCAAoC;YAC5E,2EAA2E;YAC3E,CAAC,SAAS,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,0CAA0C;UAC1G;YACA,CAAC,CAAC,cAAc,EAAE,CAAA;YAClB,YAAY,GAAG,IAAI,CAAA;SACpB;QAED,IAAI,YAAY,EAAE;YAChB,IAAI,IAAI,KAAK,GAAG,EAAE;gBAChB,gDAAgD;gBAChD,+BAA+B;gBAC/B,OAAM;aACP;YACD,IAAI,OAAO,EAAE;gBACX,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAA;aAC5D;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE;oBACpB,OAAO;oBACP,MAAM;iBACP,CAAC,CAAA;aACH;SACF;IACH,CAAC,CAAA;IAED,OAAO;QACL,iBAAiB,EAAE,MAAe;QAClC,OAAO;QACP,IAAI,EAAE,MAAM,CAAC,aAAa,CAAC,EAAE,IAAI,IAAI,CAAC;KACvC,CAAA;AACH,CAAC","sourcesContent":["import { GestureResponderEvent, Platform } from 'react-native'\n\nimport { useRouter } from '../router'\nimport { LinkCoreProps } from './core'\n\nexport type UseLinkProps = Pick<\n LinkCoreProps,\n 'as' | 'shallow' | 'href' | 'scroll' | 'replace' | 'experimental'\n>\n\nexport function useLink({\n href,\n as,\n shallow,\n scroll,\n replace,\n experimental,\n}: UseLinkProps) {\n const router = useRouter()\n\n // /~https://github.com/react-navigation/react-navigation/blob/main/packages/native/src/useLinkProps.tsx#L64\n const onPress = (\n e?: React.MouseEvent | GestureResponderEvent\n ) => {\n let shouldHandle = false\n\n if (Platform.OS !== 'web' || !e) {\n shouldHandle = e ? !e.defaultPrevented : true\n } else if (\n !e.defaultPrevented && // onPress prevented default\n // @ts-expect-error: these properties exist on web, but not in React Native\n !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && // ignore clicks with modifier keys\n // @ts-expect-error: these properties exist on web, but not in React Native\n (e.button == null || e.button === 0) && // ignore everything but left clicks\n // @ts-expect-error: these properties exist on web, but not in React Native\n [undefined, null, '', 'self'].includes(e.currentTarget?.target) // let browser handle \"target=_blank\" etc.\n ) {\n e.preventDefault()\n shouldHandle = true\n }\n\n if (shouldHandle) {\n if (href === '#') {\n // this is a way on web to stay on the same page\n // useful for conditional hrefs\n return\n }\n if (replace) {\n router.replace(href, as, { shallow, scroll, experimental })\n } else {\n router.push(href, as, {\n shallow,\n scroll,\n })\n }\n }\n }\n\n return {\n accessibilityRole: 'link' as const,\n onPress,\n href: router.parseNextPath(as || href),\n }\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/middleware/context.d.ts b/packages/link/node_modules/solito/build/middleware/context.d.ts deleted file mode 100644 index 40ad15b3..00000000 --- a/packages/link/node_modules/solito/build/middleware/context.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import { MiddlewareContextType } from './types'; -export declare const MiddlewareContext: import("react").Context; diff --git a/packages/link/node_modules/solito/build/middleware/context.js b/packages/link/node_modules/solito/build/middleware/context.js deleted file mode 100644 index 73ab9f88..00000000 --- a/packages/link/node_modules/solito/build/middleware/context.js +++ /dev/null @@ -1,7 +0,0 @@ -import { useLinkTo } from '@react-navigation/native'; -import { createContext } from 'react'; -export const MiddlewareContext = createContext({ - useLinkTo, - // useLinkProps, -}); -//# sourceMappingURL=context.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/middleware/context.js.map b/packages/link/node_modules/solito/build/middleware/context.js.map deleted file mode 100644 index 8d77bd26..00000000 --- a/packages/link/node_modules/solito/build/middleware/context.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/middleware/context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAIrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAwB;IACpE,SAAS;IACT,gBAAgB;CACjB,CAAC,CAAA","sourcesContent":["import { useLinkTo } from '@react-navigation/native'\nimport { createContext } from 'react'\n\nimport { MiddlewareContextType } from './types'\n\nexport const MiddlewareContext = createContext({\n useLinkTo,\n // useLinkProps,\n})\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/middleware/context.web.d.ts b/packages/link/node_modules/solito/build/middleware/context.web.d.ts deleted file mode 100644 index 40ad15b3..00000000 --- a/packages/link/node_modules/solito/build/middleware/context.web.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import { MiddlewareContextType } from './types'; -export declare const MiddlewareContext: import("react").Context; diff --git a/packages/link/node_modules/solito/build/middleware/context.web.js b/packages/link/node_modules/solito/build/middleware/context.web.js deleted file mode 100644 index 8f5808c1..00000000 --- a/packages/link/node_modules/solito/build/middleware/context.web.js +++ /dev/null @@ -1,10 +0,0 @@ -import { createContext } from 'react'; -function error() { - throw new Error('[solito] useLinkTo should not be called on Web. Is next/router defined?'); -} -export const MiddlewareContext = createContext({ - useLinkTo() { - return error; - }, -}); -//# sourceMappingURL=context.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/middleware/context.web.js.map b/packages/link/node_modules/solito/build/middleware/context.web.js.map deleted file mode 100644 index 877a9d4a..00000000 --- a/packages/link/node_modules/solito/build/middleware/context.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"context.web.js","sourceRoot":"","sources":["../../src/middleware/context.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAIrC,SAAS,KAAK;IACZ,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAwB;IACpE,SAAS;QACP,OAAO,KAAK,CAAA;IACd,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { createContext } from 'react'\n\nimport { MiddlewareContextType } from './types'\n\nfunction error() {\n throw new Error(\n '[solito] useLinkTo should not be called on Web. Is next/router defined?'\n )\n}\n\nexport const MiddlewareContext = createContext({\n useLinkTo() {\n return error\n },\n})\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/middleware/provider.d.ts b/packages/link/node_modules/solito/build/middleware/provider.d.ts deleted file mode 100644 index f8e10a62..00000000 --- a/packages/link/node_modules/solito/build/middleware/provider.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; -import { MiddlewareContextType } from './types'; -declare type Props = { - middleware: MiddlewareContextType; -}; -export declare function SolitoProvider({ children, middleware, }: { - children: React.ReactNode; -} & Props): JSX.Element; -export {}; diff --git a/packages/link/node_modules/solito/build/middleware/provider.js b/packages/link/node_modules/solito/build/middleware/provider.js deleted file mode 100644 index 6e97f1fb..00000000 --- a/packages/link/node_modules/solito/build/middleware/provider.js +++ /dev/null @@ -1,6 +0,0 @@ -import { jsx as _jsx } from "react/jsx-runtime"; -import { MiddlewareContext } from './context'; -export function SolitoProvider({ children, middleware, }) { - return (_jsx(MiddlewareContext.Provider, { value: middleware, children: children }, void 0)); -} -//# sourceMappingURL=provider.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/middleware/provider.js.map b/packages/link/node_modules/solito/build/middleware/provider.js.map deleted file mode 100644 index be5151f5..00000000 --- a/packages/link/node_modules/solito/build/middleware/provider.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/middleware/provider.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAO7C,MAAM,UAAU,cAAc,CAAC,EAC7B,QAAQ,EACR,UAAU,GAC4B;IACtC,OAAO,CACL,KAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YAC1C,QAAQ,WACkB,CAC9B,CAAA;AACH,CAAC","sourcesContent":["import React from 'react'\n\nimport { MiddlewareContext } from './context'\nimport { MiddlewareContextType } from './types'\n\ntype Props = {\n middleware: MiddlewareContextType\n}\n\nexport function SolitoProvider({\n children,\n middleware,\n}: { children: React.ReactNode } & Props) {\n return (\n \n {children}\n \n )\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/middleware/types.d.ts b/packages/link/node_modules/solito/build/middleware/types.d.ts deleted file mode 100644 index 7efdd335..00000000 --- a/packages/link/node_modules/solito/build/middleware/types.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { useLinkTo } from '@react-navigation/native'; -export declare type MiddlewareContextType = { - useLinkTo?: typeof useLinkTo; -}; diff --git a/packages/link/node_modules/solito/build/middleware/types.js b/packages/link/node_modules/solito/build/middleware/types.js deleted file mode 100644 index 718fd38a..00000000 --- a/packages/link/node_modules/solito/build/middleware/types.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/middleware/types.js.map b/packages/link/node_modules/solito/build/middleware/types.js.map deleted file mode 100644 index 6be48dc6..00000000 --- a/packages/link/node_modules/solito/build/middleware/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/middleware/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { useLinkTo } from '@react-navigation/native'\n\nexport type MiddlewareContextType = {\n useLinkTo?: typeof useLinkTo\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/moti/index.d.ts b/packages/link/node_modules/solito/build/moti/index.d.ts deleted file mode 100644 index e33728e0..00000000 --- a/packages/link/node_modules/solito/build/moti/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './link'; diff --git a/packages/link/node_modules/solito/build/moti/index.js b/packages/link/node_modules/solito/build/moti/index.js deleted file mode 100644 index 574b6c78..00000000 --- a/packages/link/node_modules/solito/build/moti/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from './link'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/moti/index.js.map b/packages/link/node_modules/solito/build/moti/index.js.map deleted file mode 100644 index 69fb0b6a..00000000 --- a/packages/link/node_modules/solito/build/moti/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/moti/index.tsx"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA","sourcesContent":["export * from './link'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/moti/link.d.ts b/packages/link/node_modules/solito/build/moti/link.d.ts deleted file mode 100644 index 0370227a..00000000 --- a/packages/link/node_modules/solito/build/moti/link.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { MotiPressableProps } from 'moti/interactions'; -import React from 'react'; -import type { View } from 'react-native'; -import { useLink, UseLinkProps } from '../link/use-custom-link'; -export declare type MotiLinkProps = UseLinkProps & Omit, 'href' | 'accessibilityRole'>>; -export declare const MotiLink: React.ForwardRefExoticComponent & React.RefAttributes>; diff --git a/packages/link/node_modules/solito/build/moti/link.js b/packages/link/node_modules/solito/build/moti/link.js deleted file mode 100644 index 311cf2ec..00000000 --- a/packages/link/node_modules/solito/build/moti/link.js +++ /dev/null @@ -1,15 +0,0 @@ -import { jsx as _jsx } from "react/jsx-runtime"; -import { MotiPressable } from 'moti/interactions'; -import { forwardRef } from 'react'; -import { useLink } from '../link/use-custom-link'; -export const MotiLink = forwardRef((props, ref) => { - const { onPress, ...linkProps } = useLink(props); - return (_jsx(MotiPressable, { ...props, ...linkProps, onPress: (e) => { - // @ts-expect-error no event argument - // we let users pass an onPress prop, in case they want to preventDefault() - props.onPress?.(e); - onPress?.(e); - }, ref: ref }, void 0)); -}); -MotiLink.displayName = 'MotiLink'; -//# sourceMappingURL=link.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/moti/link.js.map b/packages/link/node_modules/solito/build/moti/link.js.map deleted file mode 100644 index 6275d1df..00000000 --- a/packages/link/node_modules/solito/build/moti/link.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"link.js","sourceRoot":"","sources":["../../src/moti/link.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAsB,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACrE,OAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGzC,OAAO,EAAE,OAAO,EAAgB,MAAM,yBAAyB,CAAA;AAU/D,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAsB,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACrE,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAA;IAEhD,OAAO,CACL,KAAC,aAAa,OACR,KAAK,KACL,SAAS,EACb,OAAO,EAAE,CAAC,CAAO,EAAE,EAAE;YACnB,qCAAqC;YACrC,2EAA2E;YAC3E,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;YAElB,OAAO,EAAE,CAAC,CAAC,CAAC,CAAA;QACd,CAAC,EACD,GAAG,EAAE,GAAG,WACR,CACH,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAA","sourcesContent":["import { MotiPressableProps, MotiPressable } from 'moti/interactions'\nimport React, { forwardRef } from 'react'\nimport type { View } from 'react-native'\n\nimport { useLink, UseLinkProps } from '../link/use-custom-link'\n\nexport type MotiLinkProps = UseLinkProps &\n Omit<\n MotiPressableProps,\n // you can't pass any props that will be overridden by useLink\n | keyof UseLinkProps\n | keyof Pick, 'href' | 'accessibilityRole'>\n >\n\nexport const MotiLink = forwardRef((props, ref) => {\n const { onPress, ...linkProps } = useLink(props)\n\n return (\n {\n // @ts-expect-error no event argument\n // we let users pass an onPress prop, in case they want to preventDefault()\n props.onPress?.(e)\n\n onPress?.(e)\n }}\n ref={ref}\n />\n )\n})\n\nMotiLink.displayName = 'MotiLink'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/index.d.ts b/packages/link/node_modules/solito/build/params/index.d.ts deleted file mode 100644 index 63744833..00000000 --- a/packages/link/node_modules/solito/build/params/index.d.ts +++ /dev/null @@ -1,35 +0,0 @@ -declare type Config, Required extends boolean, ParsedType, InitialValue> = (Required extends false ? { - parse?: (value?: string | string[]) => ParsedType; -} : { - parse: (value?: string | string[]) => ParsedType; -}) & { - stringify?: (value: ParsedType) => string; - initial: InitialValue; - paramsToClearOnSetState?: (keyof Props)[]; -}; -declare type Params = Record, Name extends keyof Props = keyof Props, NullableUnparsedParsedType extends Props[Name] | undefined = Props[Name] | undefined, ParseFunction extends undefined | ((value?: string | string[]) => NonNullable) = (value?: string | string[]) => NonNullable, InitialValue = NullableUnparsedParsedType | undefined, ParsedType = InitialValue extends undefined ? NullableUnparsedParsedType : ParseFunction extends undefined ? NullableUnparsedParsedType : NonNullable> = NonNullable extends string ? [name: Name, config: Config] | [name: Name] : [name: Name, config: Config]; -declare type Returns = Record, Name extends keyof Props = keyof Props, NullableUnparsedParsedType extends Props[Name] | undefined = Props[Name] | undefined, ParseFunction extends undefined | ((value?: string | string[]) => NonNullable) = (value?: string | string[]) => NonNullable, InitialValue = NullableUnparsedParsedType | undefined, ParsedType = InitialValue extends undefined ? NullableUnparsedParsedType : ParseFunction extends undefined ? NullableUnparsedParsedType : NonNullable> = readonly [ - state: ParsedType | InitialValue, - setState: (value: ParsedType, options?: SetStateOptions) => void -]; -declare type SetStateOptions = { - /** - * Override whether this function calls `Router.push` or `Router.replace`. - * - * By default, `Router.push` is called if the query parameter already exists in the URL. - */ - webBehavior?: 'push' | 'replace'; -}; -export declare function createParam = Record>(): { - useParam: NonNullable) | undefined = (value?: string | string[] | undefined) => NonNullable, InitialValue = NullableUnparsedParsedType | undefined, ParsedType = InitialValue extends undefined ? NullableUnparsedParsedType : ParseFunction extends undefined ? NullableUnparsedParsedType : NonNullable>(...[name, maybeConfig]: Params) => Returns; - useUpdateParams: () => (props: Partial, options?: { - web?: { - replace?: boolean | undefined; - } | undefined; - } | undefined) => void; - useParams: () => { - params: Props; - setParams: (value: Partial, options?: SetStateOptions | undefined) => void; - }; -}; -export {}; diff --git a/packages/link/node_modules/solito/build/params/index.js b/packages/link/node_modules/solito/build/params/index.js deleted file mode 100644 index 80450cb8..00000000 --- a/packages/link/node_modules/solito/build/params/index.js +++ /dev/null @@ -1,156 +0,0 @@ -/* eslint-disable react-hooks/rules-of-hooks */ -// From https://gist.github.com/nandorojo/052887f99bb61b54845474f324aa41cc -import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import { Platform } from 'react-native'; -import { useNavigation } from '../router/use-navigation'; -import Router from './router'; -import { useRoute } from './use-route'; -import { useRouter } from './use-router'; -function useStable(value) { - const ref = useRef(value); - useEffect(() => { - ref.current = value; - }, [value]); - return ref; -} -function useStableCallback(callback) { - const callbackRef = useRef(callback); - useEffect(() => { - callbackRef.current = callback; - }); - // /~https://github.com/facebook/react/issues/19240 - return useMemo(() => ((...args) => callbackRef.current?.(...args)), []); -} -export function createParam() { - function useParam(...[name, maybeConfig]) { - const { parse = (value) => value, initial, stringify = (value) => `${value}`, paramsToClearOnSetState, } = maybeConfig || {}; - const nextRouter = useRouter(); - const nativeRoute = useRoute(); - const nativeNavigation = useNavigation(); - const nativeStateFromParams = nativeRoute?.params?.[name]; - const [nativeStateFromReact, setNativeStateFromReact] = useState(() => nativeStateFromParams ?? initial); - const setNativeStateFromParams = useCallback((value) => { - nativeNavigation?.setParams({ - [name]: value, - }); - }, []); - const nativeState = nativeRoute - ? nativeStateFromParams - : nativeStateFromReact; - const setNativeState = nativeRoute - ? setNativeStateFromParams - : setNativeStateFromReact; - const stableStringify = useStableCallback(stringify); - const stableParse = useStableCallback(parse); - const stableParamsToClear = useStable(paramsToClearOnSetState); - const initialValue = useRef(initial); - const hasSetState = useRef(false); - const setState = useCallback((value, options) => { - hasSetState.current = true; - const { pathname, query } = Router; - const newQuery = { ...query }; - if (value != null && value !== '') { - newQuery[name] = stableStringify(value); - } - else { - delete newQuery[name]; - } - if (stableParamsToClear.current) { - for (const paramKey of stableParamsToClear.current) { - delete newQuery[paramKey]; - } - } - const willChangeExistingParam = query[name] && newQuery[name]; - let action = willChangeExistingParam ? Router.replace : Router.push; - if (options?.webBehavior) { - action = Router[options.webBehavior]; - } - action({ - pathname, - query: newQuery, - }, undefined, { - shallow: true, - }); - }, [name, stableStringify, stableParamsToClear]); - const webParam = nextRouter?.query?.[name]; - const state = useMemo(() => { - let state; - if (webParam === undefined && !hasSetState.current) { - state = initialValue.current; - } - else { - state = stableParse(webParam); - } - return state; - }, [stableParse, webParam]); - if (Platform.OS !== 'web') { - if (!nativeRoute) { - console.error(`[solito] useParam('${name}') called when there is no React Navigation route available. In a future version, this will throw an error. Please fix this by only calling useParam() inside of a React Navigation route. For now, Solito will fallback to using React state.`); - } - return [nativeState, setNativeState]; - } - return [state, setState]; - } - function useUpdateParams() { - const nativeNavigation = useNavigation(); - const setNativeStateFromParams = useCallback((value) => { - nativeNavigation?.setParams(value); - }, []); - const setWebState = useCallback((value, options) => { - const { pathname, query } = Router; - const newQuery = { ...query, ...value }; - for (const key in value) { - if (value[key] == null || value[key] === '') { - delete newQuery[key]; - } - } - const action = options?.web?.replace ? Router.replace : Router.push; - action({ - pathname, - query: newQuery, - }, undefined, { - shallow: true, - }); - }, []); - return Platform.select({ - web: setWebState, - default: setNativeStateFromParams, - }); - } - function useParams() { - if (Platform.OS !== 'web') { - const nativeRoute = useRoute(); - const nativeNavigation = useNavigation(); - return { - params: nativeRoute?.params, - setParams: useCallback((params) => nativeNavigation?.setParams(params), [nativeNavigation]), - }; - } - const nextRouter = useRouter(); - return { - params: nextRouter?.query, - setParams: useCallback((params, options) => { - const { pathname, query } = Router; - const newQuery = { ...query, ...params }; - for (const key in params) { - if (params[key] == null || params[key] === '') { - delete newQuery[key]; - } - } - const action = Router[options?.webBehavior ?? 'push']; - action({ - pathname, - query: newQuery, - }, undefined, { - shallow: true, - }); - }, []), - }; - } - return { - useParam, - useUpdateParams, - useParams, - }; -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/index.js.map b/packages/link/node_modules/solito/build/params/index.js.map deleted file mode 100644 index 2e6d53c3..00000000 --- a/packages/link/node_modules/solito/build/params/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/params/index.tsx"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,0EAA0E;AAE1E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,MAAM,MAAM,UAAU,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExC,SAAS,SAAS,CAAI,KAAQ;IAC5B,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IACzB,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,CAAC,OAAO,GAAG,KAAK,CAAA;IACrB,CAAC,EAAE,CAAC,KAA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,EAAE,WAAW,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;gBACzC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,MAAM,CAAA;gBAClC,MAAM,QAAQ,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,EAAE,CAAA;gBACxC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;oBACxB,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE;wBAC7C,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAA;qBACrB;iBACF;gBAED,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,EAAE,WAAW,IAAI,MAAM,CAAC,CAAA;gBAErD,MAAM,CACJ;oBACE,QAAQ;oBACR,KAAK,EAAE,QAAQ;iBAChB,EACD,SAAS,EACT;oBACE,OAAO,EAAE,IAAI;iBACd,CACF,CAAA;YACH,CAAC,EAAE,EAAE,CAAC;SACP,CAAA;IACH,CAAC;IAED,OAAO;QACL,QAAQ;QACR,eAAe;QACf,SAAS;KACV,CAAA;AACH,CAAC","sourcesContent":["/* eslint-disable react-hooks/rules-of-hooks */\n// From https://gist.github.com/nandorojo/052887f99bb61b54845474f324aa41cc\n\nimport { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { Platform } from 'react-native'\n\nimport { useNavigation } from '../router/use-navigation'\nimport Router from './router'\nimport { useRoute } from './use-route'\nimport { useRouter } from './use-router'\n\nfunction useStable(value: T) {\n const ref = useRef(value)\n useEffect(() => {\n ref.current = value\n }, [value])\n\n return ref\n}\n\nfunction useStableCallback any>(\n callback: T | undefined\n): T {\n const callbackRef = useRef(callback)\n\n useEffect(() => {\n callbackRef.current = callback\n })\n\n // /~https://github.com/facebook/react/issues/19240\n return useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, [])\n}\n\ntype Config<\n Props extends Record,\n Required extends boolean,\n ParsedType,\n InitialValue\n> = (Required extends false\n ? {\n parse?: (value?: string | string[]) => ParsedType\n }\n : {\n parse: (value?: string | string[]) => ParsedType\n }) & {\n stringify?: (value: ParsedType) => string\n initial: InitialValue\n paramsToClearOnSetState?: (keyof Props)[]\n}\n\ntype Params<\n Props extends Record = Record,\n Name extends keyof Props = keyof Props,\n NullableUnparsedParsedType extends Props[Name] | undefined =\n | Props[Name]\n | undefined,\n ParseFunction extends\n | undefined\n | ((\n value?: string | string[]\n ) => NonNullable) = (\n value?: string | string[]\n ) => NonNullable,\n InitialValue = NullableUnparsedParsedType | undefined,\n ParsedType = InitialValue extends undefined\n ? NullableUnparsedParsedType\n : ParseFunction extends undefined\n ? NullableUnparsedParsedType\n : NonNullable\n> = NonNullable extends string\n ?\n | [name: Name, config: Config]\n | [name: Name]\n : [name: Name, config: Config]\n\ntype Returns<\n Props extends Record = Record,\n Name extends keyof Props = keyof Props,\n NullableUnparsedParsedType extends Props[Name] | undefined =\n | Props[Name]\n | undefined,\n ParseFunction extends\n | undefined\n | ((\n value?: string | string[]\n ) => NonNullable) = (\n value?: string | string[]\n ) => NonNullable,\n InitialValue = NullableUnparsedParsedType | undefined,\n ParsedType = InitialValue extends undefined\n ? NullableUnparsedParsedType\n : ParseFunction extends undefined\n ? NullableUnparsedParsedType\n : NonNullable\n> = readonly [\n state: ParsedType | InitialValue,\n setState: (value: ParsedType, options?: SetStateOptions) => void\n]\n\ntype SetStateOptions = {\n /**\n * Override whether this function calls `Router.push` or `Router.replace`.\n *\n * By default, `Router.push` is called if the query parameter already exists in the URL.\n */\n webBehavior?: 'push' | 'replace'\n}\n\nexport function createParam<\n Props extends Record = Record\n>() {\n function useParam<\n Name extends keyof Props,\n NullableUnparsedParsedType extends Props[Name] | undefined =\n | Props[Name]\n | undefined,\n ParseFunction extends\n | undefined\n | ((\n value?: string | string[]\n ) => NonNullable) = (\n value?: string | string[]\n ) => NonNullable,\n InitialValue = NullableUnparsedParsedType | undefined,\n ParsedType = InitialValue extends undefined\n ? NullableUnparsedParsedType\n : ParseFunction extends undefined\n ? NullableUnparsedParsedType\n : NonNullable\n >(\n ...[name, maybeConfig]: Params<\n Props,\n Name,\n NullableUnparsedParsedType,\n ParseFunction,\n InitialValue,\n ParsedType\n >\n ): Returns<\n Props,\n Name,\n NullableUnparsedParsedType,\n ParseFunction,\n InitialValue,\n ParsedType\n > {\n const {\n parse = (value?: string | string[]) => value,\n initial,\n stringify = (value: ParsedType) => `${value}`,\n paramsToClearOnSetState,\n } = maybeConfig || {}\n const nextRouter = useRouter()\n const nativeRoute = useRoute()\n const nativeNavigation = useNavigation()\n const nativeStateFromParams = (nativeRoute?.params as any)?.[\n name\n ] as ParsedType\n\n const [nativeStateFromReact, setNativeStateFromReact] = useState<\n ParsedType | InitialValue\n >(() => nativeStateFromParams ?? (initial as InitialValue))\n\n const setNativeStateFromParams = useCallback((value: ParsedType) => {\n nativeNavigation?.setParams({\n [name]: value,\n })\n }, [])\n\n const nativeState = nativeRoute\n ? nativeStateFromParams\n : nativeStateFromReact\n const setNativeState = nativeRoute\n ? setNativeStateFromParams\n : setNativeStateFromReact\n\n const stableStringify = useStableCallback(stringify)\n const stableParse = useStableCallback(parse)\n const stableParamsToClear = useStable(paramsToClearOnSetState)\n\n const initialValue = useRef(initial)\n const hasSetState = useRef(false)\n\n const setState = useCallback(\n (value: ParsedType, options?: SetStateOptions) => {\n hasSetState.current = true\n const { pathname, query } = Router\n const newQuery = { ...query }\n if (value != null && (value as any) !== '') {\n newQuery[name as string] = stableStringify(value)\n } else {\n delete newQuery[name as string]\n }\n\n if (stableParamsToClear.current) {\n for (const paramKey of stableParamsToClear.current) {\n delete newQuery[paramKey as string]\n }\n }\n\n const willChangeExistingParam =\n query[name as string] && newQuery[name as string]\n\n let action = willChangeExistingParam ? Router.replace : Router.push\n\n if (options?.webBehavior) {\n action = Router[options.webBehavior]\n }\n\n action(\n {\n pathname,\n query: newQuery,\n },\n undefined,\n {\n shallow: true,\n }\n )\n },\n [name, stableStringify, stableParamsToClear]\n )\n\n const webParam = nextRouter?.query?.[name as string]\n\n const state = useMemo(() => {\n let state: ParsedType\n if (webParam === undefined && !hasSetState.current) {\n state = initialValue.current as any\n } else {\n state = stableParse(webParam) as ParsedType\n }\n return state\n }, [stableParse, webParam])\n\n if (Platform.OS !== 'web') {\n if (!nativeRoute) {\n console.error(\n `[solito] useParam('${\n name as string\n }') called when there is no React Navigation route available. In a future version, this will throw an error. Please fix this by only calling useParam() inside of a React Navigation route. For now, Solito will fallback to using React state.`\n )\n }\n return [nativeState, setNativeState]\n }\n\n return [state, setState]\n }\n\n type UpdateOptions = {\n web?: {\n replace?: boolean\n }\n }\n\n function useUpdateParams(): (\n props: Partial,\n options?: UpdateOptions\n ) => void {\n const nativeNavigation = useNavigation()\n\n const setNativeStateFromParams = useCallback((value: Partial) => {\n nativeNavigation?.setParams(value)\n }, [])\n\n const setWebState = useCallback(\n (value: Partial, options?: UpdateOptions) => {\n const { pathname, query } = Router\n const newQuery = { ...query, ...value }\n for (const key in value) {\n if (value[key] == null || value[key] === '') {\n delete newQuery[key]\n }\n }\n\n const action = options?.web?.replace ? Router.replace : Router.push\n\n action(\n {\n pathname,\n query: newQuery,\n },\n undefined,\n {\n shallow: true,\n }\n )\n },\n []\n )\n\n return Platform.select({\n web: setWebState,\n default: setNativeStateFromParams,\n })\n }\n\n function useParams(): {\n params: Props\n setParams: (value: Partial, options?: SetStateOptions) => void\n } {\n if (Platform.OS !== 'web') {\n const nativeRoute = useRoute()\n const nativeNavigation = useNavigation()\n\n return {\n params: nativeRoute?.params as Props,\n setParams: useCallback(\n (params) => nativeNavigation?.setParams(params),\n [nativeNavigation]\n ),\n }\n }\n const nextRouter = useRouter()\n\n return {\n params: nextRouter?.query as Props,\n setParams: useCallback((params, options) => {\n const { pathname, query } = Router\n const newQuery = { ...query, ...params }\n for (const key in params) {\n if (params[key] == null || params[key] === '') {\n delete newQuery[key]\n }\n }\n\n const action = Router[options?.webBehavior ?? 'push']\n\n action(\n {\n pathname,\n query: newQuery,\n },\n undefined,\n {\n shallow: true,\n }\n )\n }, []),\n }\n }\n\n return {\n useParam,\n useUpdateParams,\n useParams,\n }\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/router.d.ts b/packages/link/node_modules/solito/build/params/router.d.ts deleted file mode 100644 index a2c3ff27..00000000 --- a/packages/link/node_modules/solito/build/params/router.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _default: import("next/router").SingletonRouter; -export default _default; diff --git a/packages/link/node_modules/solito/build/params/router.js b/packages/link/node_modules/solito/build/params/router.js deleted file mode 100644 index 7ccb6920..00000000 --- a/packages/link/node_modules/solito/build/params/router.js +++ /dev/null @@ -1,2 +0,0 @@ -export default undefined; -//# sourceMappingURL=router.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/router.js.map b/packages/link/node_modules/solito/build/params/router.js.map deleted file mode 100644 index 539bf943..00000000 --- a/packages/link/node_modules/solito/build/params/router.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"router.js","sourceRoot":"","sources":["../../src/params/router.ts"],"names":[],"mappings":"AAEA,eAAe,SAAiC,CAAA","sourcesContent":["import type Router from 'next/router'\n\nexport default undefined as any as typeof Router\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/router.web.d.ts b/packages/link/node_modules/solito/build/params/router.web.d.ts deleted file mode 100644 index 6f2fdd49..00000000 --- a/packages/link/node_modules/solito/build/params/router.web.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'next/router'; diff --git a/packages/link/node_modules/solito/build/params/router.web.js b/packages/link/node_modules/solito/build/params/router.web.js deleted file mode 100644 index 5bce5a6c..00000000 --- a/packages/link/node_modules/solito/build/params/router.web.js +++ /dev/null @@ -1,2 +0,0 @@ -export { default } from 'next/router'; -//# sourceMappingURL=router.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/router.web.js.map b/packages/link/node_modules/solito/build/params/router.web.js.map deleted file mode 100644 index bb205da0..00000000 --- a/packages/link/node_modules/solito/build/params/router.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"router.web.js","sourceRoot":"","sources":["../../src/params/router.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA","sourcesContent":["export { default } from 'next/router'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/use-route.d.ts b/packages/link/node_modules/solito/build/params/use-route.d.ts deleted file mode 100644 index 73d4f7f2..00000000 --- a/packages/link/node_modules/solito/build/params/use-route.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const useRoute: () => import("@react-navigation/native").Route | undefined; diff --git a/packages/link/node_modules/solito/build/params/use-route.js b/packages/link/node_modules/solito/build/params/use-route.js deleted file mode 100644 index 619653ba..00000000 --- a/packages/link/node_modules/solito/build/params/use-route.js +++ /dev/null @@ -1,4 +0,0 @@ -import { NavigationRouteContext } from '@react-navigation/native'; -import { useContext } from 'react'; -export const useRoute = () => useContext(NavigationRouteContext); -//# sourceMappingURL=use-route.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/use-route.js.map b/packages/link/node_modules/solito/build/params/use-route.js.map deleted file mode 100644 index 7338b876..00000000 --- a/packages/link/node_modules/solito/build/params/use-route.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-route.js","sourceRoot":"","sources":["../../src/params/use-route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,sBAAsB,CAAC,CAAA","sourcesContent":["import { NavigationRouteContext } from '@react-navigation/native'\nimport { useContext } from 'react'\n\nexport const useRoute = () => useContext(NavigationRouteContext)\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/use-route.web.d.ts b/packages/link/node_modules/solito/build/params/use-route.web.d.ts deleted file mode 100644 index 27e7db6d..00000000 --- a/packages/link/node_modules/solito/build/params/use-route.web.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const useRoute: () => undefined; diff --git a/packages/link/node_modules/solito/build/params/use-route.web.js b/packages/link/node_modules/solito/build/params/use-route.web.js deleted file mode 100644 index 5c0533ba..00000000 --- a/packages/link/node_modules/solito/build/params/use-route.web.js +++ /dev/null @@ -1,2 +0,0 @@ -export const useRoute = () => undefined; -//# sourceMappingURL=use-route.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/use-route.web.js.map b/packages/link/node_modules/solito/build/params/use-route.web.js.map deleted file mode 100644 index dd3a36b9..00000000 --- a/packages/link/node_modules/solito/build/params/use-route.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-route.web.js","sourceRoot":"","sources":["../../src/params/use-route.web.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,SAAS,CAAA","sourcesContent":["export const useRoute = () => undefined\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/use-router.d.ts b/packages/link/node_modules/solito/build/params/use-router.d.ts deleted file mode 100644 index 2ad09fbe..00000000 --- a/packages/link/node_modules/solito/build/params/use-router.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { NextRouter } from 'next/router'; -export declare const useRouter: () => NextRouter | undefined; diff --git a/packages/link/node_modules/solito/build/params/use-router.js b/packages/link/node_modules/solito/build/params/use-router.js deleted file mode 100644 index d2a64e17..00000000 --- a/packages/link/node_modules/solito/build/params/use-router.js +++ /dev/null @@ -1,2 +0,0 @@ -export const useRouter = () => undefined; -//# sourceMappingURL=use-router.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/use-router.js.map b/packages/link/node_modules/solito/build/params/use-router.js.map deleted file mode 100644 index 65b54e95..00000000 --- a/packages/link/node_modules/solito/build/params/use-router.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-router.js","sourceRoot":"","sources":["../../src/params/use-router.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,SAAmC,CAAA","sourcesContent":["import { NextRouter } from 'next/router'\n\nexport const useRouter = () => undefined as NextRouter | undefined\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/use-router.web.d.ts b/packages/link/node_modules/solito/build/params/use-router.web.d.ts deleted file mode 100644 index 612d0ce9..00000000 --- a/packages/link/node_modules/solito/build/params/use-router.web.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const useRouter: () => import("next/router").NextRouter; diff --git a/packages/link/node_modules/solito/build/params/use-router.web.js b/packages/link/node_modules/solito/build/params/use-router.web.js deleted file mode 100644 index ae313028..00000000 --- a/packages/link/node_modules/solito/build/params/use-router.web.js +++ /dev/null @@ -1,3 +0,0 @@ -import { useRouter as _useRouter } from 'next/router'; -export const useRouter = () => _useRouter(); -//# sourceMappingURL=use-router.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/params/use-router.web.js.map b/packages/link/node_modules/solito/build/params/use-router.web.js.map deleted file mode 100644 index 7dba3b86..00000000 --- a/packages/link/node_modules/solito/build/params/use-router.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-router.web.js","sourceRoot":"","sources":["../../src/params/use-router.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC","sourcesContent":["import { useRouter as _useRouter } from 'next/router';\n\nexport const useRouter = () => _useRouter();"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/index.d.ts b/packages/link/node_modules/solito/build/router/index.d.ts deleted file mode 100644 index 075d1ed1..00000000 --- a/packages/link/node_modules/solito/build/router/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './parse-next-path'; -export * from './use-router'; diff --git a/packages/link/node_modules/solito/build/router/index.js b/packages/link/node_modules/solito/build/router/index.js deleted file mode 100644 index 1d9cedd1..00000000 --- a/packages/link/node_modules/solito/build/router/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export * from './parse-next-path'; -export * from './use-router'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/index.js.map b/packages/link/node_modules/solito/build/router/index.js.map deleted file mode 100644 index 420fea3c..00000000 --- a/packages/link/node_modules/solito/build/router/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/router/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA","sourcesContent":["export * from './parse-next-path'\nexport * from './use-router'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/next-router.d.ts b/packages/link/node_modules/solito/build/router/next-router.d.ts deleted file mode 100644 index 3e2565ef..00000000 --- a/packages/link/node_modules/solito/build/router/next-router.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import Router from 'next/router'; -export declare const NextRouter: typeof Router | undefined; diff --git a/packages/link/node_modules/solito/build/router/next-router.js b/packages/link/node_modules/solito/build/router/next-router.js deleted file mode 100644 index 20e36521..00000000 --- a/packages/link/node_modules/solito/build/router/next-router.js +++ /dev/null @@ -1,3 +0,0 @@ -import Router from 'next/router'; -export const NextRouter = Router; -//# sourceMappingURL=next-router.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/next-router.js.map b/packages/link/node_modules/solito/build/router/next-router.js.map deleted file mode 100644 index 03831e03..00000000 --- a/packages/link/node_modules/solito/build/router/next-router.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"next-router.js","sourceRoot":"","sources":["../../src/router/next-router.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAEhC,MAAM,CAAC,MAAM,UAAU,GAA8B,MAAM,CAAA","sourcesContent":["import Router from 'next/router'\n\nexport const NextRouter: typeof Router | undefined = Router\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/next-router.web.d.ts b/packages/link/node_modules/solito/build/router/next-router.web.d.ts deleted file mode 100644 index d09e82a3..00000000 --- a/packages/link/node_modules/solito/build/router/next-router.web.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const NextRouter: undefined; diff --git a/packages/link/node_modules/solito/build/router/next-router.web.js b/packages/link/node_modules/solito/build/router/next-router.web.js deleted file mode 100644 index ca77f95c..00000000 --- a/packages/link/node_modules/solito/build/router/next-router.web.js +++ /dev/null @@ -1,2 +0,0 @@ -export const NextRouter = undefined; -//# sourceMappingURL=next-router.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/next-router.web.js.map b/packages/link/node_modules/solito/build/router/next-router.web.js.map deleted file mode 100644 index 203675ca..00000000 --- a/packages/link/node_modules/solito/build/router/next-router.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"next-router.web.js","sourceRoot":"","sources":["../../src/router/next-router.web.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAA","sourcesContent":["export const NextRouter = undefined\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/parse-next-path.d.ts b/packages/link/node_modules/solito/build/router/parse-next-path.d.ts deleted file mode 100644 index c1c854b7..00000000 --- a/packages/link/node_modules/solito/build/router/parse-next-path.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { NextRouter } from 'next/router'; -declare const parseNextPath: (from: Parameters[0]) => string; -export { parseNextPath }; diff --git a/packages/link/node_modules/solito/build/router/parse-next-path.js b/packages/link/node_modules/solito/build/router/parse-next-path.js deleted file mode 100644 index 702a5035..00000000 --- a/packages/link/node_modules/solito/build/router/parse-next-path.js +++ /dev/null @@ -1,37 +0,0 @@ -const parseNextPath = (from) => { - let path = (typeof from == 'string' ? from : from.pathname) || ''; - // replace each instance of [key] with the corresponding value from query[key] - // this ensures we're navigating to the correct URL - // it currently ignores [[...param]] - // but I can't see why you would use this with RN + Next.js - if (typeof from == 'object' && from.query && typeof from.query == 'object') { - const query = { ...from.query }; - for (const key in query) { - if (path.includes(`[${key}]`)) { - path = path.replace(`[${key}]`, `${query[key] ?? ''}`); - delete query[key]; - } - else if (path.includes(`[...${key}]`)) { - const values = query[key]; - if (Array.isArray(values)) { - path = path.replace(`[...${key}]`, values.join('/')); - delete query[key]; - } - } - } - if (Object.keys(query).length) { - path += '?'; - for (const key in query) { - if (query[key] != null) { - path += `${key}=${query[key]}&`; - } - } - if (path.endsWith('&') || path.endsWith('?')) { - path = path.slice(0, -1); - } - } - } - return path; -}; -export { parseNextPath }; -//# sourceMappingURL=parse-next-path.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/parse-next-path.js.map b/packages/link/node_modules/solito/build/router/parse-next-path.js.map deleted file mode 100644 index 4c4ff6d6..00000000 --- a/packages/link/node_modules/solito/build/router/parse-next-path.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"parse-next-path.js","sourceRoot":"","sources":["../../src/router/parse-next-path.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,CAAC,IAAuC,EAAE,EAAE;IAChE,IAAI,IAAI,GAAG,CAAC,OAAO,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAA;IAEjE,8EAA8E;IAC9E,mDAAmD;IACnD,oCAAoC;IACpC,2DAA2D;IAC3D,IAAI,OAAO,IAAI,IAAI,QAAQ,IAAI,IAAI,CAAC,KAAK,IAAI,OAAO,IAAI,CAAC,KAAK,IAAI,QAAQ,EAAE;QAC1E,MAAM,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,EAAE,CAAA;QAC/B,KAAK,M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) => {\n let path = (typeof from == 'string' ? from : from.pathname) || ''\n\n // replace each instance of [key] with the corresponding value from query[key]\n // this ensures we're navigating to the correct URL\n // it currently ignores [[...param]]\n // but I can't see why you would use this with RN + Next.js\n if (typeof from == 'object' && from.query && typeof from.query == 'object') {\n const query = { ...from.query }\n for (const key in query) {\n if (path.includes(`[${key}]`)) {\n path = path.replace(`[${key}]`, `${query[key] ?? ''}`)\n delete query[key]\n } else if (path.includes(`[...${key}]`)) {\n const values = query[key]\n if (Array.isArray(values)) {\n path = path.replace(`[...${key}]`, values.join('/'))\n delete query[key]\n }\n }\n }\n if (Object.keys(query).length) {\n path += '?'\n for (const key in query) {\n if (query[key] != null) {\n path += `${key}=${query[key]}&`\n }\n }\n if (path.endsWith('&') || path.endsWith('?')) {\n path = path.slice(0, -1)\n }\n }\n }\n\n return path\n}\n\nexport { parseNextPath }\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/replace-helpers.d.ts b/packages/link/node_modules/solito/build/router/replace-helpers.d.ts deleted file mode 100644 index 1e97197b..00000000 --- a/packages/link/node_modules/solito/build/router/replace-helpers.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { StackActions, getStateFromPath, getActionFromState } from '@react-navigation/native'; -import LinkingContext from '@react-navigation/native/src/LinkingContext'; -export { LinkingContext, StackActions, getStateFromPath, getActionFromState }; diff --git a/packages/link/node_modules/solito/build/router/replace-helpers.js b/packages/link/node_modules/solito/build/router/replace-helpers.js deleted file mode 100644 index 86348878..00000000 --- a/packages/link/node_modules/solito/build/router/replace-helpers.js +++ /dev/null @@ -1,10 +0,0 @@ -import { StackActions, getStateFromPath, getActionFromState, } from '@react-navigation/native'; -// THIS IS DANGEROUS -// IT ONLY WORKS ON NATIVE BECAUSE NATIVE USES THE SRC FOLDER CURRENTLY. -// THIS IS SUPER UNSAFE -// WE SHOULD BE USING THE EXPOSED VARIABLE -// see: /~https://github.com/react-navigation/react-navigation/discussions/10517 -// PR: /~https://github.com/react-navigation/react-navigation/pull/10604 -import LinkingContext from '@react-navigation/native/src/LinkingContext'; -export { LinkingContext, StackActions, getStateFromPath, getActionFromState }; -//# sourceMappingURL=replace-helpers.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/replace-helpers.js.map b/packages/link/node_modules/solito/build/router/replace-helpers.js.map deleted file mode 100644 index 7f484d6d..00000000 --- a/packages/link/node_modules/solito/build/router/replace-helpers.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"replace-helpers.js","sourceRoot":"","sources":["../../src/router/replace-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,0BAA0B,CAAA;AACjC,oBAAoB;AACpB,wEAAwE;AACxE,uBAAuB;AACvB,0CAA0C;AAC1C,8EAA8E;AAC9E,sEAAsE;AACtE,OAAO,cAAc,MAAM,6CAA6C,CAAA;AAExE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,CAAA","sourcesContent":["import {\n StackActions,\n getStateFromPath,\n getActionFromState,\n} from '@react-navigation/native'\n// THIS IS DANGEROUS\n// IT ONLY WORKS ON NATIVE BECAUSE NATIVE USES THE SRC FOLDER CURRENTLY.\n// THIS IS SUPER UNSAFE\n// WE SHOULD BE USING THE EXPOSED VARIABLE\n// see: /~https://github.com/react-navigation/react-navigation/discussions/10517\n// PR: /~https://github.com/react-navigation/react-navigation/pull/10604\nimport LinkingContext from '@react-navigation/native/src/LinkingContext'\n\nexport { LinkingContext, StackActions, getStateFromPath, getActionFromState }\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/replace-helpers.web.d.ts b/packages/link/node_modules/solito/build/router/replace-helpers.web.d.ts deleted file mode 100644 index 33c99352..00000000 --- a/packages/link/node_modules/solito/build/router/replace-helpers.web.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -declare const LinkingContext: import("react").Context<{ - options: undefined; -}>; -declare let StackActions: any, getStateFromPath: any, getActionFromState: any; -export { LinkingContext, StackActions, getStateFromPath, getActionFromState }; diff --git a/packages/link/node_modules/solito/build/router/replace-helpers.web.js b/packages/link/node_modules/solito/build/router/replace-helpers.web.js deleted file mode 100644 index ace7c00f..00000000 --- a/packages/link/node_modules/solito/build/router/replace-helpers.web.js +++ /dev/null @@ -1,7 +0,0 @@ -import { createContext } from 'react'; -const LinkingContext = createContext({ - options: undefined, -}); -let StackActions, getStateFromPath, getActionFromState; -export { LinkingContext, StackActions, getStateFromPath, getActionFromState }; -//# sourceMappingURL=replace-helpers.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/replace-helpers.web.js.map b/packages/link/node_modules/solito/build/router/replace-helpers.web.js.map deleted file mode 100644 index d4c9dd80..00000000 --- a/packages/link/node_modules/solito/build/router/replace-helpers.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"replace-helpers.web.js","sourceRoot":"","sources":["../../src/router/replace-helpers.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAErC,MAAM,cAAc,GAAG,aAAa,CAAC;IACnC,OAAO,EAAE,SAAS;CACnB,CAAC,CAAA;AAEF,IAAI,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,CAAA;AAEtD,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,CAAA","sourcesContent":["import { createContext } from 'react'\n\nconst LinkingContext = createContext({\n options: undefined,\n})\n\nlet StackActions, getStateFromPath, getActionFromState\n\nexport { LinkingContext, StackActions, getStateFromPath, getActionFromState }\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-link-to.d.ts b/packages/link/node_modules/solito/build/router/use-link-to.d.ts deleted file mode 100644 index 16e65a09..00000000 --- a/packages/link/node_modules/solito/build/router/use-link-to.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare function useLinkTo(): (to: import("@react-navigation/native/lib/typescript/src/useLinkTo").To) => void; diff --git a/packages/link/node_modules/solito/build/router/use-link-to.js b/packages/link/node_modules/solito/build/router/use-link-to.js deleted file mode 100644 index e30bf7ed..00000000 --- a/packages/link/node_modules/solito/build/router/use-link-to.js +++ /dev/null @@ -1,8 +0,0 @@ -import { useLinkTo as useNativeLinkTo } from '@react-navigation/native'; -import { useContext } from 'react'; -import { MiddlewareContext } from '../middleware/context'; -export function useLinkTo() { - const hook = useContext(MiddlewareContext).useLinkTo ?? useNativeLinkTo; - return hook(); -} -//# sourceMappingURL=use-link-to.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-link-to.js.map b/packages/link/node_modules/solito/build/router/use-link-to.js.map deleted file mode 100644 index e6d9605f..00000000 --- a/packages/link/node_modules/solito/build/router/use-link-to.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-link-to.js","sourceRoot":"","sources":["../../src/router/use-link-to.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEzD,MAAM,UAAU,SAAS;IACvB,MAAM,IAAI,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC,SAAS,IAAI,eAAe,CAAA;IAEvE,OAAO,IAAI,EAAE,CAAA;AACf,CAAC","sourcesContent":["import { useLinkTo as useNativeLinkTo } from '@react-navigation/native'\nimport { useContext } from 'react'\n\nimport { MiddlewareContext } from '../middleware/context'\n\nexport function useLinkTo() {\n const hook = useContext(MiddlewareContext).useLinkTo ?? useNativeLinkTo\n\n return hook()\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-link-to.web.d.ts b/packages/link/node_modules/solito/build/router/use-link-to.web.d.ts deleted file mode 100644 index 5a5d17d8..00000000 --- a/packages/link/node_modules/solito/build/router/use-link-to.web.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * @deprecated imported from the wrong file. Use `use-link-to` instead. - */ -export declare const useLinkTo: () => () => never; diff --git a/packages/link/node_modules/solito/build/router/use-link-to.web.js b/packages/link/node_modules/solito/build/router/use-link-to.web.js deleted file mode 100644 index 2a6e785a..00000000 --- a/packages/link/node_modules/solito/build/router/use-link-to.web.js +++ /dev/null @@ -1,8 +0,0 @@ -const noOp = () => { - throw new Error('[use-link-to] is not supported on the web. Something went wrong if you called this.'); -}; -/** - * @deprecated imported from the wrong file. Use `use-link-to` instead. - */ -export const useLinkTo = () => noOp; -//# sourceMappingURL=use-link-to.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-link-to.web.js.map b/packages/link/node_modules/solito/build/router/use-link-to.web.js.map deleted file mode 100644 index 7adce554..00000000 --- a/packages/link/node_modules/solito/build/router/use-link-to.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-link-to.web.js","sourceRoot":"","sources":["../../src/router/use-link-to.web.ts"],"names":[],"mappings":"AAAA,MAAM,IAAI,GAAG,GAAG,EAAE;IAChB,MAAM,IAAI,KAAK,CACb,qFAAqF,CACtF,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA","sourcesContent":["const noOp = () => {\n throw new Error(\n '[use-link-to] is not supported on the web. Something went wrong if you called this.'\n )\n}\n\n/**\n * @deprecated imported from the wrong file. Use `use-link-to` instead.\n */\nexport const useLinkTo = () => noOp\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-navigation.d.ts b/packages/link/node_modules/solito/build/router/use-navigation.d.ts deleted file mode 100644 index a830d3ec..00000000 --- a/packages/link/node_modules/solito/build/router/use-navigation.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -export declare const useNavigation: () => import("@react-navigation/core").NavigationProp & Readonly<{ - params?: Readonly; - }> & { - state?: Readonly | import("@react-navigation/core").PartialState> | undefined; - })[]; - type: string; - stale: false; -}>, {}, {}> | import("@react-navigation/core").NavigationContainerRef | undefined; diff --git a/packages/link/node_modules/solito/build/router/use-navigation.js b/packages/link/node_modules/solito/build/router/use-navigation.js deleted file mode 100644 index 1832ed33..00000000 --- a/packages/link/node_modules/solito/build/router/use-navigation.js +++ /dev/null @@ -1,11 +0,0 @@ -import { NavigationContext, NavigationContainerRefContext, } from '@react-navigation/core'; -import { useContext } from 'react'; -export const useNavigation = () => { - const root = useContext(NavigationContainerRefContext); - const navigation = useContext(NavigationContext); - if (navigation === undefined && root === undefined) { - throw new Error("Couldn't find a navigation object. Is your component inside NavigationContainer?"); - } - return navigation !== null && navigation !== void 0 ? navigation : root; -}; -//# sourceMappingURL=use-navigation.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-navigation.js.map b/packages/link/node_modules/solito/build/router/use-navigation.js.map deleted file mode 100644 index 02d4e90e..00000000 --- a/packages/link/node_modules/solito/build/router/use-navigation.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-navigation.js","sourceRoot":"","sources":["../../src/router/use-navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAElC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,MAAM,IAAI,GAAG,UAAU,CAAC,6BAA6B,CAAC,CAAA;IACtD,MAAM,UAAU,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAA;IAEhD,IAAI,UAAU,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,EAAE;QAClD,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;KACF;IAED,OAAO,UAAU,KAAK,IAAI,IAAI,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAA;AACzE,CAAC,CAAA","sourcesContent":["import {\n NavigationContext,\n NavigationContainerRefContext,\n} from '@react-navigation/core'\nimport { useContext } from 'react'\n\nexport const useNavigation = () => {\n const root = useContext(NavigationContainerRefContext)\n const navigation = useContext(NavigationContext)\n\n if (navigation === undefined && root === undefined) {\n throw new Error(\n \"Couldn't find a navigation object. Is your component inside NavigationContainer?\"\n )\n }\n\n return navigation !== null && navigation !== void 0 ? navigation : root\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-navigation.web.d.ts b/packages/link/node_modules/solito/build/router/use-navigation.web.d.ts deleted file mode 100644 index d5d2c049..00000000 --- a/packages/link/node_modules/solito/build/router/use-navigation.web.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const useNavigation: () => undefined; diff --git a/packages/link/node_modules/solito/build/router/use-navigation.web.js b/packages/link/node_modules/solito/build/router/use-navigation.web.js deleted file mode 100644 index 617e5b8e..00000000 --- a/packages/link/node_modules/solito/build/router/use-navigation.web.js +++ /dev/null @@ -1,2 +0,0 @@ -export const useNavigation = () => undefined; -//# sourceMappingURL=use-navigation.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-navigation.web.js.map b/packages/link/node_modules/solito/build/router/use-navigation.web.js.map deleted file mode 100644 index fa33d5e5..00000000 --- a/packages/link/node_modules/solito/build/router/use-navigation.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-navigation.web.js","sourceRoot":"","sources":["../../src/router/use-navigation.web.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,SAAS,CAAA","sourcesContent":["export const useNavigation = () => undefined\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-next-router.d.ts b/packages/link/node_modules/solito/build/router/use-next-router.d.ts deleted file mode 100644 index ca7688b6..00000000 --- a/packages/link/node_modules/solito/build/router/use-next-router.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { useRouter } from 'next/router'; -export declare const useNextRouter: () => ReturnType | undefined; diff --git a/packages/link/node_modules/solito/build/router/use-next-router.js b/packages/link/node_modules/solito/build/router/use-next-router.js deleted file mode 100644 index 295f7aec..00000000 --- a/packages/link/node_modules/solito/build/router/use-next-router.js +++ /dev/null @@ -1,2 +0,0 @@ -export const useNextRouter = () => undefined; -//# sourceMappingURL=use-next-router.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-next-router.js.map b/packages/link/node_modules/solito/build/router/use-next-router.js.map deleted file mode 100644 index cbd6454a..00000000 --- a/packages/link/node_modules/solito/build/router/use-next-router.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-next-router.js","sourceRoot":"","sources":["../../src/router/use-next-router.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG,GAA6C,EAAE,CAC1E,SAAS,CAAA","sourcesContent":["import type { useRouter } from 'next/router'\n\nexport const useNextRouter = (): ReturnType | undefined =>\n undefined\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-next-router.web.d.ts b/packages/link/node_modules/solito/build/router/use-next-router.web.d.ts deleted file mode 100644 index a344188c..00000000 --- a/packages/link/node_modules/solito/build/router/use-next-router.web.d.ts +++ /dev/null @@ -1 +0,0 @@ -export { useRouter as useNextRouter } from 'next/router'; diff --git a/packages/link/node_modules/solito/build/router/use-next-router.web.js b/packages/link/node_modules/solito/build/router/use-next-router.web.js deleted file mode 100644 index 2c731e0c..00000000 --- a/packages/link/node_modules/solito/build/router/use-next-router.web.js +++ /dev/null @@ -1,2 +0,0 @@ -export { useRouter as useNextRouter } from 'next/router'; -//# sourceMappingURL=use-next-router.web.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-next-router.web.js.map b/packages/link/node_modules/solito/build/router/use-next-router.web.js.map deleted file mode 100644 index 93daa162..00000000 --- a/packages/link/node_modules/solito/build/router/use-next-router.web.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-next-router.web.js","sourceRoot":"","sources":["../../src/router/use-next-router.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,aAAa,CAAA","sourcesContent":["export { useRouter as useNextRouter } from 'next/router'\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-router.d.ts b/packages/link/node_modules/solito/build/router/use-router.d.ts deleted file mode 100644 index f7cea73c..00000000 --- a/packages/link/node_modules/solito/build/router/use-router.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// -import type { NextRouter as NextRouterType } from 'next/router'; -interface TransitionOptions { - shallow?: boolean; - locale?: string | false; - scroll?: boolean; -} -export declare function useRouter(): { - push: (url: Parameters[0], as?: Parameters[1], transitionOptions?: TransitionOptions | undefined) => void; - replace: (url: Parameters[0], as?: Parameters[1], transitionOptions?: (TransitionOptions & { - experimental?: { - nativeBehavior?: undefined; - } | { - nativeBehavior: 'stack-replace'; - isNestedNavigator: boolean; - } | undefined; - }) | undefined) => void; - back: () => void; - parseNextPath: (from: string | import("url").UrlObject) => string; -}; -export {}; diff --git a/packages/link/node_modules/solito/build/router/use-router.js b/packages/link/node_modules/solito/build/router/use-router.js deleted file mode 100644 index 5fbe7273..00000000 --- a/packages/link/node_modules/solito/build/router/use-router.js +++ /dev/null @@ -1,92 +0,0 @@ -import { useContext, useMemo } from 'react'; -import { Platform } from 'react-native'; -import { parseNextPath } from './parse-next-path'; -import { getActionFromState, getStateFromPath, LinkingContext, StackActions, } from './replace-helpers'; -import { useLinkTo } from './use-link-to'; -import { useNavigation } from './use-navigation'; -import { useNextRouter } from './use-next-router'; -export function useRouter() { - const linkTo = useLinkTo(); - const navigation = useNavigation(); - const nextRouter = useNextRouter(); - const linking = useContext(LinkingContext); - return useMemo(() => ({ - push: (url, as, transitionOptions) => { - if (Platform.OS === 'web') { - nextRouter?.push(url, as, transitionOptions); - } - else { - const to = parseNextPath(as || url); - if (to) { - linkTo(to); - } - } - }, - replace: (url, as, transitionOptions) => { - if (Platform.OS === 'web') { - nextRouter?.replace(url, as, transitionOptions); - } - else { - const to = parseNextPath(as || url); - if (to) { - if (transitionOptions?.experimental?.nativeBehavior === - 'stack-replace') { - if (linking?.options) { - // custom logic to create a replace() from a URL on native - // /~https://github.com/react-navigation/react-navigation/discussions/10517 - const { options } = linking; - const state = options?.getStateFromPath - ? options.getStateFromPath(to, options.config) - : getStateFromPath(to, options?.config); - if (state) { - const action = getActionFromState(state, options?.config); - if (action !== undefined) { - if ('payload' in action && - action.payload && - 'name' in action.payload && - action.payload.name) { - const { name, params } = action.payload; - if (transitionOptions?.experimental?.isNestedNavigator && - params && - 'screen' in params && - params.screen) { - navigation?.dispatch(StackActions.replace(params.screen, params.params)); - } - else { - navigation?.dispatch(StackActions.replace(name, params)); - } - } - else { - navigation?.dispatch(action); - } - } - else { - navigation?.reset(state); - } - } - } - else { - // fallback in case the linking context didn't work - console.warn(`[solito] replace("${to}") faced an issue. You should still see your new screen, but it probably didn't replace the previous one. This may be due to a breaking change in React Navigation. - Please open an issue at /~https://github.com/nandorojo/solito and report how this happened. Thanks!`); - linkTo(to); - } - } - else { - linkTo(to); - } - } - } - }, - back: () => { - if (Platform.OS === 'web') { - nextRouter?.back(); - } - else { - navigation?.goBack(); - } - }, - parseNextPath, - }), [linkTo, navigation]); -} -//# sourceMappingURL=use-router.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/router/use-router.js.map b/packages/link/node_modules/solito/build/router/use-router.js.map deleted file mode 100644 index 491685f8..00000000 --- a/packages/link/node_modules/solito/build/router/use-router.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"use-router.js","sourceRoot":"","sources":["../../src/router/use-router.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvC,OAAO,EAAE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,CAAC,qBAAqB,EAAE;oGACgD,CAAC,CAAA;4BACrF,MAAM,CAAC,EAAE,CAAC,CAAA;yBACX;qBACF;yBAAM;wBACL,MAAM,CAAC,EAAE,CAAC,CAAA;qBACX;iBACF;aACF;QACH,CAAC;QACD,IAAI,EAAE,GAAG,EAAE;YACT,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;gBACzB,UAAU,EAAE,IAAI,EAAE,CAAA;aACnB;iBAAM;gBACL,UAAU,EAAE,MAAM,EAAE,CAAA;aACrB;QACH,CAAC;QACD,aAAa;KACd,CAAC,EACF,CAAC,MAAM,EAAE,UAAU,CAAC,CACrB,CAAA;AACH,CAAC","sourcesContent":["import type { NextRouter as NextRouterType } from 'next/router'\nimport { useContext, useMemo } from 'react'\nimport { Platform } from 'react-native'\n\nimport { parseNextPath } from './parse-next-path'\nimport {\n getActionFromState,\n getStateFromPath,\n LinkingContext,\n StackActions,\n} from './replace-helpers'\nimport { useLinkTo } from './use-link-to'\nimport { useNavigation } from './use-navigation'\nimport { useNextRouter } from './use-next-router'\n\n// copied from next/router to appease typescript error\n// if we don't manually write this here, then we get some ReturnType error on build\n// 🤷‍♂️\ninterface TransitionOptions {\n shallow?: boolean\n locale?: string | false\n scroll?: boolean\n}\n\nexport function useRouter() {\n const linkTo = useLinkTo()\n const navigation = useNavigation()\n\n const nextRouter = useNextRouter()\n\n const linking = useContext(LinkingContext)\n\n return useMemo(\n () => ({\n push: (\n url: Parameters[0],\n as?: Parameters[1],\n transitionOptions?: TransitionOptions\n ) => {\n if (Platform.OS === 'web') {\n nextRouter?.push(url, as, transitionOptions)\n } else {\n const to = parseNextPath(as || url)\n\n if (to) {\n linkTo(to)\n }\n }\n },\n replace: (\n url: Parameters[0],\n as?: Parameters[1],\n transitionOptions?: TransitionOptions & {\n experimental?:\n | {\n nativeBehavior?: undefined\n }\n | {\n nativeBehavior: 'stack-replace'\n isNestedNavigator: boolean\n }\n }\n ) => {\n if (Platform.OS === 'web') {\n nextRouter?.replace(url, as, transitionOptions)\n } else {\n const to = parseNextPath(as || url)\n\n if (to) {\n if (\n transitionOptions?.experimental?.nativeBehavior ===\n 'stack-replace'\n ) {\n if (linking?.options) {\n // custom logic to create a replace() from a URL on native\n // /~https://github.com/react-navigation/react-navigation/discussions/10517\n const { options } = linking\n\n const state = options?.getStateFromPath\n ? options.getStateFromPath(to, options.config)\n : getStateFromPath(to, options?.config)\n\n if (state) {\n const action = getActionFromState(state, options?.config)\n\n if (action !== undefined) {\n if (\n 'payload' in action &&\n action.payload &&\n 'name' in action.payload &&\n action.payload.name\n ) {\n const { name, params } = action.payload\n if (\n transitionOptions?.experimental?.isNestedNavigator &&\n params &&\n 'screen' in params &&\n params.screen\n ) {\n navigation?.dispatch(\n StackActions.replace(\n params.screen,\n params.params as object | undefined\n )\n )\n } else {\n navigation?.dispatch(StackActions.replace(name, params))\n }\n } else {\n navigation?.dispatch(action)\n }\n } else {\n navigation?.reset(state)\n }\n }\n } else {\n // fallback in case the linking context didn't work\n console.warn(`[solito] replace(\"${to}\") faced an issue. You should still see your new screen, but it probably didn't replace the previous one. This may be due to a breaking change in React Navigation. \n Please open an issue at /~https://github.com/nandorojo/solito and report how this happened. Thanks!`)\n linkTo(to)\n }\n } else {\n linkTo(to)\n }\n }\n }\n },\n back: () => {\n if (Platform.OS === 'web') {\n nextRouter?.back()\n } else {\n navigation?.goBack()\n }\n },\n parseNextPath,\n }),\n [linkTo, navigation]\n )\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/types/solito-page.d.ts b/packages/link/node_modules/solito/build/types/solito-page.d.ts deleted file mode 100644 index fb375d2c..00000000 --- a/packages/link/node_modules/solito/build/types/solito-page.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -/// -import type { NextPage } from 'next'; -import type { AppProps } from 'next/app'; -interface SolitoCustomNavigationOptions { -} -interface SolitoNavigationOptions extends SolitoCustomNavigationOptions { - previousPagePath?: string | null; -} -declare type NavigationOptions = SolitoNavigationOptions | ((router?: AppProps['router']) => SolitoNavigationOptions); -declare type SolitoPage

= NextPage & { - navigationOptions?: NavigationOptions; - getLayout?: (page: React.ReactNode, options?: NavigationOptions) => React.ReactNode; -}; -export declare type SolitoAppProps

= Omit, 'Component'> & { - Component: AppProps

['Component'] & { - navigationOptions?: NavigationOptions; - getLayout?: (page: React.ReactNode, options?: NavigationOptions) => React.ReactNode; - }; -}; -export type { SolitoPage, SolitoNavigationOptions, SolitoCustomNavigationOptions, }; diff --git a/packages/link/node_modules/solito/build/types/solito-page.js b/packages/link/node_modules/solito/build/types/solito-page.js deleted file mode 100644 index 87b5d989..00000000 --- a/packages/link/node_modules/solito/build/types/solito-page.js +++ /dev/null @@ -1,2 +0,0 @@ -export {}; -//# sourceMappingURL=solito-page.js.map \ No newline at end of file diff --git a/packages/link/node_modules/solito/build/types/solito-page.js.map b/packages/link/node_modules/solito/build/types/solito-page.js.map deleted file mode 100644 index 2ef8a256..00000000 --- a/packages/link/node_modules/solito/build/types/solito-page.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"solito-page.js","sourceRoot":"","sources":["../../src/types/solito-page.tsx"],"names":[],"mappings":"","sourcesContent":["/* eslint-disable @typescript-eslint/ban-types */\nimport type { NextPage } from 'next'\nimport type { AppProps } from 'next/app'\n\ninterface SolitoCustomNavigationOptions {}\n\ninterface SolitoNavigationOptions extends SolitoCustomNavigationOptions {\n previousPagePath?: string | null\n}\n\ntype NavigationOptions =\n | SolitoNavigationOptions\n | ((router?: AppProps['router']) => SolitoNavigationOptions)\n\ntype SolitoPage

= NextPage & {\n navigationOptions?: NavigationOptions\n getLayout?: (\n page: React.ReactNode,\n options?: NavigationOptions\n ) => React.ReactNode\n}\n\nexport type SolitoAppProps

= Omit, 'Component'> & {\n Component: AppProps

['Component'] & {\n navigationOptions?: NavigationOptions\n getLayout?: (\n page: React.ReactNode,\n options?: NavigationOptions\n ) => React.ReactNode\n }\n}\n\nexport type {\n SolitoPage,\n SolitoNavigationOptions,\n SolitoCustomNavigationOptions,\n}\n"]} \ No newline at end of file diff --git a/packages/link/node_modules/solito/image/author/index.d.ts b/packages/link/node_modules/solito/image/author/index.d.ts deleted file mode 100644 index f2532e56..00000000 --- a/packages/link/node_modules/solito/image/author/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../build/image/author' diff --git a/packages/link/node_modules/solito/image/author/index.js b/packages/link/node_modules/solito/image/author/index.js deleted file mode 100644 index f2532e56..00000000 --- a/packages/link/node_modules/solito/image/author/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from '../../build/image/author' diff --git a/packages/link/node_modules/solito/image/expo/index.d.ts b/packages/link/node_modules/solito/image/expo/index.d.ts deleted file mode 100644 index 0dd8a473..00000000 --- a/packages/link/node_modules/solito/image/expo/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../../build/image/expo' diff --git a/packages/link/node_modules/solito/image/expo/index.js b/packages/link/node_modules/solito/image/expo/index.js deleted file mode 100644 index 0dd8a473..00000000 --- a/packages/link/node_modules/solito/image/expo/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from '../../build/image/expo' diff --git a/packages/link/node_modules/solito/image/index.d.ts b/packages/link/node_modules/solito/image/index.d.ts deleted file mode 100644 index f31cf746..00000000 --- a/packages/link/node_modules/solito/image/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../build/image/expo' diff --git a/packages/link/node_modules/solito/image/index.js b/packages/link/node_modules/solito/image/index.js deleted file mode 100644 index f31cf746..00000000 --- a/packages/link/node_modules/solito/image/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from '../build/image/expo' diff --git a/packages/link/node_modules/solito/image/react-native-fast-image.js b/packages/link/node_modules/solito/image/react-native-fast-image.js deleted file mode 100644 index acce1629..00000000 --- a/packages/link/node_modules/solito/image/react-native-fast-image.js +++ /dev/null @@ -1 +0,0 @@ -export * from '../build/image/fast' diff --git a/packages/link/node_modules/solito/index.d.ts b/packages/link/node_modules/solito/index.d.ts deleted file mode 100644 index eeef9235..00000000 --- a/packages/link/node_modules/solito/index.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// -/// -/// -/// - -export * from './build' diff --git a/packages/link/node_modules/solito/link/index.d.ts b/packages/link/node_modules/solito/link/index.d.ts deleted file mode 100644 index d0f377c8..00000000 --- a/packages/link/node_modules/solito/link/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../build/link' diff --git a/packages/link/node_modules/solito/link/index.js b/packages/link/node_modules/solito/link/index.js deleted file mode 100644 index d0f377c8..00000000 --- a/packages/link/node_modules/solito/link/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from '../build/link' diff --git a/packages/link/node_modules/solito/moti/index.d.ts b/packages/link/node_modules/solito/moti/index.d.ts deleted file mode 100644 index 87df37db..00000000 --- a/packages/link/node_modules/solito/moti/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../build/moti' diff --git a/packages/link/node_modules/solito/moti/index.js b/packages/link/node_modules/solito/moti/index.js deleted file mode 100644 index 87df37db..00000000 --- a/packages/link/node_modules/solito/moti/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from '../build/moti' diff --git a/packages/link/node_modules/solito/package.json b/packages/link/node_modules/solito/package.json deleted file mode 100644 index daede056..00000000 --- a/packages/link/node_modules/solito/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "solito", - "version": "3.2.0", - "scripts": { - "build": "expo-module build", - "clean": "expo-module clean", - "test": "expo-module test", - "prepare": "expo-module prepare", - "upgrade-expo": "bun ./scripts/upgrade-examples-expo.ts" - }, - "devDependencies": { - "@babel/preset-env": "^7.20.2", - "@babel/preset-typescript": "^7.18.6", - "@react-navigation/bottom-tabs": "^6.0.9", - "@react-navigation/drawer": "^6.1.8", - "@react-navigation/native": "^6.0.6", - "@react-navigation/native-stack": "^6.2.5", - "@types/jest": "^29.2.3", - "@types/node": "^18.11.9", - "@types/react": "^18.0.7", - "@types/react-native": "^0.70.0", - "concurrently": "^7.6.0", - "eslint-config-nando": "^1.1.0", - "expo-image": "^1.0.0", - "expo-module-scripts": "^2.0.0", - "jest": "^29.3.1", - "moti": "^0.17.1", - "next": "13.0.1", - "react-native-fast-image": "^8.6.3" - }, - "resolutions": { - "@types/react": "^18.0.7", - "react": "18.2.0", - "react-dom": "18.2.0" - }, - "license": "MIT", - "bugs": { - "url": "/~https://github.com/nandorojo/solito/issues" - }, - "homepage": "/~https://github.com/nandorojo/solito.git#readme", - "main": "build/index.js", - "types": "index.d.ts", - "sideEffects": false, - "publishConfig": { - "access": "public" - }, - "author": { - "email": "fernando@wearptos.com", - "name": "Fernando Rojo", - "url": "https://fernandotherojo.co" - }, - "files": [ - "build/**/*", - "index.d.ts", - "src/**/*", - "link/**/*", - "router/**/*", - "moti/**/*", - "image/**/*" - ], - "packageManager": "yarn@1.22.19" -} diff --git a/packages/link/node_modules/solito/router/index.d.ts b/packages/link/node_modules/solito/router/index.d.ts deleted file mode 100644 index fe366271..00000000 --- a/packages/link/node_modules/solito/router/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from '../build/router' diff --git a/packages/link/node_modules/solito/router/index.js b/packages/link/node_modules/solito/router/index.js deleted file mode 100644 index fe366271..00000000 --- a/packages/link/node_modules/solito/router/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from '../build/router' diff --git a/packages/link/node_modules/solito/src/helpers/merge-refs.ts b/packages/link/node_modules/solito/src/helpers/merge-refs.ts deleted file mode 100644 index 0cd5929b..00000000 --- a/packages/link/node_modules/solito/src/helpers/merge-refs.ts +++ /dev/null @@ -1,14 +0,0 @@ -// credit: /~https://github.com/gregberge/react-merge-refs/blob/main/src/index.tsx -export function mergeRefs( - refs: Array | React.LegacyRef> -): React.RefCallback { - return (value) => { - refs.forEach((ref) => { - if (typeof ref === 'function') { - ref(value) - } else if (ref != null) { - ;(ref as React.MutableRefObject).current = value - } - }) - } -} diff --git a/packages/link/node_modules/solito/src/helpers/use-stable-callback.ts b/packages/link/node_modules/solito/src/helpers/use-stable-callback.ts deleted file mode 100644 index a0869210..00000000 --- a/packages/link/node_modules/solito/src/helpers/use-stable-callback.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { useRef, useMemo, useEffect } from 'react' - -/** - * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a - * prop or avoid re-executing effects when passed as a dependency - */ -function useStableCallback any>( - callback: T | undefined -): T { - const callbackRef = useRef(callback) - - useEffect(() => { - callbackRef.current = callback - }) - - // /~https://github.com/facebook/react/issues/19240 - return useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, []) -} - -export { useStableCallback } diff --git a/packages/link/node_modules/solito/src/image/author/index.ts b/packages/link/node_modules/solito/src/image/author/index.ts deleted file mode 100644 index 21ce334c..00000000 --- a/packages/link/node_modules/solito/src/image/author/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export type { SolitoImageProps } from '../image.types' - -export * from '../create-solito-image' -export * from '../use-solito-image' diff --git a/packages/link/node_modules/solito/src/image/context.tsx b/packages/link/node_modules/solito/src/image/context.tsx deleted file mode 100644 index 006223f2..00000000 --- a/packages/link/node_modules/solito/src/image/context.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { ContextType, createContext, useContext, useState } from 'react' - -import { imageConfigDefault } from './helpers' - -const SolitoImageContext = - createContext>(imageConfigDefault) - -export const SolitoImageProvider = ({ - children, - ...rest -}: { - children: React.ReactNode -} & ContextType) => { - const parent = useContext(SolitoImageContext) - const [context] = useState(() => ({ - ...parent, - ...rest, - })) - - return ( - - {children} - - ) -} - -export const useSolitoImageContext = () => useContext(SolitoImageContext) diff --git a/packages/link/node_modules/solito/src/image/create-solito-image.tsx b/packages/link/node_modules/solito/src/image/create-solito-image.tsx deleted file mode 100644 index 0338f1be..00000000 --- a/packages/link/node_modules/solito/src/image/create-solito-image.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React, { ComponentType, createElement, forwardRef } from 'react' - -import { SolitoImageProps } from './image.types' -import { useSolitoImage } from './use-solito-image' - -export function createSolitoImage< - C extends ComponentType> ->(Component: C) { - return forwardRef, SolitoImageProps>(function Img( - props, - ref - ) { - const imageProps = useSolitoImage(props) - return createElement(Component, { ...imageProps, ref } as any) - }) -} diff --git a/packages/link/node_modules/solito/src/image/default-loader.ts b/packages/link/node_modules/solito/src/image/default-loader.ts deleted file mode 100644 index b59bd989..00000000 --- a/packages/link/node_modules/solito/src/image/default-loader.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { Platform } from 'react-native' -import { ImageConfigComplete } from './types' - -export type ImageLoaderProps = { - src: string - width: number - quality?: number -} - -export type ImageLoaderPropsWithConfig = ImageLoaderProps & { - config: Readonly -} - -export function defaultLoader({ - config, - src, - width, - quality, -}: ImageLoaderPropsWithConfig): string { - if (process.env.NODE_ENV !== 'production') { - const missingValues = [] - - // these should always be provided but make sure they are - if (!src) missingValues.push('src') - if (!width) missingValues.push('width') - - if (missingValues.length > 0) { - throw new Error( - `Solito Image requires ${missingValues.join( - ', ' - )} to be provided. Make sure you pass them as props to the \`solito/image\` component. Received: ${JSON.stringify( - { src, width, quality } - )}` - ) - } - - if (src.startsWith('/') && !config.nextJsURL) { - throw new Error( - `[solito/image] Please add the "nextJsURL" prop to your to use relative paths. - -Error due to image source "${src}".` - ) - } - } - - if (src.startsWith('/') && src.endsWith('.svg')) { - // relative SVG paths are raw - return `${config.nextJsURL}${src}` - } - - if (src.startsWith('http')) { - return src - } - - if (src.startsWith('file://')) { - return src - } - - return `${config.nextJsURL}${config.path}?url=${encodeURIComponent( - src - )}&w=${width}&q=${quality || 75}` -} - -// We use this to determine if the import is the default loader -// or a custom loader defined by the user in next.config.js -// defaultLoader.__next_img_default = true diff --git a/packages/link/node_modules/solito/src/image/expo/image.tsx b/packages/link/node_modules/solito/src/image/expo/image.tsx deleted file mode 100644 index 6feae24d..00000000 --- a/packages/link/node_modules/solito/src/image/expo/image.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Image } from 'expo-image' -import { forwardRef } from 'react' - -import { SolitoImageProps } from '../image.types' -import { useSolitoImage } from '../use-solito-image' - -const SolitoImage = forwardRef(function Img( - props, - ref -) { - const { - onLoadingComplete, - resizeMode = 'contain', - ...imageProps - } = useSolitoImage(props) - - return ( - onLoadingComplete(e.source))} - ref={ref} - // @ts-expect-error expo-image has weird types - style={imageProps.style} - contentPosition={props.contentPosition} - /> - ) -}) - -export default SolitoImage diff --git a/packages/link/node_modules/solito/src/image/expo/image.web.tsx b/packages/link/node_modules/solito/src/image/expo/image.web.tsx deleted file mode 100644 index e8000dfa..00000000 --- a/packages/link/node_modules/solito/src/image/expo/image.web.tsx +++ /dev/null @@ -1,152 +0,0 @@ -// Add client directive once we implement onLayout -import { - ImageContentPosition, - ImageContentPositionObject, - ImageContentPositionString, - ImageContentPositionValue, -} from 'expo-image' -import NextImage from 'next/image' -import { forwardRef } from 'react' -import { Image, ImageResizeMode, StyleSheet } from 'react-native' -// @ts-expect-error missing types -import { unstable_createElement } from 'react-native-web' - -// import useElementLayout from 'react-native-web/dist/modules/useElementLayout' -// import { mergeRefs } from '../../helpers/merge-refs' -import { useSolitoImageContext } from '../context' -import { SolitoImageProps } from '../image.types' - -const SolitoImage = forwardRef(function SolitoImage( - { resizeMode = 'contain', fill, style, onLayout, ...props }, - ref -) { - const { loader } = useSolitoImageContext() - // add back onLayout when this is solved: /~https://github.com/vercel/next.js/discussions/43267 - // const localRef = useRef(null) - // useElementLayout( - // // /~https://github.com/necolas/react-native-web/blob/master/packages/react-native-web/src/exports/View/index.js#L88 - // localRef, - // onLayout - // ) - return unstable_createElement(NextImage, { - ...props, - // ref: mergeRefs([ref, localRef]), - loader: props.loader ?? loader, - fill, - style: [ - fill && StyleSheet.absoluteFill, - { - objectFit: objectFitFromResizeMode(resizeMode), - objectPosition: getObjectPositionFromContentPositionObject( - resolveContentPosition(props.contentPosition) - ), - }, - style, - ], - }) -}) - -export default SolitoImage - -// FORKED FROM EXPO IMAGE - -/** - * It resolves a stringified form of the `contentPosition` prop to an object, - * which is the only form supported in the native code. - * - * /~https://github.com/expo/expo/blob/baea6e76d0c6f865885aa2fb1c8f7732c119c300/packages/expo-image/src/utils.ts#L53 - */ -function resolveContentPosition( - contentPosition?: ImageContentPosition -): ImageContentPositionObject { - if (typeof contentPosition === 'string') { - const contentPositionStringMappings: Record< - ImageContentPositionString, - ImageContentPositionObject - > = { - center: { top: '50%', left: '50%' }, - top: { top: 0, left: '50%' }, - right: { top: '50%', right: 0 }, - bottom: { bottom: 0, left: '50%' }, - left: { top: '50%', left: 0 }, - 'top center': { top: 0, left: '50%' }, - 'top right': { top: 0, right: 0 }, - 'top left': { top: 0, left: 0 }, - 'right center': { top: '50%', right: 0 }, - 'right top': { top: 0, right: 0 }, - 'right bottom': { bottom: 0, right: 0 }, - 'bottom center': { bottom: 0, left: '50%' }, - 'bottom right': { bottom: 0, right: 0 }, - 'bottom left': { bottom: 0, left: 0 }, - 'left center': { top: '50%', left: 0 }, - 'left top': { top: 0, left: 0 }, - 'left bottom': { bottom: 0, left: 0 }, - } - const contentPositionObject = contentPositionStringMappings[contentPosition] - - if (!contentPositionObject) { - console.warn( - `[expo-image]: Content position "${contentPosition}" is invalid` - ) - return contentPositionStringMappings.center - } - return contentPositionObject - } - return contentPosition ?? { top: '50%', left: '50%' } -} -function ensureUnit(value: string | number) { - const trimmedValue = String(value).trim() - if (trimmedValue.endsWith('%')) { - return trimmedValue - } - return `${trimmedValue}px` -} - -type KeysOfUnion = T extends T ? keyof T : never - -function getObjectPositionFromContentPositionObject( - contentPosition?: ImageContentPositionObject -): string { - const resolvedPosition = { ...contentPosition } as Record< - KeysOfUnion, - ImageContentPositionValue - > - if (!resolvedPosition) { - return '50% 50%' - } - if (resolvedPosition.top == null && resolvedPosition.bottom == null) { - resolvedPosition.top = '50%' - } - if (resolvedPosition.left == null && resolvedPosition.right == null) { - resolvedPosition.left = '50%' - } - - return ( - (['top', 'bottom', 'left', 'right'] as const) - .map((key) => { - if (key in resolvedPosition) { - return `${key} ${ensureUnit(resolvedPosition[key])}` - } - return '' - }) - .join(' ') || '50% 50%' - ) -} -// END FORKED FROM EXPO IMAGE - -const objectFitFromResizeMode = (resizeMode: ImageResizeMode) => { - if (resizeMode === 'cover') { - return 'cover' - } - if (resizeMode === 'contain') { - return 'contain' - } - if (resizeMode === 'stretch') { - return 'fill' - } - if (resizeMode === 'center') { - return 'none' - } - - throw new Error(`[solito/image] Invalid resizeMode: ${resizeMode}`) -} diff --git a/packages/link/node_modules/solito/src/image/expo/index.ts b/packages/link/node_modules/solito/src/image/expo/index.ts deleted file mode 100644 index 06bd2c16..00000000 --- a/packages/link/node_modules/solito/src/image/expo/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import SolitoImage from './image' - -export { SolitoImage } - -export { SolitoImageProvider } from '../context' diff --git a/packages/link/node_modules/solito/src/image/fast/fast.tsx b/packages/link/node_modules/solito/src/image/fast/fast.tsx deleted file mode 100644 index e19babae..00000000 --- a/packages/link/node_modules/solito/src/image/fast/fast.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { ComponentProps } from 'react' -import FastImage from 'react-native-fast-image' - -import { SolitoImageProps } from '../image.types' -import { useSolitoImage } from '../use-solito-image' - -export default function SolitoFastImage( - props: Omit & - Pick, 'style' | 'resizeMode'> -) { - const { source, resizeMode, onLoadingComplete, style, ...imageProps } = - useSolitoImage(props as SolitoImageProps) - - return ( - onLoadingComplete(e.nativeEvent))} - // @ts-expect-error this is fine - style={style} - {...imageProps} - /> - ) -} diff --git a/packages/link/node_modules/solito/src/image/fast/fast.web.tsx b/packages/link/node_modules/solito/src/image/fast/fast.web.tsx deleted file mode 100644 index 890401b7..00000000 --- a/packages/link/node_modules/solito/src/image/fast/fast.web.tsx +++ /dev/null @@ -1 +0,0 @@ -export { default } from '../expo/image.web' diff --git a/packages/link/node_modules/solito/src/image/fast/index.ts b/packages/link/node_modules/solito/src/image/fast/index.ts deleted file mode 100644 index 7fb3525a..00000000 --- a/packages/link/node_modules/solito/src/image/fast/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import SolitoImage from './fast' - -export { SolitoImage } -export { SolitoImageProvider } from '../context' diff --git a/packages/link/node_modules/solito/src/image/helpers.test.ts b/packages/link/node_modules/solito/src/image/helpers.test.ts deleted file mode 100644 index d5c2c4ac..00000000 --- a/packages/link/node_modules/solito/src/image/helpers.test.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { resolveSourceFromImgAttributes } from './helpers' - -describe('resolveSourceFromImgAttributes', () => { - test('picks from max-width', () => { - expect( - resolveSourceFromImgAttributes({ - dimensions: { - width: 100, - height: 100, - }, - srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`, - sizes: `(max-width: 600px) 480px, 800px`, - src: 'elva-fairy.jpg', - }).uri - ).toBe('elva-fairy-480w.jpg') - }) - - test('trims excess space', () => { - expect( - resolveSourceFromImgAttributes({ - dimensions: { - width: 100, - height: 100, - }, - srcSet: `elva-fairy-480w.jpg 480w, - - elva-fairy-800w.jpg 800w`, - sizes: `(max-width: 600px) 480px, - 800px`, - src: 'elva-fairy.jpg', - }).uri - ).toBe('elva-fairy-480w.jpg') - }) - - test('picks from min-width', () => { - expect( - resolveSourceFromImgAttributes({ - dimensions: { - width: 700, - height: 700, - }, - srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`, - sizes: `(min-width: 600px) 480px, 800px`, - src: 'elva-fairy.jpg', - }).uri - ).toBe('elva-fairy-480w.jpg') - }) - - test('100vw size is treated as dimensions width', () => { - expect( - resolveSourceFromImgAttributes({ - dimensions: { - width: 700, - height: 700, - }, - srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`, - sizes: `100vw`, - src: 'elva-fairy.jpg', - }).uri - ).toBe('elva-fairy-800w.jpg') - }) - - test('100vw falls back to src', () => { - expect( - resolveSourceFromImgAttributes({ - dimensions: { - width: 900, - height: 900, - }, - srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`, - sizes: `100vw`, - src: 'elva-fairy.jpg', - }).uri - ).toBe('elva-fairy.jpg') - }) - - test('falls back to last value in sizes', () => { - expect( - resolveSourceFromImgAttributes({ - dimensions: { - width: 700, - height: 700, - }, - srcSet: `elva-fairy-480w.jpg 480w, elva-fairy-800w.jpg 800w`, - sizes: `(max-width: 600px) 480px, 800px`, - src: 'elva-fairy.jpg', - }).uri - ).toBe('elva-fairy-800w.jpg') - }) - - test('uses src if missing rest', () => { - expect( - resolveSourceFromImgAttributes({ - dimensions: { - width: 700, - height: 700, - }, - src: 'elva-fairy.jpg', - }).uri - ).toBe('elva-fairy.jpg') - }) - - test('throws for 1x, 2x', () => { - expect( - () => - resolveSourceFromImgAttributes({ - dimensions: { - width: 700, - height: 700, - }, - srcSet: `elva-fairy-480w.jpg 1x, elva-fairy-800w.jpg 2x`, - sizes: `(max-width: 600px) 480px, 800px`, - src: 'elva-fairy.jpg', - }).uri - ).toThrow() - }) -}) diff --git a/packages/link/node_modules/solito/src/image/helpers.ts b/packages/link/node_modules/solito/src/image/helpers.ts deleted file mode 100644 index 179c1bdb..00000000 --- a/packages/link/node_modules/solito/src/image/helpers.ts +++ /dev/null @@ -1,268 +0,0 @@ -import type NextImage from 'next/image' -import type { ImageResizeMode } from 'react-native' -import { defaultLoader } from './default-loader' - -import { ImageConfig, ImageConfigComplete } from './types' - -export type ImageLoaderProps = { - src: string - width: number - quality?: number -} - -function getWidths( - { deviceSizes, allSizes }: ImageConfig, - width: number | undefined, - sizes: string | undefined -): { widths: number[]; kind: 'w' | 'x' } { - if (sizes) { - // Find all the "vw" percent sizes used in the sizes prop - const viewportWidthRe = /(^|\s)(1?\d?\d)vw/g - const percentSizes = [] - for (let match; (match = viewportWidthRe.exec(sizes)); match) { - percentSizes.push(parseInt(match[2], 10)) - } - if (percentSizes.length) { - const smallestRatio = Math.min(...percentSizes) * 0.01 - return { - widths: allSizes.filter((s) => s >= deviceSizes[0] * smallestRatio), - kind: 'w', - } - } - return { widths: allSizes, kind: 'w' } - } - if (typeof width !== 'number') { - return { widths: deviceSizes, kind: 'w' } - } - - const widths = [ - ...new Set( - // > This means that most OLED screens that say they are 3x resolution, - // > are actually 3x in the green color, but only 1.5x in the red and - // > blue colors. Showing a 3x resolution image in the app vs a 2x - // > resolution image will be visually the same, though the 3x image - // > takes significantly more data. Even true 3x resolution screens are - // > wasteful as the human eye cannot see that level of detail without - // > something like a magnifying glass. - // https://blog.twitter.com/engineering/en_us/topics/infrastructure/2019/capping-image-fidelity-on-ultra-high-resolution-devices.html - [width, width * 2 /*, width * 3*/].map( - (w) => allSizes.find((p) => p >= w) || allSizes[allSizes.length - 1] - ) - ), - ] - return { widths, kind: 'x' } -} - -type GenImgAttrsData = { - config: ImageConfig - src: string - unoptimized: boolean - loader: typeof defaultLoader - // | NonNullable['loader']> - width?: number - quality?: number - sizes?: string -} - -type GenImgAttrsResult = { - src: string - srcSet: string | undefined - sizes: string | undefined -} - -export function getInt(x: unknown): number | undefined { - if (typeof x === 'number' || typeof x === 'undefined') { - return x - } - if (typeof x === 'string' && /^[0-9]+$/.test(x)) { - return parseInt(x, 10) - } - return NaN -} - -export function generateImgAttrs({ - config, - src, - unoptimized, - width, - quality, - sizes, - loader, -}: GenImgAttrsData): GenImgAttrsResult { - if (unoptimized) { - return { src, srcSet: undefined, sizes: undefined } - } - - const { widths, kind } = getWidths(config, width, sizes) - const last = widths.length - 1 - - return { - sizes: !sizes && kind === 'w' ? '100vw' : sizes, - srcSet: widths - .map( - (w, i) => - `${loader({ src, quality, width: w, config })} ${ - kind === 'w' ? w : i + 1 - }${kind}` - ) - .join(', '), - - // It's intended to keep `src` the last attribute because React updates - // attributes in order. If we keep `src` the first one, Safari will - // immediately start to fetch `src`, before `sizes` and `srcSet` are even - // updated by React. That causes multiple unnecessary requests if `srcSet` - // and `sizes` are defined. - // This bug cannot be reproduced in Chrome or Firefox. - src: loader({ quality, width: widths[last], src, config }), - } -} - -export const resolveSourceFromImgAttributes = ({ - src, - srcSet, - sizes, - dimensions, -}: { - src: string - srcSet?: string - sizes?: string - dimensions: { - width: number - height: number - } -}): { uri: string } => { - try { - if (srcSet) { - const getVw = (size: string) => { - return (parseInt(size.replace('vw', ''), 10) * dimensions.width) / 100 - } - const getPix = (size: string) => { - return parseInt(size.replace('px', ''), 10) - } - const getVwOrPix = (size: string) => { - if (size.includes('vw')) { - return getVw(size) - } - return getPix(size) - } - const getSize = (size: string): number => { - if (size.includes(')')) { - return getVwOrPix(size.split(')')[1]) - } - if (size.endsWith('vw')) { - return getVw(size) - } - return getPix(size) - } - - const sizeSet = sizes?.split(',') ?? [] - - let size = getSize(sizeSet[sizeSet.length - 1] || `100vw`) - for (let sizeChunk of sizeSet) { - sizeChunk = sizeChunk.trim() - - // regex to check for (min-width: or (max-width: - const mediaQueryRegex = /(\(min-width:|\(max-width:)/ - const mediaQueryCondition = mediaQueryRegex.test(sizeChunk) - - if (mediaQueryCondition) { - // the string looks like this: (max-width: 600px) 480px - // extract pixels from media query, and then say if it's min or max-width - // finally, get the pixels to the right as the actual sizeValue - - const minOrMax = sizeChunk.includes('min') ? 'min' : 'max' - const heightOrWidth = sizeChunk.includes('-height') - ? 'height' - : 'width' - - const sizeString = sizeChunk - .replace(mediaQueryRegex, '') - .split(')')[1] - .trim() - - const mediaQuerySize = sizeString.includes('px') - ? parseInt(sizeString.replace('px', ''), 10) - : sizeString.includes('vw') - ? (parseInt(sizeString.replace('vw', ''), 10) / 100) * - dimensions.width - : null - - if (mediaQuerySize === null) { - throw new Error( - '[solito/image] Invalid condition passed to sizes (${sizes}). ${size} does not end in px or vw' - ) - } - - let matches = false - - if (minOrMax === 'min') { - matches = dimensions[heightOrWidth] >= mediaQuerySize - } else if (minOrMax === 'max') { - matches = dimensions[heightOrWidth] <= mediaQuerySize - } - - if (matches) { - size = mediaQuerySize - break - } - } - } - - const sources = srcSet.split(', ').map((source) => { - const [sourceUrl, size] = source.trim().split(' ') - - if (size.endsWith('x')) { - // throw new Error( - // `[solito/image] srcSet does not support x descriptors, but it got "${size}" inside of ${srcSet}` - // ) - - // TODO what is the right way to handle 1x, 2x sizes? - - return { - sourceUrl, - size: parseInt(size.replace('x', ''), 10) * dimensions.width, // should this use image width? - } - } - - return { - sourceUrl, - size: parseInt(size.replace('w', ''), 10), - } - }) - - const firstSourceThatMatchesforSize = sources.find( - (source) => source.size >= size - ) - - if (firstSourceThatMatchesforSize) { - return { uri: firstSourceThatMatchesforSize.sourceUrl } - } - } - - return { - uri: src, - } - } catch (e: any) { - throw new Error( - `[solito/image] Error parsing srcSet & sizes: ${ - e?.message || 'unknown error.' - }. ${JSON.stringify({ src, srcSet, sizes })}` - ) - } -} - -export const imageConfigDefault: ImageConfigComplete = { - deviceSizes: [640, 750, 828, 1080, 1200, 1920, 2048, 3840], - imageSizes: [16, 32, 48, 64, 96, 128, 256, 384], - path: '/_next/image', - // loader: 'default', - // loaderFile: '', - // domains: [], - // disableStaticImages: false, - // minimumCacheTTL: 60, - // formats: ['image/webp'], - // dangerouslyAllowSVG: false, - // contentSecurityPolicy: `script-src 'none'; frame-src 'none'; sandbox;`, - // remotePatterns: [], - // unoptimized: false, -} diff --git a/packages/link/node_modules/solito/src/image/image.types.test.ts b/packages/link/node_modules/solito/src/image/image.types.test.ts deleted file mode 100644 index 771b30bd..00000000 --- a/packages/link/node_modules/solito/src/image/image.types.test.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type NextImage from 'next/image' - -import { SolitoImageProps } from './image.types' - -type NextImageProps = React.ComponentProps - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const test: Array = [ - { - src: '', - height: 100, - width: 100, - alt: '', - }, - { - unoptimized: true, - src: '', - height: 100, - width: 100, - alt: '', - }, - { - src: null as any as Exclude, - height: 100, - width: 100, - alt: '', - }, - { - src: 1, - alt: '', - }, -] diff --git a/packages/link/node_modules/solito/src/image/image.types.ts b/packages/link/node_modules/solito/src/image/image.types.ts deleted file mode 100644 index c809ec7e..00000000 --- a/packages/link/node_modules/solito/src/image/image.types.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { ImageContentPosition } from 'expo-image' -import type NextImage from 'next/image' -import type { ImageStyle, ImageProps } from 'react-native' - -export type AccessibilityProp = key extends `aria-${string}` - ? key - : key extends `accessibility${Capitalize}` - ? key - : never - -type NextImageProps = React.ComponentProps - -export type SolitoImageProps = Pick< - NextImageProps, - | AccessibilityProp - | 'alt' - | 'blurDataURL' - | 'placeholder' - | 'loader' - | 'priority' - | 'loading' - | 'sizes' - | 'quality' - | 'crossOrigin' - | 'referrerPolicy' - | 'quality' - | 'unoptimized' -> & { - style?: ImageStyle -} & ( - | { - src: string - height: number - width: number - fill?: false - } - | { - src: string - height?: number - width?: number - fill: true - } - | { - src: Exclude | number - height?: number - width?: number - fill?: boolean - } - ) & - Pick< - ImageProps, - 'onLayout' | 'resizeMode' | AccessibilityProp - > & { - onLoadingComplete?: (info: { height: number; width: number }) => void - fill?: boolean - contentPosition?: ImageContentPosition - } diff --git a/packages/link/node_modules/solito/src/image/types.ts b/packages/link/node_modules/solito/src/image/types.ts deleted file mode 100644 index 61e134d2..00000000 --- a/packages/link/node_modules/solito/src/image/types.ts +++ /dev/null @@ -1,26 +0,0 @@ -export type ImageConfigComplete = { - deviceSizes: number[] - imageSizes: number[] - /** - * Example: `https://beatgig.com` or `http://localhost:3000` - * - * This is the URL to your Next.js app, used on iOS & Android to resolve relative URLs. - * - * For example, if you have `public/image.png` in your Next.js app, and your URL is `https://beatgig.com`, - * then you can use `` and it will get the image from the next.js site. - * - * Docs: https://solito.dev/usage/image#solitoimageprovider- - */ - nextJsURL?: `http:${string}` | `https:${string}` - /** - * You probably shouldn't touch this. It's only used on native to get your images. - * - * Default: `'/_next/image'`. You must set nextJsURL for this to work. - */ - path?: string - loader?: (info: { src: string; width: number; quality: number }) => string -} - -export type ImageConfig = ImageConfigComplete & { - allSizes: number[] -} diff --git a/packages/link/node_modules/solito/src/image/use-solito-image.ts b/packages/link/node_modules/solito/src/image/use-solito-image.ts deleted file mode 100644 index 44391a45..00000000 --- a/packages/link/node_modules/solito/src/image/use-solito-image.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { ImageStyle } from 'expo-image' -import { useMemo, useSyncExternalStore } from 'react' -import { ImageProps, Dimensions, StyleSheet } from 'react-native' - -import { useSolitoImageContext } from './context' -import { defaultLoader } from './default-loader' -import { - generateImgAttrs, - getInt, - imageConfigDefault, - resolveSourceFromImgAttributes, -} from './helpers' -import { SolitoImageProps } from './image.types' -import { ImageConfig } from './types' - -export type UseSolitoImage = Pick< - ImageProps, - | Extract - | 'progressiveRenderingEnabled' - | 'source' - | 'accessible' - | 'onLayout' -> & { - onLoadingComplete?: (info: { height: number; width: number }) => void - style: Array -} - -export function useSolitoImage({ - src, - loader, - width, - height, - quality = 75, - crossOrigin, - referrerPolicy, - alt, - fill, - onLoadingComplete, - loading, - priority, - placeholder, - blurDataURL, - sizes, - style, - onLayout, - unoptimized, - ...props -}: SolitoImageProps): UseSolitoImage { - const contextConfig = useSolitoImageContext() - const config = useMemo(() => { - const c = { ...imageConfigDefault, ...contextConfig } - const allSizes = [...c.deviceSizes, ...c.imageSizes].sort((a, b) => a - b) - const deviceSizes = c.deviceSizes.sort((a, b) => a - b) - return { ...c, allSizes, deviceSizes } - }, [contextConfig]) - - const headers: { [key in string]: string } = {} - if (crossOrigin === 'use-credentials') { - headers['Access-Control-Allow-Credentials'] = 'true' - } - if (referrerPolicy != null) { - headers['Referrer-Policy'] = referrerPolicy - } - - const uri = useSyncExternalStore( - (callback) => { - const subscription = Dimensions.addEventListener('change', callback) - - return () => subscription?.remove() - }, - () => { - const dimensions = Dimensions.get('window') - - if (typeof src == 'string') { - const attrs = generateImgAttrs({ - src, - config, - loader: ({ config: _, ...opts }) => { - if (loader) { - return loader(opts) - } - if (config.loader) { - return config.loader({ - quality: Number(quality ?? 75), - src: opts.src, - width: opts.width, - }) - } - return defaultLoader({ ...opts, config }) - }, - unoptimized: Boolean(unoptimized), - quality: getInt(quality || 75), - sizes, - width: getInt(width || 400), - }) - const { uri } = resolveSourceFromImgAttributes({ - ...attrs, - dimensions, - }) - - return uri - } - return undefined - } - ) - - const source = useMemo(() => { - const headers: { [key in string]: string } = {} - if (crossOrigin === 'use-credentials') { - headers['Access-Control-Allow-Credentials'] = 'true' - } - if (referrerPolicy != null) { - headers['Referrer-Policy'] = referrerPolicy - } - if (typeof uri == 'string') { - return { - uri, - height, - width, - headers, - cache: priority ? 'force-cache' : 'default', - } - } - return src as number - }, [uri, src, height, width, priority, referrerPolicy, crossOrigin]) - - return { - ...props, - progressiveRenderingEnabled: true, - onLoadingComplete, - source, - accessible: Boolean(alt), - onLayout, - style: [ - fill - ? StyleSheet.absoluteFill - : { - height, - width, - }, - style, - ] as any, - - // adapter for older versions of RN - // /~https://github.com/facebook/react-native/blob/main/Libraries/Image/Image.android.js#L169-L194 - accessibilityLabel: props['aria-label'] ?? alt, - accessibilityState: { - busy: booleanish(props['aria-busy']), - checked: booleanish(props['aria-checked']), - disabled: booleanish(props['aria-disabled']), - expanded: booleanish(props['aria-expanded']), - selected: booleanish(props['aria-selected']), - }, - } -} - -function booleanish(value?: Value) { - // this should get upstreamed in RN - return ( - value === 'true' ? true : value === 'false' ? false : value - ) as Exclude -} diff --git a/packages/link/node_modules/solito/src/index.ts b/packages/link/node_modules/solito/src/index.ts deleted file mode 100644 index 5c3de9a7..00000000 --- a/packages/link/node_modules/solito/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './types/solito-page' -export * from './middleware/provider' -export * from './params' diff --git a/packages/link/node_modules/solito/src/link/core.tsx b/packages/link/node_modules/solito/src/link/core.tsx deleted file mode 100644 index d0e41613..00000000 --- a/packages/link/node_modules/solito/src/link/core.tsx +++ /dev/null @@ -1,90 +0,0 @@ -import React from 'react' -import type { ComponentProps, ComponentType } from 'react' -import { Platform } from 'react-native' - -import { openURL } from './linking' -import { NextLink } from './next-link' -import { useLink } from './use-custom-link' - -export type LinkCoreProps = { - children: React.ReactNode -} & Omit< - ComponentProps, - 'passHref' | 'replace' | 'legacyBehavior' -> & - ( - | { - replace?: false - experimental?: undefined - } - | { - replace: true - experimental?: { - nativeBehavior: 'stack-replace' - isNestedNavigator: boolean - } - } - ) - -function LinkCore({ - children, - href, - as, - componentProps, - Component, - replace, - experimental, - ...props -}: LinkCoreProps & { - Component: ComponentType - componentProps?: any -}) { - if (Platform.OS === 'web') { - return ( - - {children} - - ) - } - // eslint-disable-next-line react-hooks/rules-of-hooks - const linkTo = useLink({ - href, - as, - replace, - experimental, - }) - return ( - { - componentProps?.onPress?.(e) - const link = as || href - if (e?.defaultPrevented) return - // Handles external URLs - if (typeof link === 'string' && isAbsoluteUrl(link)) { - openURL(link) - } else { - linkTo.onPress(e) - } - }} - > - {children} - - ) -} - -// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1 -// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3 -const ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\d+\-.]*?:/ -// Source - /~https://github.com/vercel/next.js/blob/77b5f79a4dff453abb62346bf75b14d859539b81/packages/next/shared/lib/utils.ts#L313 -const isAbsoluteUrl = (url: string) => ABSOLUTE_URL_REGEX.test(url) - -export { LinkCore } diff --git a/packages/link/node_modules/solito/src/link/index.tsx b/packages/link/node_modules/solito/src/link/index.tsx deleted file mode 100644 index 541110dc..00000000 --- a/packages/link/node_modules/solito/src/link/index.tsx +++ /dev/null @@ -1,4 +0,0 @@ -export * from './core' -export * from './text-link' -export * from './link' -export * from './use-custom-link' diff --git a/packages/link/node_modules/solito/src/link/link.tsx b/packages/link/node_modules/solito/src/link/link.tsx deleted file mode 100644 index 8653c374..00000000 --- a/packages/link/node_modules/solito/src/link/link.tsx +++ /dev/null @@ -1,22 +0,0 @@ -'use client' -import { Platform, Pressable, ViewProps, View } from 'react-native' - -import { LinkCore, LinkCoreProps } from './core' - -type LinkProps = LinkCoreProps & { viewProps?: ViewProps } - -function Link({ viewProps, ...props }: LinkProps) { - return ( - - ) -} - -export { Link } -export type { LinkProps } diff --git a/packages/link/node_modules/solito/src/link/linking.ts b/packages/link/node_modules/solito/src/link/linking.ts deleted file mode 100644 index 98f2161f..00000000 --- a/packages/link/node_modules/solito/src/link/linking.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Linking } from 'react-native' - -export const openURL = (url: string) => Linking.openURL(url) diff --git a/packages/link/node_modules/solito/src/link/linking.web.ts b/packages/link/node_modules/solito/src/link/linking.web.ts deleted file mode 100644 index 573a05c5..00000000 --- a/packages/link/node_modules/solito/src/link/linking.web.ts +++ /dev/null @@ -1,2 +0,0 @@ -// noop, not supported on web -export const openURL = (url: string) => {} diff --git a/packages/link/node_modules/solito/src/link/next-link.tsx b/packages/link/node_modules/solito/src/link/next-link.tsx deleted file mode 100644 index eae0325d..00000000 --- a/packages/link/node_modules/solito/src/link/next-link.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import type Link from 'next/link' - -export const NextLink = (() => { - return <> -}) as any as typeof Link diff --git a/packages/link/node_modules/solito/src/link/next-link.web.tsx b/packages/link/node_modules/solito/src/link/next-link.web.tsx deleted file mode 100644 index 0ea20cc8..00000000 --- a/packages/link/node_modules/solito/src/link/next-link.web.tsx +++ /dev/null @@ -1 +0,0 @@ -export { default as NextLink } from 'next/link' diff --git a/packages/link/node_modules/solito/src/link/text-link.tsx b/packages/link/node_modules/solito/src/link/text-link.tsx deleted file mode 100644 index 34accc13..00000000 --- a/packages/link/node_modules/solito/src/link/text-link.tsx +++ /dev/null @@ -1,19 +0,0 @@ -'use client' -import { TextProps, Text } from 'react-native' - -import { LinkCore, LinkCoreProps } from './core' - -type TextLinkProps = LinkCoreProps & { textProps?: TextProps } - -function TextLink({ textProps, ...props }: TextLinkProps) { - return ( - - ) -} - -export { TextLink } -export type { TextLinkProps } diff --git a/packages/link/node_modules/solito/src/link/use-custom-link.tsx b/packages/link/node_modules/solito/src/link/use-custom-link.tsx deleted file mode 100644 index 6ce4dda5..00000000 --- a/packages/link/node_modules/solito/src/link/use-custom-link.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { GestureResponderEvent, Platform } from 'react-native' - -import { useRouter } from '../router' -import { LinkCoreProps } from './core' - -export type UseLinkProps = Pick< - LinkCoreProps, - 'as' | 'shallow' | 'href' | 'scroll' | 'replace' | 'experimental' -> - -export function useLink({ - href, - as, - shallow, - scroll, - replace, - experimental, -}: UseLinkProps) { - const router = useRouter() - - // /~https://github.com/react-navigation/react-navigation/blob/main/packages/native/src/useLinkProps.tsx#L64 - const onPress = ( - e?: React.MouseEvent | GestureResponderEvent - ) => { - let shouldHandle = false - - if (Platform.OS !== 'web' || !e) { - shouldHandle = e ? !e.defaultPrevented : true - } else if ( - !e.defaultPrevented && // onPress prevented default - // @ts-expect-error: these properties exist on web, but not in React Native - !(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey) && // ignore clicks with modifier keys - // @ts-expect-error: these properties exist on web, but not in React Native - (e.button == null || e.button === 0) && // ignore everything but left clicks - // @ts-expect-error: these properties exist on web, but not in React Native - [undefined, null, '', 'self'].includes(e.currentTarget?.target) // let browser handle "target=_blank" etc. - ) { - e.preventDefault() - shouldHandle = true - } - - if (shouldHandle) { - if (href === '#') { - // this is a way on web to stay on the same page - // useful for conditional hrefs - return - } - if (replace) { - router.replace(href, as, { shallow, scroll, experimental }) - } else { - router.push(href, as, { - shallow, - scroll, - }) - } - } - } - - return { - accessibilityRole: 'link' as const, - onPress, - href: router.parseNextPath(as || href), - } -} diff --git a/packages/link/node_modules/solito/src/middleware/context.tsx b/packages/link/node_modules/solito/src/middleware/context.tsx deleted file mode 100644 index fa5d2437..00000000 --- a/packages/link/node_modules/solito/src/middleware/context.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { useLinkTo } from '@react-navigation/native' -import { createContext } from 'react' - -import { MiddlewareContextType } from './types' - -export const MiddlewareContext = createContext({ - useLinkTo, - // useLinkProps, -}) diff --git a/packages/link/node_modules/solito/src/middleware/context.web.tsx b/packages/link/node_modules/solito/src/middleware/context.web.tsx deleted file mode 100644 index dc566e91..00000000 --- a/packages/link/node_modules/solito/src/middleware/context.web.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createContext } from 'react' - -import { MiddlewareContextType } from './types' - -function error() { - throw new Error( - '[solito] useLinkTo should not be called on Web. Is next/router defined?' - ) -} - -export const MiddlewareContext = createContext({ - useLinkTo() { - return error - }, -}) diff --git a/packages/link/node_modules/solito/src/middleware/provider.tsx b/packages/link/node_modules/solito/src/middleware/provider.tsx deleted file mode 100644 index 5577e987..00000000 --- a/packages/link/node_modules/solito/src/middleware/provider.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import React from 'react' - -import { MiddlewareContext } from './context' -import { MiddlewareContextType } from './types' - -type Props = { - middleware: MiddlewareContextType -} - -export function SolitoProvider({ - children, - middleware, -}: { children: React.ReactNode } & Props) { - return ( - - {children} - - ) -} diff --git a/packages/link/node_modules/solito/src/middleware/types.ts b/packages/link/node_modules/solito/src/middleware/types.ts deleted file mode 100644 index 9270e68d..00000000 --- a/packages/link/node_modules/solito/src/middleware/types.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { useLinkTo } from '@react-navigation/native' - -export type MiddlewareContextType = { - useLinkTo?: typeof useLinkTo -} diff --git a/packages/link/node_modules/solito/src/moti/index.tsx b/packages/link/node_modules/solito/src/moti/index.tsx deleted file mode 100644 index 6bbafd20..00000000 --- a/packages/link/node_modules/solito/src/moti/index.tsx +++ /dev/null @@ -1 +0,0 @@ -export * from './link' diff --git a/packages/link/node_modules/solito/src/moti/link.tsx b/packages/link/node_modules/solito/src/moti/link.tsx deleted file mode 100644 index e34f5dbf..00000000 --- a/packages/link/node_modules/solito/src/moti/link.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { MotiPressableProps, MotiPressable } from 'moti/interactions' -import React, { forwardRef } from 'react' -import type { View } from 'react-native' - -import { useLink, UseLinkProps } from '../link/use-custom-link' - -export type MotiLinkProps = UseLinkProps & - Omit< - MotiPressableProps, - // you can't pass any props that will be overridden by useLink - | keyof UseLinkProps - | keyof Pick, 'href' | 'accessibilityRole'> - > - -export const MotiLink = forwardRef((props, ref) => { - const { onPress, ...linkProps } = useLink(props) - - return ( - { - // @ts-expect-error no event argument - // we let users pass an onPress prop, in case they want to preventDefault() - props.onPress?.(e) - - onPress?.(e) - }} - ref={ref} - /> - ) -}) - -MotiLink.displayName = 'MotiLink' diff --git a/packages/link/node_modules/solito/src/params/index.tsx b/packages/link/node_modules/solito/src/params/index.tsx deleted file mode 100644 index 686d4fd5..00000000 --- a/packages/link/node_modules/solito/src/params/index.tsx +++ /dev/null @@ -1,348 +0,0 @@ -/* eslint-disable react-hooks/rules-of-hooks */ -// From https://gist.github.com/nandorojo/052887f99bb61b54845474f324aa41cc - -import { useCallback, useEffect, useMemo, useRef, useState } from 'react' -import { Platform } from 'react-native' - -import { useNavigation } from '../router/use-navigation' -import Router from './router' -import { useRoute } from './use-route' -import { useRouter } from './use-router' - -function useStable(value: T) { - const ref = useRef(value) - useEffect(() => { - ref.current = value - }, [value]) - - return ref -} - -function useStableCallback any>( - callback: T | undefined -): T { - const callbackRef = useRef(callback) - - useEffect(() => { - callbackRef.current = callback - }) - - // /~https://github.com/facebook/react/issues/19240 - return useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, []) -} - -type Config< - Props extends Record, - Required extends boolean, - ParsedType, - InitialValue -> = (Required extends false - ? { - parse?: (value?: string | string[]) => ParsedType - } - : { - parse: (value?: string | string[]) => ParsedType - }) & { - stringify?: (value: ParsedType) => string - initial: InitialValue - paramsToClearOnSetState?: (keyof Props)[] -} - -type Params< - Props extends Record = Record, - Name extends keyof Props = keyof Props, - NullableUnparsedParsedType extends Props[Name] | undefined = - | Props[Name] - | undefined, - ParseFunction extends - | undefined - | (( - value?: string | string[] - ) => NonNullable) = ( - value?: string | string[] - ) => NonNullable, - InitialValue = NullableUnparsedParsedType | undefined, - ParsedType = InitialValue extends undefined - ? NullableUnparsedParsedType - : ParseFunction extends undefined - ? NullableUnparsedParsedType - : NonNullable -> = NonNullable extends string - ? - | [name: Name, config: Config] - | [name: Name] - : [name: Name, config: Config] - -type Returns< - Props extends Record = Record, - Name extends keyof Props = keyof Props, - NullableUnparsedParsedType extends Props[Name] | undefined = - | Props[Name] - | undefined, - ParseFunction extends - | undefined - | (( - value?: string | string[] - ) => NonNullable) = ( - value?: string | string[] - ) => NonNullable, - InitialValue = NullableUnparsedParsedType | undefined, - ParsedType = InitialValue extends undefined - ? NullableUnparsedParsedType - : ParseFunction extends undefined - ? NullableUnparsedParsedType - : NonNullable -> = readonly [ - state: ParsedType | InitialValue, - setState: (value: ParsedType, options?: SetStateOptions) => void -] - -type SetStateOptions = { - /** - * Override whether this function calls `Router.push` or `Router.replace`. - * - * By default, `Router.push` is called if the query parameter already exists in the URL. - */ - webBehavior?: 'push' | 'replace' -} - -export function createParam< - Props extends Record = Record ->() { - function useParam< - Name extends keyof Props, - NullableUnparsedParsedType extends Props[Name] | undefined = - | Props[Name] - | undefined, - ParseFunction extends - | undefined - | (( - value?: string | string[] - ) => NonNullable) = ( - value?: string | string[] - ) => NonNullable, - InitialValue = NullableUnparsedParsedType | undefined, - ParsedType = InitialValue extends undefined - ? NullableUnparsedParsedType - : ParseFunction extends undefined - ? NullableUnparsedParsedType - : NonNullable - >( - ...[name, maybeConfig]: Params< - Props, - Name, - NullableUnparsedParsedType, - ParseFunction, - InitialValue, - ParsedType - > - ): Returns< - Props, - Name, - NullableUnparsedParsedType, - ParseFunction, - InitialValue, - ParsedType - > { - const { - parse = (value?: string | string[]) => value, - initial, - stringify = (value: ParsedType) => `${value}`, - paramsToClearOnSetState, - } = maybeConfig || {} - const nextRouter = useRouter() - const nativeRoute = useRoute() - const nativeNavigation = useNavigation() - const nativeStateFromParams = (nativeRoute?.params as any)?.[ - name - ] as ParsedType - - const [nativeStateFromReact, setNativeStateFromReact] = useState< - ParsedType | InitialValue - >(() => nativeStateFromParams ?? (initial as InitialValue)) - - const setNativeStateFromParams = useCallback((value: ParsedType) => { - nativeNavigation?.setParams({ - [name]: value, - }) - }, []) - - const nativeState = nativeRoute - ? nativeStateFromParams - : nativeStateFromReact - const setNativeState = nativeRoute - ? setNativeStateFromParams - : setNativeStateFromReact - - const stableStringify = useStableCallback(stringify) - const stableParse = useStableCallback(parse) - const stableParamsToClear = useStable(paramsToClearOnSetState) - - const initialValue = useRef(initial) - const hasSetState = useRef(false) - - const setState = useCallback( - (value: ParsedType, options?: SetStateOptions) => { - hasSetState.current = true - const { pathname, query } = Router - const newQuery = { ...query } - if (value != null && (value as any) !== '') { - newQuery[name as string] = stableStringify(value) - } else { - delete newQuery[name as string] - } - - if (stableParamsToClear.current) { - for (const paramKey of stableParamsToClear.current) { - delete newQuery[paramKey as string] - } - } - - const willChangeExistingParam = - query[name as string] && newQuery[name as string] - - let action = willChangeExistingParam ? Router.replace : Router.push - - if (options?.webBehavior) { - action = Router[options.webBehavior] - } - - action( - { - pathname, - query: newQuery, - }, - undefined, - { - shallow: true, - } - ) - }, - [name, stableStringify, stableParamsToClear] - ) - - const webParam = nextRouter?.query?.[name as string] - - const state = useMemo(() => { - let state: ParsedType - if (webParam === undefined && !hasSetState.current) { - state = initialValue.current as any - } else { - state = stableParse(webParam) as ParsedType - } - return state - }, [stableParse, webParam]) - - if (Platform.OS !== 'web') { - if (!nativeRoute) { - console.error( - `[solito] useParam('${ - name as string - }') called when there is no React Navigation route available. In a future version, this will throw an error. Please fix this by only calling useParam() inside of a React Navigation route. For now, Solito will fallback to using React state.` - ) - } - return [nativeState, setNativeState] - } - - return [state, setState] - } - - type UpdateOptions = { - web?: { - replace?: boolean - } - } - - function useUpdateParams(): ( - props: Partial, - options?: UpdateOptions - ) => void { - const nativeNavigation = useNavigation() - - const setNativeStateFromParams = useCallback((value: Partial) => { - nativeNavigation?.setParams(value) - }, []) - - const setWebState = useCallback( - (value: Partial, options?: UpdateOptions) => { - const { pathname, query } = Router - const newQuery = { ...query, ...value } - for (const key in value) { - if (value[key] == null || value[key] === '') { - delete newQuery[key] - } - } - - const action = options?.web?.replace ? Router.replace : Router.push - - action( - { - pathname, - query: newQuery, - }, - undefined, - { - shallow: true, - } - ) - }, - [] - ) - - return Platform.select({ - web: setWebState, - default: setNativeStateFromParams, - }) - } - - function useParams(): { - params: Props - setParams: (value: Partial, options?: SetStateOptions) => void - } { - if (Platform.OS !== 'web') { - const nativeRoute = useRoute() - const nativeNavigation = useNavigation() - - return { - params: nativeRoute?.params as Props, - setParams: useCallback( - (params) => nativeNavigation?.setParams(params), - [nativeNavigation] - ), - } - } - const nextRouter = useRouter() - - return { - params: nextRouter?.query as Props, - setParams: useCallback((params, options) => { - const { pathname, query } = Router - const newQuery = { ...query, ...params } - for (const key in params) { - if (params[key] == null || params[key] === '') { - delete newQuery[key] - } - } - - const action = Router[options?.webBehavior ?? 'push'] - - action( - { - pathname, - query: newQuery, - }, - undefined, - { - shallow: true, - } - ) - }, []), - } - } - - return { - useParam, - useUpdateParams, - useParams, - } -} diff --git a/packages/link/node_modules/solito/src/params/router.ts b/packages/link/node_modules/solito/src/params/router.ts deleted file mode 100644 index babe0038..00000000 --- a/packages/link/node_modules/solito/src/params/router.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type Router from 'next/router' - -export default undefined as any as typeof Router diff --git a/packages/link/node_modules/solito/src/params/router.web.ts b/packages/link/node_modules/solito/src/params/router.web.ts deleted file mode 100644 index 135039c6..00000000 --- a/packages/link/node_modules/solito/src/params/router.web.ts +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'next/router' diff --git a/packages/link/node_modules/solito/src/params/use-route.ts b/packages/link/node_modules/solito/src/params/use-route.ts deleted file mode 100644 index 236c2c32..00000000 --- a/packages/link/node_modules/solito/src/params/use-route.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { NavigationRouteContext } from '@react-navigation/native' -import { useContext } from 'react' - -export const useRoute = () => useContext(NavigationRouteContext) diff --git a/packages/link/node_modules/solito/src/params/use-route.web.ts b/packages/link/node_modules/solito/src/params/use-route.web.ts deleted file mode 100644 index 0b2270fb..00000000 --- a/packages/link/node_modules/solito/src/params/use-route.web.ts +++ /dev/null @@ -1 +0,0 @@ -export const useRoute = () => undefined diff --git a/packages/link/node_modules/solito/src/params/use-router.ts b/packages/link/node_modules/solito/src/params/use-router.ts deleted file mode 100644 index cc8964a4..00000000 --- a/packages/link/node_modules/solito/src/params/use-router.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { NextRouter } from 'next/router' - -export const useRouter = () => undefined as NextRouter | undefined diff --git a/packages/link/node_modules/solito/src/params/use-router.web.ts b/packages/link/node_modules/solito/src/params/use-router.web.ts deleted file mode 100644 index 5c4df31f..00000000 --- a/packages/link/node_modules/solito/src/params/use-router.web.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { useRouter as _useRouter } from 'next/router'; - -export const useRouter = () => _useRouter(); \ No newline at end of file diff --git a/packages/link/node_modules/solito/src/router/index.ts b/packages/link/node_modules/solito/src/router/index.ts deleted file mode 100644 index f83be7ee..00000000 --- a/packages/link/node_modules/solito/src/router/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './parse-next-path' -export * from './use-router' diff --git a/packages/link/node_modules/solito/src/router/next-router.ts b/packages/link/node_modules/solito/src/router/next-router.ts deleted file mode 100644 index 7c937aab..00000000 --- a/packages/link/node_modules/solito/src/router/next-router.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Router from 'next/router' - -export const NextRouter: typeof Router | undefined = Router diff --git a/packages/link/node_modules/solito/src/router/next-router.web.ts b/packages/link/node_modules/solito/src/router/next-router.web.ts deleted file mode 100644 index c7306e94..00000000 --- a/packages/link/node_modules/solito/src/router/next-router.web.ts +++ /dev/null @@ -1 +0,0 @@ -export const NextRouter = undefined diff --git a/packages/link/node_modules/solito/src/router/parse-next-path.ts b/packages/link/node_modules/solito/src/router/parse-next-path.ts deleted file mode 100644 index f8f80a87..00000000 --- a/packages/link/node_modules/solito/src/router/parse-next-path.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { NextRouter } from 'next/router' - -const parseNextPath = (from: Parameters[0]) => { - let path = (typeof from == 'string' ? from : from.pathname) || '' - - // replace each instance of [key] with the corresponding value from query[key] - // this ensures we're navigating to the correct URL - // it currently ignores [[...param]] - // but I can't see why you would use this with RN + Next.js - if (typeof from == 'object' && from.query && typeof from.query == 'object') { - const query = { ...from.query } - for (const key in query) { - if (path.includes(`[${key}]`)) { - path = path.replace(`[${key}]`, `${query[key] ?? ''}`) - delete query[key] - } else if (path.includes(`[...${key}]`)) { - const values = query[key] - if (Array.isArray(values)) { - path = path.replace(`[...${key}]`, values.join('/')) - delete query[key] - } - } - } - if (Object.keys(query).length) { - path += '?' - for (const key in query) { - if (query[key] != null) { - path += `${key}=${query[key]}&` - } - } - if (path.endsWith('&') || path.endsWith('?')) { - path = path.slice(0, -1) - } - } - } - - return path -} - -export { parseNextPath } diff --git a/packages/link/node_modules/solito/src/router/replace-helpers.ts b/packages/link/node_modules/solito/src/router/replace-helpers.ts deleted file mode 100644 index a6e733ee..00000000 --- a/packages/link/node_modules/solito/src/router/replace-helpers.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { - StackActions, - getStateFromPath, - getActionFromState, -} from '@react-navigation/native' -// THIS IS DANGEROUS -// IT ONLY WORKS ON NATIVE BECAUSE NATIVE USES THE SRC FOLDER CURRENTLY. -// THIS IS SUPER UNSAFE -// WE SHOULD BE USING THE EXPOSED VARIABLE -// see: /~https://github.com/react-navigation/react-navigation/discussions/10517 -// PR: /~https://github.com/react-navigation/react-navigation/pull/10604 -import LinkingContext from '@react-navigation/native/src/LinkingContext' - -export { LinkingContext, StackActions, getStateFromPath, getActionFromState } diff --git a/packages/link/node_modules/solito/src/router/replace-helpers.web.ts b/packages/link/node_modules/solito/src/router/replace-helpers.web.ts deleted file mode 100644 index 10c3aafb..00000000 --- a/packages/link/node_modules/solito/src/router/replace-helpers.web.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { createContext } from 'react' - -const LinkingContext = createContext({ - options: undefined, -}) - -let StackActions, getStateFromPath, getActionFromState - -export { LinkingContext, StackActions, getStateFromPath, getActionFromState } diff --git a/packages/link/node_modules/solito/src/router/use-link-to.ts b/packages/link/node_modules/solito/src/router/use-link-to.ts deleted file mode 100644 index 48343d6a..00000000 --- a/packages/link/node_modules/solito/src/router/use-link-to.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { useLinkTo as useNativeLinkTo } from '@react-navigation/native' -import { useContext } from 'react' - -import { MiddlewareContext } from '../middleware/context' - -export function useLinkTo() { - const hook = useContext(MiddlewareContext).useLinkTo ?? useNativeLinkTo - - return hook() -} diff --git a/packages/link/node_modules/solito/src/router/use-link-to.web.ts b/packages/link/node_modules/solito/src/router/use-link-to.web.ts deleted file mode 100644 index e72860ba..00000000 --- a/packages/link/node_modules/solito/src/router/use-link-to.web.ts +++ /dev/null @@ -1,10 +0,0 @@ -const noOp = () => { - throw new Error( - '[use-link-to] is not supported on the web. Something went wrong if you called this.' - ) -} - -/** - * @deprecated imported from the wrong file. Use `use-link-to` instead. - */ -export const useLinkTo = () => noOp diff --git a/packages/link/node_modules/solito/src/router/use-navigation.ts b/packages/link/node_modules/solito/src/router/use-navigation.ts deleted file mode 100644 index 3351c11a..00000000 --- a/packages/link/node_modules/solito/src/router/use-navigation.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { - NavigationContext, - NavigationContainerRefContext, -} from '@react-navigation/core' -import { useContext } from 'react' - -export const useNavigation = () => { - const root = useContext(NavigationContainerRefContext) - const navigation = useContext(NavigationContext) - - if (navigation === undefined && root === undefined) { - throw new Error( - "Couldn't find a navigation object. Is your component inside NavigationContainer?" - ) - } - - return navigation !== null && navigation !== void 0 ? navigation : root -} diff --git a/packages/link/node_modules/solito/src/router/use-navigation.web.ts b/packages/link/node_modules/solito/src/router/use-navigation.web.ts deleted file mode 100644 index 6a0e758f..00000000 --- a/packages/link/node_modules/solito/src/router/use-navigation.web.ts +++ /dev/null @@ -1 +0,0 @@ -export const useNavigation = () => undefined diff --git a/packages/link/node_modules/solito/src/router/use-next-router.ts b/packages/link/node_modules/solito/src/router/use-next-router.ts deleted file mode 100644 index 33fbd678..00000000 --- a/packages/link/node_modules/solito/src/router/use-next-router.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { useRouter } from 'next/router' - -export const useNextRouter = (): ReturnType | undefined => - undefined diff --git a/packages/link/node_modules/solito/src/router/use-next-router.web.ts b/packages/link/node_modules/solito/src/router/use-next-router.web.ts deleted file mode 100644 index 40a2dc5f..00000000 --- a/packages/link/node_modules/solito/src/router/use-next-router.web.ts +++ /dev/null @@ -1 +0,0 @@ -export { useRouter as useNextRouter } from 'next/router' diff --git a/packages/link/node_modules/solito/src/router/use-router.ts b/packages/link/node_modules/solito/src/router/use-router.ts deleted file mode 100644 index 84164d18..00000000 --- a/packages/link/node_modules/solito/src/router/use-router.ts +++ /dev/null @@ -1,139 +0,0 @@ -import type { NextRouter as NextRouterType } from 'next/router' -import { useContext, useMemo } from 'react' -import { Platform } from 'react-native' - -import { parseNextPath } from './parse-next-path' -import { - getActionFromState, - getStateFromPath, - LinkingContext, - StackActions, -} from './replace-helpers' -import { useLinkTo } from './use-link-to' -import { useNavigation } from './use-navigation' -import { useNextRouter } from './use-next-router' - -// copied from next/router to appease typescript error -// if we don't manually write this here, then we get some ReturnType error on build -// 🤷‍♂️ -interface TransitionOptions { - shallow?: boolean - locale?: string | false - scroll?: boolean -} - -export function useRouter() { - const linkTo = useLinkTo() - const navigation = useNavigation() - - const nextRouter = useNextRouter() - - const linking = useContext(LinkingContext) - - return useMemo( - () => ({ - push: ( - url: Parameters[0], - as?: Parameters[1], - transitionOptions?: TransitionOptions - ) => { - if (Platform.OS === 'web') { - nextRouter?.push(url, as, transitionOptions) - } else { - const to = parseNextPath(as || url) - - if (to) { - linkTo(to) - } - } - }, - replace: ( - url: Parameters[0], - as?: Parameters[1], - transitionOptions?: TransitionOptions & { - experimental?: - | { - nativeBehavior?: undefined - } - | { - nativeBehavior: 'stack-replace' - isNestedNavigator: boolean - } - } - ) => { - if (Platform.OS === 'web') { - nextRouter?.replace(url, as, transitionOptions) - } else { - const to = parseNextPath(as || url) - - if (to) { - if ( - transitionOptions?.experimental?.nativeBehavior === - 'stack-replace' - ) { - if (linking?.options) { - // custom logic to create a replace() from a URL on native - // /~https://github.com/react-navigation/react-navigation/discussions/10517 - const { options } = linking - - const state = options?.getStateFromPath - ? options.getStateFromPath(to, options.config) - : getStateFromPath(to, options?.config) - - if (state) { - const action = getActionFromState(state, options?.config) - - if (action !== undefined) { - if ( - 'payload' in action && - action.payload && - 'name' in action.payload && - action.payload.name - ) { - const { name, params } = action.payload - if ( - transitionOptions?.experimental?.isNestedNavigator && - params && - 'screen' in params && - params.screen - ) { - navigation?.dispatch( - StackActions.replace( - params.screen, - params.params as object | undefined - ) - ) - } else { - navigation?.dispatch(StackActions.replace(name, params)) - } - } else { - navigation?.dispatch(action) - } - } else { - navigation?.reset(state) - } - } - } else { - // fallback in case the linking context didn't work - console.warn(`[solito] replace("${to}") faced an issue. You should still see your new screen, but it probably didn't replace the previous one. This may be due to a breaking change in React Navigation. - Please open an issue at /~https://github.com/nandorojo/solito and report how this happened. Thanks!`) - linkTo(to) - } - } else { - linkTo(to) - } - } - } - }, - back: () => { - if (Platform.OS === 'web') { - nextRouter?.back() - } else { - navigation?.goBack() - } - }, - parseNextPath, - }), - [linkTo, navigation] - ) -} diff --git a/packages/link/node_modules/solito/src/types/solito-page.tsx b/packages/link/node_modules/solito/src/types/solito-page.tsx deleted file mode 100644 index 2db5daab..00000000 --- a/packages/link/node_modules/solito/src/types/solito-page.tsx +++ /dev/null @@ -1,37 +0,0 @@ -/* eslint-disable @typescript-eslint/ban-types */ -import type { NextPage } from 'next' -import type { AppProps } from 'next/app' - -interface SolitoCustomNavigationOptions {} - -interface SolitoNavigationOptions extends SolitoCustomNavigationOptions { - previousPagePath?: string | null -} - -type NavigationOptions = - | SolitoNavigationOptions - | ((router?: AppProps['router']) => SolitoNavigationOptions) - -type SolitoPage

= NextPage & { - navigationOptions?: NavigationOptions - getLayout?: ( - page: React.ReactNode, - options?: NavigationOptions - ) => React.ReactNode -} - -export type SolitoAppProps

= Omit, 'Component'> & { - Component: AppProps

['Component'] & { - navigationOptions?: NavigationOptions - getLayout?: ( - page: React.ReactNode, - options?: NavigationOptions - ) => React.ReactNode - } -} - -export type { - SolitoPage, - SolitoNavigationOptions, - SolitoCustomNavigationOptions, -} diff --git a/yarn.lock b/yarn.lock index 054c6044..378fc04b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -63,7 +63,7 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:7.21.4": +"@babel/core@npm:^7.1.0, @babel/core@npm:^7.11.6, @babel/core@npm:^7.12.10, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.17.9, @babel/core@npm:^7.19.6, @babel/core@npm:^7.20.0, @babel/core@npm:^7.20.2, @babel/core@npm:^7.7.5, @babel/core@npm:~7.21.0": version: 7.21.4 resolution: "@babel/core@npm:7.21.4" dependencies: @@ -1522,7 +1522,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:7.21.0": +"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.10, @babel/runtime@npm:^7.14.5, @babel/runtime@npm:^7.17.2, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.6, @babel/runtime@npm:^7.18.9, @babel/runtime@npm:^7.19.4, @babel/runtime@npm:^7.20.0, @babel/runtime@npm:^7.20.1, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.4": version: 7.21.0 resolution: "@babel/runtime@npm:7.21.0" dependencies: @@ -11569,7 +11569,7 @@ __metadata: react-native-screens: ^3.20.0 react-native-svg: ^13.4.0 react-native-web: ^0.18.12 - typescript: ^5.0.3 + typescript: ^5.0.4 languageName: unknown linkType: soft @@ -16801,6 +16801,8 @@ __metadata: next-images: ^1.8.4 next-transpile-modules: ^10.0.0 raf: ^3.4.1 + react: ^18.2.0 + react-dom: ^18.2.0 react-native: ^0.71.6 react-native-web: ^0.18.12 react-native-web-lite: 1.15.14 @@ -18893,7 +18895,7 @@ __metadata: languageName: node linkType: hard -"react-native-web@npm:^0.18.9": +"react-native-web@npm:0.18.12": version: 0.18.12 resolution: "react-native-web@npm:0.18.12" dependencies: @@ -19029,7 +19031,7 @@ __metadata: languageName: node linkType: hard -"react-refresh@npm:^0.14.0": +"react-refresh@npm:0.14.0": version: 0.14.0 resolution: "react-refresh@npm:0.14.0" checksum: dc69fa8c993df512f42dd0f1b604978ae89bd747c0ed5ec595c0cc50d535fb2696619ccd98ae28775cc01d0a7c146a532f0f7fb81dc22e1977c242a4912312f4 @@ -19889,8 +19891,10 @@ __metadata: app: "*" react: ^18.2.0 react-dom: ^18.2.0 + react-native: ^0.71.6 + react-native-web: 0.18.12 storybook: ^7.0.5 - typescript: 5.0.3 + typescript: 5.0.4 languageName: unknown linkType: soft @@ -20972,7 +20976,7 @@ __metadata: eslint: ^8.21.0 prettier: ^2.7.1 turbo: ^1.8.8 - typescript: ^5.0.3 + typescript: ^5.0.4 languageName: unknown linkType: soft @@ -21250,7 +21254,7 @@ __metadata: babel-jest: ^28.1.3 jest: ^28.1.3 jest-expo: ^46.0.1 - typescript: ^5.0.3 + typescript: ^5.0.4 languageName: unknown linkType: soft @@ -21745,17 +21749,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:5.0.3": - version: 5.0.3 - resolution: "typescript@npm:5.0.3" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: 3cce0576d218cb4277ff8b6adfef1a706e9114a98b4261a38ad658a7642f1b274a8396394f6cbff8c0ba852996d7ed2e233e9b8431d5d55ac7c2f6fea645af02 - languageName: node - linkType: hard - -"typescript@npm:^5.0.3, typescript@npm:^5.0.4": +"typescript@npm:5.0.4": version: 5.0.4 resolution: "typescript@npm:5.0.4" bin: @@ -21765,17 +21759,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@5.0.3#~builtin": - version: 5.0.3 - resolution: "typescript@patch:typescript@npm%3A5.0.3#~builtin::version=5.0.3&hash=85af82" - bin: - tsc: bin/tsc - tsserver: bin/tsserver - checksum: 5580367025ff7ee1f2a61e5affdbddccfe6e893bc662aa33fefdbf12de7e493173fa7d47475e9e15121828691004c4ed13bcd115e57866baed97b54c60954e1c - languageName: node - linkType: hard - -"typescript@patch:typescript@^5.0.3#~builtin, typescript@patch:typescript@^5.0.4#~builtin": +"typescript@patch:typescript@npm%3A5.0.4#~builtin": version: 5.0.4 resolution: "typescript@patch:typescript@npm%3A5.0.4#~builtin::version=5.0.4&hash=85af82" bin: