react-alp-connection-state 10.0.1 → 10.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index-browser.cjs.js","sources":["../src/index.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from \"react\";\nimport { useEffect, useRef } from \"react\";\nimport type { DimensionValue, ScaledSize } from \"react-native\";\nimport {\n Platform,\n StyleSheet,\n Text,\n View,\n useWindowDimensions,\n} from \"react-native\";\n\nconst defaultTheme = {\n container: {\n backgroundColor: \"rgba(247, 25, 0, 0.8)\",\n color: \"#fff\",\n textShadowColor: \"#111\",\n textShadowOffset: { width: 0, height: -1 },\n textShadowRadius: 1,\n },\n backgroundColorConnected: \"rgba(25, 200, 60, 0.8)\",\n};\n\nexport type ConnectionStateTheme = typeof defaultTheme;\nexport type State = \"connected\" | \"connecting\" | \"disconnected\" | null;\n\nexport interface ConnectionStateProps {\n theme?: ConnectionStateTheme;\n forceHidden?: boolean;\n state: State;\n children: NonNullable<ReactNode>;\n}\n\nconst zDepth1 =\n \"0 2px 3px 0 rgba(0, 0, 0, 0.15), 0 2px 5px 0 rgba(0, 0, 0, 0.2)\";\n\ntype CreateCalc = (\n webCalc: string,\n createCalc: (dimensions: ScaledSize) => DimensionValue,\n) => DimensionValue;\n\nconst useCreateCalcNative = (): CreateCalc => {\n const dimensions = useWindowDimensions();\n return (webCalc, createCalc) => createCalc(dimensions);\n};\nconst useCreateCalcWeb = (): CreateCalc => {\n return (webCalc) => `calc(${webCalc})` as DimensionValue;\n};\nconst useCreateCalc =\n Platform.OS === \"web\" ? useCreateCalcWeb : useCreateCalcNative;\n\n// example: const left = createCalc('50% - 100px', ({ width }) => width / 2 - 100);\n\nconst styles = StyleSheet.create({\n connectionStateContainer: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n top: 0,\n right: 0,\n left: 0,\n height: 2,\n color: defaultTheme.container.color,\n textShadowOffset: defaultTheme.container.textShadowOffset,\n textShadowRadius: defaultTheme.container.textShadowRadius,\n boxShadow: zDepth1,\n zIndex: 9,\n // @ts-expect-error -- transition is not a valid style\n transition: \"top .8s, background-color .2s\",\n },\n hide: {\n top: -24,\n },\n connectionStateText: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n width: 200,\n height: 22,\n lineHeight: 22,\n top: 2,\n textAlign: \"center\",\n borderBottomLeftRadius: 5,\n borderBottomRightRadius: 5,\n transition: \"background-color .2s\",\n },\n});\n\nexport function ConnectionState({\n theme,\n forceHidden,\n state,\n children,\n}: ConnectionStateProps): ReactElement | null {\n const unloadingRef = useRef<boolean>(false);\n\n const createCalc = useCreateCalc();\n const left = createCalc(\"50% - 100px\", ({ width }) => width / 2 - 100); // TODO use calc() in web ?\n\n useEffect((): (() => void) | undefined => {\n if (typeof globalThis === \"undefined\") return;\n\n const beforeUnloadHandler = (): void => {\n unloadingRef.current = true;\n };\n window.addEventListener(\"beforeunload\", beforeUnloadHandler);\n\n return (): void => {\n window.removeEventListener(\"beforeunload\", beforeUnloadHandler);\n };\n }, []);\n\n const shouldHide = forceHidden || !state || state === \"connected\";\n\n return (\n <View\n style={[\n styles.connectionStateContainer,\n shouldHide && styles.hide,\n theme?.container,\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n ]}\n >\n {!state ? null : (\n <Text\n style={[\n styles.connectionStateText,\n theme && { backgroundColor: theme.container.backgroundColor },\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n { left },\n ]}\n >\n {children}\n </Text>\n )}\n </View>\n );\n}\n"],"names":["useWindowDimensions","Platform","StyleSheet","useRef","useEffect","jsx","View","Text"],"mappings":";;;;;;;;AAWA,MAAM,YAAA,GAAe;AAAA,EACnB,SAAA,EAAW;AAAA,IACT,eAAA,EAAiB,uBAAA;AAAA,IACjB,KAAA,EAAO,MAAA;AAAA,IAEP,gBAAA,EAAkB,E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AAAA,MAEC,QAAA,EAAA,CAAC,QAAQ,IAAA,mBACRD,cAAA;AAAA,QAACE,mBAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO;AAAA,YACL,MAAA,CAAO,mBAAA;AAAA,YACP,KAAA,IAAS,EAAE,eAAA,EAAiB,KAAA,CAAM,UAAU,eAAA,EAAgB;AAAA,YAC5D,UAAU,WAAA,IAAe;AAAA,cACvB,eAAA,EAAA,CAAkB,SAAS,YAAA,EAAc;AAAA,aAC3C;AAAA,YACA,EAAE,IAAA;AAAK,WACT;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GAEJ;AAEJ;;;;"}
1
+ {"version":3,"file":"index-browser.cjs.js","sources":["../src/index.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from \"react\";\nimport { useEffect, useRef } from \"react\";\nimport type { DimensionValue, ScaledSize } from \"react-native\";\nimport {\n Platform,\n StyleSheet,\n Text,\n View,\n useWindowDimensions,\n} from \"react-native\";\n\nconst defaultTheme = {\n container: {\n backgroundColor: \"rgba(247, 25, 0, 0.8)\",\n color: \"#fff\",\n textShadowColor: \"#111\",\n textShadowOffset: { width: 0, height: -1 },\n textShadowRadius: 1,\n },\n backgroundColorConnected: \"rgba(25, 200, 60, 0.8)\",\n};\n\nexport type ConnectionStateTheme = typeof defaultTheme;\nexport type State = \"connected\" | \"connecting\" | \"disconnected\" | null;\n\nexport interface ConnectionStateProps {\n theme?: ConnectionStateTheme;\n forceHidden?: boolean;\n state: State;\n children: NonNullable<ReactNode>;\n}\n\nconst zDepth1 =\n \"0 2px 3px 0 rgba(0, 0, 0, 0.15), 0 2px 5px 0 rgba(0, 0, 0, 0.2)\";\n\ntype CreateCalc = (\n webCalc: string,\n createCalc: (dimensions: ScaledSize) => DimensionValue,\n) => DimensionValue;\n\nconst useCreateCalcNative = (): CreateCalc => {\n const dimensions = useWindowDimensions();\n return (webCalc, createCalc) => createCalc(dimensions);\n};\nconst useCreateCalcWeb = (): CreateCalc => {\n return (webCalc) => `calc(${webCalc})` as DimensionValue;\n};\nconst useCreateCalc =\n Platform.OS === \"web\" ? useCreateCalcWeb : useCreateCalcNative;\n\n// example: const left = createCalc('50% - 100px', ({ width }) => width / 2 - 100);\n\nconst styles = StyleSheet.create({\n connectionStateContainer: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n top: 0,\n right: 0,\n left: 0,\n height: 2,\n color: defaultTheme.container.color,\n textShadowOffset: defaultTheme.container.textShadowOffset,\n textShadowRadius: defaultTheme.container.textShadowRadius,\n boxShadow: zDepth1,\n zIndex: 9,\n // @ts-expect-error -- transition is not a valid style\n transition: \"top .8s, background-color .2s\",\n },\n hide: {\n top: -24,\n },\n connectionStateText: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n width: 200,\n height: 22,\n lineHeight: 22,\n top: 2,\n textAlign: \"center\",\n borderBottomLeftRadius: 5,\n borderBottomRightRadius: 5,\n transition: \"background-color .2s\",\n },\n});\n\nexport function ConnectionState({\n theme,\n forceHidden,\n state,\n children,\n}: ConnectionStateProps): ReactElement | null {\n const unloadingRef = useRef<boolean>(false);\n\n const createCalc = useCreateCalc();\n const left = createCalc(\"50% - 100px\", ({ width }) => width / 2 - 100); // TODO use calc() in web ?\n\n useEffect((): (() => void) | undefined => {\n if (typeof globalThis === \"undefined\") return;\n\n const beforeUnloadHandler = (): void => {\n unloadingRef.current = true;\n };\n window.addEventListener(\"beforeunload\", beforeUnloadHandler);\n\n return (): void => {\n window.removeEventListener(\"beforeunload\", beforeUnloadHandler);\n };\n }, []);\n\n const shouldHide = forceHidden || !state || state === \"connected\";\n\n return (\n <View\n style={[\n styles.connectionStateContainer,\n shouldHide && styles.hide,\n theme?.container,\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n ]}\n >\n {!state ? null : (\n <Text\n style={[\n styles.connectionStateText,\n theme && { backgroundColor: theme.container.backgroundColor },\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n { left },\n ]}\n >\n {children}\n </Text>\n )}\n </View>\n );\n}\n"],"names":["useWindowDimensions","Platform","StyleSheet","useRef","useEffect","jsx","View","Text"],"mappings":";;;;;;;;AAWA,MAAM,YAAA,GAAe;AAAA,EACnB,SAAA,EAAW;AAAA,IACT,eAAA,EAAiB,uBAAA;AAAA,IACjB,KAAA,EAAO,MAAA;AAAA,IAEP,gBAAA,EAAkB,EAAE,KAAA,EAAO,CAAA,EAAG,QAAQ,EAAA,EAAG;AAAA,IACzC,gBAAA,EAAkB;AAAA,GACpB;AAAA,EACA,wBAAA,EAA0B;AAC5B,CAAA;AAYA,MAAM,OAAA,GACJ,iEAAA;AAOF,MAAM,sBAAsB,MAAkB;AAC5C,EAAA,MAAM,aAAaA,kCAAA,EAAoB;AACvC,EAAA,OAAO,CAAC,OAAA,EAAS,UAAA,KAAe,UAAA,CAAW,UAAU,CAAA;AACvD,CAAA;AACA,MAAM,mBAAmB,MAAkB;AACzC,EAAA,OAAO,CAAC,OAAA,KAAY,CAAA,KAAA,EAAQ,OAAO,CAAA,CAAA,CAAA;AACrC,CAAA;AACA,MAAM,aAAA,GACJC,uBAAA,CAAS,EAAA,KAAO,KAAA,GAAQ,gBAAA,GAAmB,mBAAA;AAI7C,MAAM,MAAA,GAASC,0BAAW,MAAA,CAAO;AAAA,EAC/B,wBAAA,EAA0B;AAAA,IACxB,eAAA,EAAiB,aAAa,SAAA,CAAU,eAAA;AAAA,IACxC,QAAA,EAAU,UAAA;AAAA,IACV,GAAA,EAAK,CAAA;AAAA,IACL,KAAA,EAAO,CAAA;AAAA,IACP,IAAA,EAAM,CAAA;AAAA,IACN,MAAA,EAAQ,CAAA;AAAA,IACR,KAAA,EAAO,aAAa,SAAA,CAAU,KAAA;AAAA,IAC9B,gBAAA,EAAkB,aAAa,SAAA,CAAU,gBAAA;AAAA,IACzC,gBAAA,EAAkB,aAAa,SAAA,CAAU,gBAAA;AAAA,IACzC,SAAA,EAAW,OAAA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,KAAA,KAAU,WAAA;AAEtD,EAAA,uBACEC,cAAA;AAAA,IAACC,mBAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO;AAAA,QACL,MAAA,CAAO,wBAAA;AAAA,QACP,cAAc,MAAA,CAAO,IAAA;AAAA,QACrB,KAAA,EAAO,SAAA;AAAA,QACP,UAAU,WAAA,IAAe;AAAA,UACvB,eAAA,EAAA,CAAkB,SAAS,YAAA,EAAc;AAAA;AAC3C,OACF;AAAA,MAEC,QAAA,EAAA,CAAC,QAAQ,IAAA,mBACRD,cAAA;AAAA,QAACE,mBAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO;AAAA,YACL,MAAA,CAAO,mBAAA;AAAA,YACP,KAAA,IAAS,EAAE,eAAA,EAAiB,KAAA,CAAM,UAAU,eAAA,EAAgB;AAAA,YAC5D,UAAU,WAAA,IAAe;AAAA,cACvB,eAAA,EAAA,CAAkB,SAAS,YAAA,EAAc;AAAA,aAC3C;AAAA,YACA,EAAE,IAAA;AAAK,WACT;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GAEJ;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index-browser.es.js","sources":["../src/index.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from \"react\";\nimport { useEffect, useRef } from \"react\";\nimport type { DimensionValue, ScaledSize } from \"react-native\";\nimport {\n Platform,\n StyleSheet,\n Text,\n View,\n useWindowDimensions,\n} from \"react-native\";\n\nconst defaultTheme = {\n container: {\n backgroundColor: \"rgba(247, 25, 0, 0.8)\",\n color: \"#fff\",\n textShadowColor: \"#111\",\n textShadowOffset: { width: 0, height: -1 },\n textShadowRadius: 1,\n },\n backgroundColorConnected: \"rgba(25, 200, 60, 0.8)\",\n};\n\nexport type ConnectionStateTheme = typeof defaultTheme;\nexport type State = \"connected\" | \"connecting\" | \"disconnected\" | null;\n\nexport interface ConnectionStateProps {\n theme?: ConnectionStateTheme;\n forceHidden?: boolean;\n state: State;\n children: NonNullable<ReactNode>;\n}\n\nconst zDepth1 =\n \"0 2px 3px 0 rgba(0, 0, 0, 0.15), 0 2px 5px 0 rgba(0, 0, 0, 0.2)\";\n\ntype CreateCalc = (\n webCalc: string,\n createCalc: (dimensions: ScaledSize) => DimensionValue,\n) => DimensionValue;\n\nconst useCreateCalcNative = (): CreateCalc => {\n const dimensions = useWindowDimensions();\n return (webCalc, createCalc) => createCalc(dimensions);\n};\nconst useCreateCalcWeb = (): CreateCalc => {\n return (webCalc) => `calc(${webCalc})` as DimensionValue;\n};\nconst useCreateCalc =\n Platform.OS === \"web\" ? useCreateCalcWeb : useCreateCalcNative;\n\n// example: const left = createCalc('50% - 100px', ({ width }) => width / 2 - 100);\n\nconst styles = StyleSheet.create({\n connectionStateContainer: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n top: 0,\n right: 0,\n left: 0,\n height: 2,\n color: defaultTheme.container.color,\n textShadowOffset: defaultTheme.container.textShadowOffset,\n textShadowRadius: defaultTheme.container.textShadowRadius,\n boxShadow: zDepth1,\n zIndex: 9,\n // @ts-expect-error -- transition is not a valid style\n transition: \"top .8s, background-color .2s\",\n },\n hide: {\n top: -24,\n },\n connectionStateText: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n width: 200,\n height: 22,\n lineHeight: 22,\n top: 2,\n textAlign: \"center\",\n borderBottomLeftRadius: 5,\n borderBottomRightRadius: 5,\n transition: \"background-color .2s\",\n },\n});\n\nexport function ConnectionState({\n theme,\n forceHidden,\n state,\n children,\n}: ConnectionStateProps): ReactElement | null {\n const unloadingRef = useRef<boolean>(false);\n\n const createCalc = useCreateCalc();\n const left = createCalc(\"50% - 100px\", ({ width }) => width / 2 - 100); // TODO use calc() in web ?\n\n useEffect((): (() => void) | undefined => {\n if (typeof globalThis === \"undefined\") return;\n\n const beforeUnloadHandler = (): void => {\n unloadingRef.current = true;\n };\n window.addEventListener(\"beforeunload\", beforeUnloadHandler);\n\n return (): void => {\n window.removeEventListener(\"beforeunload\", beforeUnloadHandler);\n };\n }, []);\n\n const shouldHide = forceHidden || !state || state === \"connected\";\n\n return (\n <View\n style={[\n styles.connectionStateContainer,\n shouldHide && styles.hide,\n theme?.container,\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n ]}\n >\n {!state ? null : (\n <Text\n style={[\n styles.connectionStateText,\n theme && { backgroundColor: theme.container.backgroundColor },\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n { left },\n ]}\n >\n {children}\n </Text>\n )}\n </View>\n );\n}\n"],"names":[],"mappings":";;;;AAWA,MAAM,YAAA,GAAe;AAAA,EACnB,SAAA,EAAW;AAAA,IACT,eAAA,EAAiB,uBAAA;AAAA,IACjB,KAAA,EAAO,MAAA;AAAA,IAEP,gBAAA,EAAkB,EAAE,KAAA,EAAO,CAAA,EAAG,QAAQ,EAAA,EAAG;AAAA,IACzC,gBAAA,EAAkB;AAAA,GACpB;AAAA,EACA,wBAAA,EAA0B;AAC5B,CAAA;AAYA,MAAM,OAAA,GACJ,iEAAA;AAOF,MAAM,sBAAsB,MAAkB;AAC5C,EAAA,MAAM,aAAa,mBAAA,EAAoB;AACvC,EAAA,OAAO,CAAC,OAAA,EAAS,UAAA,KAAe,UAAA,CAAW,UAAU,CAAA;AACvD,CAAA;AACA,MAAM,mBAAmB,MAAkB;AACzC,EAAA,OAAO,CAAC,OAAA,KAAY,CAAA,KAAA,EAAQ,OAAO,CAAA,CAAA,CAAA;AACrC,CAAA;AACA,MAAM,aAAA,GACJ,QAAA,CAAS,EAAA,KAAO,KAAA,GAAQ,gBAAA,GAAmB,mBAAA;AAI7C,MAAM,MAAA,GAAS,WAAW,MAAA,CAAO;AAAA,EAC/B,wBAAA,EAA0B;AAAA,IACxB,eAAA,EAAiB,aAAa,SAAA,CAAU,eAAA;AAAA,IACxC,QAAA,EAAU,UAAA;AAAA,IACV,GAAA,EAAK,CAAA;AAAA,IACL,KAAA,EAA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AO,gBAAA,CAAiB,gBAAgB,mBAAmB,CAAA;AAE3D,IAAA,OAAO,MAAY;AACjB,MAAA,MAAA,CAAO,mBAAA,CAAoB,gBAAgB,mBAAmB,CAAA;AAAA,KAChE;AAAA,GACF,EAAG,EAAE,CAAA;AAEL,EAAA,MAAM,UAAA,GAAa,WAAA,IAAe,CAAC,KAAA,IAAS,KAAA,KAAU,WAAA;AAEtD,EAAA,uBACE,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO;AAAA,QACL,MAAA,CAAO,wBAAA;AAAA,QACP,cAAc,MAAA,CAAO,IAAA;AAAA,QACrB,KAAA,EAAO,SAAA;AAAA,QACP,UAAU,WAAA,IAAe;AAAA,UACvB,eAAA,EAAA,CAAkB,SAAS,YAAA,EAAc;AAAA;AAC3C,OACF;AAAA,MAEC,QAAA,EAAA,CAAC,QAAQ,IAAA,mBACR,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO;AAAA,YACL,MAAA,CAAO,mBAAA;AAAA,YACP,KAAA,IAAS,EAAE,eAAA,EAAiB,KAAA,CAAM,UAAU,eAAA,EAAgB;AAAA,YAC5D,UAAU,WAAA,IAAe;AAAA,cACvB,eAAA,EAAA,CAAkB,SAAS,YAAA,EAAc;AAAA,aAC3C;AAAA,YACA,EAAE,IAAA;AAAK,WACT;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GAEJ;AAEJ;;;;"}
1
+ {"version":3,"file":"index-browser.es.js","sources":["../src/index.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from \"react\";\nimport { useEffect, useRef } from \"react\";\nimport type { DimensionValue, ScaledSize } from \"react-native\";\nimport {\n Platform,\n StyleSheet,\n Text,\n View,\n useWindowDimensions,\n} from \"react-native\";\n\nconst defaultTheme = {\n container: {\n backgroundColor: \"rgba(247, 25, 0, 0.8)\",\n color: \"#fff\",\n textShadowColor: \"#111\",\n textShadowOffset: { width: 0, height: -1 },\n textShadowRadius: 1,\n },\n backgroundColorConnected: \"rgba(25, 200, 60, 0.8)\",\n};\n\nexport type ConnectionStateTheme = typeof defaultTheme;\nexport type State = \"connected\" | \"connecting\" | \"disconnected\" | null;\n\nexport interface ConnectionStateProps {\n theme?: ConnectionStateTheme;\n forceHidden?: boolean;\n state: State;\n children: NonNullable<ReactNode>;\n}\n\nconst zDepth1 =\n \"0 2px 3px 0 rgba(0, 0, 0, 0.15), 0 2px 5px 0 rgba(0, 0, 0, 0.2)\";\n\ntype CreateCalc = (\n webCalc: string,\n createCalc: (dimensions: ScaledSize) => DimensionValue,\n) => DimensionValue;\n\nconst useCreateCalcNative = (): CreateCalc => {\n const dimensions = useWindowDimensions();\n return (webCalc, createCalc) => createCalc(dimensions);\n};\nconst useCreateCalcWeb = (): CreateCalc => {\n return (webCalc) => `calc(${webCalc})` as DimensionValue;\n};\nconst useCreateCalc =\n Platform.OS === \"web\" ? useCreateCalcWeb : useCreateCalcNative;\n\n// example: const left = createCalc('50% - 100px', ({ width }) => width / 2 - 100);\n\nconst styles = StyleSheet.create({\n connectionStateContainer: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n top: 0,\n right: 0,\n left: 0,\n height: 2,\n color: defaultTheme.container.color,\n textShadowOffset: defaultTheme.container.textShadowOffset,\n textShadowRadius: defaultTheme.container.textShadowRadius,\n boxShadow: zDepth1,\n zIndex: 9,\n // @ts-expect-error -- transition is not a valid style\n transition: \"top .8s, background-color .2s\",\n },\n hide: {\n top: -24,\n },\n connectionStateText: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n width: 200,\n height: 22,\n lineHeight: 22,\n top: 2,\n textAlign: \"center\",\n borderBottomLeftRadius: 5,\n borderBottomRightRadius: 5,\n transition: \"background-color .2s\",\n },\n});\n\nexport function ConnectionState({\n theme,\n forceHidden,\n state,\n children,\n}: ConnectionStateProps): ReactElement | null {\n const unloadingRef = useRef<boolean>(false);\n\n const createCalc = useCreateCalc();\n const left = createCalc(\"50% - 100px\", ({ width }) => width / 2 - 100); // TODO use calc() in web ?\n\n useEffect((): (() => void) | undefined => {\n if (typeof globalThis === \"undefined\") return;\n\n const beforeUnloadHandler = (): void => {\n unloadingRef.current = true;\n };\n window.addEventListener(\"beforeunload\", beforeUnloadHandler);\n\n return (): void => {\n window.removeEventListener(\"beforeunload\", beforeUnloadHandler);\n };\n }, []);\n\n const shouldHide = forceHidden || !state || state === \"connected\";\n\n return (\n <View\n style={[\n styles.connectionStateContainer,\n shouldHide && styles.hide,\n theme?.container,\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n ]}\n >\n {!state ? null : (\n <Text\n style={[\n styles.connectionStateText,\n theme && { backgroundColor: theme.container.backgroundColor },\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n { left },\n ]}\n >\n {children}\n </Text>\n )}\n </View>\n );\n}\n"],"names":[],"mappings":";;;;AAWA,MAAM,YAAA,GAAe;AAAA,EACnB,SAAA,EAAW;AAAA,IACT,eAAA,EAAiB,uBAAA;AAAA,IACjB,KAAA,EAAO,MAAA;AAAA,IAEP,gBAAA,EAAkB,EAAE,KAAA,EAAO,CAAA,EAAG,QAAQ,EAAA,EAAG;AAAA,IACzC,gBAAA,EAAkB;AAAA,GACpB;AAAA,EACA,wBAAA,EAA0B;AAC5B,CAAA;AAYA,MAAM,OAAA,GACJ,iEAAA;AAOF,MAAM,sBAAsB,MAAkB;AAC5C,EAAA,MAAM,aAAa,mBAAA,EAAoB;AACvC,EAAA,OAAO,CAAC,OAAA,EAAS,UAAA,KAAe,UAAA,CAAW,UAAU,CAAA;AACvD,CAAA;AACA,MAAM,mBAAmB,MAAkB;AACzC,EAAA,OAAO,CAAC,OAAA,KAAY,CAAA,KAAA,EAAQ,OAAO,CAAA,CAAA,CAAA;AACrC,CAAA;AACA,MAAM,aAAA,GACJ,QAAA,CAAS,EAAA,KAAO,KAAA,GAAQ,gBAAA,GAAm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";\nimport { useEffect, useRef } from \"react\";\nimport type { DimensionValue, ScaledSize } from \"react-native\";\nimport {\n Platform,\n StyleSheet,\n Text,\n View,\n useWindowDimensions,\n} from \"react-native\";\n\nconst defaultTheme = {\n container: {\n backgroundColor: \"rgba(247, 25, 0, 0.8)\",\n color: \"#fff\",\n textShadowColor: \"#111\",\n textShadowOffset: { width: 0, height: -1 },\n textShadowRadius: 1,\n },\n backgroundColorConnected: \"rgba(25, 200, 60, 0.8)\",\n};\n\nexport type ConnectionStateTheme = typeof defaultTheme;\nexport type State = \"connected\" | \"connecting\" | \"disconnected\" | null;\n\nexport interface ConnectionStateProps {\n theme?: ConnectionStateTheme;\n forceHidden?: boolean;\n state: State;\n children: NonNullable<ReactNode>;\n}\n\nconst zDepth1 =\n \"0 2px 3px 0 rgba(0, 0, 0, 0.15), 0 2px 5px 0 rgba(0, 0, 0, 0.2)\";\n\ntype CreateCalc = (\n webCalc: string,\n createCalc: (dimensions: ScaledSize) => DimensionValue,\n) => DimensionValue;\n\nconst useCreateCalcNative = (): CreateCalc => {\n const dimensions = useWindowDimensions();\n return (webCalc, createCalc) => createCalc(dimensions);\n};\nconst useCreateCalcWeb = (): CreateCalc => {\n return (webCalc) => `calc(${webCalc})` as DimensionValue;\n};\nconst useCreateCalc =\n Platform.OS === \"web\" ? useCreateCalcWeb : useCreateCalcNative;\n\n// example: const left = createCalc('50% - 100px', ({ width }) => width / 2 - 100);\n\nconst styles = StyleSheet.create({\n connectionStateContainer: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n top: 0,\n right: 0,\n left: 0,\n height: 2,\n color: defaultTheme.container.color,\n textShadowOffset: defaultTheme.container.textShadowOffset,\n textShadowRadius: defaultTheme.container.textShadowRadius,\n boxShadow: zDepth1,\n zIndex: 9,\n // @ts-expect-error -- transition is not a valid style\n transition: \"top .8s, background-color .2s\",\n },\n hide: {\n top: -24,\n },\n connectionStateText: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n width: 200,\n height: 22,\n lineHeight: 22,\n top: 2,\n textAlign: \"center\",\n borderBottomLeftRadius: 5,\n borderBottomRightRadius: 5,\n transition: \"background-color .2s\",\n },\n});\n\nexport function ConnectionState({\n theme,\n forceHidden,\n state,\n children,\n}: ConnectionStateProps): ReactElement | null {\n const unloadingRef = useRef<boolean>(false);\n\n const createCalc = useCreateCalc();\n const left = createCalc(\"50% - 100px\", ({ width }) => width / 2 - 100); // TODO use calc() in web ?\n\n useEffect((): (() => void) | undefined => {\n if (typeof globalThis === \"undefined\") return;\n\n const beforeUnloadHandler = (): void => {\n unloadingRef.current = true;\n };\n window.addEventListener(\"beforeunload\", beforeUnloadHandler);\n\n return (): void => {\n window.removeEventListener(\"beforeunload\", beforeUnloadHandler);\n };\n }, []);\n\n const shouldHide = forceHidden || !state || state === \"connected\";\n\n return (\n <View\n style={[\n styles.connectionStateContainer,\n shouldHide && styles.hide,\n theme?.container,\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n ]}\n >\n {!state ? null : (\n <Text\n style={[\n styles.connectionStateText,\n theme && { backgroundColor: theme.container.backgroundColor },\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n { left },\n ]}\n >\n {children}\n </Text>\n )}\n </View>\n );\n}\n"],"names":[],"mappings":";;;;AAWA,MAAM,YAAA,GAAe;AAAA,EACnB,SAAA,EAAW;AAAA,IACT,eAAA,EAAiB,uBAAA;AAAA,IACjB,KAAA,EAAO,MAAA;AAAA,IAEP,gBAAA,EAAkB,EAAE,KAAA,EAAO,CAAA,EAAG,QAAQ,EAAA,EAAG;AAAA,IACzC,gBAAA,EAAkB;AAAA,GACpB;AAAA,EACA,wBAAA,EAA0B;AAC5B,CAAA;AAYA,MAAM,OAAA,GACJ,iEAAA;AAOF,MAAM,sBAAsB,MAAkB;AAC5C,EAAA,MAAM,aAAa,mBAAA,EAAoB;AACvC,EAAA,OAAO,CAAC,OAAA,EAA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,CAAkB,SAAS,YAAA,EAAc;AAAA,aAC3C;AAAA,YACA,EAAE,IAAA;AAAK,WACT;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GAEJ;AAEJ;;;;"}
1
+ {"version":3,"file":"index-node22.mjs","sources":["../src/index.tsx"],"sourcesContent":["import type { ReactElement, ReactNode } from \"react\";\nimport { useEffect, useRef } from \"react\";\nimport type { DimensionValue, ScaledSize } from \"react-native\";\nimport {\n Platform,\n StyleSheet,\n Text,\n View,\n useWindowDimensions,\n} from \"react-native\";\n\nconst defaultTheme = {\n container: {\n backgroundColor: \"rgba(247, 25, 0, 0.8)\",\n color: \"#fff\",\n textShadowColor: \"#111\",\n textShadowOffset: { width: 0, height: -1 },\n textShadowRadius: 1,\n },\n backgroundColorConnected: \"rgba(25, 200, 60, 0.8)\",\n};\n\nexport type ConnectionStateTheme = typeof defaultTheme;\nexport type State = \"connected\" | \"connecting\" | \"disconnected\" | null;\n\nexport interface ConnectionStateProps {\n theme?: ConnectionStateTheme;\n forceHidden?: boolean;\n state: State;\n children: NonNullable<ReactNode>;\n}\n\nconst zDepth1 =\n \"0 2px 3px 0 rgba(0, 0, 0, 0.15), 0 2px 5px 0 rgba(0, 0, 0, 0.2)\";\n\ntype CreateCalc = (\n webCalc: string,\n createCalc: (dimensions: ScaledSize) => DimensionValue,\n) => DimensionValue;\n\nconst useCreateCalcNative = (): CreateCalc => {\n const dimensions = useWindowDimensions();\n return (webCalc, createCalc) => createCalc(dimensions);\n};\nconst useCreateCalcWeb = (): CreateCalc => {\n return (webCalc) => `calc(${webCalc})` as DimensionValue;\n};\nconst useCreateCalc =\n Platform.OS === \"web\" ? useCreateCalcWeb : useCreateCalcNative;\n\n// example: const left = createCalc('50% - 100px', ({ width }) => width / 2 - 100);\n\nconst styles = StyleSheet.create({\n connectionStateContainer: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n top: 0,\n right: 0,\n left: 0,\n height: 2,\n color: defaultTheme.container.color,\n textShadowOffset: defaultTheme.container.textShadowOffset,\n textShadowRadius: defaultTheme.container.textShadowRadius,\n boxShadow: zDepth1,\n zIndex: 9,\n // @ts-expect-error -- transition is not a valid style\n transition: \"top .8s, background-color .2s\",\n },\n hide: {\n top: -24,\n },\n connectionStateText: {\n backgroundColor: defaultTheme.container.backgroundColor,\n position: \"absolute\",\n width: 200,\n height: 22,\n lineHeight: 22,\n top: 2,\n textAlign: \"center\",\n borderBottomLeftRadius: 5,\n borderBottomRightRadius: 5,\n transition: \"background-color .2s\",\n },\n});\n\nexport function ConnectionState({\n theme,\n forceHidden,\n state,\n children,\n}: ConnectionStateProps): ReactElement | null {\n const unloadingRef = useRef<boolean>(false);\n\n const createCalc = useCreateCalc();\n const left = createCalc(\"50% - 100px\", ({ width }) => width / 2 - 100); // TODO use calc() in web ?\n\n useEffect((): (() => void) | undefined => {\n if (typeof globalThis === \"undefined\") return;\n\n const beforeUnloadHandler = (): void => {\n unloadingRef.current = true;\n };\n window.addEventListener(\"beforeunload\", beforeUnloadHandler);\n\n return (): void => {\n window.removeEventListener(\"beforeunload\", beforeUnloadHandler);\n };\n }, []);\n\n const shouldHide = forceHidden || !state || state === \"connected\";\n\n return (\n <View\n style={[\n styles.connectionStateContainer,\n shouldHide && styles.hide,\n theme?.container,\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n ]}\n >\n {!state ? null : (\n <Text\n style={[\n styles.connectionStateText,\n theme && { backgroundColor: theme.container.backgroundColor },\n state === \"connected\" && {\n backgroundColor: (theme || defaultTheme).backgroundColorConnected,\n },\n { left },\n ]}\n >\n {children}\n </Text>\n )}\n </View>\n );\n}\n"],"names":[],"mappings":";;;;AAWA,MAAM,YAAA,GAAe;AAAA,EACnB,SAAA,EAAW;AAAA,IACT,eAAA,EAAiB,uBAAA;AAAA,IACjB,KAAA,EAAO,MAAA;AAAA,IAEP,gBAAA,EAAkB,EAAE,KAAA,EAAO,CAAA,EAAG,QAAQ,EAAA,EAAG;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AAA,mBACR,GAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO;AAAA,YACL,MAAA,CAAO,mBAAA;AAAA,YACP,KAAA,IAAS,EAAE,eAAA,EAAiB,KAAA,CAAM,UAAU,eAAA,EAAgB;AAAA,YAC5D,UAAU,WAAA,IAAe;AAAA,cACvB,eAAA,EAAA,CAAkB,SAAS,YAAA,EAAc;AAAA,aAC3C;AAAA,YACA,EAAE,IAAA;AAAK,WACT;AAAA,UAEC;AAAA;AAAA;AACH;AAAA,GAEJ;AAEJ;;;;"}
package/package.json CHANGED
@@ -1,25 +1,29 @@
1
1
  {
2
2
  "name": "react-alp-connection-state",
3
- "version": "10.0.1",
3
+ "version": "10.0.3",
4
4
  "description": "connection state",
5
5
  "keywords": [],
6
- "author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",
6
+ "homepage": "https://github.com/christophehurpeau/alp",
7
+ "bugs": {
8
+ "url": "https://github.com/christophehurpeau/alp/issues"
9
+ },
7
10
  "license": "ISC",
11
+ "author": "Christophe Hurpeau <christophe@hurpeau.com> (https://christophe.hurpeau.com)",
8
12
  "repository": {
9
13
  "type": "git",
10
14
  "url": "https://github.com/christophehurpeau/alp.git",
11
15
  "directory": "packages/react-alp-connection-state"
12
16
  },
13
- "homepage": "https://github.com/christophehurpeau/alp",
17
+ "files": [
18
+ "src",
19
+ "dist"
20
+ ],
14
21
  "type": "module",
15
- "engines": {
16
- "node": ">=22.18.0"
17
- },
18
22
  "sideEffects": false,
19
23
  "main": "./dist/index-node22.mjs",
20
- "types": "./dist/definitions/index.d.ts",
21
24
  "module": "./dist/index-browser.es.js",
22
25
  "browser": "./dist/index-browser.es.js",
26
+ "types": "./dist/definitions/index.d.ts",
23
27
  "exports": {
24
28
  "./package.json": "./package.json",
25
29
  ".": {
@@ -33,18 +37,23 @@
33
37
  }
34
38
  }
35
39
  },
36
- "files": [
37
- "src",
38
- "dist"
39
- ],
40
- "scripts": {
41
- "build": "yarn clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
42
- "build:definitions": "tsc -p tsconfig.json",
43
- "clean": "yarn clean:build",
44
- "clean:build": "pob-esbuild-clean-out dist",
45
- "lint": "yarn run lint:eslint",
46
- "lint:eslint": "yarn ../.. run eslint --quiet packages/react-alp-connection-state",
47
- "watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
40
+ "devDependencies": {
41
+ "@pob/rollup-esbuild": "9.1.1",
42
+ "@types/react": "19.2.17",
43
+ "@types/react-native": "0.73.0",
44
+ "react": "19.1.1",
45
+ "react-dom": "19.1.1",
46
+ "react-native-web": "0.21.2",
47
+ "typescript": "6.0.3"
48
+ },
49
+ "peerDependencies": {
50
+ "react": "^19.0.0",
51
+ "react-native": "*"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "react-native": {
55
+ "optional": true
56
+ }
48
57
  },
49
58
  "browserslist": {
50
59
  "production": [
@@ -55,6 +64,9 @@
55
64
  "not ios_saf < 10"
56
65
  ]
57
66
  },
67
+ "engines": {
68
+ "node": ">=22.18.0"
69
+ },
58
70
  "pob": {
59
71
  "bundler": "rollup-esbuild",
60
72
  "entries": [
@@ -76,19 +88,14 @@
76
88
  "jsx": true,
77
89
  "typescript": true
78
90
  },
79
- "prettier": "@pob/root/prettier-config",
80
- "peerDependencies": {
81
- "react": "^19.0.0",
82
- "react-native": "*"
83
- },
84
- "peerDependenciesMeta": {
85
- "react-native": {
86
- "optional": true
87
- }
88
- },
89
- "devDependencies": {
90
- "@pob/rollup-esbuild": "6.7.0",
91
- "react": "19.1.1",
92
- "typescript": "5.9.3"
91
+ "scripts": {
92
+ "build": "yarn run clean:build && rollup --config rollup.config.mjs && yarn run build:definitions",
93
+ "build:definitions": "tsc -p tsconfig.json",
94
+ "clean": "yarn clean:build",
95
+ "clean:build": "pob-esbuild-clean-out dist",
96
+ "lint": "yarn run lint:eslint",
97
+ "lint:eslint": "yarn '../..' run eslint --quiet 'packages/react-alp-connection-state'",
98
+ "tsc": "tsc",
99
+ "watch": "yarn clean:build && rollup --config rollup.config.mjs --watch"
93
100
  }
94
101
  }
package/CHANGELOG.md DELETED
@@ -1,508 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [10.0.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@10.0.0...react-alp-connection-state@10.0.1) (2025-11-12)
7
-
8
- Note: no notable changes
9
-
10
-
11
- ## [10.0.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@9.0.0...react-alp-connection-state@10.0.0) (2025-10-27)
12
-
13
- ### ⚠ BREAKING CHANGES
14
-
15
- * drop node 20 and build using esbuild
16
-
17
- ### Features
18
-
19
- * drop node 20 and build using esbuild ([812c4c1](https://github.com/christophehurpeau/alp/commit/812c4c1b0ad19984e389af4382a8d1e60643e4f1))
20
-
21
- ## [9.0.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@8.1.1...react-alp-connection-state@9.0.0) (2025-08-02)
22
-
23
- ### ⚠ BREAKING CHANGES
24
-
25
- * update dependencies and drop node 20
26
- * update dev dependencies, replace parse-json-object-as-map with native JSON.parse, update koa
27
-
28
- ### Features
29
-
30
- * update babel ([a4bf455](https://github.com/christophehurpeau/alp/commit/a4bf455c715134973c56693b7425aa05de5b10f9))
31
- * update dependencies and drop node 20 ([fc5b322](https://github.com/christophehurpeau/alp/commit/fc5b322e076e9a3c7c4a235d16734b89fd85e211))
32
- * update dev dependencies, replace parse-json-object-as-map with native JSON.parse, update koa ([5ae7723](https://github.com/christophehurpeau/alp/commit/5ae77238cafc573fe72c5eb63b103802b8b2e537))
33
-
34
- ### Bug Fixes
35
-
36
- * **deps:** update react monorepo ([#611](https://github.com/christophehurpeau/alp/issues/611)) ([b9ece4d](https://github.com/christophehurpeau/alp/commit/b9ece4dc070bcd49fa6c4a40534162d10087405b))
37
-
38
- ## [8.1.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@8.1.0...react-alp-connection-state@8.1.1) (2024-01-06)
39
-
40
- Note: no notable changes
41
-
42
-
43
-
44
-
45
- ## [8.1.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@8.0.0...react-alp-connection-state@8.1.0) (2023-12-25)
46
-
47
-
48
- ### Features
49
-
50
- * update dependencies ([ddc8f92](https://github.com/christophehurpeau/alp/commit/ddc8f92cccacf6ed2baabf8555f0b37fe281ce9d))
51
-
52
-
53
-
54
-
55
- ## [8.0.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@7.2.0...react-alp-connection-state@8.0.0) (2023-07-29)
56
-
57
-
58
- ### ⚠ BREAKING CHANGES
59
-
60
- * drop node 16
61
-
62
- ### Features
63
-
64
- * update react-native and react-native-web ([676e18a](https://github.com/christophehurpeau/alp/commit/676e18aefbe4a9b48debcbfb5327ae7e50d70d6f))
65
-
66
-
67
- ### Code Refactoring
68
-
69
- * update to node 18 ([26280d6](https://github.com/christophehurpeau/alp/commit/26280d638aba1bd46fa42ad5a571b9626f1fff6d))
70
-
71
-
72
-
73
- ## [7.2.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@7.1.5...react-alp-connection-state@7.2.0) (2023-03-19)
74
-
75
-
76
- ### Features
77
-
78
- * update dev dependencies ([9d7e24f](https://github.com/christophehurpeau/alp/commit/9d7e24f8e504d47feae64ca618dc2b3a69babc38))
79
-
80
-
81
- ### Bug Fixes
82
-
83
- * lint ([fce8605](https://github.com/christophehurpeau/alp/commit/fce86056748c6c0cbbbca49e689218475e87456f))
84
-
85
-
86
-
87
- ## [7.1.5](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@7.1.4...react-alp-connection-state@7.1.5) (2023-02-18)
88
-
89
- **Note:** Version bump only for package react-alp-connection-state
90
-
91
-
92
-
93
-
94
-
95
- ## [7.1.4](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@7.1.3...react-alp-connection-state@7.1.4) (2023-02-13)
96
-
97
- **Note:** Version bump only for package react-alp-connection-state
98
-
99
-
100
-
101
-
102
-
103
- ## [7.1.3](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@7.1.2...react-alp-connection-state@7.1.3) (2023-02-05)
104
-
105
- **Note:** Version bump only for package react-alp-connection-state
106
-
107
-
108
-
109
-
110
-
111
- ## [7.1.2](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@7.1.1...react-alp-connection-state@7.1.2) (2023-01-31)
112
-
113
- **Note:** Version bump only for package react-alp-connection-state
114
-
115
-
116
-
117
-
118
-
119
- ## [7.1.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@7.1.0...react-alp-connection-state@7.1.1) (2023-01-31)
120
-
121
- **Note:** Version bump only for package react-alp-connection-state
122
-
123
-
124
-
125
-
126
-
127
- # [7.1.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@7.0.0...react-alp-connection-state@7.1.0) (2023-01-29)
128
-
129
-
130
- ### Features
131
-
132
- * update configs ([e9cbde7](https://github.com/christophehurpeau/alp/commit/e9cbde74ddbbb730bc2b65bb6d0b87f2bba8006e))
133
-
134
-
135
-
136
-
137
-
138
- # [7.0.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@6.2.2...react-alp-connection-state@7.0.0) (2022-11-27)
139
-
140
-
141
- ### Features
142
-
143
- * drop node 14 ([5d5f90b](https://github.com/christophehurpeau/alp/commit/5d5f90b09d8532278aba75a97f10ea90bbb27919))
144
-
145
-
146
- ### BREAKING CHANGES
147
-
148
- * drop node 14
149
-
150
-
151
-
152
-
153
-
154
- ## [6.2.2](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@6.2.1...react-alp-connection-state@6.2.2) (2022-10-29)
155
-
156
-
157
- ### Bug Fixes
158
-
159
- * **react-alp-connection-state:** use Text ([629c6b1](https://github.com/christophehurpeau/alp/commit/629c6b1b5ef2361a77a68a8090939d4a0688db74))
160
-
161
-
162
-
163
-
164
-
165
- ## [6.2.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@6.2.0...react-alp-connection-state@6.2.1) (2022-10-19)
166
-
167
- **Note:** Version bump only for package react-alp-connection-state
168
-
169
-
170
-
171
-
172
-
173
- # [6.2.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@6.1.1...react-alp-connection-state@6.2.0) (2022-10-16)
174
-
175
-
176
- ### Features
177
-
178
- * update to react 18 ([6ac42b8](https://github.com/christophehurpeau/alp/commit/6ac42b84b80bf76853773f3b93819666684327d1))
179
-
180
-
181
-
182
-
183
-
184
- ## [6.1.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@6.1.0...react-alp-connection-state@6.1.1) (2022-10-13)
185
-
186
-
187
- ### Bug Fixes
188
-
189
- * **react-alp-connection-state:** remove console.log ([cf4af9e](https://github.com/christophehurpeau/alp/commit/cf4af9e31071039fe30ab16e9e7adb7cf967832c))
190
-
191
-
192
-
193
-
194
-
195
- # [6.1.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@6.0.1...react-alp-connection-state@6.1.0) (2022-03-05)
196
-
197
-
198
- ### Features
199
-
200
- * **react-alp-connection-state:** create cjs version ([8171bc6](https://github.com/christophehurpeau/alp/commit/8171bc62dd38810679ff5297a054e80459d96881))
201
-
202
-
203
-
204
-
205
-
206
- ## [6.0.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@6.0.0...react-alp-connection-state@6.0.1) (2022-02-20)
207
-
208
- **Note:** Version bump only for package react-alp-connection-state
209
-
210
-
211
-
212
-
213
-
214
- # [6.0.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@5.0.2...react-alp-connection-state@6.0.0) (2022-02-13)
215
-
216
-
217
- ### Bug Fixes
218
-
219
- * dont override react/react-in-jsx-scope ([5d21c9e](https://github.com/christophehurpeau/alp/commit/5d21c9ece092cd3397d1794211dae17cea6649f8))
220
-
221
-
222
- ### Features
223
-
224
- * **react-alp-connection-state:** rewrite with react-native ([4e81a48](https://github.com/christophehurpeau/alp/commit/4e81a48fa2a701794971576236ea4f68bd16a475))
225
-
226
-
227
- ### BREAKING CHANGES
228
-
229
- * **react-alp-connection-state:** new api, react-native or react-native-web, children with text required
230
-
231
-
232
-
233
-
234
-
235
- ## [5.0.2](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@5.0.1...react-alp-connection-state@5.0.2) (2022-02-06)
236
-
237
- **Note:** Version bump only for package react-alp-connection-state
238
-
239
-
240
-
241
-
242
-
243
- ## [5.0.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@5.0.0...react-alp-connection-state@5.0.1) (2022-01-15)
244
-
245
- **Note:** Version bump only for package react-alp-connection-state
246
-
247
-
248
-
249
-
250
-
251
- # [5.0.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@4.1.3...react-alp-connection-state@5.0.0) (2022-01-02)
252
-
253
-
254
- ### Bug Fixes
255
-
256
- * update nightingale and fix tests ([3691716](https://github.com/christophehurpeau/alp/commit/36917162d0ee3dccc07384caf018b7760d98b744))
257
-
258
-
259
- ### Features
260
-
261
- * use ESM and drop node 12 ([f45054e](https://github.com/christophehurpeau/alp/commit/f45054e931eea88451d183722797eba057511236))
262
-
263
-
264
- ### BREAKING CHANGES
265
-
266
- * requires node 14 and ESM
267
-
268
-
269
-
270
-
271
-
272
- ## [4.1.3](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@4.1.2...react-alp-connection-state@4.1.3) (2021-04-10)
273
-
274
- **Note:** Version bump only for package react-alp-connection-state
275
-
276
-
277
-
278
-
279
-
280
- ## [4.1.2](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@4.1.1...react-alp-connection-state@4.1.2) (2021-03-28)
281
-
282
- **Note:** Version bump only for package react-alp-connection-state
283
-
284
-
285
-
286
-
287
-
288
- ## [4.1.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@4.1.0...react-alp-connection-state@4.1.1) (2021-03-28)
289
-
290
- **Note:** Version bump only for package react-alp-connection-state
291
-
292
-
293
-
294
-
295
-
296
- # [4.1.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@4.0.2...react-alp-connection-state@4.1.0) (2021-03-21)
297
-
298
-
299
- ### Features
300
-
301
- * update dependencies and browserlist config ([ec17710](https://github.com/christophehurpeau/alp/commit/ec177106dbfb094fface3d2791800916929305fc))
302
-
303
-
304
-
305
-
306
-
307
- ## [4.0.2](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@4.0.1...react-alp-connection-state@4.0.2) (2021-01-18)
308
-
309
-
310
- ### Bug Fixes
311
-
312
- * deps and export import browser ([c8e51a6](https://github.com/christophehurpeau/alp/commit/c8e51a61befee852cbdbfb7697c7fd273a8d49ef))
313
- * multiple stuff ([e914474](https://github.com/christophehurpeau/alp/commit/e9144747913b8edae7dc1ba94767d03e085cbdcd))
314
-
315
-
316
-
317
-
318
-
319
- ## [4.0.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@4.0.0...react-alp-connection-state@4.0.1) (2021-01-17)
320
-
321
- **Note:** Version bump only for package react-alp-connection-state
322
-
323
-
324
-
325
-
326
-
327
- # [4.0.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@3.0.2...react-alp-connection-state@4.0.0) (2021-01-17)
328
-
329
-
330
- ### Code Refactoring
331
-
332
- * update dev deps and typescript and eslint ([8cdc20e](https://github.com/christophehurpeau/alp/commit/8cdc20e030769d98d637b9580931cc5cc608278d))
333
-
334
-
335
- ### BREAKING CHANGES
336
-
337
- * requires node 12
338
-
339
-
340
-
341
-
342
-
343
- ## [3.0.2](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@3.0.1...react-alp-connection-state@3.0.2) (2021-01-12)
344
-
345
- **Note:** Version bump only for package react-alp-connection-state
346
-
347
-
348
-
349
-
350
-
351
- ## [3.0.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@3.0.0...react-alp-connection-state@3.0.1) (2020-08-09)
352
-
353
- **Note:** Version bump only for package react-alp-connection-state
354
-
355
-
356
-
357
-
358
-
359
- # [3.0.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@2.1.1...react-alp-connection-state@3.0.0) (2020-08-08)
360
-
361
-
362
- ### Features
363
-
364
- * **react-alp-connection-state:** pass state as prop ([936cc62](https://github.com/christophehurpeau/alp/commit/936cc62))
365
-
366
-
367
- ### BREAKING CHANGES
368
-
369
- * **react-alp-connection-state:** requies to pass state as prop
370
-
371
-
372
-
373
-
374
-
375
- ## [2.1.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@2.1.0...react-alp-connection-state@2.1.1) (2020-08-08)
376
-
377
- **Note:** Version bump only for package react-alp-connection-state
378
-
379
-
380
-
381
-
382
-
383
- # [2.1.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@2.0.3...react-alp-connection-state@2.1.0) (2020-05-30)
384
-
385
-
386
- ### Features
387
-
388
- * update dependencies ([70b1f7f](https://github.com/christophehurpeau/alp/commit/70b1f7f))
389
-
390
-
391
-
392
-
393
-
394
- ## [2.0.3](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@2.0.2...react-alp-connection-state@2.0.3) (2020-05-02)
395
-
396
- **Note:** Version bump only for package react-alp-connection-state
397
-
398
-
399
-
400
-
401
-
402
- ## [2.0.2](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@2.0.1...react-alp-connection-state@2.0.2) (2019-12-16)
403
-
404
-
405
- ### Bug Fixes
406
-
407
- * update pobpack ([6e0b501](https://github.com/christophehurpeau/alp/commit/6e0b501))
408
-
409
-
410
-
411
-
412
-
413
- ## [2.0.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@2.0.0...react-alp-connection-state@2.0.1) (2019-12-15)
414
-
415
- **Note:** Version bump only for package react-alp-connection-state
416
-
417
-
418
-
419
-
420
-
421
- # [2.0.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@1.2.1...react-alp-connection-state@2.0.0) (2019-12-15)
422
-
423
-
424
- ### Features
425
-
426
- * update dependencies ([2d1539c](https://github.com/christophehurpeau/alp/commit/2d1539c))
427
- * update dependencies and pob ([edee8ce](https://github.com/christophehurpeau/alp/commit/edee8ce))
428
-
429
-
430
- ### BREAKING CHANGES
431
-
432
- * drop node 8
433
-
434
-
435
-
436
-
437
-
438
- ## [1.2.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@1.2.0...react-alp-connection-state@1.2.1) (2019-09-15)
439
-
440
-
441
- ### Bug Fixes
442
-
443
- * update ynnub to support sass-loader ([9c62b49](https://github.com/christophehurpeau/alp/commit/9c62b49))
444
-
445
-
446
-
447
-
448
-
449
- # [1.2.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@1.1.3...react-alp-connection-state@1.2.0) (2019-09-13)
450
-
451
-
452
- ### Features
453
-
454
- * add react-alp-antd-form and update dependencies ([6f60e46](https://github.com/christophehurpeau/alp/commit/6f60e46))
455
-
456
-
457
-
458
-
459
-
460
- ## [1.1.3](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@1.1.2...react-alp-connection-state@1.1.3) (2019-09-13)
461
-
462
- **Note:** Version bump only for package react-alp-connection-state
463
-
464
-
465
-
466
-
467
-
468
- ## [1.1.2](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@1.1.1...react-alp-connection-state@1.1.2) (2019-09-09)
469
-
470
-
471
- ### Bug Fixes
472
-
473
- * pob update ([ffe6857](https://github.com/christophehurpeau/alp/commit/ffe6857))
474
- * removeEventListener(beforeunload in ConnectionState ([0028dc2](https://github.com/christophehurpeau/alp/commit/0028dc2))
475
- * typescript issues ([23246f6](https://github.com/christophehurpeau/alp/commit/23246f6))
476
-
477
-
478
-
479
-
480
-
481
- ## [1.1.1](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@1.1.0...react-alp-connection-state@1.1.1) (2019-05-01)
482
-
483
-
484
- ### Bug Fixes
485
-
486
- * hot loader ([c880769](https://github.com/christophehurpeau/alp/commit/c880769))
487
-
488
-
489
-
490
-
491
-
492
- # [1.1.0](https://github.com/christophehurpeau/alp/compare/react-alp-connection-state@1.0.0...react-alp-connection-state@1.1.0) (2019-05-01)
493
-
494
-
495
- ### Features
496
-
497
- * update deps and pobpack ([1e19ea4](https://github.com/christophehurpeau/alp/commit/1e19ea4))
498
-
499
-
500
-
501
-
502
-
503
- # 1.0.0 (2019-04-29)
504
-
505
-
506
- ### Features
507
-
508
- * add react-alp-connection-state ([d54a78d](https://github.com/christophehurpeau/alp/commit/d54a78d))