{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "Posts as a grid, a list or a magazine.",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n\nexport type PostTopic = {\n  id: string;\n  title: string;\n  value: string;\n};\n\nexport type PostFilter = {\n  /** topics: tabs above the posts; the page filters by `topic` */\n  mode?: \"none\" | \"topics\";\n  /** the topic tabs */\n  topics?: PostTopic[];\n  /** accessible name of the topic tabs */\n  label?: string;\n  /** the value of the chosen topic; empty: all posts */\n  topic?: string;\n};\n\nexport type PostPager = {\n  /** pages: a numbered Pager under the posts, in a nav landmark */\n  mode?: \"none\" | \"pages\";\n  /** the current page, from 1 */\n  page?: number;\n  /** the number of pages */\n  pages?: number;\n  /** accessible name of the pager nav (Pages of posts) */\n  label?: string;\n  /** template of the summary line: ｛0｝ the page, ｛1｝ the pages */\n  summary?: string;\n  /** accessible name of the previous-page button */\n  previous?: string;\n  /** accessible name of the next-page button */\n  next?: string;\n  /** template of the accessible name of a page button, ｛0｝ the number */\n  pageLabel?: string;\n  /** address of page ｛0｝ (filled by the adapter): with it the pages are links; none: buttons that emit page */\n  url?: string;\n  /** address of page 1 when it is not url with 1 (the list's own address) */\n  firstUrl?: string;\n};\n",
      "path": "blocks/post-grid.types.ts",
      "target": "blocks/post-grid.types.ts"
    },
    {
      "content": "<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->\n<!--\n  A section with a heading and the posts as cards: a grid, a list of horizontal cards, or a magazine (the first\n  post wide, the rest in a grid). Axes: layout (grid, list, magazine), columns, media, meta (full, short, news),\n  filter mode (none, topics), pager (none, pages), tone, density.\n-->\n<script lang=\"ts\">\nimport type { PostTopic, PostFilter, PostPager } from \"./post-grid.types\";\nimport type { Post, PostLabels } from \"./post-card.types\";\nimport type { HeadLink } from \"../components/section-frame.types\";\n\nexport type PostGridProps = {\n  id: string;\n  title: string;\n  posts: Post[];\n  labels: PostLabels;\n  action?: HeadLink;\n  filter?: PostFilter;\n  pager?: PostPager;\n  layout?: \"grid\" | \"list\" | \"magazine\";\n  cols?: \"1-2\" | \"1-3\" | \"1-4\";\n  media?: \"image\" | \"none\";\n  meta?: \"full\" | \"short\" | \"news\";\n  tone?: \"default\" | \"muted\";\n  density?: \"default\" | \"compact\";\n  landmarkLabel?: string;\n};\n</script>\n\n<script setup lang=\"ts\">\nimport Block from \"../compose/Block.vue\";\nimport Grid from \"../compose/Grid.vue\";\nimport Stack from \"../compose/Stack.vue\";\nimport Pager from \"../components/pager.vue\";\nimport PostCard from \"../blocks/post-card.vue\";\nimport SectionFrame from \"../components/section-frame.vue\";\nimport Switcher from \"../components/switcher.vue\";\nimport SwitcherItem from \"../components/switcher-item.vue\";\nimport { fitCols, tpl, uniqLabel } from \"../utils\";\n\nconst {\n  id,\n  title,\n  posts,\n  labels,\n  action,\n  filter,\n  pager,\n  layout = \"grid\",\n  cols = \"1-3\",\n  media = \"image\",\n  meta = \"full\",\n  tone = \"default\",\n  density = \"default\",\n  landmarkLabel,\n} = defineProps<PostGridProps>();\nconst emit = defineEmits<{ topic: [value: string], page: [page: number] }>();\n</script>\n\n<template>\n  <SectionFrame\n    :id=\"id\"\n    :title=\"title\"\n    :action=\"action\"\n    :tone=\"tone\"\n    :density=\"(((density as string) === 'compact') ? 'compact' : 'default')\"\n    :measure=\"(((meta as string) === 'news') ? 'fill' : 'default')\"\n    :class=\"(((meta as string) === 'news') ? 'py-0' : '')\"\n    :landmarkLabel=\"landmarkLabel\"\n  >\n    <Switcher v-if=\"(filter?.mode === 'topics')\" :label=\"filter?.label\">\n      <SwitcherItem\n        v-for=\"tab in filter?.topics\"\n        :key=\"tab.id\"\n        :active=\"(tab.value === filter?.topic)\"\n        @click=\"() => emit('topic', tab.value)\"\n      >\n        {{ tab.title }}\n      </SwitcherItem>\n    </Switcher>\n    <template v-if=\"((posts.filter((i) => !filter?.topic || i['category'] === filter?.topic)?.length ?? 0) > 0)\">\n      <Stack v-if=\"((layout as string) === 'magazine')\" gap=\"6\" align=\"stretch\" data-slot=\"items\">\n        <template v-for=\"(p, i) in posts.filter((i) => !filter?.topic || i['category'] === filter?.topic)\" :key=\"p.id\">\n          <PostCard\n            v-if=\"(i === 0)\"\n            :post=\"p\"\n            :labels=\"labels\"\n            layout=\"horizontal\"\n            :media=\"media\"\n            :meta=\"meta\"\n            :density=\"density\"\n          />\n        </template>\n        <Grid :cols=\"cols\" class=\"gap-6\">\n          <template v-for=\"(p, i) in posts.filter((i) => !filter?.topic || i['category'] === filter?.topic)\" :key=\"p.id\">\n            <PostCard v-if=\"(i > 0)\" :post=\"p\" :labels=\"labels\" :media=\"media\" :meta=\"meta\" :density=\"density\" />\n          </template>\n        </Grid>\n      </Stack>\n      <Grid v-else\n        :cols=\"\n          (layout as string) === 'list' ? '1'\n          : fitCols(cols, (posts.filter((i) => !filter?.topic || i['category'] === filter?.topic)?.length ?? 0))\n        \"\n        class=\"w-full gap-6\"\n        data-slot=\"items\"\n      >\n        <PostCard v-for=\"p in posts.filter((i) => !filter?.topic || i['category'] === filter?.topic)\" :key=\"p.id\"\n          :post=\"p\"\n          :labels=\"labels\"\n          :layout=\"(((layout as string) === 'list') ? 'horizontal' : 'vertical')\"\n          :media=\"media\"\n          :meta=\"meta\"\n          :density=\"density\"\n        />\n      </Grid>\n    </template>\n    <Block v-if=\"((pager?.mode === 'pages') && ((posts.filter((i) => !filter?.topic || i['category'] === filter?.topic)?.length ?? 0) > 0))\"\n      tag=\"nav\"\n      :aria-label=\"\n        landmarkLabel ? uniqLabel(tpl('{0}, {1}', pager?.label, landmarkLabel))\n        : pager?.label\n      \"\n      data-slot=\"posts-pager\"\n    >\n      <Pager\n        :page=\"(pager?.page ?? 1)\"\n        :pages=\"(pager?.pages ?? 1)\"\n        :summary=\"tpl(pager?.summary, (pager?.page ?? 1), (pager?.pages ?? 1))\"\n        :previousLabel=\"(pager?.previous ?? '')\"\n        :nextLabel=\"(pager?.next ?? '')\"\n        :numbered=\"true\"\n        :pageLabel=\"pager?.pageLabel\"\n        :pageUrl=\"pager?.url\"\n        :firstUrl=\"pager?.firstUrl\"\n        @page=\"(arg: number) => emit('page', arg)\"\n      />\n    </Block>\n  </SectionFrame>\n</template>\n",
      "path": "blocks/post-grid.vue",
      "target": "blocks/post-grid.vue"
    }
  ],
  "meta": {
    "category": "content",
    "group": "blog",
    "kind": "block",
    "tags": [
      "vue",
      "block"
    ]
  },
  "name": "post-grid",
  "registryDependencies": [
    "block",
    "grid",
    "pager",
    "post-card",
    "section-frame",
    "stack",
    "switcher",
    "switcher-item",
    "utils"
  ],
  "runtime": "vue",
  "title": "Post Grid",
  "type": "registry:block"
}
