@intlayer/editor 8.1.1 → 8.1.3-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.
@@ -1,40 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- //#region src/compareUrls.ts
4
- /**
5
- * Compare two URLs for equality.
6
- * This function is used to determine if a message originates from the same origin.
7
- *
8
- * ```js
9
- * // Example usage
10
- * console.log(compareUrls("http://localhost:5173/", "http://localhost:5173")); // true
11
- * console.log(compareUrls("http://localhost:5173", "http://localhost:5173?myParam=true")); // true
12
- * console.log(compareUrls("http://localhost:5173/subpath", "http://localhost:5173")); // true
13
- * console.log(compareUrls("http://localhost:5172", "http://localhost:5173")); // false
14
- * ```
15
- *
16
- * @param url1 - The first URL to compare.
17
- * @param url2 - The second URL to compare.
18
- * @returns Whether the two URLs are equal.
19
- */
20
- const compareUrls = (url1, url2) => {
21
- try {
22
- const parsedUrl1 = new URL(url1);
23
- const parsedUrl2 = new URL(url2);
24
- if (parsedUrl1.protocol !== parsedUrl2.protocol || parsedUrl1.hostname !== parsedUrl2.hostname || parsedUrl1.port !== parsedUrl2.port) return false;
25
- const path1 = parsedUrl1.pathname.replace(/\/$/, "");
26
- const path2 = parsedUrl2.pathname.replace(/\/$/, "");
27
- if (path1 !== "" && path2 !== "" && path1 !== path2) return false;
28
- return true;
29
- } catch (error) {
30
- console.error("Invalid URL(s)", error, {
31
- url1,
32
- url2
33
- });
34
- return false;
35
- }
36
- };
37
-
38
- //#endregion
39
- exports.compareUrls = compareUrls;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=(e,t)=>{try{let n=new URL(e),r=new URL(t);if(n.protocol!==r.protocol||n.hostname!==r.hostname||n.port!==r.port)return!1;let i=n.pathname.replace(/\/$/,``),a=r.pathname.replace(/\/$/,``);return!(i!==``&&a!==``&&i!==a)}catch(n){return console.error(`Invalid URL(s)`,n,{url1:e,url2:t}),!1}};exports.compareUrls=e;
40
2
  //# sourceMappingURL=compareUrls.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"compareUrls.cjs","names":[],"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, { url1, url2 });\n return false;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAgBA,MAAa,eAAe,MAAc,SAA0B;AAClE,KAAI;EACF,MAAM,aAAa,IAAI,IAAI,KAAK;EAChC,MAAM,aAAa,IAAI,IAAI,KAAK;AAGhC,MACE,WAAW,aAAa,WAAW,YACnC,WAAW,aAAa,WAAW,YACnC,WAAW,SAAS,WAAW,KAE/B,QAAO;EAIT,MAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,GAAG;EACpD,MAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,GAAG;AAEpD,MAAI,UAAU,MAAM,UAAU,MAAM,UAAU,MAC5C,QAAO;AAGT,SAAO;UACA,OAAO;AACd,UAAQ,MAAM,kBAAkB,OAAO;GAAE;GAAM;GAAM,CAAC;AACtD,SAAO"}
1
+ {"version":3,"file":"compareUrls.cjs","names":[],"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, { url1, url2 });\n return false;\n }\n};\n"],"mappings":"mEAgBA,MAAa,GAAe,EAAc,IAA0B,CAClE,GAAI,CACF,IAAM,EAAa,IAAI,IAAI,EAAK,CAC1B,EAAa,IAAI,IAAI,EAAK,CAGhC,GACE,EAAW,WAAa,EAAW,UACnC,EAAW,WAAa,EAAW,UACnC,EAAW,OAAS,EAAW,KAE/B,MAAO,GAIT,IAAM,EAAQ,EAAW,SAAS,QAAQ,MAAO,GAAG,CAC9C,EAAQ,EAAW,SAAS,QAAQ,MAAO,GAAG,CAMpD,MAJA,EAAI,IAAU,IAAM,IAAU,IAAM,IAAU,SAKvC,EAAO,CAEd,OADA,QAAQ,MAAM,iBAAkB,EAAO,CAAE,OAAM,OAAM,CAAC,CAC/C"}
@@ -1,8 +1 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_compareUrls = require('./compareUrls.cjs');
3
- const require_mergeIframeClick = require('./mergeIframeClick.cjs');
4
- const require_messagesKeys = require('./messagesKeys.cjs');
5
-
6
- exports.MessageKey = require_messagesKeys.MessageKey;
7
- exports.compareUrls = require_compareUrls.compareUrls;
8
- exports.mergeIframeClick = require_mergeIframeClick.mergeIframeClick;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./compareUrls.cjs`),t=require(`./mergeIframeClick.cjs`),n=require(`./messagesKeys.cjs`);exports.MessageKey=n.MessageKey,exports.compareUrls=e.compareUrls,exports.mergeIframeClick=t.mergeIframeClick;
@@ -1,23 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- //#region src/mergeIframeClick.ts
4
- const mergeIframeClick = (event) => {
5
- const simulatedMouseDownEvent = new MouseEvent("mousedown", {
6
- bubbles: true,
7
- cancelable: true,
8
- view: window
9
- });
10
- const simulatedClickEvent = new MouseEvent("click", {
11
- bubbles: true,
12
- cancelable: true,
13
- view: window
14
- });
15
- Object.assign(simulatedClickEvent, { iframeData: event });
16
- Object.assign(simulatedMouseDownEvent, { iframeData: event });
17
- window.dispatchEvent(simulatedClickEvent);
18
- window.dispatchEvent(simulatedMouseDownEvent);
19
- };
20
-
21
- //#endregion
22
- exports.mergeIframeClick = mergeIframeClick;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=e=>{let t=new MouseEvent(`mousedown`,{bubbles:!0,cancelable:!0,view:window}),n=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window});Object.assign(n,{iframeData:e}),Object.assign(t,{iframeData:e}),window.dispatchEvent(n),window.dispatchEvent(t)};exports.mergeIframeClick=e;
23
2
  //# sourceMappingURL=mergeIframeClick.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mergeIframeClick.cjs","names":[],"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":";;;AACA,MAAa,oBAAoB,UAAwB;CAEvD,MAAM,0BAA0B,IAAI,WAAW,aAAa;EAC1D,SAAS;EACT,YAAY;EACZ,MAAM;EACP,CAAC;CACF,MAAM,sBAAsB,IAAI,WAAW,SAAS;EAClD,SAAS;EACT,YAAY;EACZ,MAAM;EACP,CAAC;AAGF,QAAO,OAAO,qBAAqB,EAAE,YAAY,OAAO,CAAC;AACzD,QAAO,OAAO,yBAAyB,EAAE,YAAY,OAAO,CAAC;AAG7D,QAAO,cAAc,oBAAoB;AACzC,QAAO,cAAc,wBAAwB"}
1
+ {"version":3,"file":"mergeIframeClick.cjs","names":[],"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":"mEACA,MAAa,EAAoB,GAAwB,CAEvD,IAAM,EAA0B,IAAI,WAAW,YAAa,CAC1D,QAAS,GACT,WAAY,GACZ,KAAM,OACP,CAAC,CACI,EAAsB,IAAI,WAAW,QAAS,CAClD,QAAS,GACT,WAAY,GACZ,KAAM,OACP,CAAC,CAGF,OAAO,OAAO,EAAqB,CAAE,WAAY,EAAO,CAAC,CACzD,OAAO,OAAO,EAAyB,CAAE,WAAY,EAAO,CAAC,CAG7D,OAAO,cAAc,EAAoB,CACzC,OAAO,cAAc,EAAwB"}
@@ -1,20 +1,2 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
-
3
- //#region src/messagesKeys.ts
4
- let MessageKey = /* @__PURE__ */ function(MessageKey) {
5
- MessageKey["INTLAYER_CONFIGURATION"] = "INTLAYER_CONFIGURATION";
6
- MessageKey["INTLAYER_CURRENT_LOCALE"] = "INTLAYER_CURRENT_LOCALE";
7
- MessageKey["INTLAYER_EDITOR_ENABLED"] = "INTLAYER_EDITOR_ENABLED";
8
- MessageKey["INTLAYER_URL_CHANGE"] = "INTLAYER_URL_CHANGE";
9
- MessageKey["INTLAYER_HOVERED_CONTENT_CHANGED"] = "INTLAYER_HOVERED_CONTENT_CHANGED";
10
- MessageKey["INTLAYER_FOCUSED_CONTENT_CHANGED"] = "INTLAYER_FOCUSED_CONTENT_CHANGED";
11
- MessageKey["INTLAYER_LOCALE_DICTIONARIES_CHANGED"] = "INTLAYER_LOCALE_DICTIONARIES_CHANGED";
12
- MessageKey["INTLAYER_DISTANT_DICTIONARIES_CHANGED"] = "INTLAYER_DISTANT_DICTIONARIES_CHANGED";
13
- MessageKey["INTLAYER_EDITED_CONTENT_CHANGED"] = "INTLAYER_EDITED_CONTENT_CHANGED";
14
- MessageKey["INTLAYER_IFRAME_CLICKED"] = "INTLAYER_IFRAME_CLICKED";
15
- return MessageKey;
16
- }({});
17
-
18
- //#endregion
19
- exports.MessageKey = MessageKey;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=function(e){return e.INTLAYER_CONFIGURATION=`INTLAYER_CONFIGURATION`,e.INTLAYER_CURRENT_LOCALE=`INTLAYER_CURRENT_LOCALE`,e.INTLAYER_EDITOR_ENABLED=`INTLAYER_EDITOR_ENABLED`,e.INTLAYER_URL_CHANGE=`INTLAYER_URL_CHANGE`,e.INTLAYER_HOVERED_CONTENT_CHANGED=`INTLAYER_HOVERED_CONTENT_CHANGED`,e.INTLAYER_FOCUSED_CONTENT_CHANGED=`INTLAYER_FOCUSED_CONTENT_CHANGED`,e.INTLAYER_LOCALE_DICTIONARIES_CHANGED=`INTLAYER_LOCALE_DICTIONARIES_CHANGED`,e.INTLAYER_DISTANT_DICTIONARIES_CHANGED=`INTLAYER_DISTANT_DICTIONARIES_CHANGED`,e.INTLAYER_EDITED_CONTENT_CHANGED=`INTLAYER_EDITED_CONTENT_CHANGED`,e.INTLAYER_IFRAME_CLICKED=`INTLAYER_IFRAME_CLICKED`,e}({});exports.MessageKey=e;
20
2
  //# sourceMappingURL=messagesKeys.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"messagesKeys.cjs","names":[],"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_HOVERED_CONTENT_CHANGED = 'INTLAYER_HOVERED_CONTENT_CHANGED',\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,IAAY,kDAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"messagesKeys.cjs","names":[],"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_HOVERED_CONTENT_CHANGED = 'INTLAYER_HOVERED_CONTENT_CHANGED',\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":"mEAAA,IAAY,EAAA,SAAA,EAAL,OACL,GAAA,uBAAA,yBACA,EAAA,wBAAA,0BACA,EAAA,wBAAA,0BACA,EAAA,oBAAA,sBACA,EAAA,iCAAA,mCACA,EAAA,iCAAA,mCACA,EAAA,qCAAA,uCACA,EAAA,sCAAA,wCACA,EAAA,gCAAA,kCACA,EAAA,wBAAA"}
@@ -1,38 +1,2 @@
1
- //#region src/compareUrls.ts
2
- /**
3
- * Compare two URLs for equality.
4
- * This function is used to determine if a message originates from the same origin.
5
- *
6
- * ```js
7
- * // Example usage
8
- * console.log(compareUrls("http://localhost:5173/", "http://localhost:5173")); // true
9
- * console.log(compareUrls("http://localhost:5173", "http://localhost:5173?myParam=true")); // true
10
- * console.log(compareUrls("http://localhost:5173/subpath", "http://localhost:5173")); // true
11
- * console.log(compareUrls("http://localhost:5172", "http://localhost:5173")); // false
12
- * ```
13
- *
14
- * @param url1 - The first URL to compare.
15
- * @param url2 - The second URL to compare.
16
- * @returns Whether the two URLs are equal.
17
- */
18
- const compareUrls = (url1, url2) => {
19
- try {
20
- const parsedUrl1 = new URL(url1);
21
- const parsedUrl2 = new URL(url2);
22
- if (parsedUrl1.protocol !== parsedUrl2.protocol || parsedUrl1.hostname !== parsedUrl2.hostname || parsedUrl1.port !== parsedUrl2.port) return false;
23
- const path1 = parsedUrl1.pathname.replace(/\/$/, "");
24
- const path2 = parsedUrl2.pathname.replace(/\/$/, "");
25
- if (path1 !== "" && path2 !== "" && path1 !== path2) return false;
26
- return true;
27
- } catch (error) {
28
- console.error("Invalid URL(s)", error, {
29
- url1,
30
- url2
31
- });
32
- return false;
33
- }
34
- };
35
-
36
- //#endregion
37
- export { compareUrls };
1
+ const e=(e,t)=>{try{let n=new URL(e),r=new URL(t);if(n.protocol!==r.protocol||n.hostname!==r.hostname||n.port!==r.port)return!1;let i=n.pathname.replace(/\/$/,``),a=r.pathname.replace(/\/$/,``);return!(i!==``&&a!==``&&i!==a)}catch(n){return console.error(`Invalid URL(s)`,n,{url1:e,url2:t}),!1}};export{e as compareUrls};
38
2
  //# sourceMappingURL=compareUrls.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"compareUrls.mjs","names":[],"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, { url1, url2 });\n return false;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAa,eAAe,MAAc,SAA0B;AAClE,KAAI;EACF,MAAM,aAAa,IAAI,IAAI,KAAK;EAChC,MAAM,aAAa,IAAI,IAAI,KAAK;AAGhC,MACE,WAAW,aAAa,WAAW,YACnC,WAAW,aAAa,WAAW,YACnC,WAAW,SAAS,WAAW,KAE/B,QAAO;EAIT,MAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,GAAG;EACpD,MAAM,QAAQ,WAAW,SAAS,QAAQ,OAAO,GAAG;AAEpD,MAAI,UAAU,MAAM,UAAU,MAAM,UAAU,MAC5C,QAAO;AAGT,SAAO;UACA,OAAO;AACd,UAAQ,MAAM,kBAAkB,OAAO;GAAE;GAAM;GAAM,CAAC;AACtD,SAAO"}
1
+ {"version":3,"file":"compareUrls.mjs","names":[],"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, { url1, url2 });\n return false;\n }\n};\n"],"mappings":"AAgBA,MAAa,GAAe,EAAc,IAA0B,CAClE,GAAI,CACF,IAAM,EAAa,IAAI,IAAI,EAAK,CAC1B,EAAa,IAAI,IAAI,EAAK,CAGhC,GACE,EAAW,WAAa,EAAW,UACnC,EAAW,WAAa,EAAW,UACnC,EAAW,OAAS,EAAW,KAE/B,MAAO,GAIT,IAAM,EAAQ,EAAW,SAAS,QAAQ,MAAO,GAAG,CAC9C,EAAQ,EAAW,SAAS,QAAQ,MAAO,GAAG,CAMpD,MAJA,EAAI,IAAU,IAAM,IAAU,IAAM,IAAU,SAKvC,EAAO,CAEd,OADA,QAAQ,MAAM,iBAAkB,EAAO,CAAE,OAAM,OAAM,CAAC,CAC/C"}
@@ -1,5 +1 @@
1
- import { compareUrls } from "./compareUrls.mjs";
2
- import { mergeIframeClick } from "./mergeIframeClick.mjs";
3
- import { MessageKey } from "./messagesKeys.mjs";
4
-
5
- export { MessageKey, compareUrls, mergeIframeClick };
1
+ import{compareUrls as e}from"./compareUrls.mjs";import{mergeIframeClick as t}from"./mergeIframeClick.mjs";import{MessageKey as n}from"./messagesKeys.mjs";export{n as MessageKey,e as compareUrls,t as mergeIframeClick};
@@ -1,21 +1,2 @@
1
- //#region src/mergeIframeClick.ts
2
- const mergeIframeClick = (event) => {
3
- const simulatedMouseDownEvent = new MouseEvent("mousedown", {
4
- bubbles: true,
5
- cancelable: true,
6
- view: window
7
- });
8
- const simulatedClickEvent = new MouseEvent("click", {
9
- bubbles: true,
10
- cancelable: true,
11
- view: window
12
- });
13
- Object.assign(simulatedClickEvent, { iframeData: event });
14
- Object.assign(simulatedMouseDownEvent, { iframeData: event });
15
- window.dispatchEvent(simulatedClickEvent);
16
- window.dispatchEvent(simulatedMouseDownEvent);
17
- };
18
-
19
- //#endregion
20
- export { mergeIframeClick };
1
+ const e=e=>{let t=new MouseEvent(`mousedown`,{bubbles:!0,cancelable:!0,view:window}),n=new MouseEvent(`click`,{bubbles:!0,cancelable:!0,view:window});Object.assign(n,{iframeData:e}),Object.assign(t,{iframeData:e}),window.dispatchEvent(n),window.dispatchEvent(t)};export{e as mergeIframeClick};
21
2
  //# sourceMappingURL=mergeIframeClick.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"mergeIframeClick.mjs","names":[],"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":";AACA,MAAa,oBAAoB,UAAwB;CAEvD,MAAM,0BAA0B,IAAI,WAAW,aAAa;EAC1D,SAAS;EACT,YAAY;EACZ,MAAM;EACP,CAAC;CACF,MAAM,sBAAsB,IAAI,WAAW,SAAS;EAClD,SAAS;EACT,YAAY;EACZ,MAAM;EACP,CAAC;AAGF,QAAO,OAAO,qBAAqB,EAAE,YAAY,OAAO,CAAC;AACzD,QAAO,OAAO,yBAAyB,EAAE,YAAY,OAAO,CAAC;AAG7D,QAAO,cAAc,oBAAoB;AACzC,QAAO,cAAc,wBAAwB"}
1
+ {"version":3,"file":"mergeIframeClick.mjs","names":[],"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":"AACA,MAAa,EAAoB,GAAwB,CAEvD,IAAM,EAA0B,IAAI,WAAW,YAAa,CAC1D,QAAS,GACT,WAAY,GACZ,KAAM,OACP,CAAC,CACI,EAAsB,IAAI,WAAW,QAAS,CAClD,QAAS,GACT,WAAY,GACZ,KAAM,OACP,CAAC,CAGF,OAAO,OAAO,EAAqB,CAAE,WAAY,EAAO,CAAC,CACzD,OAAO,OAAO,EAAyB,CAAE,WAAY,EAAO,CAAC,CAG7D,OAAO,cAAc,EAAoB,CACzC,OAAO,cAAc,EAAwB"}
@@ -1,18 +1,2 @@
1
- //#region src/messagesKeys.ts
2
- let MessageKey = /* @__PURE__ */ function(MessageKey) {
3
- MessageKey["INTLAYER_CONFIGURATION"] = "INTLAYER_CONFIGURATION";
4
- MessageKey["INTLAYER_CURRENT_LOCALE"] = "INTLAYER_CURRENT_LOCALE";
5
- MessageKey["INTLAYER_EDITOR_ENABLED"] = "INTLAYER_EDITOR_ENABLED";
6
- MessageKey["INTLAYER_URL_CHANGE"] = "INTLAYER_URL_CHANGE";
7
- MessageKey["INTLAYER_HOVERED_CONTENT_CHANGED"] = "INTLAYER_HOVERED_CONTENT_CHANGED";
8
- MessageKey["INTLAYER_FOCUSED_CONTENT_CHANGED"] = "INTLAYER_FOCUSED_CONTENT_CHANGED";
9
- MessageKey["INTLAYER_LOCALE_DICTIONARIES_CHANGED"] = "INTLAYER_LOCALE_DICTIONARIES_CHANGED";
10
- MessageKey["INTLAYER_DISTANT_DICTIONARIES_CHANGED"] = "INTLAYER_DISTANT_DICTIONARIES_CHANGED";
11
- MessageKey["INTLAYER_EDITED_CONTENT_CHANGED"] = "INTLAYER_EDITED_CONTENT_CHANGED";
12
- MessageKey["INTLAYER_IFRAME_CLICKED"] = "INTLAYER_IFRAME_CLICKED";
13
- return MessageKey;
14
- }({});
15
-
16
- //#endregion
17
- export { MessageKey };
1
+ let e=function(e){return e.INTLAYER_CONFIGURATION=`INTLAYER_CONFIGURATION`,e.INTLAYER_CURRENT_LOCALE=`INTLAYER_CURRENT_LOCALE`,e.INTLAYER_EDITOR_ENABLED=`INTLAYER_EDITOR_ENABLED`,e.INTLAYER_URL_CHANGE=`INTLAYER_URL_CHANGE`,e.INTLAYER_HOVERED_CONTENT_CHANGED=`INTLAYER_HOVERED_CONTENT_CHANGED`,e.INTLAYER_FOCUSED_CONTENT_CHANGED=`INTLAYER_FOCUSED_CONTENT_CHANGED`,e.INTLAYER_LOCALE_DICTIONARIES_CHANGED=`INTLAYER_LOCALE_DICTIONARIES_CHANGED`,e.INTLAYER_DISTANT_DICTIONARIES_CHANGED=`INTLAYER_DISTANT_DICTIONARIES_CHANGED`,e.INTLAYER_EDITED_CONTENT_CHANGED=`INTLAYER_EDITED_CONTENT_CHANGED`,e.INTLAYER_IFRAME_CLICKED=`INTLAYER_IFRAME_CLICKED`,e}({});export{e as MessageKey};
18
2
  //# sourceMappingURL=messagesKeys.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"messagesKeys.mjs","names":[],"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_HOVERED_CONTENT_CHANGED = 'INTLAYER_HOVERED_CONTENT_CHANGED',\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,IAAY,kDAAL;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"messagesKeys.mjs","names":[],"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_HOVERED_CONTENT_CHANGED = 'INTLAYER_HOVERED_CONTENT_CHANGED',\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,IAAY,EAAA,SAAA,EAAL,OACL,GAAA,uBAAA,yBACA,EAAA,wBAAA,0BACA,EAAA,wBAAA,0BACA,EAAA,oBAAA,sBACA,EAAA,iCAAA,mCACA,EAAA,iCAAA,mCACA,EAAA,qCAAA,uCACA,EAAA,sCAAA,wCACA,EAAA,gCAAA,kCACA,EAAA,wBAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/editor",
3
- "version": "8.1.1",
3
+ "version": "8.1.3-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": [
@@ -75,7 +75,7 @@
75
75
  "@utils/ts-config": "1.0.4",
76
76
  "@utils/ts-config-types": "1.0.4",
77
77
  "@utils/tsdown-config": "1.0.4",
78
- "rimraf": "6.1.2",
78
+ "rimraf": "6.1.3",
79
79
  "tsdown": "0.20.3",
80
80
  "typescript": "5.9.3",
81
81
  "vitest": "4.0.18"