@intlayer/editor 5.3.12 → 5.4.0-canary.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/dist/cjs/compareUrls.cjs +46 -0
- package/dist/cjs/compareUrls.cjs.map +1 -0
- package/dist/cjs/index.cjs +25 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/mergeIframeClick.cjs +44 -0
- package/dist/cjs/mergeIframeClick.cjs.map +1 -0
- package/dist/cjs/messagesKeys.cjs +40 -0
- package/dist/cjs/messagesKeys.cjs.map +1 -0
- package/dist/esm/compareUrls.mjs +22 -0
- package/dist/esm/compareUrls.mjs.map +1 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/mergeIframeClick.mjs +20 -0
- package/dist/esm/mergeIframeClick.mjs.map +1 -0
- package/dist/esm/messagesKeys.mjs +16 -0
- package/dist/esm/messagesKeys.mjs.map +1 -0
- package/dist/types/compareUrls.d.ts +18 -0
- package/dist/types/compareUrls.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/mergeIframeClick.d.ts +2 -0
- package/dist/types/mergeIframeClick.d.ts.map +1 -0
- package/dist/types/messagesKeys.d.ts +12 -0
- package/dist/types/messagesKeys.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var compareUrls_exports = {};
|
|
20
|
+
__export(compareUrls_exports, {
|
|
21
|
+
compareUrls: () => compareUrls
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(compareUrls_exports);
|
|
24
|
+
const compareUrls = (url1, url2) => {
|
|
25
|
+
try {
|
|
26
|
+
const parsedUrl1 = new URL(url1);
|
|
27
|
+
const parsedUrl2 = new URL(url2);
|
|
28
|
+
if (parsedUrl1.protocol !== parsedUrl2.protocol || parsedUrl1.hostname !== parsedUrl2.hostname || parsedUrl1.port !== parsedUrl2.port) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
const path1 = parsedUrl1.pathname.replace(/\/$/, "");
|
|
32
|
+
const path2 = parsedUrl2.pathname.replace(/\/$/, "");
|
|
33
|
+
if (path1 !== "" && path2 !== "" && path1 !== path2) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
return true;
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error("Invalid URL(s)", error);
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
compareUrls
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=compareUrls.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/compareUrls.ts"],"sourcesContent":["/**\n * Compare two URLs for equality.\n * This function is used to determine if a message originates from the same origin.\n *\n * ```js\n * // Example usage\n * console.log(compareUrls(\"http://localhost:5173/\", \"http://localhost:5173\")); // true\n * console.log(compareUrls(\"http://localhost:5173\", \"http://localhost:5173?myParam=true\")); // true\n * console.log(compareUrls(\"http://localhost:5173/subpath\", \"http://localhost:5173\")); // true\n * console.log(compareUrls(\"http://localhost:5172\", \"http://localhost:5173\")); // false\n * ```\n *\n * @param url1 - The first URL to compare.\n * @param url2 - The second URL to compare.\n * @returns Whether the two URLs are equal.\n */\nexport const compareUrls = (url1: string, url2: string): boolean => {\n try {\n const parsedUrl1 = new URL(url1);\n const parsedUrl2 = new URL(url2);\n\n // Compare protocol, hostname, and port\n if (\n parsedUrl1.protocol !== parsedUrl2.protocol ||\n parsedUrl1.hostname !== parsedUrl2.hostname ||\n parsedUrl1.port !== parsedUrl2.port\n ) {\n return false;\n }\n\n // One URL should not have a subpath while the other does\n const path1 = parsedUrl1.pathname.replace(/\\/$/, ''); // Remove trailing slash\n const path2 = parsedUrl2.pathname.replace(/\\/$/, '');\n\n if (path1 !== '' && path2 !== '' && path1 !== path2) {\n return false;\n }\n\n return true;\n } catch (error) {\n console.error('Invalid URL(s)', error);\n return false;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBO,MAAM,cAAc,CAAC,MAAc,SAA0B;AAClE,MAAI;AACF,UAAM,aAAa,IAAI,IAAI,IAAI;AAC/B,UAAM,aAAa,IAAI,IAAI,IAAI;AAG/B,QACE,WAAW,aAAa,WAAW,YACnC,WAAW,aAAa,WAAW,YACnC,WAAW,SAAS,WAAW,MAC/B;AACA,aAAO;AAAA,IACT;AAGA,UAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,EAAE;AACnD,UAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,EAAE;AAEnD,QAAI,UAAU,MAAM,UAAU,MAAM,UAAU,OAAO;AACnD,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,kBAAkB,KAAK;AACrC,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,2 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var index_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(index_exports);
|
|
18
|
+
__reExport(index_exports, require('./compareUrls.cjs'), module.exports);
|
|
19
|
+
__reExport(index_exports, require('./mergeIframeClick.cjs'), module.exports);
|
|
20
|
+
__reExport(index_exports, require('./messagesKeys.cjs'), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require('./compareUrls.cjs'),
|
|
24
|
+
...require('./mergeIframeClick.cjs'),
|
|
25
|
+
...require('./messagesKeys.cjs')
|
|
26
|
+
});
|
|
2
27
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './compareUrls';\nexport * from './mergeIframeClick';\nexport * from './messagesKeys';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,0BAAd;AACA,0BAAc,+BADd;AAEA,0BAAc,2BAFd;","names":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var mergeIframeClick_exports = {};
|
|
20
|
+
__export(mergeIframeClick_exports, {
|
|
21
|
+
mergeIframeClick: () => mergeIframeClick
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(mergeIframeClick_exports);
|
|
24
|
+
const mergeIframeClick = (event) => {
|
|
25
|
+
const simulatedMouseDownEvent = new MouseEvent("mousedown", {
|
|
26
|
+
bubbles: true,
|
|
27
|
+
cancelable: true,
|
|
28
|
+
view: window
|
|
29
|
+
});
|
|
30
|
+
const simulatedClickEvent = new MouseEvent("click", {
|
|
31
|
+
bubbles: true,
|
|
32
|
+
cancelable: true,
|
|
33
|
+
view: window
|
|
34
|
+
});
|
|
35
|
+
Object.assign(simulatedClickEvent, { iframeData: event });
|
|
36
|
+
Object.assign(simulatedMouseDownEvent, { iframeData: event });
|
|
37
|
+
window.dispatchEvent(simulatedClickEvent);
|
|
38
|
+
window.dispatchEvent(simulatedMouseDownEvent);
|
|
39
|
+
};
|
|
40
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
+
0 && (module.exports = {
|
|
42
|
+
mergeIframeClick
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=mergeIframeClick.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/mergeIframeClick.ts"],"sourcesContent":["// Listener for messages from the iframe\nexport const mergeIframeClick = (event: MessageEvent) => {\n // Simulate or merge the iframe message with a click event\n const simulatedMouseDownEvent = new MouseEvent('mousedown', {\n bubbles: true,\n cancelable: true,\n view: window,\n });\n const simulatedClickEvent = new MouseEvent('click', {\n bubbles: true,\n cancelable: true,\n view: window,\n });\n\n // Optionally attach additional properties from the iframe message\n Object.assign(simulatedClickEvent, { iframeData: event });\n Object.assign(simulatedMouseDownEvent, { iframeData: event });\n\n // Dispatch the simulated click event on the window or a specific element\n window.dispatchEvent(simulatedClickEvent);\n window.dispatchEvent(simulatedMouseDownEvent);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACO,MAAM,mBAAmB,CAAC,UAAwB;AAEvD,QAAM,0BAA0B,IAAI,WAAW,aAAa;AAAA,IAC1D,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,MAAM;AAAA,EACR,CAAC;AACD,QAAM,sBAAsB,IAAI,WAAW,SAAS;AAAA,IAClD,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,MAAM;AAAA,EACR,CAAC;AAGD,SAAO,OAAO,qBAAqB,EAAE,YAAY,MAAM,CAAC;AACxD,SAAO,OAAO,yBAAyB,EAAE,YAAY,MAAM,CAAC;AAG5D,SAAO,cAAc,mBAAmB;AACxC,SAAO,cAAc,uBAAuB;AAC9C;","names":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var messagesKeys_exports = {};
|
|
20
|
+
__export(messagesKeys_exports, {
|
|
21
|
+
MessageKey: () => MessageKey
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(messagesKeys_exports);
|
|
24
|
+
var MessageKey = /* @__PURE__ */ ((MessageKey2) => {
|
|
25
|
+
MessageKey2["INTLAYER_CONFIGURATION"] = "INTLAYER_CONFIGURATION";
|
|
26
|
+
MessageKey2["INTLAYER_CURRENT_LOCALE"] = "INTLAYER_CURRENT_LOCALE";
|
|
27
|
+
MessageKey2["INTLAYER_EDITOR_ENABLED"] = "INTLAYER_EDITOR_ENABLED";
|
|
28
|
+
MessageKey2["INTLAYER_URL_CHANGE"] = "INTLAYER_URL_CHANGE";
|
|
29
|
+
MessageKey2["INTLAYER_FOCUSED_CONTENT_CHANGED"] = "INTLAYER_FOCUSED_CONTENT_CHANGED";
|
|
30
|
+
MessageKey2["INTLAYER_LOCALE_DICTIONARIES_CHANGED"] = "INTLAYER_LOCALE_DICTIONARIES_CHANGED";
|
|
31
|
+
MessageKey2["INTLAYER_DISTANT_DICTIONARIES_CHANGED"] = "INTLAYER_DISTANT_DICTIONARIES_CHANGED";
|
|
32
|
+
MessageKey2["INTLAYER_EDITED_CONTENT_CHANGED"] = "INTLAYER_EDITED_CONTENT_CHANGED";
|
|
33
|
+
MessageKey2["INTLAYER_IFRAME_CLICKED"] = "INTLAYER_IFRAME_CLICKED";
|
|
34
|
+
return MessageKey2;
|
|
35
|
+
})(MessageKey || {});
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
MessageKey
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=messagesKeys.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/messagesKeys.ts"],"sourcesContent":["export enum MessageKey {\n INTLAYER_CONFIGURATION = 'INTLAYER_CONFIGURATION',\n INTLAYER_CURRENT_LOCALE = 'INTLAYER_CURRENT_LOCALE',\n INTLAYER_EDITOR_ENABLED = 'INTLAYER_EDITOR_ENABLED',\n INTLAYER_URL_CHANGE = 'INTLAYER_URL_CHANGE',\n INTLAYER_FOCUSED_CONTENT_CHANGED = 'INTLAYER_FOCUSED_CONTENT_CHANGED',\n INTLAYER_LOCALE_DICTIONARIES_CHANGED = 'INTLAYER_LOCALE_DICTIONARIES_CHANGED',\n INTLAYER_DISTANT_DICTIONARIES_CHANGED = 'INTLAYER_DISTANT_DICTIONARIES_CHANGED',\n INTLAYER_EDITED_CONTENT_CHANGED = 'INTLAYER_EDITED_CONTENT_CHANGED',\n INTLAYER_IFRAME_CLICKED = 'INTLAYER_IFRAME_CLICKED',\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,4BAAyB;AACzB,EAAAA,YAAA,6BAA0B;AAC1B,EAAAA,YAAA,6BAA0B;AAC1B,EAAAA,YAAA,yBAAsB;AACtB,EAAAA,YAAA,sCAAmC;AACnC,EAAAA,YAAA,0CAAuC;AACvC,EAAAA,YAAA,2CAAwC;AACxC,EAAAA,YAAA,qCAAkC;AAClC,EAAAA,YAAA,6BAA0B;AAThB,SAAAA;AAAA,GAAA;","names":["MessageKey"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const compareUrls = (url1, url2) => {
|
|
2
|
+
try {
|
|
3
|
+
const parsedUrl1 = new URL(url1);
|
|
4
|
+
const parsedUrl2 = new URL(url2);
|
|
5
|
+
if (parsedUrl1.protocol !== parsedUrl2.protocol || parsedUrl1.hostname !== parsedUrl2.hostname || parsedUrl1.port !== parsedUrl2.port) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
const path1 = parsedUrl1.pathname.replace(/\/$/, "");
|
|
9
|
+
const path2 = parsedUrl2.pathname.replace(/\/$/, "");
|
|
10
|
+
if (path1 !== "" && path2 !== "" && path1 !== path2) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
} catch (error) {
|
|
15
|
+
console.error("Invalid URL(s)", error);
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
compareUrls
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=compareUrls.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/compareUrls.ts"],"sourcesContent":["/**\n * Compare two URLs for equality.\n * This function is used to determine if a message originates from the same origin.\n *\n * ```js\n * // Example usage\n * console.log(compareUrls(\"http://localhost:5173/\", \"http://localhost:5173\")); // true\n * console.log(compareUrls(\"http://localhost:5173\", \"http://localhost:5173?myParam=true\")); // true\n * console.log(compareUrls(\"http://localhost:5173/subpath\", \"http://localhost:5173\")); // true\n * console.log(compareUrls(\"http://localhost:5172\", \"http://localhost:5173\")); // false\n * ```\n *\n * @param url1 - The first URL to compare.\n * @param url2 - The second URL to compare.\n * @returns Whether the two URLs are equal.\n */\nexport const compareUrls = (url1: string, url2: string): boolean => {\n try {\n const parsedUrl1 = new URL(url1);\n const parsedUrl2 = new URL(url2);\n\n // Compare protocol, hostname, and port\n if (\n parsedUrl1.protocol !== parsedUrl2.protocol ||\n parsedUrl1.hostname !== parsedUrl2.hostname ||\n parsedUrl1.port !== parsedUrl2.port\n ) {\n return false;\n }\n\n // One URL should not have a subpath while the other does\n const path1 = parsedUrl1.pathname.replace(/\\/$/, ''); // Remove trailing slash\n const path2 = parsedUrl2.pathname.replace(/\\/$/, '');\n\n if (path1 !== '' && path2 !== '' && path1 !== path2) {\n return false;\n }\n\n return true;\n } catch (error) {\n console.error('Invalid URL(s)', error);\n return false;\n }\n};\n"],"mappings":"AAgBO,MAAM,cAAc,CAAC,MAAc,SAA0B;AAClE,MAAI;AACF,UAAM,aAAa,IAAI,IAAI,IAAI;AAC/B,UAAM,aAAa,IAAI,IAAI,IAAI;AAG/B,QACE,WAAW,aAAa,WAAW,YACnC,WAAW,aAAa,WAAW,YACnC,WAAW,SAAS,WAAW,MAC/B;AACA,aAAO;AAAA,IACT;AAGA,UAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,EAAE;AACnD,UAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,EAAE;AAEnD,QAAI,UAAU,MAAM,UAAU,MAAM,UAAU,OAAO;AACnD,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,kBAAkB,KAAK;AACrC,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/dist/esm/index.mjs
CHANGED
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export * from './compareUrls';\nexport * from './mergeIframeClick';\nexport * from './messagesKeys';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const mergeIframeClick = (event) => {
|
|
2
|
+
const simulatedMouseDownEvent = new MouseEvent("mousedown", {
|
|
3
|
+
bubbles: true,
|
|
4
|
+
cancelable: true,
|
|
5
|
+
view: window
|
|
6
|
+
});
|
|
7
|
+
const simulatedClickEvent = new MouseEvent("click", {
|
|
8
|
+
bubbles: true,
|
|
9
|
+
cancelable: true,
|
|
10
|
+
view: window
|
|
11
|
+
});
|
|
12
|
+
Object.assign(simulatedClickEvent, { iframeData: event });
|
|
13
|
+
Object.assign(simulatedMouseDownEvent, { iframeData: event });
|
|
14
|
+
window.dispatchEvent(simulatedClickEvent);
|
|
15
|
+
window.dispatchEvent(simulatedMouseDownEvent);
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
mergeIframeClick
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=mergeIframeClick.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/mergeIframeClick.ts"],"sourcesContent":["// Listener for messages from the iframe\nexport const mergeIframeClick = (event: MessageEvent) => {\n // Simulate or merge the iframe message with a click event\n const simulatedMouseDownEvent = new MouseEvent('mousedown', {\n bubbles: true,\n cancelable: true,\n view: window,\n });\n const simulatedClickEvent = new MouseEvent('click', {\n bubbles: true,\n cancelable: true,\n view: window,\n });\n\n // Optionally attach additional properties from the iframe message\n Object.assign(simulatedClickEvent, { iframeData: event });\n Object.assign(simulatedMouseDownEvent, { iframeData: event });\n\n // Dispatch the simulated click event on the window or a specific element\n window.dispatchEvent(simulatedClickEvent);\n window.dispatchEvent(simulatedMouseDownEvent);\n};\n"],"mappings":"AACO,MAAM,mBAAmB,CAAC,UAAwB;AAEvD,QAAM,0BAA0B,IAAI,WAAW,aAAa;AAAA,IAC1D,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,MAAM;AAAA,EACR,CAAC;AACD,QAAM,sBAAsB,IAAI,WAAW,SAAS;AAAA,IAClD,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,MAAM;AAAA,EACR,CAAC;AAGD,SAAO,OAAO,qBAAqB,EAAE,YAAY,MAAM,CAAC;AACxD,SAAO,OAAO,yBAAyB,EAAE,YAAY,MAAM,CAAC;AAG5D,SAAO,cAAc,mBAAmB;AACxC,SAAO,cAAc,uBAAuB;AAC9C;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var MessageKey = /* @__PURE__ */ ((MessageKey2) => {
|
|
2
|
+
MessageKey2["INTLAYER_CONFIGURATION"] = "INTLAYER_CONFIGURATION";
|
|
3
|
+
MessageKey2["INTLAYER_CURRENT_LOCALE"] = "INTLAYER_CURRENT_LOCALE";
|
|
4
|
+
MessageKey2["INTLAYER_EDITOR_ENABLED"] = "INTLAYER_EDITOR_ENABLED";
|
|
5
|
+
MessageKey2["INTLAYER_URL_CHANGE"] = "INTLAYER_URL_CHANGE";
|
|
6
|
+
MessageKey2["INTLAYER_FOCUSED_CONTENT_CHANGED"] = "INTLAYER_FOCUSED_CONTENT_CHANGED";
|
|
7
|
+
MessageKey2["INTLAYER_LOCALE_DICTIONARIES_CHANGED"] = "INTLAYER_LOCALE_DICTIONARIES_CHANGED";
|
|
8
|
+
MessageKey2["INTLAYER_DISTANT_DICTIONARIES_CHANGED"] = "INTLAYER_DISTANT_DICTIONARIES_CHANGED";
|
|
9
|
+
MessageKey2["INTLAYER_EDITED_CONTENT_CHANGED"] = "INTLAYER_EDITED_CONTENT_CHANGED";
|
|
10
|
+
MessageKey2["INTLAYER_IFRAME_CLICKED"] = "INTLAYER_IFRAME_CLICKED";
|
|
11
|
+
return MessageKey2;
|
|
12
|
+
})(MessageKey || {});
|
|
13
|
+
export {
|
|
14
|
+
MessageKey
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=messagesKeys.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/messagesKeys.ts"],"sourcesContent":["export enum MessageKey {\n INTLAYER_CONFIGURATION = 'INTLAYER_CONFIGURATION',\n INTLAYER_CURRENT_LOCALE = 'INTLAYER_CURRENT_LOCALE',\n INTLAYER_EDITOR_ENABLED = 'INTLAYER_EDITOR_ENABLED',\n INTLAYER_URL_CHANGE = 'INTLAYER_URL_CHANGE',\n INTLAYER_FOCUSED_CONTENT_CHANGED = 'INTLAYER_FOCUSED_CONTENT_CHANGED',\n INTLAYER_LOCALE_DICTIONARIES_CHANGED = 'INTLAYER_LOCALE_DICTIONARIES_CHANGED',\n INTLAYER_DISTANT_DICTIONARIES_CHANGED = 'INTLAYER_DISTANT_DICTIONARIES_CHANGED',\n INTLAYER_EDITED_CONTENT_CHANGED = 'INTLAYER_EDITED_CONTENT_CHANGED',\n INTLAYER_IFRAME_CLICKED = 'INTLAYER_IFRAME_CLICKED',\n}\n"],"mappings":"AAAO,IAAK,aAAL,kBAAKA,gBAAL;AACL,EAAAA,YAAA,4BAAyB;AACzB,EAAAA,YAAA,6BAA0B;AAC1B,EAAAA,YAAA,6BAA0B;AAC1B,EAAAA,YAAA,yBAAsB;AACtB,EAAAA,YAAA,sCAAmC;AACnC,EAAAA,YAAA,0CAAuC;AACvC,EAAAA,YAAA,2CAAwC;AACxC,EAAAA,YAAA,qCAAkC;AAClC,EAAAA,YAAA,6BAA0B;AAThB,SAAAA;AAAA,GAAA;","names":["MessageKey"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare two URLs for equality.
|
|
3
|
+
* This function is used to determine if a message originates from the same origin.
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* // Example usage
|
|
7
|
+
* console.log(compareUrls("http://localhost:5173/", "http://localhost:5173")); // true
|
|
8
|
+
* console.log(compareUrls("http://localhost:5173", "http://localhost:5173?myParam=true")); // true
|
|
9
|
+
* console.log(compareUrls("http://localhost:5173/subpath", "http://localhost:5173")); // true
|
|
10
|
+
* console.log(compareUrls("http://localhost:5172", "http://localhost:5173")); // false
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param url1 - The first URL to compare.
|
|
14
|
+
* @param url2 - The second URL to compare.
|
|
15
|
+
* @returns Whether the two URLs are equal.
|
|
16
|
+
*/
|
|
17
|
+
export declare const compareUrls: (url1: string, url2: string) => boolean;
|
|
18
|
+
//# sourceMappingURL=compareUrls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compareUrls.d.ts","sourceRoot":"","sources":["../../src/compareUrls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,MAAM,MAAM,KAAG,OA2BxD,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mergeIframeClick.d.ts","sourceRoot":"","sources":["../../src/mergeIframeClick.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,gBAAgB,GAAI,OAAO,YAAY,SAoBnD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum MessageKey {
|
|
2
|
+
INTLAYER_CONFIGURATION = "INTLAYER_CONFIGURATION",
|
|
3
|
+
INTLAYER_CURRENT_LOCALE = "INTLAYER_CURRENT_LOCALE",
|
|
4
|
+
INTLAYER_EDITOR_ENABLED = "INTLAYER_EDITOR_ENABLED",
|
|
5
|
+
INTLAYER_URL_CHANGE = "INTLAYER_URL_CHANGE",
|
|
6
|
+
INTLAYER_FOCUSED_CONTENT_CHANGED = "INTLAYER_FOCUSED_CONTENT_CHANGED",
|
|
7
|
+
INTLAYER_LOCALE_DICTIONARIES_CHANGED = "INTLAYER_LOCALE_DICTIONARIES_CHANGED",
|
|
8
|
+
INTLAYER_DISTANT_DICTIONARIES_CHANGED = "INTLAYER_DISTANT_DICTIONARIES_CHANGED",
|
|
9
|
+
INTLAYER_EDITED_CONTENT_CHANGED = "INTLAYER_EDITED_CONTENT_CHANGED",
|
|
10
|
+
INTLAYER_IFRAME_CLICKED = "INTLAYER_IFRAME_CLICKED"
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=messagesKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messagesKeys.d.ts","sourceRoot":"","sources":["../../src/messagesKeys.ts"],"names":[],"mappings":"AAAA,oBAAY,UAAU;IACpB,sBAAsB,2BAA2B;IACjD,uBAAuB,4BAA4B;IACnD,uBAAuB,4BAA4B;IACnD,mBAAmB,wBAAwB;IAC3C,gCAAgC,qCAAqC;IACrE,oCAAoC,yCAAyC;IAC7E,qCAAqC,0CAA0C;IAC/E,+BAA+B,oCAAoC;IACnE,uBAAuB,4BAA4B;CACpD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/editor",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0-canary.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Provides the utilities to interface the application with the Intlayer editor and manipulate dictionaries",
|
|
6
6
|
"keywords": [
|
|
@@ -66,10 +66,10 @@
|
|
|
66
66
|
"tsc-alias": "^1.8.11",
|
|
67
67
|
"tsup": "^8.4.0",
|
|
68
68
|
"typescript": "^5.8.2",
|
|
69
|
-
"@utils/ts-config": "1.0.4",
|
|
70
|
-
"@utils/eslint-config": "1.0.4",
|
|
71
69
|
"@utils/ts-config-types": "1.0.4",
|
|
72
|
-
"@utils/tsup-config": "1.0.4"
|
|
70
|
+
"@utils/tsup-config": "1.0.4",
|
|
71
|
+
"@utils/ts-config": "1.0.4",
|
|
72
|
+
"@utils/eslint-config": "1.0.4"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">=14.18"
|