@bloomreach/vue-sdk
Version:
Bloomreach SPA SDK for Vue
1 lines • 33.5 kB
Source Map (JSON)
{"version":3,"file":"index.umd.cjs","sources":["../src/providerKeys.ts","../src/BrMeta.vue","../src/render-container.ts","../src/BrContainerBox.vue","../src/BrContainerInline.vue","../src/BrContainerNoMarkup.vue","../src/BrContainerOrderedList.vue","../src/BrContainerUnorderedList.vue","../src/BrNodeContainer.vue","../src/BrContainerItemUndefined.vue","../src/BrNodeContainerItem.vue","../src/has-slot-content.ts","../src/BrNodeComponent.vue","../src/BrComponent.vue","../src/BrManageContentButton.vue","../src/BrManageMenuButton.vue","../src/BrPage.vue","../src/main.ts"],"sourcesContent":["/*\n * Copyright 2023-2026 Bloomreach\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Component, Page } from '@bloomreach/spa-sdk';\nimport type { InjectionKey, Ref } from 'vue';\nimport type { BrMapping } from '../typings';\n\nexport const page$: InjectionKey<Ref<Page | undefined>> = Symbol('page$');\nexport const mapping$: InjectionKey<Ref<BrMapping>> = Symbol('mapping$');\nexport const component$: InjectionKey<Ref<Component | undefined>> = Symbol('component$');\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n\n<template>\n <span v-if=\"meta && meta.length > 0\" style=\"display: none;\" ref=\"head\"/>\n <slot v-bind=\"$attrs\" />\n <span v-if=\"meta && meta.length > 0\" style=\"display: none;\" ref=\"tail\"/>\n</template>\n\n<script setup lang=\"ts\">\nimport type { MetaCollection } from '@bloomreach/spa-sdk';\nimport { getCurrentInstance, inject, onBeforeUnmount, onBeforeUpdate, onMounted, onUpdated, ref, toRef, watch } from 'vue';\nimport { page$ } from '@/providerKeys';\n\nconst props = defineProps<{ meta?: MetaCollection }>();\nconst meta = toRef(() => props.meta);\nlet clear: ReturnType<MetaCollection['render']> | undefined;\nconst page = inject(page$, undefined);\n\nconst head = ref<HTMLSpanElement>();\nconst tail = ref<HTMLSpanElement>();\n\nconst injectMeta = () => {\n if (!head.value?.nextSibling || !tail.value) {\n return;\n }\n\n clear = meta.value?.render(head.value.nextSibling, tail.value);\n if (clear) page?.value?.sync();\n};\n\nconst clearMeta = () => {\n if (!clear) return;\n clear();\n clear = undefined;\n page?.value?.sync();\n};\n\nwatch(meta, () => getCurrentInstance()?.proxy?.$forceUpdate(), { deep: false });\nonMounted(injectMeta);\nonUpdated(injectMeta);\nonBeforeUnmount(clearMeta);\nonBeforeUpdate(clearMeta);\n</script>\n","/*\n * Copyright 2023-2026 Bloomreach\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { page$ } from '@/providerKeys';\nimport type { VNode } from 'vue';\nimport { computed, h, inject, useSlots } from 'vue';\n\nexport function useRenderContainer(\n containerTag: string,\n containerItemTag: string,\n) {\n const page = inject(page$);\n const isPreview = computed(() => page?.value?.isPreview());\n\n const getChildNodes = () => {\n const slots = useSlots();\n const slotDefaultRootNode = slots.default!()[0];\n const rootNodeChildren = slotDefaultRootNode.children as VNode[] | undefined;\n const containerItems = rootNodeChildren?.[0]?.children;\n\n return (containerItems as VNode[] | undefined)\n ?.map((node) => h(\n containerItemTag,\n { class: { 'hst-container-item': isPreview } },\n [node],\n ));\n };\n\n return () => h(\n containerTag,\n { class: { 'hst-container': isPreview } },\n getChildNodes(),\n );\n}\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n<script lang=\"ts\">\nimport { useRenderContainer } from '@/render-container';\nimport { defineComponent } from 'vue';\n\nexport default defineComponent({\n setup() {\n return useRenderContainer('div', 'div');\n },\n});\n</script>\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n<script lang=\"ts\">\nimport { useRenderContainer } from '@/render-container';\nimport { defineComponent } from 'vue';\n\nexport default defineComponent({\n setup() {\n return useRenderContainer('div', 'span');\n },\n});\n</script>\n","<!--\n - Copyright 2023-2026 Bloomreach\n -\n - Licensed under the Apache License, Version 2.0 (the \"License\");\n - you may not use this file except in compliance with the License.\n - You may obtain a copy of the License at\n -\n - http://www.apache.org/licenses/LICENSE-2.0\n -\n - Unless required by applicable law or agreed to in writing, software\n - distributed under the License is distributed on an \"AS IS\" BASIS,\n - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n - See the License for the specific language governing permissions and\n - limitations under the License.\n -->\n\n<template>\n <slot v-bind=\"attrs\"/>\n</template>\n\n<script setup lang=\"ts\">\nimport { useAttrs } from 'vue';\nconst attrs = useAttrs();\n</script>\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n<script lang=\"ts\">\nimport { useRenderContainer } from '@/render-container';\nimport { defineComponent } from 'vue';\n\nexport default defineComponent({\n setup() {\n return useRenderContainer('ol', 'li');\n },\n});\n</script>\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n<script lang=\"ts\">\nimport { useRenderContainer } from '@/render-container';\nimport { defineComponent } from 'vue';\n\nexport default defineComponent({\n setup() {\n return useRenderContainer('ul', 'li');\n },\n});\n</script>\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n\n<template>\n <br-meta :meta=\"meta\" :key=\"component?.getId()\">\n <component\n v-if=\"containerType && containerType in mapping\"\n :is=\"mapping[containerType]\"\n :component=\"component\"\n :page=\"page\">\n <slot/>\n </component>\n\n <br-container-inline\n v-else-if=\"containerType === TYPE_CONTAINER_INLINE\"\n :component=\"component\"\n :page=\"page\">\n <slot/>\n </br-container-inline>\n\n <br-container-no-markup\n v-else-if=\"containerType === TYPE_CONTAINER_NO_MARKUP\"\n :component=\"component\"\n :page=\"page\">\n <slot/>\n </br-container-no-markup>\n\n <br-container-ordered-list\n v-else-if=\"containerType === TYPE_CONTAINER_ORDERED_LIST\"\n :component=\"component\"\n :page=\"page\">\n <slot/>\n </br-container-ordered-list>\n\n <br-container-unordered-list\n v-else-if=\"containerType === TYPE_CONTAINER_UNORDERED_LIST\"\n :component=\"component\"\n :page=\"page\">\n <slot/>\n </br-container-unordered-list>\n\n <br-container-box\n v-else\n :component=\"component\"\n :page=\"page\">\n <slot/>\n </br-container-box>\n </br-meta>\n</template>\n\n<script setup lang=\"ts\">\nimport { component$, mapping$, page$ } from '@/providerKeys';\nimport type { Container } from '@bloomreach/spa-sdk';\nimport {\n TYPE_CONTAINER_INLINE,\n TYPE_CONTAINER_NO_MARKUP,\n TYPE_CONTAINER_ORDERED_LIST,\n TYPE_CONTAINER_UNORDERED_LIST,\n} from '@bloomreach/spa-sdk';\nimport type { Ref } from 'vue';\nimport { computed, inject } from 'vue';\nimport type { BrMapping } from '../typings';\nimport BrMeta from './BrMeta.vue';\nimport BrContainerBox from './BrContainerBox.vue';\nimport BrContainerInline from './BrContainerInline.vue';\nimport BrContainerNoMarkup from './BrContainerNoMarkup.vue';\nimport BrContainerOrderedList from './BrContainerOrderedList.vue';\nimport BrContainerUnorderedList from './BrContainerUnorderedList.vue';\n\nconst page = inject(page$);\nconst component = inject<Ref<Container>>(component$);\nconst mapping = inject(mapping$) as Ref<BrMapping>;\nconst containerType = computed(() => component?.value?.getType());\nconst meta = computed(() => component?.value?.getMeta());\n</script>\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n\n<template>\n <div>{{ `Component \"${type}\" is not defined.` }}</div>\n</template>\n\n<script setup lang=\"ts\">\nimport type { ContainerItem } from '@bloomreach/spa-sdk';\nimport { computed } from 'vue';\n\nconst props = defineProps<{ component: ContainerItem }>();\nconst type = computed(() => props.component.getType());\n</script>\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n\n<template>\n <br-meta :meta=\"meta\" :key=\"passedComponent.getId()\">\n <component\n :is=\"mapping[componentType]\"\n v-if=\"componentType && componentType in mapping\"\n :component=\"passedComponent\"\n :page=\"page\"\n />\n\n <component\n :is=\"mapping[TYPE_CONTAINER_ITEM_UNDEFINED]\"\n v-else-if=\"TYPE_CONTAINER_ITEM_UNDEFINED in mapping\"\n :component=\"passedComponent\"\n :page=\"page\"\n />\n\n <br-container-item-undefined v-else-if=\"passedComponent\" :component=\"passedComponent\"/>\n </br-meta>\n</template>\n\n<script setup lang=\"ts\">\nimport { component$, mapping$, page$ } from '@/providerKeys';\nimport type { ContainerItem } from '@bloomreach/spa-sdk';\nimport { TYPE_CONTAINER_ITEM_UNDEFINED } from '@bloomreach/spa-sdk';\nimport type { Ref } from 'vue';\nimport { computed, inject, onUnmounted, shallowRef, toRaw, watch } from 'vue';\nimport BrMeta from '@/BrMeta.vue';\nimport BrContainerItemUndefined from '@/BrContainerItemUndefined.vue';\n\nconst page = inject(page$)!;\nconst mapping = inject(mapping$)!;\nconst component = inject<Ref<ContainerItem>>(component$)!;\nconst componentType = computed(() => component.value.getType());\nlet unsubscribe: ReturnType<ContainerItem['on']>;\n\nfunction shallowClone(value: ContainerItem): ContainerItem {\n const cloned = Object.create(Object.getPrototypeOf(value));\n return Object.assign(cloned, value);\n}\n\n// Need to create a new object on every change of container item internals\n// or the unref`ed object reference in the template wont change and the 'component' props\n// will not trigger updates in child components\n// https://vuejs.org/guide/essentials/reactivity-fundamentals.html#ref-unwrapping-in-templates\n// https://vuejs.org/api/reactivity-utilities.html#unref\nconst passedComponent = shallowRef<ContainerItem>(component.value);\nconst meta = computed(() => passedComponent.value.getMeta());\nconst updateHook = () => {\n passedComponent.value = shallowClone(component.value);\n const sdkPage = toRaw(page.value);\n sdkPage?.sync();\n};\nonUnmounted(() => unsubscribe?.());\n\nwatch(\n component,\n () => {\n passedComponent.value = shallowClone(component.value);\n unsubscribe?.();\n unsubscribe = component.value.on('update', updateHook);\n }, { immediate: true, deep: true },\n);\n</script>\n","/*\n * Copyright 2023-2026 Bloomreach\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useSlots } from 'vue';\n\nexport function useHasSlotContent(slotName: string = 'default') {\n const slots = useSlots();\n return !!(slots[slotName]?.()[0].children?.length);\n}\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n\n<template>\n <br-meta :meta=\"meta\" :key=\"componentRef?.getId()\" v-if=\"hasSlotContent\">\n <slot />\n </br-meta>\n <template v-else>\n <br-node-container-item v-if=\"isContainerItem(componentRef)\"/>\n\n <br-node-container v-else-if=\"isContainer(componentRef)\">\n <br-node-component v-for=\"child in children\" :key=\"(child as Component).getId()\" :component=\"child\"/>\n </br-node-container>\n\n <template v-else-if=\"name && name in mapping\">\n <br-meta :meta=\"meta\" :key=\"componentRef?.getId()\">\n <component :is=\"mapping[name]\" :component=\"componentRef\" :page=\"page\"/>\n </br-meta>\n </template>\n\n <template v-else>\n <br-meta :meta=\"meta\" :key=\"componentRef?.getId()\">\n <br-node-component v-for=\"child in children\" :key=\"(child as Component).getId()\" :component=\"child\"/>\n </br-meta>\n </template>\n </template>\n</template>\n\n<script setup lang=\"ts\">\nimport BrMeta from '@/BrMeta.vue';\nimport BrNodeContainer from '@/BrNodeContainer.vue';\nimport BrNodeContainerItem from '@/BrNodeContainerItem.vue';\nimport { component$, mapping$, page$ } from '@/providerKeys';\nimport type { Component } from '@bloomreach/spa-sdk';\nimport { isContainer, isContainerItem } from '@bloomreach/spa-sdk';\nimport { computed, inject, provide, toRefs } from 'vue';\nimport { useHasSlotContent } from './has-slot-content';\n\nconst props = defineProps<{ component: Component | undefined }>();\nconst { component: componentRef } = toRefs(props);\nconst page = inject(page$);\nconst mapping = inject(mapping$)!;\nconst hasSlotContent = useHasSlotContent();\n\nconst children = computed(() => componentRef?.value?.getChildren());\nconst meta = computed(() => componentRef?.value?.getMeta());\nconst name = computed(() => componentRef?.value?.getName());\n\nprovide(component$, componentRef);\n</script>\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n\n<template>\n <br-node-component v-for=\"component in components\" :component=\"component\">\n <slot :component=\"component\" :page=\"page\"></slot>\n </br-node-component>\n</template>\n\n<script setup lang=\"ts\">\nimport BrNodeComponent from '@/BrNodeComponent.vue';\nimport { component$, page$ } from '@/providerKeys';\nimport type { Component } from '@bloomreach/spa-sdk';\nimport { isComponent } from '@bloomreach/spa-sdk';\nimport { computed, inject } from 'vue';\n\nfunction getComponents(\n parentComponent: Component | undefined,\n propsComponent: Component | string | undefined,\n): Component[] {\n if (isComponent(propsComponent)) {\n return [propsComponent];\n }\n\n if (!parentComponent) {\n return [];\n }\n\n if (!propsComponent) {\n return parentComponent.getChildren();\n }\n\n // else propsComponent is a string denoting a path in the page model tree\n const componentInParent = parentComponent.getComponent(...propsComponent.split('/'));\n return componentInParent ? [componentInParent] : [];\n}\n\nconst props = defineProps<{ component?: Component | string }>();\nconst page = inject(page$);\nconst parent = inject(component$);\nconst components = computed(() => getComponents(parent?.value, props.component));\n</script>\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n\n<template>\n <br-meta v-if=\"page && page?.isPreview()\" :meta=\"meta\"/>\n</template>\n\n<script setup lang=\"ts\">\nimport { page$ } from '@/providerKeys';\nimport type { ManageContentButton, MetaCollection } from '@bloomreach/spa-sdk';\nimport { TYPE_MANAGE_CONTENT_BUTTON } from '@bloomreach/spa-sdk';\nimport { computed, inject } from 'vue';\nimport BrMeta from '@/BrMeta.vue';\n\nconst props = defineProps<{\n content?: ManageContentButton['content'],\n documentTemplateQuery?: ManageContentButton['documentTemplateQuery'],\n folderTemplateQuery?: ManageContentButton['folderTemplateQuery'],\n path?: ManageContentButton['path'],\n parameter?: ManageContentButton['parameter'],\n pickerConfiguration?: ManageContentButton['pickerConfiguration'],\n pickerEnableUpload?: ManageContentButton['pickerEnableUpload'],\n pickerInitialPath?: ManageContentButton['pickerInitialPath'],\n pickerRemembersLastVisited?: ManageContentButton['pickerRemembersLastVisited'],\n pickerRootPath?: ManageContentButton['pickerRootPath'],\n pickerSelectableNodeTypes?: ManageContentButton['pickerSelectableNodeTypes'],\n relative?: ManageContentButton['relative'],\n root?: ManageContentButton['root'],\n}>();\n\nconst page = inject(page$);\nconst meta = computed<MetaCollection | undefined>(() => page?.value?.getButton(TYPE_MANAGE_CONTENT_BUTTON, props));\n</script>\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n\n<template>\n <br-meta v-if=\"page && page.isPreview()\" :meta=\"meta\"/>\n</template>\n\n<script setup lang=\"ts\">\nimport { page$ } from '@/providerKeys';\nimport type { Menu, MetaCollection } from '@bloomreach/spa-sdk';\nimport { TYPE_MANAGE_MENU_BUTTON } from '@bloomreach/spa-sdk';\nimport { computed, inject } from 'vue';\nimport BrMeta from '@/BrMeta.vue';\n\nconst props = defineProps<{ menu: Menu }>();\nconst page = inject(page$);\nconst meta = computed<MetaCollection | undefined>(() => page?.value?.getButton(TYPE_MANAGE_MENU_BUTTON, props.menu));\n</script>\n","<!--\n Copyright 2023-2026 Bloomreach\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n -->\n\n<template>\n <br-node-component v-if=\"page || configuration.NBRMode\" :component=\"root\">\n <slot :component=\"root\" :page=\"page\"/>\n </br-node-component>\n</template>\n\n<script setup lang=\"ts\">\nimport BrNodeComponent from '@/BrNodeComponent.vue';\nimport { mapping$, page$ } from '@/providerKeys';\nimport type { Configuration, Page, PageModel } from '@bloomreach/spa-sdk';\nimport { initialize } from '@bloomreach/spa-sdk';\nimport {\n computed,\n onMounted,\n onServerPrefetch,\n onUpdated,\n provide,\n ref,\n toRaw,\n toRefs,\n watch,\n} from 'vue';\nimport type { BrMapping } from '../typings';\n\nconst props = defineProps<{\n page?: Page | PageModel,\n configuration: Configuration,\n mapping: BrMapping,\n}>();\nconst { configuration, mapping } = toRefs(props);\nconst page = ref<Page | undefined>();\nconst root = computed(() => page.value?.getComponent());\nlet loading: Promise<Page> | null = null;\n\nprovide(page$, page);\nprovide(mapping$, mapping);\n\nwatch(configuration, async (current, previous) => {\n if (!previous && props.page) {\n page.value = initialize(current, props.page);\n return;\n }\n\n loading = initialize(current);\n page.value = await loading;\n loading = null;\n}, { deep: true, immediate: true });\n\nonMounted(() => {\n const sdkPage = toRaw(page.value);\n sdkPage?.sync();\n});\nonUpdated(() => {\n const sdkPage = toRaw(page.value);\n sdkPage?.sync();\n});\nonServerPrefetch(async () => await loading);\n</script>\n","/*\n * Copyright 2023-2026 Bloomreach\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport BrComponent from '@/BrComponent.vue';\nimport BrManageContentButton from '@/BrManageContentButton.vue';\nimport BrManageMenuButton from '@/BrManageMenuButton.vue';\nimport BrPage from '@/BrPage.vue';\nimport type { App, Plugin } from 'vue';\n\n/**\n * The brXM SDK plugin.\n */\nexport const BrSdk: Plugin = {\n install(app: App): void {\n app.component('br-component', BrComponent);\n app.component('br-manage-content-button', BrManageContentButton);\n app.component('br-manage-menu-button', BrManageMenuButton);\n app.component('br-page', BrPage);\n },\n};\n\nexport { BrComponent, BrManageContentButton, BrManageMenuButton, BrPage };\n"],"names":["page$","mapping$","component$","meta","toRef","props","clear","page","inject","head","ref","tail","injectMeta","_a","_b","_c","clearMeta","watch","getCurrentInstance","onMounted","onUpdated","onBeforeUnmount","onBeforeUpdate","useRenderContainer","containerTag","containerItemTag","isPreview","computed","getChildNodes","rootNodeChildren","useSlots","containerItems","node","h","_sfc_main$c","defineComponent","_sfc_main$b","attrs","useAttrs","_sfc_main$9","_sfc_main$8","component","mapping","containerType","type","componentType","unsubscribe","shallowClone","value","cloned","passedComponent","shallowRef","updateHook","sdkPage","toRaw","onUnmounted","useHasSlotContent","slotName","slots","componentRef","toRefs","hasSlotContent","children","name","provide","getComponents","parentComponent","propsComponent","isComponent","componentInParent","parent","components","TYPE_MANAGE_CONTENT_BUTTON","TYPE_MANAGE_MENU_BUTTON","configuration","root","loading","current","previous","initialize","onServerPrefetch","BrSdk","app","BrComponent","BrManageContentButton","BrManageMenuButton","BrPage"],"mappings":"oUAoBO,MAAMA,EAA6C,OAAO,OAAO,EAC3DC,EAA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