locize 3.3.0 → 4.0.0

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.
Files changed (95) hide show
  1. package/README.md +74 -36
  2. package/dist/cjs/{processLegacy.js → _processLegacy.js} +1 -2
  3. package/dist/cjs/{startStandalone.js → _startStandalone.js} +2 -2
  4. package/dist/cjs/api/handleCommitKeys.js +7 -0
  5. package/dist/cjs/api/handleEditKey.js +1 -1
  6. package/dist/cjs/api/handleIsLocizeEnabled.js +2 -2
  7. package/dist/cjs/api/handleRequestPopupChanges.js +11 -0
  8. package/dist/cjs/api/handleSendMatchedUninstrumented.js +26 -0
  9. package/dist/cjs/api/postMessage.js +32 -45
  10. package/dist/cjs/implementations/dummyImplementation.js +35 -0
  11. package/dist/cjs/implementations/i18nextImplementation.js +94 -0
  12. package/dist/cjs/index.d.ts +9 -16
  13. package/dist/cjs/index.js +4 -9
  14. package/dist/cjs/locizePlugin.js +6 -90
  15. package/dist/cjs/observer.js +1 -0
  16. package/dist/cjs/parser.js +100 -14
  17. package/dist/cjs/process.js +37 -5
  18. package/dist/cjs/store.js +1 -0
  19. package/dist/cjs/ui/elements/highlightBox.js +13 -0
  20. package/dist/cjs/ui/elements/icons.js +1 -17
  21. package/dist/cjs/ui/elements/popup.js +3 -3
  22. package/dist/cjs/ui/elements/ribbonBox.js +3 -6
  23. package/dist/cjs/ui/highlightNode.js +28 -77
  24. package/dist/cjs/ui/popup.js +10 -0
  25. package/dist/cjs/ui/utils.js +18 -0
  26. package/dist/cjs/uninstrumentedStore.js +18 -2
  27. package/dist/cjs/utils.js +54 -0
  28. package/dist/cjs/vars.js +5 -2
  29. package/dist/esm/{processLegacy.js → _processLegacy.js} +1 -2
  30. package/dist/esm/{startStandalone.js → _startStandalone.js} +1 -1
  31. package/dist/esm/api/handleCommitKeys.js +7 -0
  32. package/dist/esm/api/handleEditKey.js +1 -1
  33. package/dist/esm/api/handleIsLocizeEnabled.js +2 -2
  34. package/dist/esm/api/handleRequestPopupChanges.js +11 -0
  35. package/dist/esm/api/handleSendMatchedUninstrumented.js +20 -0
  36. package/dist/esm/api/postMessage.js +33 -44
  37. package/dist/esm/implementations/dummyImplementation.js +31 -0
  38. package/dist/esm/implementations/i18nextImplementation.js +85 -0
  39. package/dist/esm/index.d.ts +9 -16
  40. package/dist/esm/index.js +5 -8
  41. package/dist/esm/locizePlugin.js +5 -85
  42. package/dist/esm/observer.js +1 -0
  43. package/dist/esm/parser.js +101 -16
  44. package/dist/esm/process.js +38 -6
  45. package/dist/esm/store.js +1 -0
  46. package/dist/esm/ui/elements/highlightBox.js +9 -0
  47. package/dist/esm/ui/elements/icons.js +2 -16
  48. package/dist/esm/ui/elements/popup.js +3 -3
  49. package/dist/esm/ui/elements/ribbonBox.js +4 -7
  50. package/dist/esm/ui/highlightNode.js +28 -78
  51. package/dist/esm/ui/popup.js +10 -0
  52. package/dist/esm/ui/utils.js +18 -1
  53. package/dist/esm/uninstrumentedStore.js +18 -2
  54. package/dist/esm/utils.js +53 -1
  55. package/dist/esm/vars.js +5 -3
  56. package/dist/umd/locize.js +726 -496
  57. package/dist/umd/locize.min.js +1 -1
  58. package/index.d.ts +9 -16
  59. package/locize.js +726 -496
  60. package/locize.min.js +1 -1
  61. package/package.json +1 -1
  62. package/src/_startStandalone.js +22 -0
  63. package/src/api/handleCommitKeys.js +9 -0
  64. package/src/api/handleEditKey.js +5 -11
  65. package/src/api/handleIsLocizeEnabled.js +7 -2
  66. package/src/api/handleRequestPopupChanges.js +27 -0
  67. package/src/api/handleSendMatchedUninstrumented.js +38 -0
  68. package/src/api/index.js +1 -4
  69. package/src/api/postMessage.js +37 -53
  70. package/src/implementations/dummyImplementation.js +29 -0
  71. package/src/implementations/i18nextImplementation.js +114 -0
  72. package/src/implementations/index.js +2 -0
  73. package/src/index.js +8 -7
  74. package/src/locizePlugin.js +51 -28
  75. package/src/observer.js +1 -0
  76. package/src/parser.js +207 -19
  77. package/src/process.js +52 -5
  78. package/src/startStandalone.js +4 -17
  79. package/src/store.js +2 -0
  80. package/src/ui/elements/highlightBox.js +17 -0
  81. package/src/ui/elements/popup.js +4 -4
  82. package/src/ui/elements/ribbonBox.js +12 -8
  83. package/src/ui/highlightNode.js +102 -71
  84. package/src/ui/popup.js +33 -5
  85. package/src/ui/utils.js +28 -1
  86. package/src/uninstrumentedStore.js +18 -2
  87. package/src/utils.js +72 -5
  88. package/src/vars.js +6 -4
  89. package/dist/cjs/api/handleTurnOff.js +0 -8
  90. package/dist/cjs/api/handleTurnOn.js +0 -8
  91. package/dist/esm/api/handleTurnOff.js +0 -6
  92. package/dist/esm/api/handleTurnOn.js +0 -6
  93. /package/src/{processLegacy.js → _processLegacy.js} +0 -0
  94. /package/src/api/{handleTurnOff.js → _handleTurnOff.js} +0 -0
  95. /package/src/api/{handleTurnOn.js → _handleTurnOn.js} +0 -0
package/dist/cjs/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var locizePlugin = require('./locizePlugin.js');
6
- var startStandalone = require('./startStandalone.js');
6
+ var _startStandalone = require('./_startStandalone.js');
7
7
  require('./api/handleEditKey.js');
8
8
  require('./api/handleCommitKey.js');
9
9
  require('./api/handleCommitKeys.js');
@@ -12,8 +12,7 @@ require('./api/handleRequestPopupChanges.js');
12
12
  require('./api/handleRequestResourceBundle.js');
13
13
  require('./api/handleSelectedKeys.js');
14
14
  require('./api/handleIsLocizeEnabled.js');
15
- require('./api/handleTurnOn.js');
16
- require('./api/handleTurnOff.js');
15
+ require('./api/handleSendMatchedUninstrumented.js');
17
16
  var postMessage = require('./api/postMessage.js');
18
17
  var i18nextSubliminal = require('i18next-subliminal');
19
18
 
@@ -25,19 +24,15 @@ var index = {
25
24
  addLocizeSavedHandler: postMessage.addLocizeSavedHandler,
26
25
  locizePlugin: locizePlugin.locizePlugin,
27
26
  locizeEditorPlugin: locizePlugin.locizeEditorPlugin,
28
- turnOn: postMessage.turnOn,
29
- turnOff: postMessage.turnOff,
30
27
  setEditorLng: postMessage.setEditorLng,
31
- startStandalone: startStandalone.startStandalone
28
+ startStandalone: _startStandalone.startStandalone
32
29
  };
33
30
 
34
31
  exports.locizeEditorPlugin = locizePlugin.locizeEditorPlugin;
35
32
  exports.locizePlugin = locizePlugin.locizePlugin;
36
- exports.startStandalone = startStandalone.startStandalone;
33
+ exports.startStandalone = _startStandalone.startStandalone;
37
34
  exports.addLocizeSavedHandler = postMessage.addLocizeSavedHandler;
38
35
  exports.setEditorLng = postMessage.setEditorLng;
39
- exports.turnOff = postMessage.turnOff;
40
- exports.turnOn = postMessage.turnOn;
41
36
  Object.defineProperty(exports, 'PostProcessor', {
42
37
  enumerable: true,
43
38
  get: function () { return i18nextSubliminal.PostProcessor; }
@@ -2,22 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
5
+ require('@babel/runtime/helpers/defineProperty');
6
+ require('@babel/runtime/helpers/toConsumableArray');
6
7
  var i18nextSubliminal = require('i18next-subliminal');
7
8
  var process = require('./process.js');
8
- var processLegacy = require('./processLegacy.js');
9
- var utils = require('./utils.js');
9
+ var i18nextImplementation = require('./implementations/i18nextImplementation.js');
10
10
 
11
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
-
13
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
14
-
15
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
- var isInIframe = typeof window !== 'undefined';
18
- try {
19
- isInIframe = self !== top;
20
- } catch (e) {}
21
11
  function configurePostProcessor(i18next, options) {
22
12
  i18next.use(i18nextSubliminal.PostProcessor);
23
13
  if (typeof options.postProcess === 'string') {
@@ -29,75 +19,6 @@ function configurePostProcessor(i18next, options) {
29
19
  }
30
20
  options.postProcessPassResolved = true;
31
21
  }
32
- function getImplementation(i18n) {
33
- var impl = {
34
- getResource: function getResource(lng, ns, key) {
35
- return i18n.getResource(lng, ns, key);
36
- },
37
- setResource: function setResource(lng, ns, key, value) {
38
- return i18n.addResource(lng, ns, key, value, {
39
- silent: true
40
- });
41
- },
42
- getResourceBundle: function getResourceBundle(lng, ns, cb) {
43
- i18n.loadNamespaces(ns, function () {
44
- cb(i18n.getResourceBundle(lng, ns));
45
- });
46
- },
47
- getLng: function getLng() {
48
- return i18n.resolvedLanguage || i18n.languages[0];
49
- },
50
- getSourceLng: function getSourceLng() {
51
- var fallback = i18n.options.fallbackLng;
52
- if (typeof fallback === 'string') return fallback;
53
- if (Array.isArray(fallback)) return fallback[fallback.length - 1];
54
- if (fallback && fallback["default"]) {
55
- if (typeof fallback["default"] === 'string') return fallback;
56
- if (Array.isArray(fallback["default"])) return fallback["default"][fallback["default"].length - 1];
57
- }
58
- if (typeof fallback === 'function') {
59
- var res = fallback(i18n.resolvedLanguage);
60
- if (typeof res === 'string') return res;
61
- if (Array.isArray(res)) return res[res.length - 1];
62
- }
63
- return 'dev';
64
- },
65
- getLocizeDetails: function getLocizeDetails() {
66
- var backendName;
67
- if (i18n.services.backendConnector.backend && i18n.services.backendConnector.backend.options && i18n.services.backendConnector.backend.options.loadPath && i18n.services.backendConnector.backend.options.loadPath.indexOf('.locize.') > 0) {
68
- backendName = 'I18NextLocizeBackend';
69
- } else {
70
- backendName = i18n.services.backendConnector.backend ? i18n.services.backendConnector.backend.constructor.name : 'options.resources';
71
- }
72
- var opts = {
73
- backendName: backendName,
74
- sourceLng: impl.getSourceLng(),
75
- i18nFormat: i18n.options.compatibilityJSON === 'v3' ? 'i18next_v3' : 'i18next_v4',
76
- i18nFramework: 'i18next',
77
- isLocizify: i18n.options.isLocizify,
78
- defaultNS: i18n.options.defaultNS
79
- };
80
- if (!i18n.options.backend && !i18n.options.editor) return opts;
81
- var pickFrom = i18n.options.backend || i18n.options.editor;
82
- return _objectSpread(_objectSpread({}, opts), {}, {
83
- projectId: pickFrom.projectId,
84
- version: pickFrom.version
85
- });
86
- },
87
- bindLanguageChange: function bindLanguageChange(cb) {
88
- i18n.on('languageChanged', cb);
89
- },
90
- bindMissingKeyHandler: function bindMissingKeyHandler(cb) {
91
- i18n.options.missingKeyHandler = function (lng, ns, k, val, isUpdate, opts) {
92
- if (!isUpdate) cb(lng, ns, k, val);
93
- };
94
- },
95
- triggerRerender: function triggerRerender() {
96
- i18n.emit('editorSaved');
97
- }
98
- };
99
- return impl;
100
- }
101
22
  var i18next;
102
23
  var locizeEditorPlugin = function locizeEditorPlugin() {
103
24
  var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -107,14 +28,9 @@ var locizeEditorPlugin = function locizeEditorPlugin() {
107
28
  init: function init(i18n) {
108
29
  var options = i18n.options;
109
30
  i18next = i18n;
110
- var showInContext = opt.show || utils.getQsParameterByName(opt.qsProp) === 'true';
111
- if (!isInIframe && showInContext) configurePostProcessor(i18next, options);
112
- var impl = getImplementation(i18n);
113
- if (!isInIframe && showInContext) {
114
- process.start(impl);
115
- } else if (isInIframe) {
116
- processLegacy.startLegacy(impl);
117
- }
31
+ var impl = i18nextImplementation.getImplementation(i18n);
32
+ configurePostProcessor(i18next, options);
33
+ process.start(impl, opt);
118
34
  }
119
35
  };
120
36
  };
@@ -97,6 +97,7 @@ function createObserver(ele, handle) {
97
97
  characterData: true,
98
98
  subtree: true
99
99
  };
100
+ handle([ele]);
100
101
  observer.observe(ele, observerConfig);
101
102
  },
102
103
  skipNext: function skipNext() {
@@ -7,6 +7,7 @@ var i18nextSubliminal = require('i18next-subliminal');
7
7
  var store = require('./store.js');
8
8
  var uninstrumentedStore = require('./uninstrumentedStore.js');
9
9
  var vars = require('./vars.js');
10
+ var utils = require('./utils.js');
10
11
  require('./shims/uniqueID.js');
11
12
 
12
13
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -24,35 +25,84 @@ function setImplementation(impl) {
24
25
  function walk(node, func) {
25
26
  if (node.dataset && node.dataset.i18nextEditorElement === 'true') return;
26
27
  func(node);
28
+ var instr = store.store.get(node.uniqueID);
29
+ var uninstr = uninstrumentedStore.uninstrumentedStore.get(node.uniqueID);
30
+ if (instr || uninstr) {
31
+ var _node$parentElement;
32
+ var id = (_node$parentElement = node.parentElement) === null || _node$parentElement === void 0 ? void 0 : _node$parentElement.uniqueID;
33
+ uninstrumentedStore.uninstrumentedStore.remove(id, node.parentElement);
34
+ }
27
35
  var children = node.childNodes;
28
- for (var i = 0; i < children.length; i++) {
29
- walk(children[i], func);
36
+ for (var _i = 0; _i < children.length; _i++) {
37
+ walk(children[_i], func);
30
38
  }
31
39
  }
32
- function extractMeta(id, type, meta, children) {
33
- var _i18n, _i18n2;
40
+ function extractHiddenMeta(id, type, meta, children) {
41
+ var _i18n, _i18n2, _i18n3;
34
42
  var invisibleMeta = meta.invisibleMeta,
35
43
  text = meta.text;
36
44
  if (!invisibleMeta || !invisibleMeta.key || !invisibleMeta.ns) return;
37
- if (!currentSourceLng) currentSourceLng = (_i18n = i18n) === null || _i18n === void 0 ? void 0 : _i18n.getSourceLng();
45
+ if (!currentSourceLng) currentSourceLng = i18n.getSourceLng();
38
46
  return _objectSpread(_objectSpread({
39
47
  eleUniqueID: id,
40
48
  textType: type,
41
- children: children ? children.map(function (c) {
49
+ children: children && children.map ? children.map(function (c) {
42
50
  return c.childIndex;
43
51
  }).join(',') : null,
44
52
  qualifiedKey: "".concat(invisibleMeta.ns, ":").concat(invisibleMeta.key)
45
53
  }, invisibleMeta), {}, {
46
54
  extractedText: text,
47
- i18nTargetLng: (_i18n2 = i18n) === null || _i18n2 === void 0 ? void 0 : _i18n2.getLng(),
55
+ i18nTargetLng: (_i18n = i18n) === null || _i18n === void 0 ? void 0 : _i18n.getLng(),
48
56
  i18nSourceLng: currentSourceLng,
49
- i18nRawText: _defineProperty__default["default"](_defineProperty__default["default"]({}, "".concat(invisibleMeta.lng), invisibleMeta.source === 'translation' && i18n ? i18n.getResource(invisibleMeta.lng, invisibleMeta.ns, invisibleMeta.key) : null), "".concat(currentSourceLng), invisibleMeta.source === 'translation' && i18n ? i18n.getResource(currentSourceLng, invisibleMeta.ns, invisibleMeta.key) : null)
57
+ i18nRawText: _defineProperty__default["default"](_defineProperty__default["default"]({}, "".concat(invisibleMeta.lng), invisibleMeta.source === 'translation' && i18n ? (_i18n2 = i18n) === null || _i18n2 === void 0 ? void 0 : _i18n2.getResource(invisibleMeta.lng, invisibleMeta.ns, invisibleMeta.key) : null), "".concat(currentSourceLng), invisibleMeta.source === 'translation' && i18n ? (_i18n3 = i18n) === null || _i18n3 === void 0 ? void 0 : _i18n3.getResource(currentSourceLng, invisibleMeta.ns, invisibleMeta.key) : null)
50
58
  });
51
59
  }
60
+ function extractNodeMeta(id, type) {
61
+ var _i18n4, _i18n5, _i18n6, _i18n7, _i18n8;
62
+ var nodeMeta = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
63
+ var text = arguments.length > 3 ? arguments[3] : undefined;
64
+ var children = arguments.length > 4 ? arguments[4] : undefined;
65
+ var meta = nodeMeta[type];
66
+ if (!meta) return;
67
+ if (!currentSourceLng) currentSourceLng = i18n.getSourceLng();
68
+ var i18nTargetLng = i18n.getLng();
69
+ return {
70
+ eleUniqueID: id,
71
+ textType: type,
72
+ children: children && children.map ? children.map(function (c) {
73
+ return c.childIndex;
74
+ }).join(',') : null,
75
+ qualifiedKey: meta.key && (meta.ns || (_i18n4 = i18n) !== null && _i18n4 !== void 0 && _i18n4.getDefaultNS()) ? "".concat(meta.ns || ((_i18n5 = i18n) === null || _i18n5 === void 0 ? void 0 : _i18n5.getDefaultNS()), ":").concat(meta.key) : null,
76
+ key: meta.key,
77
+ ns: meta.ns || ((_i18n6 = i18n) === null || _i18n6 === void 0 ? void 0 : _i18n6.getDefaultNS()),
78
+ extractedText: text,
79
+ i18nTargetLng: i18nTargetLng,
80
+ i18nSourceLng: currentSourceLng,
81
+ i18nRawText: _defineProperty__default["default"](_defineProperty__default["default"]({}, "".concat(i18nTargetLng), i18n && meta.ns && meta.key ? ((_i18n7 = i18n) === null || _i18n7 === void 0 ? void 0 : _i18n7.getResource(i18nTargetLng, meta.ns, meta.key)) || text : text), "".concat(currentSourceLng), i18n && meta.ns && meta.key ? (_i18n8 = i18n) === null || _i18n8 === void 0 ? void 0 : _i18n8.getResource(currentSourceLng, meta.ns, meta.key) : null)
82
+ };
83
+ }
52
84
  function containsOnlySpaces(str) {
53
85
  return /^\s*$/.test(str);
54
86
  }
87
+ function storeIfQualifiedKey(id, subliminal, type, nodeI18nMeta, node, children, txt) {
88
+ var stored = store.store.get(id);
89
+ var storedMeta = stored && stored.keys["".concat(type)] || {};
90
+ var typeMeta = nodeI18nMeta["".concat(type)] || {};
91
+ if (!typeMeta.key && storedMeta.key) typeMeta.key = storedMeta.key;
92
+ if (!typeMeta.ns && storedMeta.ns) typeMeta.ns = storedMeta.ns;
93
+ nodeI18nMeta["".concat(type)] = typeMeta;
94
+ var meta = extractNodeMeta(id, type, nodeI18nMeta, txt, children);
95
+ if (meta.qualifiedKey) {
96
+ store.store.save(id, null, type, meta, node, children);
97
+ uninstrumentedStore.uninstrumentedStore.removeKey(i, type, node);
98
+ } else {
99
+ uninstrumentedStore.uninstrumentedStore.save(id, type, node, txt);
100
+ }
101
+ }
55
102
  function handleNode(node) {
103
+ if (vars.ignoreElements.indexOf(node.nodeName) > -1) return;
104
+ var nodeI18nMeta = utils.getI18nMetaFromNode(node);
105
+ var usedSubliminalForText = false;
56
106
  if (node.childNodes && !ignoreMergedEleUniqueIds.includes(node.uniqueID)) {
57
107
  var merge = [];
58
108
  node.childNodes.forEach(function (child, i) {
@@ -68,9 +118,11 @@ function handleNode(node) {
68
118
  if (containsOnlySpaces(txt)) return;
69
119
  var hasHiddenMeta = i18nextSubliminal.containsHiddenMeta(txt);
70
120
  var hasHiddenStartMarker = i18nextSubliminal.containsHiddenStartMarker(txt);
121
+ if (hasHiddenMeta) usedSubliminalForText = true;
71
122
  if (hasHiddenStartMarker && hasHiddenMeta) {
72
123
  var meta = i18nextSubliminal.unwrap(txt);
73
- store.store.save(node.uniqueID, meta.invisibleMeta, 'text', extractMeta(node.uniqueID, 'text', meta), node);
124
+ uninstrumentedStore.uninstrumentedStore.remove(node.uniqueID, node);
125
+ store.store.save(node.uniqueID, meta.invisibleMeta, 'text', extractHiddenMeta(node.uniqueID, 'text', meta), node);
74
126
  } else if (hasHiddenStartMarker) {
75
127
  merge.push({
76
128
  childIndex: i,
@@ -92,21 +144,54 @@ function handleNode(node) {
92
144
  var _meta = i18nextSubliminal.unwrap(merge.reduce(function (mem, item) {
93
145
  return mem + item.text;
94
146
  }, ''));
95
- store.store.save(node.uniqueID, _meta.invisibleMeta, 'html', extractMeta(node.uniqueID, 'html', _meta, merge), node, merge);
147
+ uninstrumentedStore.uninstrumentedStore.removeKey(node.uniqueID, 'html', node, txt);
148
+ store.store.save(node.uniqueID, _meta.invisibleMeta, 'html', extractHiddenMeta(node.uniqueID, 'html', _meta, merge), node, merge);
96
149
  merge = [];
97
- } else if (txt) {
98
- uninstrumentedStore.uninstrumentedStore.save(node.uniqueID, 'text', node);
99
150
  }
100
151
  });
152
+ if (!usedSubliminalForText) {
153
+ node.childNodes.forEach(function (child, i) {
154
+ if (merge.length && child.nodeName !== '#text') {
155
+ ignoreMergedEleUniqueIds.push(child.uniqueID);
156
+ }
157
+ var txt = child.textContent;
158
+ if (nodeI18nMeta && nodeI18nMeta['html'] && i < node.childNodes.length - 1) {
159
+ merge.push({
160
+ childIndex: i,
161
+ child: child,
162
+ text: txt
163
+ });
164
+ } else if (nodeI18nMeta && nodeI18nMeta['html'] && i === node.childNodes.length - 1) {
165
+ merge.push({
166
+ childIndex: i,
167
+ child: child,
168
+ text: txt
169
+ });
170
+ storeIfQualifiedKey(node.uniqueID, null, 'html', nodeI18nMeta, node, merge, node.innerHTML);
171
+ merge = [];
172
+ } else if (txt) {
173
+ if (nodeI18nMeta && nodeI18nMeta['text']) {
174
+ storeIfQualifiedKey(node.uniqueID, null, 'text', nodeI18nMeta, node, undefined, txt);
175
+ } else if (child.nodeName === '#text' && !containsOnlySpaces(txt)) {
176
+ uninstrumentedStore.uninstrumentedStore.save(node.uniqueID, 'text', node, txt);
177
+ }
178
+ }
179
+ });
180
+ }
101
181
  }
102
182
  if (!node.getAttribute) return;
103
183
  vars.validAttributes.forEach(function (attr) {
104
184
  var txt = node.getAttribute(attr);
105
185
  if (i18nextSubliminal.containsHiddenMeta(txt)) {
106
186
  var meta = i18nextSubliminal.unwrap(txt);
107
- store.store.save(node.uniqueID, meta.invisibleMeta, "attr:".concat(attr), extractMeta(node.uniqueID, "attr:".concat(attr), meta), node);
187
+ uninstrumentedStore.uninstrumentedStore.removeKey(node.uniqueID, attr, node);
188
+ store.store.save(node.uniqueID, meta.invisibleMeta, attr, extractHiddenMeta(node.uniqueID, "".concat(attr), meta), node);
108
189
  } else if (txt) {
109
- uninstrumentedStore.uninstrumentedStore.save(node.uniqueID, "attr:".concat(attr), node);
190
+ if (nodeI18nMeta && nodeI18nMeta[attr]) {
191
+ storeIfQualifiedKey(node.uniqueID, null, attr, nodeI18nMeta, node, undefined, txt);
192
+ } else {
193
+ uninstrumentedStore.uninstrumentedStore.save(node.uniqueID, attr, node, txt);
194
+ }
110
195
  }
111
196
  });
112
197
  }
@@ -118,5 +203,6 @@ function parseTree(node) {
118
203
  return store.store.data;
119
204
  }
120
205
 
206
+ exports.extractNodeMeta = extractNodeMeta;
121
207
  exports.parseTree = parseTree;
122
208
  exports.setImplementation = setImplementation;
@@ -17,9 +17,11 @@ require('./api/handleRequestPopupChanges.js');
17
17
  require('./api/handleRequestResourceBundle.js');
18
18
  require('./api/handleSelectedKeys.js');
19
19
  require('./api/handleIsLocizeEnabled.js');
20
- require('./api/handleTurnOn.js');
21
- require('./api/handleTurnOff.js');
20
+ require('./api/handleSendMatchedUninstrumented.js');
22
21
  var postMessage = require('./api/postMessage.js');
22
+ var utils = require('./utils.js');
23
+ require('@babel/runtime/helpers/toConsumableArray');
24
+ var dummyImplementation$1 = require('./implementations/dummyImplementation.js');
23
25
 
24
26
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
25
27
 
@@ -27,9 +29,19 @@ var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_definePropert
27
29
 
28
30
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
29
31
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty__default["default"](e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
32
+ var dummyImplementation = dummyImplementation$1.getImplementation();
33
+ var isInIframe = typeof window !== 'undefined';
34
+ try {
35
+ isInIframe = self !== top;
36
+ } catch (e) {}
30
37
  function start() {
31
- var implementation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
38
+ var implementation = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : dummyImplementation;
39
+ var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
40
+ show: false,
41
+ qsProp: 'incontext'
42
+ };
32
43
  if (typeof document === 'undefined') return;
44
+ var showInContext = opt.show || utils.getQsParameterByName(opt.qsProp) === 'true';
33
45
  var scriptEle = document.getElementById('locize');
34
46
  var config = {};
35
47
  ['projectId', 'version'].forEach(function (attr) {
@@ -39,13 +51,15 @@ function start() {
39
51
  if (value === 'false') value = false;
40
52
  if (value !== undefined && value !== null) config[attr] = value;
41
53
  });
42
- config = _objectSpread(_objectSpread({}, implementation.getLocizeDetails()), config);
54
+ config = _objectSpread(_objectSpread(_objectSpread({}, implementation.getLocizeDetails()), config), opt);
55
+ postMessage.api.config = config;
43
56
  postMessage.api.init(implementation);
44
57
  parser.setImplementation(implementation);
45
58
  implementation === null || implementation === void 0 || implementation.bindLanguageChange(function (lng) {
46
59
  postMessage.api.sendCurrentTargetLanguage(implementation.getLng());
47
60
  });
48
61
  function continueToStart() {
62
+ if (!isInIframe && !showInContext) return;
49
63
  var observer$1 = observer.createObserver(document.body, function (eles) {
50
64
  eles.forEach(function (ele) {
51
65
  parser.parseTree(ele);
@@ -54,13 +68,31 @@ function start() {
54
68
  });
55
69
  observer$1.start();
56
70
  mouseDistance.startMouseTracking(observer$1);
57
- if (!document.getElementById(popup.popupId)) {
71
+ if (!isInIframe && !document.getElementById(popup.popupId)) {
58
72
  document.body.append(popup.Popup(vars.getIframeUrl(), function () {
59
73
  postMessage.api.requestInitialize(config);
60
74
  }));
61
75
  popup$1.initDragElement();
62
76
  popup$1.initResizeElement();
63
77
  }
78
+ if (typeof window !== 'undefined') {
79
+ var oldHref = window.document.location.href;
80
+ postMessage.api.sendHrefchanged(oldHref);
81
+ var bodyList = window.document.querySelector('body');
82
+ var _observer = new window.MutationObserver(function (mutations) {
83
+ mutations.forEach(function (mutation) {
84
+ if (oldHref !== window.document.location.href) {
85
+ oldHref = window.document.location.href;
86
+ postMessage.api.sendHrefchanged(oldHref);
87
+ }
88
+ });
89
+ });
90
+ var _config = {
91
+ childList: true,
92
+ subtree: true
93
+ };
94
+ _observer.observe(bodyList, _config);
95
+ }
64
96
  }
65
97
  if (document.body) return continueToStart();
66
98
  window.addEventListener('load', function () {
package/dist/cjs/store.js CHANGED
@@ -29,6 +29,7 @@ function save(id, subliminal, type, meta, node, children) {
29
29
  subliminal: subliminal
30
30
  };
31
31
  }
32
+ if (subliminal) data[id].subliminal = subliminal;
32
33
  data[id].keys = _objectSpread(_objectSpread({}, data[id].keys), {}, _defineProperty__default["default"]({}, "".concat(type), meta));
33
34
  if (children) {
34
35
  data[id].children = _objectSpread(_objectSpread({}, data[id].children), {}, _defineProperty__default["default"]({}, "".concat(type, "-").concat(children.map(function (c) {
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function HighlightBox(ele, borderColor, shadowColor) {
6
+ var rect = ele.getBoundingClientRect();
7
+ var box = document.createElement('div');
8
+ box.style = "position: absolute; top: ".concat(rect.top - 2 + window.scrollY, "px; left: ").concat(rect.left - 2 + window.scrollX, "px; height: ").concat(rect.height + 4, "px; width: ").concat(rect.width + 4, "px; border: 1px solid ").concat(borderColor, "; border-radius: 2px; ").concat(shadowColor ? "box-shadow: 0 0 20px 0 ".concat(shadowColor, ";") : '');
9
+ box.setAttribute('data-i18next-editor-element', 'true');
10
+ return box;
11
+ }
12
+
13
+ exports.HighlightBox = HighlightBox;
@@ -2,8 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var vars = require('../../vars.js');
6
-
7
5
  var iconEdit = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#FFFFFF"><g></g><g><g><g><path d="M3,21l3.75,0L17.81,9.94l-3.75-3.75L3,17.25L3,21z M5,18.08l9.06-9.06l0.92,0.92L5.92,19L5,19L5,18.08z"/></g><g><path d="M18.37,3.29c-0.39-0.39-1.02-0.39-1.41,0l-1.83,1.83l3.75,3.75l1.83-1.83c0.39-0.39,0.39-1.02,0-1.41L18.37,3.29z"/></g></g></g></svg>';
8
6
  var i18nextIcon = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 210 304\" stroke=\"#000\" stroke-linecap=\"round\" stroke-linejoin=\"round\" fill=\"#fff\" fill-rule=\"evenodd\">\n <g stroke=\"none\" class=\"B\">\n <path d=\"M 142 31.5 v 57.2 l 64.3 165.1 s 19.6 40.3 -36.5 50.1 h -128 s -52.3 -5.5 -39.8 -46.9 L 69.5 88.7 V 31.5 z\" fill=\"#009688\"/>\n <path d=\"M 143.3 24.8 H 66.2 c -6.2 0 -11.3 -5.6 -11.3 -12.4 S 60 0 66.2 0 h 77.1 c 6.3 0 11.3 5.6 11.3 12.4 s -5.1 12.4 -11.3 12.4 z\" class=\"C\" fill=\"#004d40\"/>\n <path d=\"M 123 124.9 c 8.3 0 15 8.1 15 18.1 c 0 10 -6.8 18.1 -15 18.1 c -8.3 0 -15 -8.1 -15 -18.1 c 0 -10 6.7 -18.1 15 -18.1 z m -58.8 31.7 c 0 -8.5 5.6 -15.3 12.7 -15.3 s 12.7 6.8 12.7 15.3 s -5.6 15.3 -12.7 15.3 s -12.7 -6.8 -12.7 -15.3 z\" fill=\"white\"/>\n <path d=\"M 147.7 84.9 V 57.7 s 34.5 -7.6 51.7 32.5 c 0 0 -26.9 19.6 -51.7 -5.3 z m -84.5 0 V 57.7 s -34.5 -7.6 -51.7 32.5 c 0 0 26.8 19.6 51.7 -5.3 z\" class=\"C\" fill=\"#004d40\"/>\n <path d=\"M 168.4 197.5 c -56.1 -17.4 -103.3 -8.1 -126.3 -1 l -23.2 56 c -10.5 33.4 33.2 37.8 33.2 37.8 h 106.9 c 46.9 -7.9 30.5 -40.4 30.5 -40.4 z\" fill=\"white\"/>\n <path d=\"M 87.6 218.3 c 0 6 -8.1 10.9 -18.1 10.9 s -18.1 -4.9 -18.1 -10.9 c 0 -6.1 8.1 -10.9 18.1 -10.9 s 18.1 4.9 18.1 10.9 z m 64.4 0 c 0 6 -8.1 10.9 -18.1 10.9 c -10 0 -18.1 -4.9 -18.1 -10.9 c 0 -6.1 8.1 -10.9 18.1 -10.9 c 10 0 18.1 4.9 18.1 10.9 z\" class=\"C\" fill=\"#004d40\"/>\n </g>\n</svg>\n";
9
7
  var locizeIcon = "\n<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 194.667 196\" height=\"196\" width=\"194.667\" xml:space=\"preserve\">\n <defs>\n <clipPath id=\"a\" clipPathUnits=\"userSpaceOnUse\">\n <path d=\"M5.5 74.048C5.5 36.98 35.551 6.93 72.619 6.93c37.069 0 67.119 30.05 67.119 67.118 0 37.07-30.05 67.12-67.119 67.12-37.068 0-67.119-30.05-67.119-67.12\"/>\n </clipPath>\n <clipPath id=\"b\" clipPathUnits=\"userSpaceOnUse\">\n <path d=\"M0 147h146V0H0Z\"/>\n </clipPath>\n <clipPath id=\"c\" clipPathUnits=\"userSpaceOnUse\">\n <path d=\"M88.756 55.055h50.982l4.512 88.195-64 1.25z\"/>\n </clipPath>\n </defs>\n <g clip-path=\"url(#a)\" transform=\"matrix(1.33333 0 0 -1.33333 0 196)\">\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-.766-5.554 1.148-8.427 0-11.107-1.149-2.681-2.49-7.469-1.341-10.724 1.149-3.255 2.872-10.34 4.404-10.533 1.532-.19-1.148 7.66.383 5.171 1.533-2.49 1.533-6.193 4.214-8.746 2.68-2.553 6.319-2.17 9.192-4.658 2.872-2.49 5.744-6.129 8.425-5.746 0 0-.192-1.914-1.532-5.17-1.34-3.255-1.532-7.084.192-9.383 1.723-2.298 3.446-5.746 4.979-7.469 1.532-1.723 2.681-10.915 2.297-15.51-.382-4.596 1.724-14.937 6.511-17.236 4.787-2.298 0 1.15-.957 4.022-.958 2.872.739 9.575 3.052 10.533 2.309.958 4.416 4.787 6.139 7.469 1.724 2.68 6.128 3.83 7.469 7.084 1.341 3.255.766 7.085 1.532 8.809.766 1.724 2.873 5.554-1.724 7.852-4.595 2.298-6.51 1.148-6.702 3.255-.192 2.107-1.341 4.404-4.595 5.361-3.256.959-6.129 2.816-9.768 3.227-3.638.412-4.404-2.461-6.319-.928-1.914 1.531-3.446 3.064-4.213 4.978-.765 1.915-3.064.766-2.871 1.915.19 1.15 3.254 4.404-.193 3.255-3.446-1.148-6.51-.765-6.319 2.298.193 3.064 4.405 4.214 6.129 4.597 1.722.383 3.063-1.723 5.17-3.065 2.106-1.34.191 1.915 1.34 4.214 1.149 2.298 5.554 2.106 6.128 5.361.575 3.255-.191 5.937 3.256 6.32 3.446.383 7.084-.191 7.468 1.533.382 1.722-4.022-.576-4.213 1.531-.192 2.106 3.829 4.978 4.978 2.872 1.149-2.106 4.022-2.298 4.405-1.531.383.765 0 2.105-1.341 5.361-1.34 3.256-2.681 2.298-3.829 5.936-1.149 3.639-3.064-.191-4.979 1.724s-4.213 5.937-4.597 2.489c-.382-3.446-.382-5.361-2.105-8.042-1.724-2.682-2.489-.575-4.022 1.149-1.532 1.723-4.979 3.447-3.83 4.978C23.362 4.979 24.511 9 26.234 7.85c1.724-1.149 4.405-1.149 4.022.767-.383 1.914 0 2.681.766 3.638.766.958 3.447 2.682 3.447-.766 0-3.447-.384-4.405 2.298-4.788 2.681-.383 5.744-.574 5.554 1.149-.193 1.724.766 1.341 0 4.214-.767 2.873-3.065 3.063-5.554 4.405-2.489 1.34-3.83 3.446-5.936 2.68s-2.299-1.531-2.49-3.638c-.192-2.107-1.341-2.873-2.107-1.915-.765.957.192 4.022-2.68 2.106-2.873-1.914-4.021-5.171-5.553-2.872-1.533 2.297 2.297 6.319-1.724 4.595-4.022-1.723-6.895-3.637-4.788-4.404 2.107-.766 4.214-2.107 2.107-2.873-2.107-.765-6.32.575-7.852-.957C4.212 7.66 0 0 0 0\" transform=\"translate(13.926 109.38)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-.766-5.554 1.148-8.427 0-11.107-1.149-2.681-2.49-7.469-1.341-10.724 1.149-3.255 2.872-10.34 4.404-10.533 1.532-.19-1.148 7.66.383 5.171 1.533-2.49 1.533-6.193 4.214-8.746 2.68-2.553 6.319-2.17 9.192-4.658 2.872-2.49 5.744-6.129 8.425-5.746 0 0-.192-1.914-1.532-5.17-1.34-3.255-1.532-7.084.192-9.383 1.723-2.298 3.446-5.746 4.979-7.469 1.532-1.723 2.681-10.915 2.297-15.51-.382-4.596 1.724-14.937 6.511-17.236 4.787-2.298 0 1.15-.957 4.022-.958 2.872.739 9.575 3.052 10.533 2.309.958 4.416 4.787 6.139 7.469 1.724 2.68 6.128 3.83 7.469 7.084 1.341 3.255.766 7.085 1.532 8.809.766 1.724 2.873 5.554-1.724 7.852-4.595 2.298-6.51 1.148-6.702 3.255-.192 2.107-1.341 4.404-4.595 5.361-3.256.959-6.129 2.816-9.768 3.227-3.638.412-4.404-2.461-6.319-.928-1.914 1.531-3.446 3.064-4.213 4.978-.765 1.915-3.064.766-2.871 1.915.19 1.15 3.254 4.404-.193 3.255-3.446-1.148-6.51-.765-6.319 2.298.193 3.064 4.405 4.214 6.129 4.597 1.722.383 3.063-1.723 5.17-3.065 2.106-1.34.191 1.915 1.34 4.214 1.149 2.298 5.554 2.106 6.128 5.361.575 3.255-.191 5.937 3.256 6.32 3.446.383 7.084-.191 7.468 1.533.382 1.722-4.022-.576-4.213 1.531-.192 2.106 3.829 4.978 4.978 2.872 1.149-2.106 4.022-2.298 4.405-1.531.383.765 0 2.105-1.341 5.361-1.34 3.256-2.681 2.298-3.829 5.936-1.149 3.639-3.064-.191-4.979 1.724s-4.213 5.937-4.597 2.489c-.382-3.446-.382-5.361-2.105-8.042-1.724-2.682-2.489-.575-4.022 1.149-1.532 1.723-4.979 3.447-3.83 4.978C23.362 4.979 24.511 9 26.234 7.85c1.724-1.149 4.405-1.149 4.022.767-.383 1.914 0 2.681.766 3.638.766.958 3.447 2.682 3.447-.766 0-3.447-.384-4.405 2.298-4.788 2.681-.383 5.744-.574 5.554 1.149-.193 1.724.766 1.341 0 4.214-.767 2.873-3.065 3.063-5.554 4.405-2.489 1.34-3.83 3.446-5.936 2.68s-2.299-1.531-2.49-3.638c-.192-2.107-1.341-2.873-2.107-1.915-.765.957.192 4.022-2.68 2.106-2.873-1.914-4.021-5.171-5.553-2.872-1.533 2.297 2.297 6.319-1.724 4.595-4.022-1.723-6.895-3.637-4.788-4.404 2.107-.766 4.214-2.107 2.107-2.873-2.107-.765-6.32.575-7.852-.957C4.212 7.66 0 0 0 0Z\" transform=\"translate(13.926 109.38)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-.01-2.141.575-3.829 2.49-1.915C4.405 0 5.553 2.298 6.895 1.341c1.34-.958 3.638-.703 4.594-.639.959.064 1.15 2.937 3.831 2.554s1.724.574 4.596 2.107c2.873 1.532 9.001 4.212 2.681 3.446-6.32-.766-6.703.958-11.108-1.914-4.403-2.873-5.36-2.873-6.509-3.639-1.149-.766-2.49 2.298-4.022 0C-.575.958.011 2.182 0 0\" transform=\"translate(36.522 130.061)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-.01-2.141.575-3.829 2.49-1.915C4.405 0 5.553 2.298 6.895 1.341c1.34-.958 3.638-.703 4.594-.639.959.064 1.15 2.937 3.831 2.554s1.724.574 4.596 2.107c2.873 1.532 9.001 4.212 2.681 3.446-6.32-.766-6.703.958-11.108-1.914-4.403-2.873-5.36-2.873-6.509-3.639-1.149-.766-2.49 2.298-4.022 0C-.575.958.011 2.182 0 0Z\" transform=\"translate(36.522 130.061)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-2.263-1.956-5.744-4.788-3.064-4.788 2.681 0 3.983 1.404 5.439-.447 1.456-1.85.88-4.723.88-6.063 0-1.341-.766-4.406 1.15-8.235 1.915-3.829 2.106-6.319 4.022-3.829 1.914 2.488 6.51 7.276 8.808 7.658 2.298.384 4.597 1.342 5.746 3.257 1.148 1.915 0 3.773 1.914 5.141 1.914 1.369 1.531 3.093 2.107 5.199C27.575 0 32.747 0 30.448 1.148c-2.297 1.15-6.51 1.916-11.49 1.341C13.979 1.915 4.213 3.638 0 0\" transform=\"translate(59.502 135.998)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-2.263-1.956-5.744-4.788-3.064-4.788 2.681 0 3.983 1.404 5.439-.447 1.456-1.85.88-4.723.88-6.063 0-1.341-.766-4.406 1.15-8.235 1.915-3.829 2.106-6.319 4.022-3.829 1.914 2.488 6.51 7.276 8.808 7.658 2.298.384 4.597 1.342 5.746 3.257 1.148 1.915 0 3.773 1.914 5.141 1.914 1.369 1.531 3.093 2.107 5.199C27.575 0 32.747 0 30.448 1.148c-2.297 1.15-6.51 1.916-11.49 1.341C13.979 1.915 4.213 3.638 0 0Z\" transform=\"translate(59.502 135.998)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-1.218-1.986-.575-2.107.766-2.49 1.34-.383-.575-2.68.957-2.872 1.532-.193 4.979-1.15 5.936 0 .959 1.148-1.531.7-3.255 1.977C2.682-2.107.865 1.41 0 0\" transform=\"translate(38.438 76.826)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-1.218-1.986-.575-2.107.766-2.49 1.34-.383-.575-2.68.957-2.872 1.532-.193 4.979-1.15 5.936 0 .959 1.148-1.531.7-3.255 1.977C2.682-2.107.865 1.41 0 0Z\" transform=\"translate(38.438 76.826)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-2.063-1.033-1.148-2.682-3.064-3.831-1.915-1.148-1.149-1.531-1.723-4.213-.575-2.68.191-4.212 1.532-2.106S2.298 1.148 0 0\" transform=\"translate(131.121 45.612)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-2.063-1.033-1.148-2.682-3.064-3.831-1.915-1.148-1.149-1.531-1.723-4.213-.575-2.68.191-4.212 1.532-2.106S2.298 1.148 0 0Z\" transform=\"translate(131.121 45.612)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-.575-.575-1.532 2.681-2.106 4.213-.575 1.532-.561 4.195 1.056 5.675C.964 11.734 0 7.469 0 5.17 0 2.873.574.575 0 0m-6.704 5.936c-1.341.766-3.828 0-6.892-.957-3.065-.958-.613 2.131.766 4.213 1.233 1.861.574-.574 3.256-.766 2.68-.192 4.213-3.256 2.87-2.49m-4.402-6.511c-.192-1.531.574-4.021-3.639-3.064-4.213.958-4.213 3.256-5.936 1.533-1.723-1.724-3.83-3.255-6.32-.575C-29.49 0-29.107.766-30.447.958c-.955.135-4.138.846-6.792.074.206.123.426.285.663.5 1.915 1.723 1.532 2.298 3.638 4.213 2.108 1.916 3.639 3.638 5.171 1.916 1.532-1.725 4.788-2.108 3.639-4.023-1.149-1.914-.383-3.063.958-1.914 1.339 1.149 3.255 1.914 1.915 3.446-1.342 1.532-2.682 5.554-.766 2.873 1.915-2.681 2.489-4.022 3.637-5.553C-17.234.958-16.085 0-15.702.958c.383.957-.192 3.063.383 3.446.574.383 0-3.255 1.723-3.446 1.723-.192 2.681 0 2.49-1.533M9.192-8.81c-.574 3.257-4.787 32.747-4.787 32.747s-11.299 7.277-13.213 5.746c-1.916-1.533-5.171-1.302-4.788.21s2.872 1.128-1.341 4.002c-4.212 2.873-4.978 5.362-8.233 1.724-3.257-3.639-4.022-6.703-5.937-7.661-1.915-.957-3.447-4.021-1.34-4.787 2.106-.765 2.298 0 4.02-1.531 1.725-1.533 4.023-1.149 4.406-.193.383.959.766 4.022.957 5.171.192 1.149 2.138 4.979 1.93 1.915-.207-3.064 2.665-3.064.75-5.17-1.914-2.106-.765-3.831-4.595-4.214-3.831-.382-4.022 1.915-6.128.766-2.107-1.148-1.915-1.915-2.681-3.063-.766-1.149-4.788-3.447-4.788-3.447s-3.255 1.149-1.724-.958c1.533-2.106 2.873-4.595 1.533-4.786-1.341-.192-4.98 1.914-4.98-.384s-.573-4.787.959-5.362c1.081-.405 1.783-1.284 2.775-1.161-.769-.332-1.468-.813-2.009-1.52-1.491-1.947-.575-5.362-3.639-6.511-3.063-1.15-3.063-2.489-3.639-4.979-.573-2.489 0-8.808.766-9.383.765-.574 2.107-5.362 5.363-4.978 3.256.383 6.702.53 7.851-.023 1.149-.551 3.063 1.171 3.638-3.233.575-4.404 1.915-4.979 2.681-7.277.766-2.297-.383-7.086 0-9.958s3.064-7.852 3.064-10.341c0-2.489 2.873-3.638 4.405-2.681 1.532.958 4.787 2.873 6.127 5.937 1.342 3.063 1.342 4.595 3.447 8.617 2.106 4.021 1.533 6.894 2.489 9.958.958 3.064 3.262 5.171 6.419 8.617 3.156 3.446 2.588 5.362 0 5.171-2.588-.191-4.314 2.297-5.654 5.361-1.338 3.065-2.87 10.724-1.721 8.235 1.149-2.491 3.446-9.384 5.744-10.533 2.298-1.149 6.512 1.953 7.469 3.083.957 1.131.574 4.385-1.916 5.726C.383-8.617 1.915-7.469 4.405-9c2.489-1.532 5.362-3.064 4.787.19\" transform=\"translate(132.845 86.592)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-.575-.575-1.532 2.681-2.106 4.213-.575 1.532-.561 4.195 1.056 5.675C.964 11.734 0 7.469 0 5.17 0 2.873.574.575 0 0Zm-6.704 5.936c-1.341.766-3.828 0-6.892-.957-3.065-.958-.613 2.131.766 4.213 1.233 1.861.574-.574 3.256-.766 2.68-.192 4.213-3.256 2.87-2.49zm-4.402-6.511c-.192-1.531.574-4.021-3.639-3.064-4.213.958-4.213 3.256-5.936 1.533-1.723-1.724-3.83-3.255-6.32-.575C-29.49 0-29.107.766-30.447.958c-.955.135-4.138.846-6.792.074.206.123.426.285.663.5 1.915 1.723 1.532 2.298 3.638 4.213 2.108 1.916 3.639 3.638 5.171 1.916 1.532-1.725 4.788-2.108 3.639-4.023-1.149-1.914-.383-3.063.958-1.914 1.339 1.149 3.255 1.914 1.915 3.446-1.342 1.532-2.682 5.554-.766 2.873 1.915-2.681 2.489-4.022 3.637-5.553C-17.234.958-16.085 0-15.702.958c.383.957-.192 3.063.383 3.446.574.383 0-3.255 1.723-3.446 1.723-.192 2.681 0 2.49-1.533zM9.192-8.81c-.574 3.257-4.787 32.747-4.787 32.747s-11.299 7.277-13.213 5.746c-1.916-1.533-5.171-1.302-4.788.21s2.872 1.128-1.341 4.002c-4.212 2.873-4.978 5.362-8.233 1.724-3.257-3.639-4.022-6.703-5.937-7.661-1.915-.957-3.447-4.021-1.34-4.787 2.106-.765 2.298 0 4.02-1.531 1.725-1.533 4.023-1.149 4.406-.193.383.959.766 4.022.957 5.171.192 1.149 2.138 4.979 1.93 1.915-.207-3.064 2.665-3.064.75-5.17-1.914-2.106-.765-3.831-4.595-4.214-3.831-.382-4.022 1.915-6.128.766-2.107-1.148-1.915-1.915-2.681-3.063-.766-1.149-4.788-3.447-4.788-3.447s-3.255 1.149-1.724-.958c1.533-2.106 2.873-4.595 1.533-4.786-1.341-.192-4.98 1.914-4.98-.384s-.573-4.787.959-5.362c1.081-.405 1.783-1.284 2.775-1.161-.769-.332-1.468-.813-2.009-1.52-1.491-1.947-.575-5.362-3.639-6.511-3.063-1.15-3.063-2.489-3.639-4.979-.573-2.489 0-8.808.766-9.383.765-.574 2.107-5.362 5.363-4.978 3.256.383 6.702.53 7.851-.023 1.149-.551 3.063 1.171 3.638-3.233.575-4.404 1.915-4.979 2.681-7.277.766-2.297-.383-7.086 0-9.958s3.064-7.852 3.064-10.341c0-2.489 2.873-3.638 4.405-2.681 1.532.958 4.787 2.873 6.127 5.937 1.342 3.063 1.342 4.595 3.447 8.617 2.106 4.021 1.533 6.894 2.489 9.958.958 3.064 3.262 5.171 6.419 8.617 3.156 3.446 2.588 5.362 0 5.171-2.588-.191-4.314 2.297-5.654 5.361-1.338 3.065-2.87 10.724-1.721 8.235 1.149-2.491 3.446-9.384 5.744-10.533 2.298-1.149 6.512 1.953 7.469 3.083.957 1.131.574 4.385-1.916 5.726C.383-8.617 1.915-7.469 4.405-9c2.489-1.532 5.362-3.064 4.787.19z\" transform=\"translate(132.845 86.592)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-1.173-.353-2.106-2.681-1.532-3.831.576-1.148-.574.576-2.106-.382-1.533-.957-3.808-3.639-1.713-3.829 2.096-.193 1.713 1.531 3.628.765 1.915-.765 4.021-.575 4.021 1.34C2.298-4.021 1.915.574 0 0\" transform=\"translate(95.886 109.955)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-1.173-.353-2.106-2.681-1.532-3.831.576-1.148-.574.576-2.106-.382-1.533-.957-3.808-3.639-1.713-3.829 2.096-.193 1.713 1.531 3.628.765 1.915-.765 4.021-.575 4.021 1.34C2.298-4.021 1.915.574 0 0Z\" transform=\"translate(95.886 109.955)\"/>\n <path style=\"fill:#2196f3;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-1.154-.165-1.533-3.064.957-3.447 2.49-.383 6.947.575 5.293 2.107C4.596.191 2.682.383 0 0\" transform=\"translate(83.44 118.763)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-1.154-.165-1.533-3.064.957-3.447 2.49-.383 6.947.575 5.293 2.107C4.596.191 2.682.383 0 0Z\" transform=\"translate(83.44 118.763)\"/>\n </g>\n <g clip-path=\"url(#b)\" transform=\"matrix(1.33333 0 0 -1.33333 0 196)\">\n <path style=\"fill:none;stroke:#2196f3;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c0-37.068-30.05-67.119-67.119-67.119S-134.238-37.068-134.238 0c0 37.069 30.05 67.119 67.119 67.119S0 37.069 0 0Z\" transform=\"translate(139.738 74.049)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c0-36.731-29.777-66.509-66.509-66.509S-133.019-36.731-133.019 0c0 36.733 29.778 66.51 66.51 66.51C-29.777 66.51 0 36.733 0 0Z\" transform=\"translate(139.438 73.186)\"/>\n </g>\n <g clip-path=\"url(#c)\" transform=\"matrix(1.33333 0 0 -1.33333 0 196)\">\n <path style=\"fill:#fff;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-1.542-1.541-3.386-2.311-5.533-2.311-2.148 0-3.991.77-5.532 2.311s-2.313 3.387-2.313 5.533c0 2.147.772 3.963 2.313 5.45 1.541 1.486 3.384 2.23 5.532 2.23 2.147 0 3.991-.744 5.533-2.23 1.54-1.487 2.312-3.303 2.312-5.45C2.312 3.387 1.54 1.541 0 0m12.551 23.039c-4.954 4.9-10.954 7.35-18.001 7.35-7.047 0-13.047-2.45-18.002-7.35-4.955-4.898-7.432-10.817-7.432-17.754 0-4.183 2.119-11.176 6.359-20.974 4.238-9.799 8.477-18.717 12.715-26.754 4.241-8.037 6.36-11.946 6.36-11.727.66 1.211 1.568 2.863 2.724 4.955 1.157 2.092 3.194 6.029 6.112 11.809 2.917 5.781 5.477 11.094 7.678 15.935a203.312 203.312 0 0 1 6.111 15.032c1.873 5.173 2.807 9.082 2.807 11.724 0 6.937-2.477 12.856-7.431 17.754\" transform=\"translate(119.64 109.307)\"/>\n <path style=\"fill:#fff;fill-opacity:1;fill-rule:nonzero;stroke:none\" d=\"M0 0c-1.542-1.541-3.386-2.311-5.533-2.311-2.148 0-3.991.77-5.532 2.311s-2.313 3.387-2.313 5.533c0 2.147.772 3.963 2.313 5.45 1.541 1.486 3.384 2.23 5.532 2.23 2.147 0 3.991-.744 5.533-2.23 1.54-1.487 2.312-3.303 2.312-5.45C2.312 3.387 1.54 1.541 0 0m12.551 23.039c-4.954 4.9-10.954 7.35-18.001 7.35-7.047 0-13.047-2.45-18.002-7.35-4.955-4.898-7.432-10.817-7.432-17.754 0-4.183 2.119-11.176 6.359-20.974 4.238-9.799 8.477-18.717 12.715-26.754 4.241-8.037 6.36-11.946 6.36-11.727.66 1.211 1.568 2.863 2.724 4.955 1.157 2.092 3.194 6.029 6.112 11.809 2.917 5.781 5.477 11.094 7.678 15.935a203.312 203.312 0 0 1 6.111 15.032c1.873 5.173 2.807 9.082 2.807 11.724 0 6.937-2.477 12.856-7.431 17.754\" transform=\"translate(119.64 109.307)\"/>\n <path style=\"fill:none;stroke:#2196f3;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1\" d=\"M0 0c-1.542-1.541-3.386-2.311-5.533-2.311-2.148 0-3.991.77-5.532 2.311s-2.313 3.387-2.313 5.533c0 2.147.772 3.963 2.313 5.45 1.541 1.486 3.384 2.23 5.532 2.23 2.147 0 3.991-.744 5.533-2.23 1.54-1.487 2.312-3.303 2.312-5.45C2.312 3.387 1.54 1.541 0 0Zm12.551 23.039c-4.954 4.9-10.954 7.35-18.001 7.35-7.047 0-13.047-2.45-18.002-7.35-4.955-4.898-7.432-10.817-7.432-17.754 0-4.183 2.119-11.176 6.359-20.974 4.238-9.799 8.477-18.717 12.715-26.754 4.241-8.037 6.36-11.946 6.36-11.727.66 1.211 1.568 2.863 2.724 4.955 1.157 2.092 3.194 6.029 6.112 11.809 2.917 5.781 5.477 11.094 7.678 15.935a203.312 203.312 0 0 1 6.111 15.032c1.873 5.173 2.807 9.082 2.807 11.724 0 6.937-2.477 12.856-7.431 17.754z\" transform=\"translate(119.64 109.307)\"/>\n </g>\n</svg>\n";
@@ -11,7 +9,7 @@ var minimizeIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
11
9
  var editIconUrl = URL.createObjectURL(new Blob([iconEdit], {
12
10
  type: 'image/svg+xml'
13
11
  }));
14
- var i18nextIconUrl = URL.createObjectURL(new Blob([i18nextIcon], {
12
+ URL.createObjectURL(new Blob([i18nextIcon], {
15
13
  type: 'image/svg+xml'
16
14
  }));
17
15
  var minimizeIconUrl = URL.createObjectURL(new Blob([minimizeIcon], {
@@ -27,22 +25,8 @@ function EditIcon() {
27
25
  image.style.width = '15px';
28
26
  return image;
29
27
  }
30
- function RibbonLogo() {
31
- var circleSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '18px';
32
- var logoSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '15px';
33
- var ribbon = document.createElement('div');
34
- ribbon.setAttribute('data-i18next-editor-element', 'true');
35
- ribbon.style = "display: inline-flex; align-items: center; justify-content: center; width: ".concat(circleSize, "; height: ").concat(circleSize, "; box-shadow: inset 0 0 5px ").concat(vars.colors.highlight, "; border: 2px solid ").concat(vars.colors.highlight, "; border-radius: 50%");
36
- var image = document.createElement('img');
37
- image.src = i18nextIconUrl;
38
- image.style.width = logoSize;
39
- ribbon.appendChild(image);
40
- return ribbon;
41
- }
42
28
 
43
29
  exports.EditIcon = EditIcon;
44
- exports.RibbonLogo = RibbonLogo;
45
30
  exports.editIconUrl = editIconUrl;
46
- exports.i18nextIconUrl = i18nextIconUrl;
47
31
  exports.locizeIconUrl = locizeIconUrl;
48
32
  exports.minimizeIconUrl = minimizeIconUrl;
@@ -17,7 +17,7 @@ if (stylesheet.sheet) {
17
17
  function Ribbon(popupEle, onMaximize) {
18
18
  var ribbon = document.createElement('div');
19
19
  ribbon.setAttribute('data-i18next-editor-element', 'true');
20
- ribbon.style = "\n cursor: pointer;\n position: fixed;\n bottom: 25px;\n right: 25px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 50px;\n height: 50px;\n background-color: rgba(249, 249, 249, 0.2);\n backdrop-filter: blur(3px);\n box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);\n border-radius: 50%\n ";
20
+ ribbon.style = "\n cursor: pointer;\n position: fixed;\n bottom: 25px;\n right: 25px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 50px;\n height: 50px;\n background-color: rgba(249, 249, 249, 0.2);\n backdrop-filter: blur(3px);\n box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);\n border-radius: 50%;\n ";
21
21
  ribbon.onclick = function () {
22
22
  onMaximize();
23
23
  };
@@ -46,7 +46,7 @@ function Popup(url, cb) {
46
46
  var popup = document.createElement('div');
47
47
  popup.setAttribute('id', popupId);
48
48
  popup.classList.add('i18next-editor-popup');
49
- popup.style = "\n z-index: 9;\n background-color: transparent;\n border: 1px solid rgba(200, 200, 200, 0.9);\n box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);\n border-radius: 3px;\n --i18next-editor-popup-height: 200px;\n height: var(--i18next-editor-popup-height);\n min-height: 150px;\n min-width: 300px;\n --i18next-editor-popup-width: 400px;\n width: var(--i18next-editor-popup-width);\n max-height: 600px;\n max-width: 800px;\n\n position: fixed;\n --i18next-editor-popup-position-top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n --i18next-editor-popup-position-left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n\n overflow: visible;\n ";
49
+ popup.style = "\n z-index: 9;\n background-color: transparent;\n border: 1px solid rgba(200, 200, 200, 0.9);\n box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);\n border-radius: 3px;\n --i18next-editor-popup-height: 200px;\n height: var(--i18next-editor-popup-height);\n min-height: 150px;\n min-width: 300px;\n --i18next-editor-popup-width: 400px;\n width: var(--i18next-editor-popup-width);\n max-height: 800px;\n max-width: 1000px;\n\n position: fixed;\n --i18next-editor-popup-position-top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n top: calc(100vh - var(--i18next-editor-popup-height) - 10px);\n --i18next-editor-popup-position-left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n left: calc(100vw - var(--i18next-editor-popup-width) - 10px);\n\n overflow: visible;\n ";
50
50
  popup.setAttribute('data-i18next-editor-element', 'true');
51
51
  var header = document.createElement('div');
52
52
  header.classList.add('i18next-editor-popup-header');
@@ -66,7 +66,7 @@ function Popup(url, cb) {
66
66
  var iframe = document.createElement('iframe');
67
67
  iframe.setAttribute('id', 'i18next-editor-iframe');
68
68
  iframe.setAttribute('data-i18next-editor-element', 'true');
69
- iframe.style = "\n z-index: 100;\n width: 100%;\n height: calc(100% - 28px);\n border: none;\n background: #fff;\n ";
69
+ iframe.style = "\n z-index: 100;\n width: 100%;\n height: calc(100% - 32px);\n border: none;\n background: #fff;\n ";
70
70
  iframe.setAttribute('src', url);
71
71
  iframe.addEventListener('load', cb);
72
72
  popup.appendChild(iframe);
@@ -12,17 +12,16 @@ require('../../api/handleRequestPopupChanges.js');
12
12
  require('../../api/handleRequestResourceBundle.js');
13
13
  require('../../api/handleSelectedKeys.js');
14
14
  require('../../api/handleIsLocizeEnabled.js');
15
- require('../../api/handleTurnOn.js');
16
- require('../../api/handleTurnOff.js');
15
+ require('../../api/handleSendMatchedUninstrumented.js');
17
16
  var postMessage = require('../../api/postMessage.js');
18
17
  var icons = require('./icons.js');
19
18
 
20
19
  if (stylesheet.sheet) {
21
- stylesheet.sheet.insertRule('.i18next-editor-button:hover { background-color: rgba(38, 166, 154, 1) !important; }');
20
+ stylesheet.sheet.insertRule('.i18next-editor-button:hover { background-color: rgba(21, 65, 154, 1) !important; }');
22
21
  }
23
22
  function RibbonButton(text, attrTitle, onClick) {
24
23
  var btn = document.createElement('button');
25
- btn.style = 'font-family: Arial; position: relative; backdrop-filter: blur(3px); cursor: pointer; padding: 2px 10px 2px 20px; font-size: 15px; font-weight: 300; text-transform: uppercase; color: #fff; background-color: rgba(38, 166, 154, 0.8); border: none; border-radius: 12px';
24
+ btn.style = 'font-family: Arial; position: relative; backdrop-filter: blur(3px); cursor: pointer; padding: 2px 10px 2px 20px; font-size: 15px; font-weight: 300; text-transform: uppercase; color: #fff; background-color: rgba(25, 118, 210, 0.8); border: none; border-radius: 12px; z-index: 99999;';
26
25
  btn.classList.add('i18next-editor-button');
27
26
  btn.setAttribute('data-i18next-editor-element', 'true');
28
27
  btn.setAttribute('title', attrTitle);
@@ -44,8 +43,6 @@ function RibbonBox() {
44
43
  var arrow = document.createElement('div');
45
44
  arrow.style = "\n position: absolute;\n width: 0;\n height: 0;\n border-top-width: 7px;\n border-bottom-width: 7px;\n border-left-width: 10px;\n border-right-width: 10px;\n border-style: solid;\n border-color: transparent ".concat(vars.colors.highlight, " transparent\n transparent;\n ");
46
45
  box.appendChild(arrow);
47
- var logo = icons.RibbonLogo();
48
- box.appendChild(logo);
49
46
  var btnbox = document.createElement('div');
50
47
  btnbox.style = 'display: flex; flex-direction: column; align-items: flex-start; margin-left: 2px; margin-top: 1px';
51
48
  Object.keys(keys).forEach(function (k) {