@lingui/react
Advanced tools
Comparing version 3.0.0-7 to 3.0.0-8
@@ -1,2 +0,2 @@ | ||
import * as React from "react"; | ||
import React from "react"; | ||
/** | ||
@@ -3,0 +3,0 @@ * `formatElements` - parse string and return tree of react elements |
@@ -1,2 +0,2 @@ | ||
/// <reference types="react" /> | ||
import { FunctionComponent } from "react"; | ||
import { I18n } from "@lingui/core"; | ||
@@ -9,7 +9,6 @@ import { TransRenderType } from "./Trans"; | ||
export interface I18nProviderProps extends I18nContext { | ||
children: any; | ||
} | ||
export declare function useLingui(): I18nContext; | ||
export declare const I18nProvider: (props: I18nProviderProps) => JSX.Element; | ||
export declare const I18nProvider: FunctionComponent<I18nProviderProps>; | ||
export {}; | ||
//# sourceMappingURL=I18nProvider.d.ts.map |
@@ -8,4 +8,4 @@ 'use strict'; | ||
var _slicedToArray = _interopDefault(require('@babel/runtime/helpers/slicedToArray')); | ||
var React = require('react'); | ||
var _objectSpread = _interopDefault(require('@babel/runtime/helpers/objectSpread2')); | ||
var React = _interopDefault(require('react')); | ||
var _defineProperty = _interopDefault(require('@babel/runtime/helpers/defineProperty')); | ||
@@ -67,6 +67,12 @@ var LinguiContext = React.createContext(null); | ||
value: context | ||
}, context.i18n.locale && props.children); | ||
}, props.children); | ||
}; | ||
var tagRe = /<(\d+)>(.*)<\/\1>|<(\d+)\/>/; | ||
function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; } | ||
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } | ||
var tagRe = /<(\d+)>(.*?)<\/\1>|<(\d+)\/>/; | ||
var nlRe = /(?:\r\n|\r|\n)/g; | ||
@@ -89,8 +95,8 @@ /** | ||
if (before) tree.push(before); | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
var _iterator = _createForOfIteratorHelper(getElements(parts)), | ||
_step; | ||
try { | ||
for (var _iterator = getElements(parts)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
for (_iterator.s(); !(_step = _iterator.n()).done;) { | ||
var _step$value = _slicedToArray(_step.value, 3), | ||
@@ -110,14 +116,5 @@ index = _step$value[0], | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
_iterator.e(err); | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
_iterator.f(); | ||
} | ||
@@ -156,2 +153,5 @@ | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function Trans(props) { | ||
@@ -158,0 +158,0 @@ var _useLingui = useLingui(), |
@@ -1,1 +0,1 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("@babel/runtime/helpers/slicedToArray")),n=require("react"),t=e(require("@babel/runtime/helpers/objectSpread2")),a=n.createContext(null);function u(){var e=n.useContext(a);return e}var l=/<(\d+)>(.*)<\/\1>|<(\d+)\/>/,i=/(?:\r\n|\r|\n)/g;function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=e.replace(i,"").split(l);if(1===a.length)return e;var u=[],c=a.shift();c&&u.push(c);var s=!0,f=!1,d=void 0;try{for(var v,p=function e(n){if(!n.length)return[];var t=n.slice(0,4),a=r(t,4),u=a[0],l=a[1],i=a[2],o=a[3];return[[parseInt(u||i),l||"",o]].concat(e(n.slice(4,n.length)))}(a)[Symbol.iterator]();!(s=(v=p.next()).done);s=!0){var h=r(v.value,3),m=h[0],y=h[1],g=h[2],b=t[m];u.push(n.cloneElement(b,{key:m},y?o(y,t):b.props.children)),g&&u.push(g)}}catch(e){f=!0,d=e}finally{try{s||null==p.return||p.return()}finally{if(f)throw d}}return u}function c(e){var r=u(),a=r.i18n,l=r.defaultRender,i=e.render,c=void 0===i?l:i,s=e.id,f=e.message,d=e.formats,v=t({},e.values),p=t({},e.components);v&&Object.keys(v).forEach(function(e){var r=v[e];if(n.isValidElement(r)){var t=Object.keys(p).length;p[t]=r,v[e]="<".concat(t,"/>")}});var h=a&&"function"==typeof a._?a._(s,v,{message:f,formats:d}):s,m=h?o(h,p):null;return null==c?m:"string"==typeof c?n.createElement(c,{},m):n.isValidElement(c)?n.cloneElement(c,{},m):n.createElement(c,{id:s,translation:m,message:f})}c.defaultProps={values:{},components:{}},exports.I18nProvider=function(e){var t=n.useState(o()),u=r(t,2),l=u[0],i=u[1];function o(){return{i18n:e.i18n,defaultRender:e.defaultRender}}return n.useEffect(function(){var r=e.i18n.on("change",function(){return i(o())});return function(){return r()}},[]),n.createElement(a.Provider,{value:l},l.i18n.locale&&e.children)},exports.Trans=c,exports.useLingui=u; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var r=e(require("@babel/runtime/helpers/slicedToArray")),t=e(require("react")),n=e(require("@babel/runtime/helpers/defineProperty")),o=t.createContext(null);function i(){var e=t.useContext(o);return e}function u(e){if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(e=function(e,r){if(!e)return;if("string"==typeof e)return a(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return a(e,r)}(e))){var r=0,t=function(){};return{s:t,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:t}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n,o,i=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return i=e.done,e},e:function(e){u=!0,o=e},f:function(){try{i||null==n.return||n.return()}finally{if(u)throw o}}}}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}var c=/<(\d+)>(.*?)<\/\1>|<(\d+)\/>/,l=/(?:\r\n|\r|\n)/g;function f(e){if(!e.length)return[];var t=e.slice(0,4),n=r(t,4),o=n[0],i=n[1],u=n[2],a=n[3];return[[parseInt(o||u),i||"",a]].concat(f(e.slice(4,e.length)))}function s(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function p(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?s(Object(t),!0).forEach((function(r){n(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function d(e){var n=i(),o=n.i18n,a=n.defaultRender,s=e.render,d=void 0===s?a:s,y=e.id,v=e.message,b=e.formats,m=p({},e.values),h=p({},e.components);m&&Object.keys(m).forEach((function(e){var r=m[e];if(t.isValidElement(r)){var n=Object.keys(h).length;h[n]=r,m[e]="<".concat(n,"/>")}}));var g=o&&"function"==typeof o._?o._(y,m,{message:v,formats:b}):y,O=g?function e(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.replace(l,"").split(c);if(1===i.length)return n;var a=[],s=i.shift();s&&a.push(s);var p,d=u(f(i));try{for(d.s();!(p=d.n()).done;){var y=r(p.value,3),v=y[0],b=y[1],m=y[2],h=o[v];a.push(t.cloneElement(h,{key:v},b?e(b,o):h.props.children)),m&&a.push(m)}}catch(e){d.e(e)}finally{d.f()}return a}(g,h):null;return null==d?O:"string"==typeof d?t.createElement(d,{},O):t.isValidElement(d)?t.cloneElement(d,{},O):t.createElement(d,{id:y,translation:O,message:v})}d.defaultProps={values:{},components:{}},exports.I18nProvider=function(e){var n=t.useState(c()),i=r(n,2),u=i[0],a=i[1];function c(){return{i18n:e.i18n,defaultRender:e.defaultRender}}return t.useEffect((function(){var r=e.i18n.on("change",(function(){return a(c())}));return function(){return r()}}),[]),t.createElement(o.Provider,{value:u},e.children)},exports.Trans=d,exports.useLingui=i; |
@@ -1,2 +0,2 @@ | ||
import * as React from "react"; | ||
import React from "react"; | ||
export interface TransRenderProps { | ||
@@ -18,4 +18,4 @@ id: string; | ||
} | ||
declare function Trans(props: TransProps): string | any[] | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>; | ||
declare namespace Trans { | ||
export declare function Trans(props: TransProps): string | any[] | React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)>) | (new (props: any) => React.Component<any, any, any>)>; | ||
export declare namespace Trans { | ||
var defaultProps: { | ||
@@ -26,3 +26,2 @@ values: {}; | ||
} | ||
export default Trans; | ||
//# sourceMappingURL=Trans.d.ts.map |
{ | ||
"name": "@lingui/react", | ||
"version": "3.0.0-7", | ||
"version": "3.0.0-8", | ||
"description": "React components for translations", | ||
@@ -30,3 +30,3 @@ "main": "index.js", | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=10.0.0" | ||
}, | ||
@@ -43,4 +43,4 @@ "files": [ | ||
"dependencies": { | ||
"@babel/runtime": "^7.4.5", | ||
"@lingui/core": "3.0.0-7" | ||
"@babel/runtime": "^7.9.2", | ||
"@lingui/core": "3.0.0-8" | ||
}, | ||
@@ -47,0 +47,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19390
254
+ Added@lingui/core@3.0.0-8(transitive)
+ Addedmake-plural@6.2.2(transitive)
+ Addedmessageformat-parser@4.1.3(transitive)
- Removed@lingui/core@3.0.0-7(transitive)
- Removedmake-plural@4.3.0(transitive)
- Removedmessageformat-parser@2.0.0(transitive)
- Removedminimist@1.2.8(transitive)
Updated@babel/runtime@^7.9.2
Updated@lingui/core@3.0.0-8