@finsemble/finsemble-ui 7.3.2 → 7.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finsemble/finsemble-ui",
3
- "version": "7.3.2",
3
+ "version": "7.3.4",
4
4
  "description": "Ready-made React components to give you a head-start building your SmartDesktop.",
5
5
  "types": "index.d.ts",
6
6
  "files": [
@@ -29,7 +29,7 @@
29
29
  "build-storybook": "build-storybook"
30
30
  },
31
31
  "dependencies": {
32
- "@finsemble/finsemble-api": "7.3.2",
32
+ "@finsemble/finsemble-api": "7.3.4",
33
33
  "@q42/floating-focus-a11y": "^1.3.3",
34
34
  "@reduxjs/toolkit": "^1.5.0",
35
35
  "@svgr/webpack": "^5.5.0",
@@ -67,6 +67,7 @@ function EditTab(props) {
67
67
  }
68
68
  };
69
69
  const clickHandler = () => {
70
+ var _a;
70
71
  const allowWindowTitleRenaming = Store.getValue("allowWindowTitleRenaming");
71
72
  if (clickTimeout) {
72
73
  // double click
@@ -81,8 +82,12 @@ function EditTab(props) {
81
82
  setClickTimeout(undefined);
82
83
  }, 500);
83
84
  setClickTimeout(timeout);
84
- if (props.setActiveTab)
85
+ // Only call props.setActiveTab IFF this current tab is NOT the current tab
86
+ // This prevents white flashes/renders while clicking on an actibe tab
87
+ if (((_a = props.windowIdentifier) === null || _a === void 0 ? void 0 : _a.windowName) !== FSBL.Clients.WindowClient.getCurrentWindow().name &&
88
+ !!props.setActiveTab) {
85
89
  props.setActiveTab();
90
+ }
86
91
  }
87
92
  };
88
93
  const blurHandler = (e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"windowTitle.js","sourceRoot":"","sources":["../../../../src/components/windowTitleBar/components/windowTitle.tsx"],"names":[],"mappings":";;;;;;AAGA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,MA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,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,EAAE,EACjD,IAAI,CAAC,4BAA4B,EACjC,CAAC,GAAkB,EAAE,QAA6B,EAAE,EAAE;QACrD,IAAI,CAAC,CAAC,GAAG,EAAE;YACV,qGAAqG;YACrG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CACvB,yCAAyC,sBAAsB,gBAAgB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,GAAG,EACxH,GAAG,CACH,CAAC;YACF,OAAO;SACP;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CACxB,8BAA8B,sBAAsB,gBAAgB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,GAAG,CAC7G,CAAC;IACH,CAAC,CACD,CAAC;AACH,CAAC","sourcesContent":["import { WindowIdentifier, WindowDescriptor, services } from \"@finsemble/finsemble-api\";\nimport { ListenerFunction } from \"@finsemble/finsemble-api/types/clients/StoreModel\";\nimport { StandardError } from \"@finsemble/finsemble-api/types/types\";\nimport React, { Component } from \"react\";\nimport { EditTabProps } from \"../../../types/windowTitleBar\";\nimport { Icon } from \"../../icon/Icon\";\nimport { Store } from \"../stores/windowTitleBarStore\";\n\ntype IconDescriptor = services.window.types.IconDescriptor;\n\n/**\n * TAB TITLES: HOW DO THEY WORK?\n *\n * Each component, when stacked, will have several tab titles. For each component, there is a window. For each window, there are 2 tab titles per component.\n *\n * Whichever component is \"active\" will render all tabs - exactly one \"active\" tab and n-1 \"inactive\" tabs (where n is the number of components in the stack). When\n * the active component is changed (via a click, for example), then the visible window becomes the window associated with the active component.\n *\n * Tab titles may change at any time, and for a number of reasons. For example, the component may execute \"document.title='...some title'\". Or perhaps the tab title has\n * been edited by the user. In order to account for all title changes, the following flow is used:\n * *something* updates document.title\n * The WindowClient for the component will notice the title change and send a router message (via FinsembleWindow.setTitle) with a topic representitive of the windowName\n * BaseWindow listens to router changes on the same topic and updates a DistributedStore dedicated to tab names\n * The tab components all subscribe to the DistributedStore dedicated to tab names and will update the title accordingly\n *\n * This is a \"one-way\" operation; that is to say that some code will ultimately alter the DistributedStore and the tab title components will read the changes. While this generally\n * happens with a write to document.title, it can also happen when a user edits the tab title manually. In this case, the component state is altered with a field \"persistedTitle\"\n * whose value is the edited title. At render time, the tab title component will use any value in \"persistedTitle\" as the title, irregardless of any other value.\n *\n * NOTE: A tab may be edited only when it is the active component; ergo the call to \"setComponentState\" is safe.\n */\n\n/**\n * WINDOW TITLES: HOW DO THEY WORK?\n *\n * Each application window has a title which is displayed in the operating system taskbar and task switcher. This title comes from the\n * value of \"document.title\" in the window title bar component. It is important to understand that when tabs are stacked, the actual window\n * which holds the window title is the title of the window of the active component. It is therefore important to keep the window title and the\n * tab titles up to date and synchronized.\n */\n\ntype TitleProps = {\n\twindowIdentifier: WindowIdentifier;\n\tonUpdate?: Function;\n\ttitleWidth?: number;\n\tonClick?: () => void;\n};\n\ntype TitleState = {\n\ttitle: string | undefined;\n\ticon: any;\n\twindowName?: string;\n};\n\n// The store name for the distributed store which tracks tab titles\nconst WINDOW_TAB_TITLE_STORE = \"window-tab-title\";\n// The field name to watch for tab title edits\nconst FIELD_NAME_PERSISTED_TITLE = \"persistedTitle\";\n\n// The windowTabNameStore reference\nlet windowTabNameStore: any;\n\n/**\n * Gets the store which tracks the tab title for a windowName. This is a distributed store shared by all components.\n *\n * @returns a Promise which resolves the StoreModel associated with window and tab names\n */\nconst getWindowTabNameStore = async () => {\n\tif (!windowTabNameStore) {\n\t\tlet { data: store } = await FSBL.Clients.DistributedStoreClient.createGlobalStore({\n\t\t\tstore: WINDOW_TAB_TITLE_STORE,\n\t\t});\n\t\twindowTabNameStore = store;\n\t}\n\n\t// Return the store\n\treturn windowTabNameStore;\n};\n\n/**\n * The wrapper component for tab renaming\n * @param {*} props\n */\nfunction EditTab(props: EditTabProps) {\n\tconst [editingTitle, setEditingTitle] = React.useState(false);\n\tconst [clickTimeout, setClickTimeout] = React.useState<NodeJS.Timeout | undefined>(undefined);\n\tconst inputEl = React.useRef<HTMLInputElement>(null);\n\n\tconst updateTabTitle = async (e: React.KeyboardEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement>) => {\n\t\t// When the tab title has changed via a user edit, simply update the DistributedStore\n\n\t\t// Get the title\n\t\tconst title = (e.target as HTMLInputElement).value;\n\n\t\t// Get the tab name store\n\t\tlet store = await getWindowTabNameStore();\n\t\t// If the store is unavailable, then the tab name cannot be persisted\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error persisting tab title via EditTab: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Persist the tab title\n\t\tstore.setValue({ field: props.windowIdentifier.windowName, value: title });\n\n\t\t// Get the window which coresponds to the tab being edited\n\t\tconst { wrap: win } = await FSBL.FinsembleWindow.getInstance(props.windowIdentifier);\n\n\t\t// Set the component state \"persistedTitle\" (which is the edited title)\n\t\tFSBL.Clients.Logger.debug(`Setting component state \"${FIELD_NAME_PERSISTED_TITLE}\" with value \"${title}\"`);\n\t\tawait win.setComponentState({ field: FIELD_NAME_PERSISTED_TITLE, value: title });\n\n\t\t// Stop editing in all cases\n\t\tsetEditingTitle(false);\n\t};\n\n\tconst beginEditing = async () => {\n\t\tawait setEditingTitle(true);\n\t\tinputEl?.current?.focus();\n\t\tif (inputEl?.current) {\n\t\t\tinputEl.current.value = props.title ?? \"\";\n\t\t}\n\t};\n\n\tconst clickHandler = () => {\n\t\tconst allowWindowTitleRenaming = Store.getValue(\"allowWindowTitleRenaming\");\n\n\t\tif (clickTimeout) {\n\t\t\t// double click\n\t\t\tif (allowWindowTitleRenaming) {\n\t\t\t\tbeginEditing();\n\t\t\t}\n\t\t} else if (!editingTitle) {\n\t\t\t// single click\n\t\t\tlet timeout = setTimeout(() => {\n\t\t\t\tclearTimeout(clickTimeout);\n\t\t\t\tsetClickTimeout(undefined);\n\t\t\t}, 500);\n\t\t\tsetClickTimeout(timeout);\n\t\t\tif (props.setActiveTab) props.setActiveTab();\n\t\t}\n\t};\n\n\tconst blurHandler = (e: React.FocusEvent<HTMLInputElement>) => {\n\t\tupdateTabTitle(e);\n\t};\n\n\tconst keyDownHandler = (e: React.KeyboardEvent<HTMLInputElement>) => {\n\t\te.key === \"Enter\" && updateTabTitle(e);\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"fsbl-tab-editor\"\n\t\t\t// We can't use Click and Dblclick events together cause for one dblclick fires two click events which close title editor.\n\t\t\t// Workaround with setTimeout should resolve this behavior.\n\t\t\tonClick={clickHandler}\n\t\t>\n\t\t\t{editingTitle ? (\n\t\t\t\t<div className=\"fsbl-tab fsbl-active-tab\" style={{ width: props.tabWidth || \"auto\" }}>\n\t\t\t\t\t{/* workaround to disable tab dragging in the edit mode */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tdraggable={true}\n\t\t\t\t\t\tonDragStart={(e) => {\n\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tid=\"title_editor_input\"\n\t\t\t\t\t\t\tref={inputEl}\n\t\t\t\t\t\t\tonBlur={blurHandler}\n\t\t\t\t\t\t\tonKeyDown={keyDownHandler}\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tclassName=\"tab__input\"\n\t\t\t\t\t\t\tmaxLength={32}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\tprops.children\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\n/*\n * Description how stacked window tabs work.\n *\n * The simplest case - when you have only 2 tabs. In that case you will actually have 2 windows and 4 tabs.\n * Lets call them as: window 1 - w1, window 2 - w2, tab 1 from window 1 - w1_t1, tab 2 from window 1 - w1_t2, for tabs from window 2 - w2_t1 and w2_t2.\n * When you switch tabs you activate w1 or w2 with active tab w1_t1 or w2_t2 correspondingly.\n * Tabs w1_t2 and w2_t1 are inactive. They needed only for rendering. I call them as remote tabs, cause their titles must be synchronized with active tabs titles.\n * Thus when you rename active tab (w1_t1), the corresponding remote tab (w2_t1) should be updated automatically.\n */\n\nexport class Title extends Component<TitleProps, TitleState> {\n\t// The listener for tab title change events via the DistributedStoreClient, kept as a reference so\n\t// that the listener can be deregistered when the component is unmounted\n\ttabTitleChangedStoreListener: ListenerFunction = (err: StandardError, response: { field: string; value: string }) => {\n\t\tif (!!err) {\n\t\t\t// This is not critical; in the worst case this tab title will be stale\n\t\t\tFSBL.Clients.Logger.warn(\n\t\t\t\t`Listener error for store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`,\n\t\t\t\terr\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Log a message\n\t\tFSBL.Clients.Logger.debug(\n\t\t\t`Store \"${WINDOW_TAB_TITLE_STORE}\" notified of new title \"${response.value}\" for window \"${response.field}\"`\n\t\t);\n\n\t\t// Invoke updateTitle\n\t\tif (!!this._mounted) {\n\t\t\tthis.updateTitle();\n\t\t}\n\t};\n\n\t// Flag to determine if this instance is currently mounted; this is necessary because:\n\t// 1.) Title components are mounted and unmounted as an artifact of how the tab or tab list is rendered\n\t// 2.) Keeping tab titles synchronized is an asynchronous process\n\t// 3.) During the asynchronous process of tab title synchronization, a call to setState is made and\n\t// that raises a React warning since the component state cannot be changed while the component\n\t// is unmounted\n\t_mounted = false;\n\n\tconstructor(props: TitleProps) {\n\t\tsuper(props);\n\n\t\t// Declare the initial title as a blank string\n\t\tlet initialTitle = \" \";\n\n\t\t// If the currently rendering tab represents the current window, then use the document title (or window name)\n\t\tif (\n\t\t\tundefined !== finsembleWindow?.thisWindowName &&\n\t\t\tfinsembleWindow?.thisWindowName === props?.windowIdentifier?.windowName\n\t\t) {\n\t\t\tinitialTitle = document.title || props.windowIdentifier?.windowName;\n\t\t}\n\n\t\tthis.state = {\n\t\t\t// Use document.title first to prevent a title flickering when dragging a tab of another window.\n\t\t\t// The reason for flickering is the component re-rendering multiple times. The initial place\n\t\t\t// where re-rendering start is the `disallowDragOnCenterRegion()` at the WindowTitleBarShell.\n\t\t\t// At that function, we change the state of the parent component which triggers re-rendering for the children tree.\n\t\t\ttitle: initialTitle,\n\t\t\ticon: null,\n\t\t\t// The \"windowName\" is the name of the window which corresponds to the this instance of the\n\t\t\t// Title component, though the actual current window may belong to some other\n\t\t\t// component(ie this tab represents an inactive window)\n\t\t\twindowName: props.windowIdentifier?.windowName,\n\t\t};\n\n\t\t// Bind the \"updateTitle\" function (in order to use React component functions)\n\t\tthis.updateTitle = this.updateTitle.bind(this);\n\n\t\t// Initial title set\n\t\tthis.updateTitle();\n\t}\n\n\t/**\n\t * Gets a reference to the \"Window Manager\" component for the tab which is rendering. If the this tab IS the active tab, then the WindowManager will be the same as the WindowManager\n\t * attached to the WindowClient. However, all other tab components displayed in this window will need to derive the WindowManager from the config, based on the\n\t * tab's windowIdentifier.\n\t *\n\t * This is because the tab's windowIdentifier only has the name (ex: SomeApp-37ba6708-3a75-462e-b900-1812e338cbf1). The name is derived by removing the last 5 substrings\n\t * separated by \"-\". This will fail in the face of a UUID format change.\n\t *\n\t * @returns the \"Window Manager\" component, or \"undefined\" if the \"Window Manager\" is not found\n\t */\n\tasync #getWindowManagerForTab() {\n\t\t// On second thought, ALL tabs will derive the WindowManager the same way; at least if it is wrong, it is wrong consistently\n\t\t//\n\t\t// if (finsembleWindow.thisWindowName === this.props?.windowIdentifier?.windowName) {\n\t\t// \treturn FSBL.Clients.WindowClient.options?.customData?.foreign?.components?.[\"Window Manager\"] || FSBL.Clients.WindowClient.options?.customData?.appDConfig?.manifest?.foreign?.components?.[\"Window Manager\"];\n\t\t// } else {\n\n\t\t// Check that \"windowName\" exists\n\t\tif (!!this.props?.windowIdentifier?.windowName) {\n\t\t\t// Get the window name\n\t\t\tconst tabsWindowName = this.props.windowIdentifier.windowName;\n\t\t\t// Get the active descriptors\n\t\t\tconst { data: activeDescriptors } = await FSBL.Clients.LauncherClient.getActiveDescriptors();\n\t\t\t// Return the \"Window Manager\" for the window whose name matches THIS tab's name\n\t\t\treturn activeDescriptors?.[tabsWindowName]?.customData?.appDConfig?.manifest?.foreign?.components?.[\n\t\t\t\t\"Window Manager\"\n\t\t\t];\n\t\t}\n\n\t\treturn undefined;\n\t\t// }\n\t}\n\n\t/**\n\t * Calculates a tab title. Uses the following algorithm until a non-null value is found.\n\t * <ol>\n\t * <li>user edited tab title</li>\n\t * <li>the component config</li>\n\t * <li>document.title</li>\n\t * <li>appd config</li>\n\t * </ol>\n\t *\n\t * @returns the calculated tab title\n\t */\n\tasync #calculateTabTitle() {\n\t\treturn (\n\t\t\t(await this.#getUserEditedTitle()) ||\n\t\t\t(await this.#getConfigTitle()) ||\n\t\t\t(await this.#getDocumentTitle()) ||\n\t\t\tthis.#getAppDTitle()\n\t\t);\n\t}\n\n\t/**\n\t * Returns the name of the title supplied by a user; undefined if the user has not supplied a title.\n\t *\n\t * @returns The name of the title supplied by a user; undefined if the user has not supplied a title\n\t */\n\tasync #getUserEditedTitle() {\n\t\tconst { wrap: tabWindow } = await FSBL.FinsembleWindow.getInstance(this.props.windowIdentifier);\n\t\treturn new Promise((resolve) => {\n\t\t\ttabWindow.getComponentState({ field: FIELD_NAME_PERSISTED_TITLE }, (error: any, persistedTitle: any) => {\n\t\t\t\tif (!!error) {\n\t\t\t\t\t// should always return value even if it hasn't been retrieved from the state\n\t\t\t\t\tresolve(undefined);\n\t\t\t\t} else {\n\t\t\t\t\tresolve(persistedTitle);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Gets a title set in the component configuration.\n\t *\n\t * @returns any title set in the component configuration\n\t */\n\tasync #getConfigTitle() {\n\t\tconst windowManager = await this.#getWindowManagerForTab();\n\t\treturn windowManager?.FSBLHeader?.title || windowManager?.title;\n\t}\n\n\t/**\n\t * Returns document.title.\n\t *\n\t * @returns the document.title (from the \"tab name\" store)\n\t */\n\tasync #getDocumentTitle() {\n\t\tconst store = await getWindowTabNameStore();\n\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error setting the tab title: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.props?.windowIdentifier?.windowName\n\t\t\t? (await store.getGlobalValue(this.props.windowIdentifier.windowName)).data\n\t\t\t: undefined;\n\t}\n\n\t/**\n\t * Gets the AppD configuration\n\t *\n\t * @returns The AppD name\n\t */\n\t#getAppDTitle() {\n\t\treturn (\n\t\t\tFSBL.Clients.WindowClient.options?.customData?.appDConfig?.manifest?.component?.displayName ||\n\t\t\tFSBL.Clients.WindowClient.options?.customData?.appDConfig?.name\n\t\t);\n\t}\n\n\t/**\n\t * Updates the title for both the tab and the window.\n\t *\n\t * @returns a Promise which resolves nothing\n\t */\n\tasync updateTitle() {\n\t\t// There is a subtle difference bewtween windowTitle and tabTitle. Since this code executes\n\t\t// when *any* tab has a name change, this code can execute when the active window represents\n\t\t// a tab other than the currently rendering tab (ie an inactive tab).\n\n\t\t// The window represented by this tab title instance\n\t\tconst { wrap: tabWindow } = await FSBL.FinsembleWindow.getInstance(this.props.windowIdentifier);\n\n\t\t// \"tabWindowOptions\" refers to the options from the window which hosts the component represented by this tab\n\t\tconst { data: tabWindowOptions } = await tabWindow.getOptions();\n\n\t\t// Derive the title: \"config title\" then \"document.title\" then \"appd title\"\n\t\tlet title = await this.#calculateTabTitle();\n\n\t\t// Get the titleBar icon from the WindowDescriptor for the TAB window (not the CURRENT window)\n\t\tconst icon: IconDescriptor = (tabWindowOptions as WindowDescriptor)?.icons?.titleBarIcon ?? {\n\t\t\timageType: \"initials\",\n\t\t\tname: title,\n\t\t};\n\n\t\t// Log a message\n\t\tFSBL.Clients.Logger.debug(`Setting tab title ${title} for window ${this.props.windowIdentifier.windowName}`);\n\n\t\t// Finally, set the state if the component is mounted\n\t\tif (!!this._mounted) {\n\t\t\tthis.setState({\n\t\t\t\ttitle,\n\t\t\t\ticon: {\n\t\t\t\t\t...icon,\n\t\t\t\t\t// Application causes the background to default to a circle rather than a square\n\t\t\t\t\tcategory: \"Application\",\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// If this tab component instance represents the window (that is, this is the active tab), then set the title\n\t\tif (finsembleWindow.thisWindowName === this.props.windowIdentifier.windowName) {\n\t\t\tdocument.title = await this.#calculateTabTitle();\n\t\t}\n\t}\n\n\t/**\n\t * Adds the listener(s) required to set window and tab titles.\n\t */\n\tasync #addListeners() {\n\t\t// Subscribe to the DistributedStoreClient (these messages originate from BaseWindow, when the\n\t\t// DistributedStore has been updated).\n\t\t//\n\t\t// Each window will have n listeners, where n is the number of tabs held in the window.\n\n\t\t// Get the store and add a listener\n\t\tconst store = await getWindowTabNameStore();\n\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error adding a tab title listener: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Add a listener\n\t\tstore.addListener({ field: this.props.windowIdentifier.windowName }, this.tabTitleChangedStoreListener, () => {\n\t\t\tFSBL.Clients.Logger.debug(\n\t\t\t\t`Added listener to store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Removes listener(s) required to set window and tab titles.\n\t */\n\tasync #removeListeners() {\n\t\t// Unsubscribe from the window/tab store\n\t\tconst store = await getWindowTabNameStore();\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error removing a tab title listener: the store was not found\");\n\t\t\treturn;\n\t\t}\n\t\tstore.removeListener(\n\t\t\t{ field: this.props.windowIdentifier.windowName },\n\t\t\tthis.tabTitleChangedStoreListener,\n\t\t\t(err: StandardError, response: boolean | undefined) => {\n\t\t\t\tif (!!err) {\n\t\t\t\t\t// This is not critical; the listener could not be removed from the store - this may be a memory leak\n\t\t\t\t\tFSBL.Clients.Logger.warn(\n\t\t\t\t\t\t`Could not remove listener from store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`,\n\t\t\t\t\t\terr\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tFSBL.Clients.Logger.debug(\n\t\t\t\t\t`Removed listener to store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * React component lifecycle event, triggered once the component has been added to the DOM.\n\t */\n\tcomponentDidMount() {\n\t\t// Set the mounted flag to true (this component is currently mounted)\n\t\tthis._mounted = true;\n\n\t\t// Add listeners\n\t\tthis.#addListeners();\n\t}\n\n\t// Triggers a re-rendering of the drag handle in the title bar.\n\tcomponentDidUpdate() {\n\t\tif (typeof this.props.onUpdate === \"function\") {\n\t\t\tthis.props.onUpdate();\n\t\t}\n\t}\n\n\t/**\n\t * React component lifecycle event, triggered before the component is removed from the DOM.\n\t */\n\tcomponentWillUnmount() {\n\t\t// Set the mounted flag to false (this component is not currently mounted)\n\t\tthis._mounted = false;\n\n\t\t// Remove listeners\n\t\tthis.#removeListeners();\n\t}\n\n\trender() {\n\t\tconst { titleWidth } = this.props;\n\t\tconst style = titleWidth ? { width: titleWidth } : {};\n\t\treturn (\n\t\t\t<EditTab\n\t\t\t\ttabWidth={titleWidth}\n\t\t\t\tsetActiveTab={this?.props?.onClick}\n\t\t\t\ttitle={this.state.title}\n\t\t\t\t// The windowIdentifier indicates which app/component this tab instance should represent\n\t\t\t\twindowIdentifier={this.props.windowIdentifier}\n\t\t\t>\n\t\t\t\t<div className=\"fsbl-tab-title\" style={style}>\n\t\t\t\t\t{this.state.icon && <Icon {...this.state.icon} />}\n\t\t\t\t\t<div className=\"title-text\">{this.state.title}</div>\n\t\t\t\t</div>\n\t\t\t</EditTab>\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"windowTitle.js","sourceRoot":"","sources":["../../../../src/components/windowTitleBar/components/windowTitle.tsx"],"names":[],"mappings":";;;;;;AAGA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAgDtD,mEAAmE;AACnE,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAClD,8CAA8C;AAC9C,MAAM,0BAA0B,GAAG,gBAAgB,CAAC;AAEpD,mCAAmC;AACnC,IAAI,kBAAuB,CAAC;AAE5B;;;;GAIG;AACH,MAAM,qBAAqB,GAAG,KAAK,IAAI,EAAE;IACxC,IAAI,CAAC,kBAAkB,EAAE;QACxB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,iBAAiB,CAAC;YACjF,KAAK,EAAE,sBAAsB;SAC7B,CAAC,CAAC;QACH,kBAAkB,GAAG,KAAK,CAAC;KAC3B;IAED,mBAAmB;IACnB,OAAO,kBAAkB,CAAC;AAC3B,CAAC,CAAC;AAEF;;;GAGG;AACH,SAAS,OAAO,CAAC,KAAmB;IACnC,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9D,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,KAAK,CAAC,QAAQ,CAA6B,SAAS,CAAC,CAAC;IAC9F,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAmB,IAAI,CAAC,CAAC;IAErD,MAAM,cAAc,GAAG,KAAK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,EAAE,IAAI,CAAC,4BAA4B,EAAE,GAAG,EAAE;QAC5G,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CACxB,4BAA4B,sBAAsB,gBAAgB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,GAAG,CAC3G,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,KAAK;IACJ,wCAAwC;IACxC,MAAM,KAAK,GAAG,MAAM,qBAAqB,EAAE,CAAC;IAC5C,mEAAmE;IACnE,IAAI,CAAC,KAAK,EAAE;QACX,oDAAoD;QACpD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;QACzF,OAAO;KACP;IACD,KAAK,CAAC,cAAc,CACnB,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,EAAE,EACjD,IAAI,CAAC,4BAA4B,EACjC,CAAC,GAAkB,EAAE,QAA6B,EAAE,EAAE;QACrD,IAAI,CAAC,CAAC,GAAG,EAAE;YACV,qGAAqG;YACrG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CACvB,yCAAyC,sBAAsB,gBAAgB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,GAAG,EACxH,GAAG,CACH,CAAC;YACF,OAAO;SACP;QACD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CACxB,8BAA8B,sBAAsB,gBAAgB,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,UAAU,GAAG,CAC7G,CAAC;IACH,CAAC,CACD,CAAC;AACH,CAAC","sourcesContent":["import { WindowIdentifier, WindowDescriptor, services } from \"@finsemble/finsemble-api\";\nimport { ListenerFunction } from \"@finsemble/finsemble-api/types/clients/StoreModel\";\nimport { StandardError } from \"@finsemble/finsemble-api/types/types\";\nimport React, { Component } from \"react\";\nimport { EditTabProps } from \"../../../types/windowTitleBar\";\nimport { Icon } from \"../../icon/Icon\";\nimport { Store } from \"../stores/windowTitleBarStore\";\n\ntype IconDescriptor = services.window.types.IconDescriptor;\n\n/**\n * TAB TITLES: HOW DO THEY WORK?\n *\n * Each component, when stacked, will have several tab titles. For each component, there is a window. For each window, there are 2 tab titles per component.\n *\n * Whichever component is \"active\" will render all tabs - exactly one \"active\" tab and n-1 \"inactive\" tabs (where n is the number of components in the stack). When\n * the active component is changed (via a click, for example), then the visible window becomes the window associated with the active component.\n *\n * Tab titles may change at any time, and for a number of reasons. For example, the component may execute \"document.title='...some title'\". Or perhaps the tab title has\n * been edited by the user. In order to account for all title changes, the following flow is used:\n * *something* updates document.title\n * The WindowClient for the component will notice the title change and send a router message (via FinsembleWindow.setTitle) with a topic representitive of the windowName\n * BaseWindow listens to router changes on the same topic and updates a DistributedStore dedicated to tab names\n * The tab components all subscribe to the DistributedStore dedicated to tab names and will update the title accordingly\n *\n * This is a \"one-way\" operation; that is to say that some code will ultimately alter the DistributedStore and the tab title components will read the changes. While this generally\n * happens with a write to document.title, it can also happen when a user edits the tab title manually. In this case, the component state is altered with a field \"persistedTitle\"\n * whose value is the edited title. At render time, the tab title component will use any value in \"persistedTitle\" as the title, irregardless of any other value.\n *\n * NOTE: A tab may be edited only when it is the active component; ergo the call to \"setComponentState\" is safe.\n */\n\n/**\n * WINDOW TITLES: HOW DO THEY WORK?\n *\n * Each application window has a title which is displayed in the operating system taskbar and task switcher. This title comes from the\n * value of \"document.title\" in the window title bar component. It is important to understand that when tabs are stacked, the actual window\n * which holds the window title is the title of the window of the active component. It is therefore important to keep the window title and the\n * tab titles up to date and synchronized.\n */\n\ntype TitleProps = {\n\twindowIdentifier: WindowIdentifier;\n\tonUpdate?: Function;\n\ttitleWidth?: number;\n\tonClick?: () => void;\n};\n\ntype TitleState = {\n\ttitle: string | undefined;\n\ticon: any;\n\twindowName?: string;\n};\n\n// The store name for the distributed store which tracks tab titles\nconst WINDOW_TAB_TITLE_STORE = \"window-tab-title\";\n// The field name to watch for tab title edits\nconst FIELD_NAME_PERSISTED_TITLE = \"persistedTitle\";\n\n// The windowTabNameStore reference\nlet windowTabNameStore: any;\n\n/**\n * Gets the store which tracks the tab title for a windowName. This is a distributed store shared by all components.\n *\n * @returns a Promise which resolves the StoreModel associated with window and tab names\n */\nconst getWindowTabNameStore = async () => {\n\tif (!windowTabNameStore) {\n\t\tlet { data: store } = await FSBL.Clients.DistributedStoreClient.createGlobalStore({\n\t\t\tstore: WINDOW_TAB_TITLE_STORE,\n\t\t});\n\t\twindowTabNameStore = store;\n\t}\n\n\t// Return the store\n\treturn windowTabNameStore;\n};\n\n/**\n * The wrapper component for tab renaming\n * @param {*} props\n */\nfunction EditTab(props: EditTabProps) {\n\tconst [editingTitle, setEditingTitle] = React.useState(false);\n\tconst [clickTimeout, setClickTimeout] = React.useState<NodeJS.Timeout | undefined>(undefined);\n\tconst inputEl = React.useRef<HTMLInputElement>(null);\n\n\tconst updateTabTitle = async (e: React.KeyboardEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement>) => {\n\t\t// When the tab title has changed via a user edit, simply update the DistributedStore\n\n\t\t// Get the title\n\t\tconst title = (e.target as HTMLInputElement).value;\n\n\t\t// Get the tab name store\n\t\tlet store = await getWindowTabNameStore();\n\t\t// If the store is unavailable, then the tab name cannot be persisted\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error persisting tab title via EditTab: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Persist the tab title\n\t\tstore.setValue({ field: props.windowIdentifier.windowName, value: title });\n\n\t\t// Get the window which coresponds to the tab being edited\n\t\tconst { wrap: win } = await FSBL.FinsembleWindow.getInstance(props.windowIdentifier);\n\n\t\t// Set the component state \"persistedTitle\" (which is the edited title)\n\t\tFSBL.Clients.Logger.debug(`Setting component state \"${FIELD_NAME_PERSISTED_TITLE}\" with value \"${title}\"`);\n\t\tawait win.setComponentState({ field: FIELD_NAME_PERSISTED_TITLE, value: title });\n\n\t\t// Stop editing in all cases\n\t\tsetEditingTitle(false);\n\t};\n\n\tconst beginEditing = async () => {\n\t\tawait setEditingTitle(true);\n\t\tinputEl?.current?.focus();\n\t\tif (inputEl?.current) {\n\t\t\tinputEl.current.value = props.title ?? \"\";\n\t\t}\n\t};\n\n\tconst clickHandler = () => {\n\t\tconst allowWindowTitleRenaming = Store.getValue(\"allowWindowTitleRenaming\");\n\n\t\tif (clickTimeout) {\n\t\t\t// double click\n\t\t\tif (allowWindowTitleRenaming) {\n\t\t\t\tbeginEditing();\n\t\t\t}\n\t\t} else if (!editingTitle) {\n\t\t\t// single click\n\t\t\tlet timeout = setTimeout(() => {\n\t\t\t\tclearTimeout(clickTimeout);\n\t\t\t\tsetClickTimeout(undefined);\n\t\t\t}, 500);\n\t\t\tsetClickTimeout(timeout);\n\t\t\t// Only call props.setActiveTab IFF this current tab is NOT the current tab\n\t\t\t// This prevents white flashes/renders while clicking on an actibe tab\n\t\t\tif (\n\t\t\t\tprops.windowIdentifier?.windowName !== FSBL.Clients.WindowClient.getCurrentWindow().name &&\n\t\t\t\t!!props.setActiveTab\n\t\t\t) {\n\t\t\t\tprops.setActiveTab();\n\t\t\t}\n\t\t}\n\t};\n\n\tconst blurHandler = (e: React.FocusEvent<HTMLInputElement>) => {\n\t\tupdateTabTitle(e);\n\t};\n\n\tconst keyDownHandler = (e: React.KeyboardEvent<HTMLInputElement>) => {\n\t\te.key === \"Enter\" && updateTabTitle(e);\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tclassName=\"fsbl-tab-editor\"\n\t\t\t// We can't use Click and Dblclick events together cause for one dblclick fires two click events which close title editor.\n\t\t\t// Workaround with setTimeout should resolve this behavior.\n\t\t\tonClick={clickHandler}\n\t\t>\n\t\t\t{editingTitle ? (\n\t\t\t\t<div className=\"fsbl-tab fsbl-active-tab\" style={{ width: props.tabWidth || \"auto\" }}>\n\t\t\t\t\t{/* workaround to disable tab dragging in the edit mode */}\n\t\t\t\t\t<div\n\t\t\t\t\t\tdraggable={true}\n\t\t\t\t\t\tonDragStart={(e) => {\n\t\t\t\t\t\t\te.stopPropagation();\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tid=\"title_editor_input\"\n\t\t\t\t\t\t\tref={inputEl}\n\t\t\t\t\t\t\tonBlur={blurHandler}\n\t\t\t\t\t\t\tonKeyDown={keyDownHandler}\n\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\tclassName=\"tab__input\"\n\t\t\t\t\t\t\tmaxLength={32}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t) : (\n\t\t\t\tprops.children\n\t\t\t)}\n\t\t</div>\n\t);\n}\n\n/*\n * Description how stacked window tabs work.\n *\n * The simplest case - when you have only 2 tabs. In that case you will actually have 2 windows and 4 tabs.\n * Lets call them as: window 1 - w1, window 2 - w2, tab 1 from window 1 - w1_t1, tab 2 from window 1 - w1_t2, for tabs from window 2 - w2_t1 and w2_t2.\n * When you switch tabs you activate w1 or w2 with active tab w1_t1 or w2_t2 correspondingly.\n * Tabs w1_t2 and w2_t1 are inactive. They needed only for rendering. I call them as remote tabs, cause their titles must be synchronized with active tabs titles.\n * Thus when you rename active tab (w1_t1), the corresponding remote tab (w2_t1) should be updated automatically.\n */\n\nexport class Title extends Component<TitleProps, TitleState> {\n\t// The listener for tab title change events via the DistributedStoreClient, kept as a reference so\n\t// that the listener can be deregistered when the component is unmounted\n\ttabTitleChangedStoreListener: ListenerFunction = (err: StandardError, response: { field: string; value: string }) => {\n\t\tif (!!err) {\n\t\t\t// This is not critical; in the worst case this tab title will be stale\n\t\t\tFSBL.Clients.Logger.warn(\n\t\t\t\t`Listener error for store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`,\n\t\t\t\terr\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\t// Log a message\n\t\tFSBL.Clients.Logger.debug(\n\t\t\t`Store \"${WINDOW_TAB_TITLE_STORE}\" notified of new title \"${response.value}\" for window \"${response.field}\"`\n\t\t);\n\n\t\t// Invoke updateTitle\n\t\tif (!!this._mounted) {\n\t\t\tthis.updateTitle();\n\t\t}\n\t};\n\n\t// Flag to determine if this instance is currently mounted; this is necessary because:\n\t// 1.) Title components are mounted and unmounted as an artifact of how the tab or tab list is rendered\n\t// 2.) Keeping tab titles synchronized is an asynchronous process\n\t// 3.) During the asynchronous process of tab title synchronization, a call to setState is made and\n\t// that raises a React warning since the component state cannot be changed while the component\n\t// is unmounted\n\t_mounted = false;\n\n\tconstructor(props: TitleProps) {\n\t\tsuper(props);\n\n\t\t// Declare the initial title as a blank string\n\t\tlet initialTitle = \" \";\n\n\t\t// If the currently rendering tab represents the current window, then use the document title (or window name)\n\t\tif (\n\t\t\tundefined !== finsembleWindow?.thisWindowName &&\n\t\t\tfinsembleWindow?.thisWindowName === props?.windowIdentifier?.windowName\n\t\t) {\n\t\t\tinitialTitle = document.title || props.windowIdentifier?.windowName;\n\t\t}\n\n\t\tthis.state = {\n\t\t\t// Use document.title first to prevent a title flickering when dragging a tab of another window.\n\t\t\t// The reason for flickering is the component re-rendering multiple times. The initial place\n\t\t\t// where re-rendering start is the `disallowDragOnCenterRegion()` at the WindowTitleBarShell.\n\t\t\t// At that function, we change the state of the parent component which triggers re-rendering for the children tree.\n\t\t\ttitle: initialTitle,\n\t\t\ticon: null,\n\t\t\t// The \"windowName\" is the name of the window which corresponds to the this instance of the\n\t\t\t// Title component, though the actual current window may belong to some other\n\t\t\t// component(ie this tab represents an inactive window)\n\t\t\twindowName: props.windowIdentifier?.windowName,\n\t\t};\n\n\t\t// Bind the \"updateTitle\" function (in order to use React component functions)\n\t\tthis.updateTitle = this.updateTitle.bind(this);\n\n\t\t// Initial title set\n\t\tthis.updateTitle();\n\t}\n\n\t/**\n\t * Gets a reference to the \"Window Manager\" component for the tab which is rendering. If the this tab IS the active tab, then the WindowManager will be the same as the WindowManager\n\t * attached to the WindowClient. However, all other tab components displayed in this window will need to derive the WindowManager from the config, based on the\n\t * tab's windowIdentifier.\n\t *\n\t * This is because the tab's windowIdentifier only has the name (ex: SomeApp-37ba6708-3a75-462e-b900-1812e338cbf1). The name is derived by removing the last 5 substrings\n\t * separated by \"-\". This will fail in the face of a UUID format change.\n\t *\n\t * @returns the \"Window Manager\" component, or \"undefined\" if the \"Window Manager\" is not found\n\t */\n\tasync #getWindowManagerForTab() {\n\t\t// On second thought, ALL tabs will derive the WindowManager the same way; at least if it is wrong, it is wrong consistently\n\t\t//\n\t\t// if (finsembleWindow.thisWindowName === this.props?.windowIdentifier?.windowName) {\n\t\t// \treturn FSBL.Clients.WindowClient.options?.customData?.foreign?.components?.[\"Window Manager\"] || FSBL.Clients.WindowClient.options?.customData?.appDConfig?.manifest?.foreign?.components?.[\"Window Manager\"];\n\t\t// } else {\n\n\t\t// Check that \"windowName\" exists\n\t\tif (!!this.props?.windowIdentifier?.windowName) {\n\t\t\t// Get the window name\n\t\t\tconst tabsWindowName = this.props.windowIdentifier.windowName;\n\t\t\t// Get the active descriptors\n\t\t\tconst { data: activeDescriptors } = await FSBL.Clients.LauncherClient.getActiveDescriptors();\n\t\t\t// Return the \"Window Manager\" for the window whose name matches THIS tab's name\n\t\t\treturn activeDescriptors?.[tabsWindowName]?.customData?.appDConfig?.manifest?.foreign?.components?.[\n\t\t\t\t\"Window Manager\"\n\t\t\t];\n\t\t}\n\n\t\treturn undefined;\n\t\t// }\n\t}\n\n\t/**\n\t * Calculates a tab title. Uses the following algorithm until a non-null value is found.\n\t * <ol>\n\t * <li>user edited tab title</li>\n\t * <li>the component config</li>\n\t * <li>document.title</li>\n\t * <li>appd config</li>\n\t * </ol>\n\t *\n\t * @returns the calculated tab title\n\t */\n\tasync #calculateTabTitle() {\n\t\treturn (\n\t\t\t(await this.#getUserEditedTitle()) ||\n\t\t\t(await this.#getConfigTitle()) ||\n\t\t\t(await this.#getDocumentTitle()) ||\n\t\t\tthis.#getAppDTitle()\n\t\t);\n\t}\n\n\t/**\n\t * Returns the name of the title supplied by a user; undefined if the user has not supplied a title.\n\t *\n\t * @returns The name of the title supplied by a user; undefined if the user has not supplied a title\n\t */\n\tasync #getUserEditedTitle() {\n\t\tconst { wrap: tabWindow } = await FSBL.FinsembleWindow.getInstance(this.props.windowIdentifier);\n\t\treturn new Promise((resolve) => {\n\t\t\ttabWindow.getComponentState({ field: FIELD_NAME_PERSISTED_TITLE }, (error: any, persistedTitle: any) => {\n\t\t\t\tif (!!error) {\n\t\t\t\t\t// should always return value even if it hasn't been retrieved from the state\n\t\t\t\t\tresolve(undefined);\n\t\t\t\t} else {\n\t\t\t\t\tresolve(persistedTitle);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t/**\n\t * Gets a title set in the component configuration.\n\t *\n\t * @returns any title set in the component configuration\n\t */\n\tasync #getConfigTitle() {\n\t\tconst windowManager = await this.#getWindowManagerForTab();\n\t\treturn windowManager?.FSBLHeader?.title || windowManager?.title;\n\t}\n\n\t/**\n\t * Returns document.title.\n\t *\n\t * @returns the document.title (from the \"tab name\" store)\n\t */\n\tasync #getDocumentTitle() {\n\t\tconst store = await getWindowTabNameStore();\n\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error setting the tab title: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.props?.windowIdentifier?.windowName\n\t\t\t? (await store.getGlobalValue(this.props.windowIdentifier.windowName)).data\n\t\t\t: undefined;\n\t}\n\n\t/**\n\t * Gets the AppD configuration\n\t *\n\t * @returns The AppD name\n\t */\n\t#getAppDTitle() {\n\t\treturn (\n\t\t\tFSBL.Clients.WindowClient.options?.customData?.appDConfig?.manifest?.component?.displayName ||\n\t\t\tFSBL.Clients.WindowClient.options?.customData?.appDConfig?.name\n\t\t);\n\t}\n\n\t/**\n\t * Updates the title for both the tab and the window.\n\t *\n\t * @returns a Promise which resolves nothing\n\t */\n\tasync updateTitle() {\n\t\t// There is a subtle difference bewtween windowTitle and tabTitle. Since this code executes\n\t\t// when *any* tab has a name change, this code can execute when the active window represents\n\t\t// a tab other than the currently rendering tab (ie an inactive tab).\n\n\t\t// The window represented by this tab title instance\n\t\tconst { wrap: tabWindow } = await FSBL.FinsembleWindow.getInstance(this.props.windowIdentifier);\n\n\t\t// \"tabWindowOptions\" refers to the options from the window which hosts the component represented by this tab\n\t\tconst { data: tabWindowOptions } = await tabWindow.getOptions();\n\n\t\t// Derive the title: \"config title\" then \"document.title\" then \"appd title\"\n\t\tlet title = await this.#calculateTabTitle();\n\n\t\t// Get the titleBar icon from the WindowDescriptor for the TAB window (not the CURRENT window)\n\t\tconst icon: IconDescriptor = (tabWindowOptions as WindowDescriptor)?.icons?.titleBarIcon ?? {\n\t\t\timageType: \"initials\",\n\t\t\tname: title,\n\t\t};\n\n\t\t// Log a message\n\t\tFSBL.Clients.Logger.debug(`Setting tab title ${title} for window ${this.props.windowIdentifier.windowName}`);\n\n\t\t// Finally, set the state if the component is mounted\n\t\tif (!!this._mounted) {\n\t\t\tthis.setState({\n\t\t\t\ttitle,\n\t\t\t\ticon: {\n\t\t\t\t\t...icon,\n\t\t\t\t\t// Application causes the background to default to a circle rather than a square\n\t\t\t\t\tcategory: \"Application\",\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\t// If this tab component instance represents the window (that is, this is the active tab), then set the title\n\t\tif (finsembleWindow.thisWindowName === this.props.windowIdentifier.windowName) {\n\t\t\tdocument.title = await this.#calculateTabTitle();\n\t\t}\n\t}\n\n\t/**\n\t * Adds the listener(s) required to set window and tab titles.\n\t */\n\tasync #addListeners() {\n\t\t// Subscribe to the DistributedStoreClient (these messages originate from BaseWindow, when the\n\t\t// DistributedStore has been updated).\n\t\t//\n\t\t// Each window will have n listeners, where n is the number of tabs held in the window.\n\n\t\t// Get the store and add a listener\n\t\tconst store = await getWindowTabNameStore();\n\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error adding a tab title listener: the store was not found\");\n\t\t\treturn;\n\t\t}\n\n\t\t// Add a listener\n\t\tstore.addListener({ field: this.props.windowIdentifier.windowName }, this.tabTitleChangedStoreListener, () => {\n\t\t\tFSBL.Clients.Logger.debug(\n\t\t\t\t`Added listener to store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`\n\t\t\t);\n\t\t});\n\t}\n\n\t/**\n\t * Removes listener(s) required to set window and tab titles.\n\t */\n\tasync #removeListeners() {\n\t\t// Unsubscribe from the window/tab store\n\t\tconst store = await getWindowTabNameStore();\n\t\t// If the store is unavailable, then the tab name cannot be updated\n\t\tif (!store) {\n\t\t\t// This is not critical, but tab titles may be stale\n\t\t\tFSBL.Clients.Logger.warn(\"Error removing a tab title listener: the store was not found\");\n\t\t\treturn;\n\t\t}\n\t\tstore.removeListener(\n\t\t\t{ field: this.props.windowIdentifier.windowName },\n\t\t\tthis.tabTitleChangedStoreListener,\n\t\t\t(err: StandardError, response: boolean | undefined) => {\n\t\t\t\tif (!!err) {\n\t\t\t\t\t// This is not critical; the listener could not be removed from the store - this may be a memory leak\n\t\t\t\t\tFSBL.Clients.Logger.warn(\n\t\t\t\t\t\t`Could not remove listener from store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`,\n\t\t\t\t\t\terr\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tFSBL.Clients.Logger.debug(\n\t\t\t\t\t`Removed listener to store \"${WINDOW_TAB_TITLE_STORE}\" for field \"${this.props.windowIdentifier.windowName}\"`\n\t\t\t\t);\n\t\t\t}\n\t\t);\n\t}\n\n\t/**\n\t * React component lifecycle event, triggered once the component has been added to the DOM.\n\t */\n\tcomponentDidMount() {\n\t\t// Set the mounted flag to true (this component is currently mounted)\n\t\tthis._mounted = true;\n\n\t\t// Add listeners\n\t\tthis.#addListeners();\n\t}\n\n\t// Triggers a re-rendering of the drag handle in the title bar.\n\tcomponentDidUpdate() {\n\t\tif (typeof this.props.onUpdate === \"function\") {\n\t\t\tthis.props.onUpdate();\n\t\t}\n\t}\n\n\t/**\n\t * React component lifecycle event, triggered before the component is removed from the DOM.\n\t */\n\tcomponentWillUnmount() {\n\t\t// Set the mounted flag to false (this component is not currently mounted)\n\t\tthis._mounted = false;\n\n\t\t// Remove listeners\n\t\tthis.#removeListeners();\n\t}\n\n\trender() {\n\t\tconst { titleWidth } = this.props;\n\t\tconst style = titleWidth ? { width: titleWidth } : {};\n\t\treturn (\n\t\t\t<EditTab\n\t\t\t\ttabWidth={titleWidth}\n\t\t\t\tsetActiveTab={this?.props?.onClick}\n\t\t\t\ttitle={this.state.title}\n\t\t\t\t// The windowIdentifier indicates which app/component this tab instance should represent\n\t\t\t\twindowIdentifier={this.props.windowIdentifier}\n\t\t\t>\n\t\t\t\t<div className=\"fsbl-tab-title\" style={style}>\n\t\t\t\t\t{this.state.icon && <Icon {...this.state.icon} />}\n\t\t\t\t\t<div className=\"title-text\">{this.state.title}</div>\n\t\t\t\t</div>\n\t\t\t</EditTab>\n\t\t);\n\t}\n}\n"]}