KO
베타 번역

← @core/blocks

1.0.1 → 1.1.0

8개 파일 변경 · +35 −16 · ab594ba…f1719b6

내 수정 사항을 유지하면서 이 변경을 적용하려면 프로젝트에서 실행하세요: genpm diff @core/blocks --to 1.1.0

src/lib/blocks/AGENTS.md 수정 +6 −0
@@ -26,8 +26,14 @@ posts…) to the same registry. Blocks are stored as JSON inside @core/content e
 5. Styles: import `src/lib/ui/ui.css` then `src/lib/blocks/blocks.css` in the root layout.
 6. Verify: a page with every block passes axe and has one `h1`; a block with an unknown type renders nothing and warns in dev.
 
+## Upgrading from 1.0
+The inner lists of gallery, logos and stats and the video frame now use `blk-gallery__list`, `blk-logos__list`,
+`blk-stats__list` and `blk-video__frame` (before, they repeated the section's class and its grid applied twice). If your
+CSS targeted `.blk-gallery img`, `.blk-stats dd`… switch to the `__list` / `__frame` selectors.
+
 ## Conventions
 - A new block = new file with `defineBlock` + entry in the registry. Never add `if (type === …)` to `RenderBlocks`.
+- Inner elements use `blk-<type>__<part>` (`blk-gallery__list`); never reuse `blk-<type>`, which is the section's class.
 - Use `Section` and `Heading` with `ctx.level` (items one level below); only blocks with `pageTitle` may become the `h1`.
 - Images are media ids resolved with `loadBlockMedia`; links go through the `href` schema (no `javascript:`).
 - Text in blocks is plain text; use the `rich-text` block for formatting.
src/lib/blocks/blocks-ui.test.ts 수정 +13 −0
@@ -39,6 +39,19 @@ describe('accessibility', () => {
   });
 });
 
+describe('class names', () => {
+  it('only the section carries blk-<type>: inner elements use blk-<type>__<part> (no double grid)', async () => {
+    await act(async () =>
+      root.render(h(RenderBlocks, { blocks: allBlocks, registry, media: allMedia, embeds: 'iframe', renderForm: () => h('p', null, 'form'), onSkip: () => {} })),
+    );
+    for (const section of container.querySelectorAll('section.blk')) {
+      const own = [...section.classList].find((c) => /^blk-[a-z-]+$/.test(c) && !c.includes('--'));
+      if (own) expect(section.querySelectorAll(`.${own}`).length, own).toBe(0);
+    }
+    expect(container.querySelector('.blk-gallery__list')).not.toBeNull();
+  });
+});
+
 describe('blocks editor', () => {
   const api = createAdminApi('/api/admin', async () => Response.json({ rows: [], total: 0 }));
   const render = blocksRenderer(JSON.parse(JSON.stringify(blockMeta(registry)))); // como llega al cliente
src/lib/blocks/blocks.css 수정 +11 −11
@@ -20,23 +20,23 @@
 .blk-rating { color: var(--ui-warning); margin: 0; }
 .blk-card blockquote { margin: 0.5rem 0; }
 .blk-avatar { width: 2.5rem; height: 2.5rem; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-inline-end: 0.5rem; }
-.blk-logos { display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; justify-content: center; list-style: none; padding: 0; }
-.blk-logos img { max-height: 3rem; width: auto; filter: grayscale(1); }
+.blk-logos__list { display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; justify-content: center; list-style: none; padding: 0; }
+.blk-logos__list img { max-height: 3rem; width: auto; filter: grayscale(1); }
 .blk-plan--highlighted { border-color: var(--ui-primary); border-width: 2px; }
 .blk-plan__price strong { font-size: 2rem; }
 .blk-faq__item { border-block-end: 1px solid var(--ui-border); padding-block: 0.75rem; }
 .blk-faq__item summary { cursor: pointer; font-weight: 600; }
 .blk-cta { text-align: center; }
 .blk-cta--primary { background: var(--ui-surface); border-radius: var(--ui-radius); }
-.blk-gallery { display: grid; gap: 1rem; list-style: none; padding: 0; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
-.blk-gallery figure { margin: 0; }
-.blk-gallery img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
-.blk-video { position: relative; aspect-ratio: 16 / 9; }
-.blk-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: var(--ui-radius); }
-.blk-stats { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin: 0; }
-.blk-stats div { display: flex; flex-direction: column-reverse; }
-.blk-stats dd { margin: 0; font-size: 2.5rem; font-weight: 700; }
-.blk-stats dt { color: var(--ui-muted); }
+.blk-gallery__list { display: grid; gap: 1rem; list-style: none; padding: 0; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); }
+.blk-gallery__list figure { margin: 0; }
+.blk-gallery__list img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
+.blk-video__frame { position: relative; aspect-ratio: 16 / 9; }
+.blk-video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: var(--ui-radius); }
+.blk-stats__list { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin: 0; }
+.blk-stats__list div { display: flex; flex-direction: column-reverse; }
+.blk-stats__list dd { margin: 0; font-size: 2.5rem; font-weight: 700; }
+.blk-stats__list dt { color: var(--ui-muted); }
 .blk-guarantee { text-align: center; max-width: 48rem; }
 .blk-guarantee__badge { display: inline-block; border: 2px solid var(--ui-success); color: var(--ui-success); border-radius: 999px; padding: 0.25rem 1rem; font-weight: 700; }
 .blk-rich-text--narrow { max-width: 44rem; }
src/lib/blocks/core/gallery.ts 수정 +1 −1
@@ -28,7 +28,7 @@ export const gallery = defineBlock({
       { id: ctx.id, block: 'gallery', title: data.title, ctx, label: 'Gallery' },
       h(
         'ul',
-        { className: 'blk-gallery', role: 'list' },
+        { className: 'blk-gallery__list', role: 'list' },
         data.items.map((it, i) => {
           const img = ctx.image(it.image);
           return img && h('li', { key: i }, h('figure', null, h(Img, { image: img }), it.caption && h('figcaption', null, it.caption)));
src/lib/blocks/core/logos.ts 수정 +1 −1
@@ -32,7 +32,7 @@ export const logos = defineBlock({
       { id: ctx.id, block: 'logos', title: data.title, ctx, label: 'Logos' },
       h(
         'ul',
-        { className: 'blk-logos', role: 'list' },
+        { className: 'blk-logos__list', role: 'list' },
         data.items.map((it, i) => {
           const img = ctx.image(it.image);
           const content = img ? h(Img, { image: img, alt: it.name }) : h('span', null, it.name);
src/lib/blocks/core/stats.ts 수정 +1 −1
@@ -27,7 +27,7 @@ export const stats = defineBlock({
     h(
       Section,
       { id: ctx.id, block: 'stats', title: data.title, ctx, label: 'Stats' },
-      h('dl', { className: 'blk-stats' }, data.items.map((it, i) => h('div', { key: i }, h('dt', null, it.label), h('dd', null, it.value)))),
+      h('dl', { className: 'blk-stats__list' }, data.items.map((it, i) => h('div', { key: i }, h('dt', null, it.label), h('dd', null, it.value)))),
       data.source && h('p', { className: 'blk__note' }, data.source),
     ),
 });
src/lib/blocks/core/video.ts 수정 +1 −1
@@ -43,7 +43,7 @@ export const video = defineBlock({
       ctx.embeds === 'iframe'
         ? h(
             'div',
-            { className: 'blk-video' },
+            { className: 'blk-video__frame' },
             h('iframe', { src: embedUrl(v.provider, v.id, 'iframe'), title: name, loading: 'lazy', allow: 'fullscreen; picture-in-picture', referrerPolicy: 'strict-origin-when-cross-origin', sandbox: 'allow-scripts allow-same-origin allow-presentation' }),
           )
         : h('p', null, h('a', { href: embedUrl(v.provider, v.id, 'link'), rel: 'noopener noreferrer' }, `▶ ${name}`)),
src/lib/blocks/genpm.json 수정 +1 −1
@@ -1,7 +1,7 @@
 {
   "$": 1,
   "n": "@core/blocks",
-  "v": "1.0.1",
+  "v": "1.1.0",
   "s": {
     "en": "Page builder blocks: 15 accessible sections (hero, pricing, FAQ with JSON-LD…), admin editor and registry for more",
     "es": "Bloques de página: 15 secciones accesibles (hero, precios, FAQ con JSON-LD…), editor en el admin y registro ampliable",