Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@tolgee/core

Package Overview
Dependencies
Maintainers
1
Versions
354
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tolgee/core - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

1

lib/__testFixtures/createElement.js

@@ -38,2 +38,3 @@ var __read = (this && this.__read) || function (o, n) {

params: { a: 'aaa' },
defaultValue: 'default value',
});

@@ -40,0 +41,0 @@ }

@@ -76,2 +76,4 @@ var __extends = (this && this.__extends) || (function () {

elementWithMeta._tolgee.wrappedWithElementOnlyKey = element.getAttribute(TOLGEE_WRAPPED_ONLY_DATA_ATTRIBUTE);
elementWithMeta._tolgee.wrappedWithElementOnlyDefaultHtml =
element.innerHTML;
_this.elementRegistrar.register(elementWithMeta);

@@ -78,0 +80,0 @@ });

1

lib/highlighter/MouseEventHandler.d.ts

@@ -8,3 +8,2 @@ import { ElementWithMeta } from '../types';

private highlighted;
private highlightedInitialBackgroundColor;
private mouseOnChanged;

@@ -11,0 +10,0 @@ private keysChanged;

@@ -12,4 +12,4 @@ import { ElementWithMeta } from '../types';

listen(element: ElementWithMeta & ElementCSSInlineStyle): void;
private getKey;
private getKeyAndDefault;
private translationEdit;
}

@@ -72,7 +72,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

if (!(typeof this.renderer === 'object')) return [3 /*break*/, 2];
return [4 /*yield*/, this.getKey(e, element)];
return [4 /*yield*/, this.getKeyAndDefault(e, element)];
case 1:
key = _a.sent();
if (key) {
this.renderer.renderViewer(key);
this.renderer.renderViewer(key.key, key.defaultValue);
return [2 /*return*/];

@@ -104,4 +104,6 @@ }

var nodes = Array.from(node._tolgee.nodes);
var keys = nodes.reduce(function (acc, curr) { return __spreadArray(__spreadArray([], __read(acc), false), __read(curr._tolgee.keys.map(function (k) { return k.key; })), false); }, []);
return new Set(keys);
return nodes.reduce(function (acc, curr) { return __spreadArray(__spreadArray([], __read(acc), false), __read(curr._tolgee.keys.map(function (k) { return ({
key: k.key,
defaultValue: k.defaultValue,
}); })), false); }, []);
};

@@ -118,5 +120,5 @@ TranslationHighlighter.prototype.listen = function (element) {

};
TranslationHighlighter.prototype.getKey = function (mouseEvent, element) {
TranslationHighlighter.prototype.getKeyAndDefault = function (mouseEvent, element) {
return __awaiter(this, void 0, void 0, function () {
var keys;
var keysWithDefaults, keySet, selectedKey_1, found;
return __generator(this, function (_a) {

@@ -126,11 +128,24 @@ switch (_a.label) {

if (element._tolgee.wrappedWithElementOnlyKey) {
return [2 /*return*/, element._tolgee.wrappedWithElementOnlyKey];
return [2 /*return*/, {
key: element._tolgee.wrappedWithElementOnlyKey,
defaultValue: element._tolgee.wrappedWithElementOnlyDefaultHtml,
}];
}
keys = TranslationHighlighter.getKeyOptions(element);
if (!(keys.size > 1)) return [3 /*break*/, 2];
return [4 /*yield*/, this.renderer.getKey({ keys: keys, openEvent: mouseEvent })];
case 1: return [2 /*return*/, _a.sent()];
keysWithDefaults = TranslationHighlighter.getKeyOptions(element);
keySet = new Set(keysWithDefaults.map(function (keyWithDefault) { return keyWithDefault.key; }));
if (!(keySet.size > 1)) return [3 /*break*/, 2];
return [4 /*yield*/, this.renderer.getKey({
keys: keySet,
openEvent: mouseEvent,
})];
case 1:
selectedKey_1 = _a.sent();
found = keysWithDefaults.find(function (kwd) { return kwd.key === selectedKey_1; });
if (found) {
return [2 /*return*/, found];
}
_a.label = 2;
case 2:
if (keys.size === 1) {
return [2 /*return*/, Array.from(keys)[0]];
if (keySet.size === 1) {
return [2 /*return*/, keysWithDefaults[0]];
}

@@ -137,0 +152,0 @@ // eslint-disable-next-line no-console

@@ -97,3 +97,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

expect(rendererViewerMock).toBeCalledTimes(1);
expect(rendererViewerMock).toBeCalledWith('key');
expect(rendererViewerMock).toBeCalledWith('key', 'default value');
return [2 /*return*/];

@@ -114,3 +114,3 @@ }

expect(rendererViewerMock).toBeCalledTimes(1);
expect(rendererViewerMock).toBeCalledWith('key');
expect(rendererViewerMock).toBeCalledWith('key', 'default value');
return [2 /*return*/];

@@ -117,0 +117,0 @@ }

@@ -50,2 +50,3 @@ export interface TextInputElementData {

wrappedWithElementOnlyKey?: string;
wrappedWithElementOnlyDefaultHtml?: string;
nodes: Set<NodeWithMeta>;

@@ -52,0 +53,0 @@ listeningForHighlighting?: boolean;

{
"name": "@tolgee/core",
"version": "2.0.0",
"version": "2.1.0",
"description": "Library providing ability to translate messages directly in context of developed application.",

@@ -41,4 +41,4 @@ "main": "index.js",

"devDependencies": {
"@rollup/plugin-node-resolve": "13.0.5",
"@rollup/plugin-typescript": "8.2.5",
"@rollup/plugin-node-resolve": "13.0.6",
"@rollup/plugin-typescript": "8.3.0",
"@testing-library/dom": "^8.7.1",

@@ -58,7 +58,7 @@ "@testing-library/jest-dom": "^5.11.4",

"tslib": "^2.3.1",
"typedoc": "0.22.5",
"typedoc": "0.22.7",
"typedoc-plugin-markdown": "3.11.3",
"typescript": "4.4.3"
"typescript": "4.4.4"
},
"gitHead": "420df902ef07bf3d19cec19e53f2a61a6f49aef5",
"gitHead": "883ec544ab3eb922629e6cee003fe860e329f2d8",
"publishConfig": {

@@ -65,0 +65,0 @@ "access": "public"

![test workflow](https://github.com/tolgee/tolgee-js/actions/workflows/test.yml/badge.svg)
![@tolgee/core version](https://img.shields.io/npm/v/@tolgee/core?label=%40tolgee%2Fcore)
![types typescript](https://img.shields.io/badge/Types-Typescript-blue)
![twitter](https://img.shields.io/twitter/follow/Tolgee_i18n?style=social)
[![twitter](https://img.shields.io/twitter/follow/Tolgee_i18n?style=social)](https://twitter.com/Tolgee_i18n)
[![github stars](https://img.shields.io/github/stars/tolgee/tolgee-js?style=social)](https://github.com/tolgee/tolgee-js)

@@ -6,0 +6,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc