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.
- package/README.md +74 -36
- package/dist/cjs/{processLegacy.js → _processLegacy.js} +1 -2
- package/dist/cjs/{startStandalone.js → _startStandalone.js} +2 -2
- package/dist/cjs/api/handleCommitKeys.js +7 -0
- package/dist/cjs/api/handleEditKey.js +1 -1
- package/dist/cjs/api/handleIsLocizeEnabled.js +2 -2
- package/dist/cjs/api/handleRequestPopupChanges.js +11 -0
- package/dist/cjs/api/handleSendMatchedUninstrumented.js +26 -0
- package/dist/cjs/api/postMessage.js +32 -45
- package/dist/cjs/implementations/dummyImplementation.js +35 -0
- package/dist/cjs/implementations/i18nextImplementation.js +94 -0
- package/dist/cjs/index.d.ts +9 -16
- package/dist/cjs/index.js +4 -9
- package/dist/cjs/locizePlugin.js +6 -90
- package/dist/cjs/observer.js +1 -0
- package/dist/cjs/parser.js +100 -14
- package/dist/cjs/process.js +37 -5
- package/dist/cjs/store.js +1 -0
- package/dist/cjs/ui/elements/highlightBox.js +13 -0
- package/dist/cjs/ui/elements/icons.js +1 -17
- package/dist/cjs/ui/elements/popup.js +3 -3
- package/dist/cjs/ui/elements/ribbonBox.js +3 -6
- package/dist/cjs/ui/highlightNode.js +28 -77
- package/dist/cjs/ui/popup.js +10 -0
- package/dist/cjs/ui/utils.js +18 -0
- package/dist/cjs/uninstrumentedStore.js +18 -2
- package/dist/cjs/utils.js +54 -0
- package/dist/cjs/vars.js +5 -2
- package/dist/esm/{processLegacy.js → _processLegacy.js} +1 -2
- package/dist/esm/{startStandalone.js → _startStandalone.js} +1 -1
- package/dist/esm/api/handleCommitKeys.js +7 -0
- package/dist/esm/api/handleEditKey.js +1 -1
- package/dist/esm/api/handleIsLocizeEnabled.js +2 -2
- package/dist/esm/api/handleRequestPopupChanges.js +11 -0
- package/dist/esm/api/handleSendMatchedUninstrumented.js +20 -0
- package/dist/esm/api/postMessage.js +33 -44
- package/dist/esm/implementations/dummyImplementation.js +31 -0
- package/dist/esm/implementations/i18nextImplementation.js +85 -0
- package/dist/esm/index.d.ts +9 -16
- package/dist/esm/index.js +5 -8
- package/dist/esm/locizePlugin.js +5 -85
- package/dist/esm/observer.js +1 -0
- package/dist/esm/parser.js +101 -16
- package/dist/esm/process.js +38 -6
- package/dist/esm/store.js +1 -0
- package/dist/esm/ui/elements/highlightBox.js +9 -0
- package/dist/esm/ui/elements/icons.js +2 -16
- package/dist/esm/ui/elements/popup.js +3 -3
- package/dist/esm/ui/elements/ribbonBox.js +4 -7
- package/dist/esm/ui/highlightNode.js +28 -78
- package/dist/esm/ui/popup.js +10 -0
- package/dist/esm/ui/utils.js +18 -1
- package/dist/esm/uninstrumentedStore.js +18 -2
- package/dist/esm/utils.js +53 -1
- package/dist/esm/vars.js +5 -3
- package/dist/umd/locize.js +726 -496
- package/dist/umd/locize.min.js +1 -1
- package/index.d.ts +9 -16
- package/locize.js +726 -496
- package/locize.min.js +1 -1
- package/package.json +1 -1
- package/src/_startStandalone.js +22 -0
- package/src/api/handleCommitKeys.js +9 -0
- package/src/api/handleEditKey.js +5 -11
- package/src/api/handleIsLocizeEnabled.js +7 -2
- package/src/api/handleRequestPopupChanges.js +27 -0
- package/src/api/handleSendMatchedUninstrumented.js +38 -0
- package/src/api/index.js +1 -4
- package/src/api/postMessage.js +37 -53
- package/src/implementations/dummyImplementation.js +29 -0
- package/src/implementations/i18nextImplementation.js +114 -0
- package/src/implementations/index.js +2 -0
- package/src/index.js +8 -7
- package/src/locizePlugin.js +51 -28
- package/src/observer.js +1 -0
- package/src/parser.js +207 -19
- package/src/process.js +52 -5
- package/src/startStandalone.js +4 -17
- package/src/store.js +2 -0
- package/src/ui/elements/highlightBox.js +17 -0
- package/src/ui/elements/popup.js +4 -4
- package/src/ui/elements/ribbonBox.js +12 -8
- package/src/ui/highlightNode.js +102 -71
- package/src/ui/popup.js +33 -5
- package/src/ui/utils.js +28 -1
- package/src/uninstrumentedStore.js +18 -2
- package/src/utils.js +72 -5
- package/src/vars.js +6 -4
- package/dist/cjs/api/handleTurnOff.js +0 -8
- package/dist/cjs/api/handleTurnOn.js +0 -8
- package/dist/esm/api/handleTurnOff.js +0 -6
- package/dist/esm/api/handleTurnOn.js +0 -6
- /package/src/{processLegacy.js → _processLegacy.js} +0 -0
- /package/src/api/{handleTurnOff.js → _handleTurnOff.js} +0 -0
- /package/src/api/{handleTurnOn.js → _handleTurnOn.js} +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { colors } from '../../vars.js';
|
|
2
|
-
|
|
3
1
|
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>';
|
|
4
2
|
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";
|
|
5
3
|
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";
|
|
@@ -7,7 +5,7 @@ var minimizeIcon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"
|
|
|
7
5
|
var editIconUrl = URL.createObjectURL(new Blob([iconEdit], {
|
|
8
6
|
type: 'image/svg+xml'
|
|
9
7
|
}));
|
|
10
|
-
|
|
8
|
+
URL.createObjectURL(new Blob([i18nextIcon], {
|
|
11
9
|
type: 'image/svg+xml'
|
|
12
10
|
}));
|
|
13
11
|
var minimizeIconUrl = URL.createObjectURL(new Blob([minimizeIcon], {
|
|
@@ -23,17 +21,5 @@ function EditIcon() {
|
|
|
23
21
|
image.style.width = '15px';
|
|
24
22
|
return image;
|
|
25
23
|
}
|
|
26
|
-
function RibbonLogo() {
|
|
27
|
-
var circleSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '18px';
|
|
28
|
-
var logoSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '15px';
|
|
29
|
-
var ribbon = document.createElement('div');
|
|
30
|
-
ribbon.setAttribute('data-i18next-editor-element', 'true');
|
|
31
|
-
ribbon.style = "display: inline-flex; align-items: center; justify-content: center; width: ".concat(circleSize, "; height: ").concat(circleSize, "; box-shadow: inset 0 0 5px ").concat(colors.highlight, "; border: 2px solid ").concat(colors.highlight, "; border-radius: 50%");
|
|
32
|
-
var image = document.createElement('img');
|
|
33
|
-
image.src = i18nextIconUrl;
|
|
34
|
-
image.style.width = logoSize;
|
|
35
|
-
ribbon.appendChild(image);
|
|
36
|
-
return ribbon;
|
|
37
|
-
}
|
|
38
24
|
|
|
39
|
-
export { EditIcon,
|
|
25
|
+
export { EditIcon, editIconUrl, locizeIconUrl, minimizeIconUrl };
|
|
@@ -13,7 +13,7 @@ if (sheet) {
|
|
|
13
13
|
function Ribbon(popupEle, onMaximize) {
|
|
14
14
|
var ribbon = document.createElement('div');
|
|
15
15
|
ribbon.setAttribute('data-i18next-editor-element', 'true');
|
|
16
|
-
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
|
|
16
|
+
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 ";
|
|
17
17
|
ribbon.onclick = function () {
|
|
18
18
|
onMaximize();
|
|
19
19
|
};
|
|
@@ -42,7 +42,7 @@ function Popup(url, cb) {
|
|
|
42
42
|
var popup = document.createElement('div');
|
|
43
43
|
popup.setAttribute('id', popupId);
|
|
44
44
|
popup.classList.add('i18next-editor-popup');
|
|
45
|
-
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:
|
|
45
|
+
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 ";
|
|
46
46
|
popup.setAttribute('data-i18next-editor-element', 'true');
|
|
47
47
|
var header = document.createElement('div');
|
|
48
48
|
header.classList.add('i18next-editor-popup-header');
|
|
@@ -62,7 +62,7 @@ function Popup(url, cb) {
|
|
|
62
62
|
var iframe = document.createElement('iframe');
|
|
63
63
|
iframe.setAttribute('id', 'i18next-editor-iframe');
|
|
64
64
|
iframe.setAttribute('data-i18next-editor-element', 'true');
|
|
65
|
-
iframe.style = "\n z-index: 100;\n width: 100%;\n height: calc(100% -
|
|
65
|
+
iframe.style = "\n z-index: 100;\n width: 100%;\n height: calc(100% - 32px);\n border: none;\n background: #fff;\n ";
|
|
66
66
|
iframe.setAttribute('src', url);
|
|
67
67
|
iframe.addEventListener('load', cb);
|
|
68
68
|
popup.appendChild(iframe);
|
|
@@ -8,17 +8,16 @@ import '../../api/handleRequestPopupChanges.js';
|
|
|
8
8
|
import '../../api/handleRequestResourceBundle.js';
|
|
9
9
|
import '../../api/handleSelectedKeys.js';
|
|
10
10
|
import '../../api/handleIsLocizeEnabled.js';
|
|
11
|
-
import '../../api/
|
|
12
|
-
import '../../api/handleTurnOff.js';
|
|
11
|
+
import '../../api/handleSendMatchedUninstrumented.js';
|
|
13
12
|
import { api } from '../../api/postMessage.js';
|
|
14
|
-
import {
|
|
13
|
+
import { EditIcon } from './icons.js';
|
|
15
14
|
|
|
16
15
|
if (sheet) {
|
|
17
|
-
sheet.insertRule('.i18next-editor-button:hover { background-color: rgba(
|
|
16
|
+
sheet.insertRule('.i18next-editor-button:hover { background-color: rgba(21, 65, 154, 1) !important; }');
|
|
18
17
|
}
|
|
19
18
|
function RibbonButton(text, attrTitle, onClick) {
|
|
20
19
|
var btn = document.createElement('button');
|
|
21
|
-
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(
|
|
20
|
+
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;';
|
|
22
21
|
btn.classList.add('i18next-editor-button');
|
|
23
22
|
btn.setAttribute('data-i18next-editor-element', 'true');
|
|
24
23
|
btn.setAttribute('title', attrTitle);
|
|
@@ -40,8 +39,6 @@ function RibbonBox() {
|
|
|
40
39
|
var arrow = document.createElement('div');
|
|
41
40
|
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(colors.highlight, " transparent\n transparent;\n ");
|
|
42
41
|
box.appendChild(arrow);
|
|
43
|
-
var logo = RibbonLogo();
|
|
44
|
-
box.appendChild(logo);
|
|
45
42
|
var btnbox = document.createElement('div');
|
|
46
43
|
btnbox.style = 'display: flex; flex-direction: column; align-items: flex-start; margin-left: 2px; margin-top: 1px';
|
|
47
44
|
Object.keys(keys).forEach(function (k) {
|
|
@@ -1,52 +1,25 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
2
|
import { colors } from '../vars.js';
|
|
3
3
|
import { RibbonBox } from './elements/ribbonBox.js';
|
|
4
|
+
import { HighlightBox } from './elements/highlightBox.js';
|
|
4
5
|
import { computePosition, flip, shift, offset, arrow } from '@floating-ui/dom';
|
|
6
|
+
import { getOptimizedBoundingRectEle } from './utils.js';
|
|
5
7
|
|
|
6
|
-
var eleToOutline = ['DIV', 'P', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'OL', 'UL', 'ADDRESS', 'BLOCKQUOTE', 'DL', 'PRE'];
|
|
7
|
-
var overriddenStyles = ['outline', 'border-radius', 'outline-offset', 'filter'];
|
|
8
|
-
var originalStyles = {};
|
|
9
8
|
var selected = {};
|
|
10
9
|
function highlight(item, node, keys) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, {});
|
|
18
|
-
}
|
|
19
|
-
if (eleToOutline.includes(node.nodeName)) {
|
|
20
|
-
node.style.outline = "".concat(colors.highlight, " solid 1px");
|
|
21
|
-
node.style.setProperty('border-radius', '1px');
|
|
22
|
-
node.style.setProperty('outline-offset', '2px');
|
|
23
|
-
node.style.filter = 'brightness(110%)';
|
|
24
|
-
} else {
|
|
25
|
-
node.style.outline = "".concat(colors.highlight, " solid 1px");
|
|
26
|
-
node.style.setProperty('border-radius', '1px');
|
|
27
|
-
node.style.setProperty('outline-offset', '1px');
|
|
28
|
-
node.style.filter = 'brightness(110%)';
|
|
10
|
+
item.id;
|
|
11
|
+
var rectEle = getOptimizedBoundingRectEle(node);
|
|
12
|
+
if (!item.highlightBox) {
|
|
13
|
+
var box = HighlightBox(rectEle, colors.highlight);
|
|
14
|
+
document.body.appendChild(box);
|
|
15
|
+
item.highlightBox = box;
|
|
29
16
|
}
|
|
30
17
|
if (!item.ribbonBox) {
|
|
31
18
|
var _RibbonBox = RibbonBox(keys),
|
|
32
19
|
actions = _RibbonBox.box,
|
|
33
20
|
arrowEle = _RibbonBox.arrow;
|
|
34
21
|
document.body.appendChild(actions);
|
|
35
|
-
|
|
36
|
-
if (node.childNodes.length === 1) {
|
|
37
|
-
var childNode = node.childNodes[0];
|
|
38
|
-
if (childNode && childNode.nodeName === '#text') {
|
|
39
|
-
var range = document.createRange();
|
|
40
|
-
range.selectNode(childNode);
|
|
41
|
-
var rect = range.getBoundingClientRect();
|
|
42
|
-
refEle = {
|
|
43
|
-
getBoundingClientRect: function getBoundingClientRect() {
|
|
44
|
-
return rect;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
computePosition(refEle, actions, {
|
|
22
|
+
computePosition(rectEle, actions, {
|
|
50
23
|
placement: 'right',
|
|
51
24
|
middleware: [flip({
|
|
52
25
|
fallbackPlacements: ['left', 'bottom']
|
|
@@ -93,58 +66,35 @@ function highlight(item, node, keys) {
|
|
|
93
66
|
function highlightUninstrumented(item, node, keys) {
|
|
94
67
|
var id = item.id;
|
|
95
68
|
if (selected[id]) return;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
if (eleToOutline.includes(node.nodeName)) {
|
|
103
|
-
node.style.outline = "".concat(colors.warning, " solid 1px");
|
|
104
|
-
node.style.setProperty('border-radius', '1px');
|
|
105
|
-
node.style.setProperty('outline-offset', '2px');
|
|
106
|
-
node.style.filter = 'brightness(110%)';
|
|
107
|
-
} else {
|
|
108
|
-
node.style.outline = "".concat(colors.warning, " solid 1px");
|
|
109
|
-
node.style.setProperty('border-radius', '1px');
|
|
110
|
-
node.style.setProperty('outline-offset', '1px');
|
|
111
|
-
node.style.filter = 'brightness(110%)';
|
|
69
|
+
var rectEle = getOptimizedBoundingRectEle(node);
|
|
70
|
+
if (!item.highlightBox) {
|
|
71
|
+
var box = HighlightBox(rectEle, colors.warning);
|
|
72
|
+
document.body.appendChild(box);
|
|
73
|
+
item.highlightBox = box;
|
|
112
74
|
}
|
|
113
75
|
}
|
|
114
76
|
function selectedHighlight(item, node, keys) {
|
|
115
77
|
var id = item.id;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
if (eleToOutline.includes(node.nodeName)) {
|
|
123
|
-
node.style.outline = "".concat(colors.highlight, " solid 1px");
|
|
124
|
-
node.style.setProperty('border-radius', '1px');
|
|
125
|
-
node.style.setProperty('outline-offset', '2px');
|
|
126
|
-
node.style.filter = "brightness(110%) drop-shadow(0px 0px 2px ".concat(colors.highlight, " )");
|
|
127
|
-
} else {
|
|
128
|
-
node.style.outline = "".concat(colors.highlight, " solid 1px");
|
|
129
|
-
node.style.setProperty('border-radius', '1px');
|
|
130
|
-
node.style.setProperty('outline-offset', '1px');
|
|
131
|
-
node.style.filter = "brightness(110%) drop-shadow(0px 0px 2px ".concat(colors.highlight, " )");
|
|
132
|
-
}
|
|
133
|
-
if (item.ribbonBox) {
|
|
134
|
-
document.body.removeChild(item.ribbonBox);
|
|
135
|
-
delete item.ribbonBox;
|
|
78
|
+
var rectEle = getOptimizedBoundingRectEle(node);
|
|
79
|
+
if (!item.highlightBox) {
|
|
80
|
+
var box = HighlightBox(rectEle, colors.highlight, colors.gray);
|
|
81
|
+
document.body.appendChild(box);
|
|
82
|
+
item.highlightBox = box;
|
|
136
83
|
}
|
|
137
84
|
selected[id] = true;
|
|
138
85
|
}
|
|
86
|
+
function recalcSelectedHighlight(item, node, keys) {
|
|
87
|
+
if (!selected[item.id]) return;
|
|
88
|
+
resetHighlight(item, node, keys, false);
|
|
89
|
+
selectedHighlight(item, node);
|
|
90
|
+
}
|
|
139
91
|
function resetHighlight(item, node, keys) {
|
|
140
92
|
var ignoreSelected = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
141
93
|
var id = item.id;
|
|
142
94
|
if (ignoreSelected && selected[id]) return;
|
|
143
|
-
if (
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
147
|
-
delete originalStyles[id];
|
|
95
|
+
if (item.highlightBox) {
|
|
96
|
+
document.body.removeChild(item.highlightBox);
|
|
97
|
+
delete item.highlightBox;
|
|
148
98
|
}
|
|
149
99
|
if (item.ribbonBox) {
|
|
150
100
|
document.body.removeChild(item.ribbonBox);
|
|
@@ -153,4 +103,4 @@ function resetHighlight(item, node, keys) {
|
|
|
153
103
|
delete selected[id];
|
|
154
104
|
}
|
|
155
105
|
|
|
156
|
-
export { highlight, highlightUninstrumented, resetHighlight, selectedHighlight };
|
|
106
|
+
export { highlight, highlightUninstrumented, recalcSelectedHighlight, resetHighlight, selectedHighlight };
|
package/dist/esm/ui/popup.js
CHANGED
|
@@ -47,6 +47,11 @@ function initDragElement() {
|
|
|
47
47
|
function closeDragElement() {
|
|
48
48
|
startMouseTracking();
|
|
49
49
|
if (overlay) overlay.style.display = 'none';
|
|
50
|
+
var ele = document.getElementById('i18next-editor-popup');
|
|
51
|
+
localStorage.setItem('locize_popup_pos', JSON.stringify({
|
|
52
|
+
top: parseInt(document.defaultView.getComputedStyle(ele).top, 10),
|
|
53
|
+
left: parseInt(document.defaultView.getComputedStyle(ele).left, 10)
|
|
54
|
+
}));
|
|
50
55
|
document.onmouseup = null;
|
|
51
56
|
document.onmousemove = null;
|
|
52
57
|
}
|
|
@@ -100,6 +105,11 @@ function initResizeElement() {
|
|
|
100
105
|
function stopDrag() {
|
|
101
106
|
startMouseTracking();
|
|
102
107
|
if (overlay) overlay.style.display = 'none';
|
|
108
|
+
var ele = document.getElementById('i18next-editor-popup');
|
|
109
|
+
localStorage.setItem('locize_popup_size', JSON.stringify({
|
|
110
|
+
width: parseInt(document.defaultView.getComputedStyle(ele).width, 10),
|
|
111
|
+
height: parseInt(document.defaultView.getComputedStyle(ele).height, 10)
|
|
112
|
+
}));
|
|
103
113
|
document.documentElement.removeEventListener('mousemove', doDrag, false);
|
|
104
114
|
document.documentElement.removeEventListener('mouseup', stopDrag, false);
|
|
105
115
|
}
|
package/dist/esm/ui/utils.js
CHANGED
|
@@ -34,5 +34,22 @@ function mouseDistanceFromElement(mouseEvent, element) {
|
|
|
34
34
|
hypot = Math.pow(Math.pow(distX, 2) + Math.pow(distY, 2), 1 / 2);
|
|
35
35
|
return Math.floor(hypot);
|
|
36
36
|
}
|
|
37
|
+
function getOptimizedBoundingRectEle(node) {
|
|
38
|
+
var refEle = node;
|
|
39
|
+
if (node.childNodes.length === 1) {
|
|
40
|
+
var childNode = node.childNodes[0];
|
|
41
|
+
if (childNode && childNode.nodeName === '#text') {
|
|
42
|
+
var range = document.createRange();
|
|
43
|
+
range.selectNode(childNode);
|
|
44
|
+
var rect = range.getBoundingClientRect();
|
|
45
|
+
refEle = {
|
|
46
|
+
getBoundingClientRect: function getBoundingClientRect() {
|
|
47
|
+
return rect;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return refEle;
|
|
53
|
+
}
|
|
37
54
|
|
|
38
|
-
export { isInViewport, mouseDistanceFromElement };
|
|
55
|
+
export { getOptimizedBoundingRectEle, isInViewport, mouseDistanceFromElement };
|
|
@@ -12,7 +12,7 @@ function clean() {
|
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
function save(id, type, node) {
|
|
15
|
+
function save(id, type, node, txt) {
|
|
16
16
|
if (!id || !type || !node) return;
|
|
17
17
|
if (!data[id]) {
|
|
18
18
|
data[id] = {
|
|
@@ -20,13 +20,29 @@ function save(id, type, node) {
|
|
|
20
20
|
node: node
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
data[id].keys = _objectSpread(_objectSpread({}, data[id].keys), {}, _defineProperty({}, "".concat(type),
|
|
23
|
+
data[id].keys = _objectSpread(_objectSpread({}, data[id].keys), {}, _defineProperty({}, "".concat(type), {
|
|
24
|
+
value: txt,
|
|
25
|
+
eleUniqueID: id,
|
|
26
|
+
textType: type
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
function remove(id, node) {
|
|
30
|
+
resetHighlight(id, node);
|
|
31
|
+
delete data[id];
|
|
32
|
+
}
|
|
33
|
+
function removeKey(id, key, node) {
|
|
34
|
+
var item = get(id);
|
|
35
|
+
if (!item) return;
|
|
36
|
+
delete item.keys["".concat(key)];
|
|
37
|
+
if (!Object.keys(item.keys).length) remove(id, node);
|
|
24
38
|
}
|
|
25
39
|
function get(id) {
|
|
26
40
|
return data[id];
|
|
27
41
|
}
|
|
28
42
|
var uninstrumentedStore = {
|
|
29
43
|
save: save,
|
|
44
|
+
remove: remove,
|
|
45
|
+
removeKey: removeKey,
|
|
30
46
|
clean: clean,
|
|
31
47
|
get: get,
|
|
32
48
|
data: data
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/esm/slicedToArray';
|
|
1
2
|
import _typeof from '@babel/runtime/helpers/esm/typeof';
|
|
2
3
|
|
|
3
4
|
function debounce(func, wait, immediate) {
|
|
@@ -96,6 +97,57 @@ function getElementI18nKey(el) {
|
|
|
96
97
|
}
|
|
97
98
|
return undefined;
|
|
98
99
|
}
|
|
100
|
+
function parseAttrFromKey(key) {
|
|
101
|
+
var attr = 'text';
|
|
102
|
+
if (key.indexOf('[') == 0) {
|
|
103
|
+
var parts = key.split(']');
|
|
104
|
+
key = parts[1];
|
|
105
|
+
attr = parts[0].substr(1, parts[0].length - 1);
|
|
106
|
+
}
|
|
107
|
+
var newKey = key.indexOf(';') == key.length - 1 ? key.substr(0, key.length - 2) : key;
|
|
108
|
+
return [newKey, attr];
|
|
109
|
+
}
|
|
110
|
+
function getI18nMetaFromNode(el) {
|
|
111
|
+
var hasNamespacePrependToKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
112
|
+
var key = getElementI18nKey(el);
|
|
113
|
+
var ns = getElementNamespace(el);
|
|
114
|
+
var allKeys = {};
|
|
115
|
+
if (key && key.indexOf(';') >= 0) {
|
|
116
|
+
var keys = key.split(';');
|
|
117
|
+
for (var ix = 0, l_ix = keys.length; ix < l_ix; ix++) {
|
|
118
|
+
if (keys[ix] != '') {
|
|
119
|
+
var _parseAttrFromKey = parseAttrFromKey(keys[ix]),
|
|
120
|
+
_parseAttrFromKey2 = _slicedToArray(_parseAttrFromKey, 2),
|
|
121
|
+
usedKey = _parseAttrFromKey2[0],
|
|
122
|
+
attr = _parseAttrFromKey2[1];
|
|
123
|
+
allKeys[attr] = usedKey;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} else if (key) {
|
|
127
|
+
var _parseAttrFromKey3 = parseAttrFromKey(key),
|
|
128
|
+
_parseAttrFromKey4 = _slicedToArray(_parseAttrFromKey3, 2),
|
|
129
|
+
_usedKey = _parseAttrFromKey4[0],
|
|
130
|
+
_attr = _parseAttrFromKey4[1];
|
|
131
|
+
allKeys[_attr] = _usedKey;
|
|
132
|
+
}
|
|
133
|
+
if (Object.keys(allKeys).length < 1) return null;
|
|
134
|
+
var res = Object.keys(allKeys).reduce(function (mem, attr) {
|
|
135
|
+
var key = allKeys[attr];
|
|
136
|
+
var usedNS = ns;
|
|
137
|
+
var usedKey = key;
|
|
138
|
+
if (hasNamespacePrependToKey && key.indexOf(':') > -1) {
|
|
139
|
+
var parts = key.split(':');
|
|
140
|
+
usedKey = parts[1];
|
|
141
|
+
usedNS = parts[0];
|
|
142
|
+
}
|
|
143
|
+
mem[attr] = {
|
|
144
|
+
key: usedKey,
|
|
145
|
+
ns: usedNS
|
|
146
|
+
};
|
|
147
|
+
return mem;
|
|
148
|
+
}, {});
|
|
149
|
+
return res;
|
|
150
|
+
}
|
|
99
151
|
function getElementNamespace(el) {
|
|
100
152
|
var found;
|
|
101
153
|
var find = function find(ele) {
|
|
@@ -130,4 +182,4 @@ function getQsParameterByName(name, url) {
|
|
|
130
182
|
return decodeURIComponent(results[2].replace(/\+/g, ' '));
|
|
131
183
|
}
|
|
132
184
|
|
|
133
|
-
export { debounce, getClickedElement, getElementI18nKey, getElementNamespace, getElementText, getQsParameterByName, getWindow, isWindow, offset };
|
|
185
|
+
export { debounce, getClickedElement, getElementI18nKey, getElementNamespace, getElementText, getI18nMetaFromNode, getQsParameterByName, getWindow, isWindow, offset };
|
package/dist/esm/vars.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
var validAttributes = ['placeholder', 'title', 'alt'];
|
|
2
|
+
var ignoreElements = ['SCRIPT'];
|
|
2
3
|
var colors = {
|
|
3
|
-
highlight: '#
|
|
4
|
-
warning: '#e67a00'
|
|
4
|
+
highlight: '#1976d2',
|
|
5
|
+
warning: '#e67a00',
|
|
6
|
+
gray: '#ccc'
|
|
5
7
|
};
|
|
6
8
|
var getIframeUrl = function getIframeUrl() {
|
|
7
9
|
var _prc$env;
|
|
@@ -13,4 +15,4 @@ var getIframeUrl = function getIframeUrl() {
|
|
|
13
15
|
return env === 'development' ? 'http://localhost:3003/' : env === 'staging' ? 'https://incontext-dev.locize.app' : 'https://incontext.locize.app';
|
|
14
16
|
};
|
|
15
17
|
|
|
16
|
-
export { colors, getIframeUrl, validAttributes };
|
|
18
|
+
export { colors, getIframeUrl, ignoreElements, validAttributes };
|