{"version":3,"file":"StandardElement-xfvg6dim.mjs","names":[],"sources":["../src/components/templates/StandardElement.vue"],"sourcesContent":["<template>\n  <component\n    :is=\"tag\"\n    :=\"attrs\"\n    @[isButton&&`click`]=\"buttonClicked\"\n    ref=\"componentElement\"\n  >\n    <component\n      v-for=\"(c, index) in children\"\n      :key=\"'standard_element_component_' + index\"\n      :is=\"c.component\"\n      :node=\"c.node\"\n      :componentName=\"c.name\"\n      :properties=\"c.properties\"\n    />\n  </component>\n</template>\n\n<script setup>\nimport { defineProps, toRefs, ref } from 'vue'\n\nimport { nodeNameTagNameMap } from '../../js/nodemap'\nimport { useChildren } from '../../composables/computed'\nimport { useMethods } from '../../composables/methods'\n\nconst props = defineProps({\n  node: {\n    type: undefined,\n    default: null,\n  },\n  componentName: {\n    type: String,\n  },\n})\n\nconst { node } = toRefs(props)\nconst { children } = useChildren(node)\nconst { dataObject } = useMethods()\nconst attrs = ref({})\nconst isButton = ref(false)\nconst componentElement = ref(null)\n\nconst transferAttributes = new Set(['div', 'button'])\nconst tag = nodeNameTagNameMap.get(node.value.nodeName)\n\nconst tmpDataObject = dataObject(node.value, node.value.getAttribute('classes'))\nconst classList = tmpDataObject.class\n  ? tmpDataObject.class.join(' ')\n  : undefined\nattrs.value = {\n  ...tmpDataObject.attrs,\n  class: classList,\n}\n\n// An empty prefix attribute causes problems for <ol> elements.\nif (attrs.value.prefix === '') {\n  delete attrs.value.prefix\n}\n\nif (node.value.nodeName === 'button') {\n  isButton.value = true\n}\n\nfunction buttonClicked() {\n  if (componentElement.value.getAttribute('aria-selected') === 'false') {\n    const parentElement = componentElement.value.parentElement\n    let panels = []\n    for (const child of parentElement.children) {\n      const el = document.getElementById(child.id)\n      el.setAttribute(\n        'aria-selected',\n        el.getAttribute('aria-selected') === 'true' ? 'false' : 'true',\n      )\n      panels.push({ id: child.getAttribute('aria-controls') })\n    }\n    for (const panel of panels) {\n      const el = document.getElementById(panel.id)\n      if (el.hasAttribute('hidden')) {\n        el.removeAtt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