{"version":3,"file":"menu-item-layout.element-CVCWj2AY.js","sources":["../../../src/packages/core/menu/components/menu-item/menu-item-default.element.ts","../../../src/packages/core/menu/components/menu/menu.element.ts","../../../src/packages/core/menu/components/menu-item-layout/menu-item-layout.element.ts"],"sourcesContent":["import { customElement, html, property, state } from '@umbraco-cms/backoffice/external/lit';\nimport { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';\nimport { UMB_SECTION_CONTEXT } from '@umbraco-cms/backoffice/section';\nimport type { ManifestMenuItem, UmbMenuItemElement } from '@umbraco-cms/backoffice/extension-registry';\n\n@customElement('umb-menu-item-default')\nexport class UmbMenuItemDefaultElement extends UmbLitElement implements UmbMenuItemElement {\n\t#pathname?: string;\n\n\t@property({ type: Object, attribute: false })\n\tprivate _manifest!: ManifestMenuItem;\n\tpublic get manifest(): ManifestMenuItem {\n\t\treturn this._manifest;\n\t}\n\tpublic set manifest(value: ManifestMenuItem) {\n\t\tthis._manifest = value;\n\t\tthis.#constructHref();\n\t}\n\n\t@state()\n\tprivate _href?: string;\n\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.consumeContext(UMB_SECTION_CONTEXT, (sectionContext) => {\n\t\t\tthis.observe(\n\t\t\t\tsectionContext?.pathname,\n\t\t\t\t(pathname) => {\n\t\t\t\t\tthis.#pathname = pathname;\n\t\t\t\t\tthis.#constructHref();\n\t\t\t\t},\n\t\t\t\t'observePathname',\n\t\t\t);\n\t\t});\n\t}\n\n\t#constructHref() {\n\t\tif (!this.#pathname || !this.manifest) return;\n\t\tthis._href = `section/${this.#pathname}/workspace/${this.manifest.meta.entityType}`;\n\t}\n\n\toverride render() {\n\t\treturn html`\n\t\t\t\n\t\t\t\n\t\t`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'umb-menu-item-default': UmbMenuItemDefaultElement;\n\t}\n}\n","import { html, customElement, property } from '@umbraco-cms/backoffice/external/lit';\nimport type { ManifestMenu, ManifestMenuItem } from '@umbraco-cms/backoffice/extension-registry';\nimport { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';\n\nimport '../menu-item/menu-item-default.element.js';\n\n@customElement('umb-menu')\nexport class UmbMenuElement extends UmbLitElement {\n\t@property({ attribute: false })\n\tmanifest?: ManifestMenu;\n\n\tconstructor() {\n\t\tsuper();\n\t\t//this.provideContext(UMB_MENU_CONTEXT, new UmbMenuContext());\n\t}\n\n\toverride render() {\n\t\treturn html`\n\t\t\t items.meta.menus.includes(this.manifest!.alias)}>\n\t\t\t\n\t\t`;\n\t}\n}\n\nexport default UmbMenuElement;\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'umb-menu': UmbMenuElement;\n\t}\n}\n","import { html, customElement, property, ifDefined, state } from '@umbraco-cms/backoffice/external/lit';\nimport { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';\nimport { debounce } from '@umbraco-cms/backoffice/utils';\n\n/**\n * @element umb-menu-item-layout\n * @description\n * A menu item layout to render he backoffice menu item look.\n * This supports nested menu items, and if a `entityType` is provided, it will render the entity actions for it.\n */\n@customElement('umb-menu-item-layout')\nexport class UmbMenuItemLayoutElement extends UmbLitElement {\n\t@property({ type: String, attribute: 'entity-type' })\n\tpublic entityType?: string;\n\n\t/**\n\t * The icon name for the icon to show in this menu item.\n\t */\n\t@property({ type: String, attribute: 'icon-name' })\n\tpublic iconName = '';\n\n\t/**\n\t * The label for this menu item.\n\t */\n\t@property({ type: String })\n\tpublic label = '';\n\n\t/**\n\t * Declare if this item has children, this will show the expand symbol.\n\t */\n\t@property({ type: Boolean, attribute: 'has-children' })\n\tpublic hasChildren = false;\n\n\t/**\n\t * Define a href for this menu item.\n\t */\n\t@property({ type: String })\n\tpublic href?: string;\n\n\t@state()\n\tprivate _isActive = false;\n\n\toverride connectedCallback() {\n\t\tsuper.connectedCallback();\n\t\twindow.addEventListener('navigationend', this.#debouncedCheckIsActive);\n\t}\n\n\t#debouncedCheckIsActive = debounce(() => this.#checkIsActive(), 100);\n\n\t#checkIsActive() {\n\t\tif (!this.href) {\n\t\t\tthis._isActive = false;\n\t\t\treturn;\n\t\t}\n\n\t\tconst location = window.location.pathname;\n\t\tthis._isActive = location.includes(this.href);\n\t}\n\n\toverride render() {\n\t\treturn html`\n\t\t\t\n\t\t\t${this.entityType\n\t\t\t\t? html`\n\t\t\t\t\t`\n\t\t\t\t: ''}\n\t\t\t\n\t\t`;\n\t}\n\n\toverride disconnectedCallback() {\n\t\tsuper.disconnectedCallback();\n\t\twindow.removeEventListener('navigationend', this.#debouncedCheckIsActive);\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'umb-menu-item-layout': UmbMenuItemLayoutElement;\n\t}\n}\n"],"names":["_pathname","_UmbMenuItemDefaultElement_instances","constructHref_fn","UmbMenuItemDefaultElement","UmbLitElement","__privateAdd","UMB_SECTION_CONTEXT","sectionContext","pathname","__privateSet","__privateMethod","value","html","__privateGet","__decorateClass","property","state","customElement","UmbMenuElement","items","_debouncedCheckIsActive","_UmbMenuItemLayoutElement_instances","checkIsActive_fn","UmbMenuItemLayoutElement","debounce","ifDefined","location"],"mappings":";;;;;;;;;;wXAAAA,GAAAC,GAAAC;AAMa,IAAAC,IAAN,cAAwCC,EAA4C;AAAA,EAgB1F,cAAc;AACP,aAjBDC,EAAA,MAAAJ,CAAA,GACNI,EAAA,MAAAL,CAAA,GAkBM,KAAA,eAAeM,GAAqB,CAACC,MAAmB;AACvD,WAAA;AAAA,QACJA,GAAgB;AAAA,QAChB,CAACC,MAAa;AACb,UAAAC,EAAA,MAAKT,GAAYQ,CAAA,GACjBE,EAAA,MAAKT,GAALC,CAAA,EAAA,KAAA,IAAA;AAAA,QACD;AAAA,QACA;AAAA,MAAA;AAAA,IACD,CACA;AAAA,EACF;AAAA,EAxBA,IAAW,WAA6B;AACvC,WAAO,KAAK;AAAA,EACb;AAAA,EACA,IAAW,SAASS,GAAyB;AAC5C,SAAK,YAAYA,GACjBD,EAAA,MAAKT,GAALC,CAAA,EAAA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