@intlayer/editor 8.6.2 → 8.6.4

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.
@@ -8,9 +8,8 @@ _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
8
8
 
9
9
  //#region src/core/initEditorClient.ts
10
10
  const buildClientMessengerConfig = () => {
11
- const { editor } = _intlayer_config_built.default ?? {};
12
11
  return {
13
- allowedOrigins: [editor?.editorURL, editor?.cmsURL].filter(Boolean),
12
+ allowedOrigins: [_intlayer_config_built.editor?.editorURL, _intlayer_config_built.editor?.cmsURL].filter(Boolean),
14
13
  postMessageFn: (payload, origin) => {
15
14
  if (typeof window === "undefined") return;
16
15
  if (!(window.self !== window.top)) return;
@@ -1 +1 @@
1
- {"version":3,"file":"initEditorClient.cjs","names":["configuration","getGlobalEditorManager","EditorStateManager"],"sources":["../../../src/core/initEditorClient.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { defineIntlayerElements } from '../components';\nimport type { MessengerConfig } from './CrossFrameMessenger';\nimport { EditorStateManager } from './EditorStateManager';\nimport {\n getGlobalEditorManager,\n setGlobalEditorManager,\n} from './globalManager';\n\nexport const buildClientMessengerConfig = (): MessengerConfig => {\n const { editor } = configuration ?? {};\n\n return {\n allowedOrigins: [editor?.editorURL, editor?.cmsURL].filter(\n Boolean\n ) as string[],\n postMessageFn: (payload: unknown, origin: string) => {\n if (typeof window === 'undefined') return;\n\n const isInIframe = window.self !== window.top;\n\n if (!isInIframe) return;\n window.parent?.postMessage(payload, origin);\n },\n };\n};\n\n/** Reference count — tracks how many providers have called initEditorClient. */\nlet _clientRefCount = 0;\n\n/**\n * Initialize the Intlayer editor client singleton.\n * Safe to call multiple times — returns the existing manager if already initialized.\n * Increments a reference counter so nested providers don't destroy the manager\n * prematurely when the inner provider unmounts.\n */\nexport const initEditorClient = (): EditorStateManager => {\n _clientRefCount++;\n\n const existing = getGlobalEditorManager();\n if (existing) return existing;\n\n const manager = new EditorStateManager({\n mode: 'client',\n messenger: buildClientMessengerConfig(),\n configuration,\n });\n\n setGlobalEditorManager(manager);\n defineIntlayerElements();\n manager.start();\n\n return manager;\n};\n\n/**\n * Decrement the reference count and stop the global editor client singleton\n * only when the last provider unmounts.\n */\nexport const stopEditorClient = (): void => {\n _clientRefCount = Math.max(0, _clientRefCount - 1);\n\n if (_clientRefCount > 0) return;\n\n const manager = getGlobalEditorManager();\n manager?.stop();\n setGlobalEditorManager(null);\n};\n"],"mappings":";;;;;;;;;AASA,MAAa,mCAAoD;CAC/D,MAAM,EAAE,WAAWA,kCAAiB,EAAE;AAEtC,QAAO;EACL,gBAAgB,CAAC,QAAQ,WAAW,QAAQ,OAAO,CAAC,OAClD,QACD;EACD,gBAAgB,SAAkB,WAAmB;AACnD,OAAI,OAAO,WAAW,YAAa;AAInC,OAAI,EAFe,OAAO,SAAS,OAAO,KAEzB;AACjB,UAAO,QAAQ,YAAY,SAAS,OAAO;;EAE9C;;;AAIH,IAAI,kBAAkB;;;;;;;AAQtB,MAAa,yBAA6C;AACxD;CAEA,MAAM,WAAWC,mDAAwB;AACzC,KAAI,SAAU,QAAO;CAErB,MAAM,UAAU,IAAIC,mDAAmB;EACrC,MAAM;EACN,WAAW,4BAA4B;EACvC;EACD,CAAC;AAEF,mDAAuB,QAAQ;AAC/B,4DAAwB;AACxB,SAAQ,OAAO;AAEf,QAAO;;;;;;AAOT,MAAa,yBAA+B;AAC1C,mBAAkB,KAAK,IAAI,GAAG,kBAAkB,EAAE;AAElD,KAAI,kBAAkB,EAAG;AAGzB,CADgBD,mDAAwB,EAC/B,MAAM;AACf,mDAAuB,KAAK"}
1
+ {"version":3,"file":"initEditorClient.cjs","names":["editor","getGlobalEditorManager","EditorStateManager"],"sources":["../../../src/core/initEditorClient.ts"],"sourcesContent":["import { default as configuration, editor } from '@intlayer/config/built';\n\nimport { defineIntlayerElements } from '../components';\nimport type { MessengerConfig } from './CrossFrameMessenger';\nimport { EditorStateManager } from './EditorStateManager';\nimport {\n getGlobalEditorManager,\n setGlobalEditorManager,\n} from './globalManager';\n\nexport const buildClientMessengerConfig = (): MessengerConfig => {\n return {\n allowedOrigins: [editor?.editorURL, editor?.cmsURL].filter(\n Boolean\n ) as string[],\n postMessageFn: (payload: unknown, origin: string) => {\n if (typeof window === 'undefined') return;\n\n const isInIframe = window.self !== window.top;\n\n if (!isInIframe) return;\n window.parent?.postMessage(payload, origin);\n },\n };\n};\n\n/** Reference count — tracks how many providers have called initEditorClient. */\nlet _clientRefCount = 0;\n\n/**\n * Initialize the Intlayer editor client singleton.\n * Safe to call multiple times — returns the existing manager if already initialized.\n * Increments a reference counter so nested providers don't destroy the manager\n * prematurely when the inner provider unmounts.\n */\nexport const initEditorClient = (): EditorStateManager => {\n _clientRefCount++;\n\n const existing = getGlobalEditorManager();\n if (existing) return existing;\n\n const manager = new EditorStateManager({\n mode: 'client',\n messenger: buildClientMessengerConfig(),\n configuration,\n });\n\n setGlobalEditorManager(manager);\n defineIntlayerElements();\n manager.start();\n\n return manager;\n};\n\n/**\n * Decrement the reference count and stop the global editor client singleton\n * only when the last provider unmounts.\n */\nexport const stopEditorClient = (): void => {\n _clientRefCount = Math.max(0, _clientRefCount - 1);\n\n if (_clientRefCount > 0) return;\n\n const manager = getGlobalEditorManager();\n manager?.stop();\n setGlobalEditorManager(null);\n};\n"],"mappings":";;;;;;;;;AAUA,MAAa,mCAAoD;AAC/D,QAAO;EACL,gBAAgB,CAACA,+BAAQ,WAAWA,+BAAQ,OAAO,CAAC,OAClD,QACD;EACD,gBAAgB,SAAkB,WAAmB;AACnD,OAAI,OAAO,WAAW,YAAa;AAInC,OAAI,EAFe,OAAO,SAAS,OAAO,KAEzB;AACjB,UAAO,QAAQ,YAAY,SAAS,OAAO;;EAE9C;;;AAIH,IAAI,kBAAkB;;;;;;;AAQtB,MAAa,yBAA6C;AACxD;CAEA,MAAM,WAAWC,mDAAwB;AACzC,KAAI,SAAU,QAAO;CAErB,MAAM,UAAU,IAAIC,mDAAmB;EACrC,MAAM;EACN,WAAW,4BAA4B;EACvC;EACD,CAAC;AAEF,mDAAuB,QAAQ;AAC/B,4DAAwB;AACxB,SAAQ,OAAO;AAEf,QAAO;;;;;;AAOT,MAAa,yBAA+B;AAC1C,mBAAkB,KAAK,IAAI,GAAG,kBAAkB,EAAE;AAElD,KAAI,kBAAkB,EAAG;AAGzB,CADgBD,mDAAwB,EAC/B,MAAM;AACf,mDAAuB,KAAK"}
@@ -1,11 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  let _intlayer_config_built = require("@intlayer/config/built");
4
- _intlayer_config_built = require_runtime.__toESM(_intlayer_config_built);
5
- let _intlayer_config_envVars = require("@intlayer/config/envVars");
6
4
 
7
5
  //#region src/isEnabled.ts
8
- const isEnabled = !_intlayer_config_envVars.TREE_SHAKE_EDITOR && _intlayer_config_built.default.editor?.enabled && typeof window !== "undefined" && window.self !== window.top;
6
+ const TREE_SHAKE_EDITOR = process.env["INTLAYER_EDITOR_ENABLED"] === "false";
7
+ const isEnabled = !TREE_SHAKE_EDITOR && _intlayer_config_built.editor?.enabled && typeof window !== "undefined" && window.self !== window.top;
9
8
 
10
9
  //#endregion
11
10
  exports.isEnabled = isEnabled;
@@ -1 +1 @@
1
- {"version":3,"file":"isEnabled.cjs","names":["TREE_SHAKE_EDITOR","configuration"],"sources":["../../src/isEnabled.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { TREE_SHAKE_EDITOR } from '@intlayer/config/envVars';\n\nexport const isEnabled =\n !TREE_SHAKE_EDITOR && // Allow purging a build time using bundler + env var\n configuration.editor?.enabled && // Editor enabled in config\n typeof window !== 'undefined' && // Client side\n window.self !== window.top; // Is in iframe\n"],"mappings":";;;;;;;AAGA,MAAa,YACX,CAACA,8CACDC,+BAAc,QAAQ,WACtB,OAAO,WAAW,eAClB,OAAO,SAAS,OAAO"}
1
+ {"version":3,"file":"isEnabled.cjs","names":["editor"],"sources":["../../src/isEnabled.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\n\nconst TREE_SHAKE_EDITOR = process.env['INTLAYER_EDITOR_ENABLED'] === 'false';\n\nexport const isEnabled =\n !TREE_SHAKE_EDITOR && // Allow purging a build time using bundler + env var\n editor?.enabled && // Editor enabled in config\n typeof window !== 'undefined' && // Client side\n window.self !== window.top; // Is in iframe\n"],"mappings":";;;;;AAEA,MAAM,oBAAoB,QAAQ,IAAI,+BAA+B;AAErE,MAAa,YACX,CAAC,qBACDA,+BAAQ,WACR,OAAO,WAAW,eAClB,OAAO,SAAS,OAAO"}
@@ -1,11 +1,10 @@
1
1
  import { getGlobalEditorManager, setGlobalEditorManager } from "./globalManager.mjs";
2
2
  import { EditorStateManager } from "./EditorStateManager.mjs";
3
3
  import { defineIntlayerElements } from "../components/ContentSelector.mjs";
4
- import configuration from "@intlayer/config/built";
4
+ import configuration, { editor } from "@intlayer/config/built";
5
5
 
6
6
  //#region src/core/initEditorClient.ts
7
7
  const buildClientMessengerConfig = () => {
8
- const { editor } = configuration ?? {};
9
8
  return {
10
9
  allowedOrigins: [editor?.editorURL, editor?.cmsURL].filter(Boolean),
11
10
  postMessageFn: (payload, origin) => {
@@ -1 +1 @@
1
- {"version":3,"file":"initEditorClient.mjs","names":[],"sources":["../../../src/core/initEditorClient.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { defineIntlayerElements } from '../components';\nimport type { MessengerConfig } from './CrossFrameMessenger';\nimport { EditorStateManager } from './EditorStateManager';\nimport {\n getGlobalEditorManager,\n setGlobalEditorManager,\n} from './globalManager';\n\nexport const buildClientMessengerConfig = (): MessengerConfig => {\n const { editor } = configuration ?? {};\n\n return {\n allowedOrigins: [editor?.editorURL, editor?.cmsURL].filter(\n Boolean\n ) as string[],\n postMessageFn: (payload: unknown, origin: string) => {\n if (typeof window === 'undefined') return;\n\n const isInIframe = window.self !== window.top;\n\n if (!isInIframe) return;\n window.parent?.postMessage(payload, origin);\n },\n };\n};\n\n/** Reference count — tracks how many providers have called initEditorClient. */\nlet _clientRefCount = 0;\n\n/**\n * Initialize the Intlayer editor client singleton.\n * Safe to call multiple times — returns the existing manager if already initialized.\n * Increments a reference counter so nested providers don't destroy the manager\n * prematurely when the inner provider unmounts.\n */\nexport const initEditorClient = (): EditorStateManager => {\n _clientRefCount++;\n\n const existing = getGlobalEditorManager();\n if (existing) return existing;\n\n const manager = new EditorStateManager({\n mode: 'client',\n messenger: buildClientMessengerConfig(),\n configuration,\n });\n\n setGlobalEditorManager(manager);\n defineIntlayerElements();\n manager.start();\n\n return manager;\n};\n\n/**\n * Decrement the reference count and stop the global editor client singleton\n * only when the last provider unmounts.\n */\nexport const stopEditorClient = (): void => {\n _clientRefCount = Math.max(0, _clientRefCount - 1);\n\n if (_clientRefCount > 0) return;\n\n const manager = getGlobalEditorManager();\n manager?.stop();\n setGlobalEditorManager(null);\n};\n"],"mappings":";;;;;;AASA,MAAa,mCAAoD;CAC/D,MAAM,EAAE,WAAW,iBAAiB,EAAE;AAEtC,QAAO;EACL,gBAAgB,CAAC,QAAQ,WAAW,QAAQ,OAAO,CAAC,OAClD,QACD;EACD,gBAAgB,SAAkB,WAAmB;AACnD,OAAI,OAAO,WAAW,YAAa;AAInC,OAAI,EAFe,OAAO,SAAS,OAAO,KAEzB;AACjB,UAAO,QAAQ,YAAY,SAAS,OAAO;;EAE9C;;;AAIH,IAAI,kBAAkB;;;;;;;AAQtB,MAAa,yBAA6C;AACxD;CAEA,MAAM,WAAW,wBAAwB;AACzC,KAAI,SAAU,QAAO;CAErB,MAAM,UAAU,IAAI,mBAAmB;EACrC,MAAM;EACN,WAAW,4BAA4B;EACvC;EACD,CAAC;AAEF,wBAAuB,QAAQ;AAC/B,yBAAwB;AACxB,SAAQ,OAAO;AAEf,QAAO;;;;;;AAOT,MAAa,yBAA+B;AAC1C,mBAAkB,KAAK,IAAI,GAAG,kBAAkB,EAAE;AAElD,KAAI,kBAAkB,EAAG;AAGzB,CADgB,wBAAwB,EAC/B,MAAM;AACf,wBAAuB,KAAK"}
1
+ {"version":3,"file":"initEditorClient.mjs","names":[],"sources":["../../../src/core/initEditorClient.ts"],"sourcesContent":["import { default as configuration, editor } from '@intlayer/config/built';\n\nimport { defineIntlayerElements } from '../components';\nimport type { MessengerConfig } from './CrossFrameMessenger';\nimport { EditorStateManager } from './EditorStateManager';\nimport {\n getGlobalEditorManager,\n setGlobalEditorManager,\n} from './globalManager';\n\nexport const buildClientMessengerConfig = (): MessengerConfig => {\n return {\n allowedOrigins: [editor?.editorURL, editor?.cmsURL].filter(\n Boolean\n ) as string[],\n postMessageFn: (payload: unknown, origin: string) => {\n if (typeof window === 'undefined') return;\n\n const isInIframe = window.self !== window.top;\n\n if (!isInIframe) return;\n window.parent?.postMessage(payload, origin);\n },\n };\n};\n\n/** Reference count — tracks how many providers have called initEditorClient. */\nlet _clientRefCount = 0;\n\n/**\n * Initialize the Intlayer editor client singleton.\n * Safe to call multiple times — returns the existing manager if already initialized.\n * Increments a reference counter so nested providers don't destroy the manager\n * prematurely when the inner provider unmounts.\n */\nexport const initEditorClient = (): EditorStateManager => {\n _clientRefCount++;\n\n const existing = getGlobalEditorManager();\n if (existing) return existing;\n\n const manager = new EditorStateManager({\n mode: 'client',\n messenger: buildClientMessengerConfig(),\n configuration,\n });\n\n setGlobalEditorManager(manager);\n defineIntlayerElements();\n manager.start();\n\n return manager;\n};\n\n/**\n * Decrement the reference count and stop the global editor client singleton\n * only when the last provider unmounts.\n */\nexport const stopEditorClient = (): void => {\n _clientRefCount = Math.max(0, _clientRefCount - 1);\n\n if (_clientRefCount > 0) return;\n\n const manager = getGlobalEditorManager();\n manager?.stop();\n setGlobalEditorManager(null);\n};\n"],"mappings":";;;;;;AAUA,MAAa,mCAAoD;AAC/D,QAAO;EACL,gBAAgB,CAAC,QAAQ,WAAW,QAAQ,OAAO,CAAC,OAClD,QACD;EACD,gBAAgB,SAAkB,WAAmB;AACnD,OAAI,OAAO,WAAW,YAAa;AAInC,OAAI,EAFe,OAAO,SAAS,OAAO,KAEzB;AACjB,UAAO,QAAQ,YAAY,SAAS,OAAO;;EAE9C;;;AAIH,IAAI,kBAAkB;;;;;;;AAQtB,MAAa,yBAA6C;AACxD;CAEA,MAAM,WAAW,wBAAwB;AACzC,KAAI,SAAU,QAAO;CAErB,MAAM,UAAU,IAAI,mBAAmB;EACrC,MAAM;EACN,WAAW,4BAA4B;EACvC;EACD,CAAC;AAEF,wBAAuB,QAAQ;AAC/B,yBAAwB;AACxB,SAAQ,OAAO;AAEf,QAAO;;;;;;AAOT,MAAa,yBAA+B;AAC1C,mBAAkB,KAAK,IAAI,GAAG,kBAAkB,EAAE;AAElD,KAAI,kBAAkB,EAAG;AAGzB,CADgB,wBAAwB,EAC/B,MAAM;AACf,wBAAuB,KAAK"}
@@ -1,8 +1,8 @@
1
- import configuration from "@intlayer/config/built";
2
- import { TREE_SHAKE_EDITOR } from "@intlayer/config/envVars";
1
+ import { editor } from "@intlayer/config/built";
3
2
 
4
3
  //#region src/isEnabled.ts
5
- const isEnabled = !TREE_SHAKE_EDITOR && configuration.editor?.enabled && typeof window !== "undefined" && window.self !== window.top;
4
+ const TREE_SHAKE_EDITOR = process.env["INTLAYER_EDITOR_ENABLED"] === "false";
5
+ const isEnabled = !TREE_SHAKE_EDITOR && editor?.enabled && typeof window !== "undefined" && window.self !== window.top;
6
6
 
7
7
  //#endregion
8
8
  export { isEnabled };
@@ -1 +1 @@
1
- {"version":3,"file":"isEnabled.mjs","names":[],"sources":["../../src/isEnabled.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { TREE_SHAKE_EDITOR } from '@intlayer/config/envVars';\n\nexport const isEnabled =\n !TREE_SHAKE_EDITOR && // Allow purging a build time using bundler + env var\n configuration.editor?.enabled && // Editor enabled in config\n typeof window !== 'undefined' && // Client side\n window.self !== window.top; // Is in iframe\n"],"mappings":";;;;AAGA,MAAa,YACX,CAAC,qBACD,cAAc,QAAQ,WACtB,OAAO,WAAW,eAClB,OAAO,SAAS,OAAO"}
1
+ {"version":3,"file":"isEnabled.mjs","names":[],"sources":["../../src/isEnabled.ts"],"sourcesContent":["import { editor } from '@intlayer/config/built';\n\nconst TREE_SHAKE_EDITOR = process.env['INTLAYER_EDITOR_ENABLED'] === 'false';\n\nexport const isEnabled =\n !TREE_SHAKE_EDITOR && // Allow purging a build time using bundler + env var\n editor?.enabled && // Editor enabled in config\n typeof window !== 'undefined' && // Client side\n window.self !== window.top; // Is in iframe\n"],"mappings":";;;AAEA,MAAM,oBAAoB,QAAQ,IAAI,+BAA+B;AAErE,MAAa,YACX,CAAC,qBACD,QAAQ,WACR,OAAO,WAAW,eAClB,OAAO,SAAS,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"initEditorClient.d.ts","names":[],"sources":["../../../src/core/initEditorClient.ts"],"mappings":";;;;cASa,0BAAA,QAAiC,eAAA;;AAA9C;;;;;cA2Ba,gBAAA,QAAuB,kBAAA;;;;;cAuBvB,gBAAA"}
1
+ {"version":3,"file":"initEditorClient.d.ts","names":[],"sources":["../../../src/core/initEditorClient.ts"],"mappings":";;;;cAUa,0BAAA,QAAiC,eAAA;;AAA9C;;;;;cAyBa,gBAAA,QAAuB,kBAAA;;;;;cAuBvB,gBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"isEnabled.d.ts","names":[],"sources":["../../src/isEnabled.ts"],"mappings":";cAGa,SAAA"}
1
+ {"version":3,"file":"isEnabled.d.ts","names":[],"sources":["../../src/isEnabled.ts"],"mappings":";cAIa,SAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/editor",
3
- "version": "8.6.2",
3
+ "version": "8.6.4",
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,10 +75,10 @@
75
75
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
76
76
  },
77
77
  "dependencies": {
78
- "@intlayer/config": "8.6.2",
79
- "@intlayer/core": "8.6.2",
80
- "@intlayer/types": "8.6.2",
81
- "@intlayer/unmerged-dictionaries-entry": "8.6.2",
78
+ "@intlayer/config": "8.6.4",
79
+ "@intlayer/core": "8.6.4",
80
+ "@intlayer/types": "8.6.4",
81
+ "@intlayer/unmerged-dictionaries-entry": "8.6.4",
82
82
  "lit": "^3.3.2"
83
83
  },
84
84
  "devDependencies": {