lookbkdev/lookbk-skills / skills/laser-etch-hero
laser-etch-hero
VerifiedBuild a website hero where a laser engraver cuts the headline into a real plate - a vector contour pass, then a gantry raster line by line or a galvo hatching glyph by glyph - and one low raking lamp shows the cut's depth: char, smoke and a glowing front on maple, sparks and frosted metal on black anodised aluminium, or a pale frost on slate; the pointer moves the lamp. Two art-directed layouts: a maple board on a bench with the copy on a clamp bar (centred lockup), or a full-bleed anodised plate with the headline across the width (type as the effect). One self-contained HTML page plus a paste-in embed on the Motion Heroes kit v2, checked at four widths for text size, contrast and clearance, with a baked still picture if WebGL fails and a frame-exact looping 1080p MP4 that opens on the settled plate. Use for makers, engravers, workshops, tools, instruments, gifts or any product that is made, marked or personalised.
| File | Kind | Size |
|---|---|---|
| NOTICE.md | markdown | 1.1 KB |
| SKILL.md | skill md | 8.3 KB |
| TESTED.json | config | 975 B |
| assets/anodised.webp | binary | 948 B |
| assets/maple.webp | binary | 30.2 KB |
| assets/slate.webp | binary | 7.6 KB |
| examples/varde/hero.json | config | 1.3 KB |
| examples/wrenfold/hero.json | config | 1.3 KB |
| scripts/build.mjs | script | 263 B |
| scripts/check.mjs | script | 179 B |
| scripts/chrome.mjs | script | 3.6 KB |
| scripts/color.mjs | script | 1.4 KB |
| scripts/effect/effect.js | script | 43.8 KB |
| scripts/effect/effect.mjs | script | 5.5 KB |
| scripts/inline.mjs | script | 1.7 KB |
| scripts/kit/KIT.md | markdown | 13.7 KB |
| scripts/kit/build.mjs | script | 47.4 KB |
| scripts/kit/cdp.mjs | script | 5.1 KB |
| scripts/kit/check.mjs | script | 15.7 KB |
| scripts/kit/fonts.json | config | 5.4 KB |
| scripts/kit/record.mjs | script | 8.1 KB |
| scripts/kit/runtime.js | script | 22.5 KB |
| scripts/kit/shell.css | other | 18.7 KB |
| scripts/kit/three.json | config | 6.3 KB |
| scripts/markup.mjs | script | 6.2 KB |
| scripts/record.mjs | script | 255 B |
| scripts/screenshot.mjs | script | 1.8 KB |
scripts/markup.mjs
View on GitHub// A small element tree that prints as HTML or as JSX, so the static page and
// the Next.js component are built from the same markup.
//
// h('a', { class: 'pill', href: '/signup' }, 'Start free')
//
// Attributes use HTML names (class, for, stroke-width); `style` takes an
// object with camelCase keys. In `class`, a token starting with $ is a JS
// expression that only the JSX output keeps, e.g. '$sans.variable'.
const VOID = new Set([
'area',
'base',
'br',
'col',
'embed',
'hr',
'img',
'input',
'link',
'meta',
'source',
'track',
'wbr',
])
// Containers whose element children can go on their own lines: whitespace
// between block-level children never renders.
const BLOCK = new Set([
'html',
'head',
'body',
'div',
'section',
'nav',
'header',
'footer',
'main',
'article',
'aside',
'ul',
'ol',
'li',
'figure',
'details',
'form',
'svg',
'g',
'defs',
'linearGradient',
'radialGradient',
])
const INLINE = new Set([
'a',
'abbr',
'b',
'br',
'button',
'code',
'em',
'i',
'img',
'input',
'label',
'mark',
's',
'small',
'span',
'strong',
'sub',
'sup',
'svg',
'time',
'u',
])
export function h(tag, attrs, ...children) {
return {
tag,
attrs: attrs || {},
children: children
.flat(Infinity)
.filter((c) => c !== null && c !== undefined && c !== false && c !== '')
.map((c) => (typeof c === 'number' ? String(c) : c)),
}
}
// SVG shapes are written self-closed, as in JSX.
const SVG_LEAF = new Set([
'circle',
'ellipse',
'line',
'path',
'polygon',
'polyline',
'rect',
'stop',
'use',
])
const isEl = (n) => typeof n === 'object'
const pretty = (n) =>
BLOCK.has(n.tag) &&
n.children.length > 0 &&
n.children.every((c) => isEl(c) && !INLINE.has(c.tag))
const kebab = (k) => k.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)
const esc = (s) =>
String(s).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
const escAttr = (s) => esc(s).replace(/"/g, '"')
function htmlAttrs(attrs) {
let out = ''
for (const [k, v] of Object.entries(attrs)) {
if (v === false || v === null || v === undefined) continue
if (k === 'style') {
const css = Object.entries(v)
.map(([p, x]) => `${p.startsWith('--') ? p : kebab(p)}:${x}`)
.join(';')
out += ` style="${escAttr(css)}"`
} else if (k === 'class') {
const cls = String(v)
.split(/\s+/)
.filter((c) => c && !c.startsWith('$'))
.join(' ')
if (cls) out += ` class="${escAttr(cls)}"`
} else out += v === true ? ` ${k}` : ` ${k}="${escAttr(v)}"`
}
return out
}
/** The tree as indented HTML. */
export function toHtml(node, depth = 0) {
if (!isEl(node)) return esc(node)
const pad = ' '.repeat(depth)
const open = `<${node.tag}${htmlAttrs(node.attrs)}`
if (VOID.has(node.tag)) return `${open}>`
if (!node.children.length)
return SVG_LEAF.has(node.tag) ? `${open} />` : `${open}></${node.tag}>`
if (pretty(node))
return `${open}>\n${node.children.map((c) => `${pad} ${toHtml(c, depth + 1)}`).join('\n')}\n${pad}</${node.tag}>`
return `${open}>${node.children.map((c) => toHtml(c, depth + 1)).join('')}</${node.tag}>`
}
const JSX_NAMES = {
class: 'className',
for: 'htmlFor',
tabindex: 'tabIndex',
srcset: 'srcSet',
crossorigin: 'crossOrigin',
referrerpolicy: 'referrerPolicy',
fetchpriority: 'fetchPriority',
autocomplete: 'autoComplete',
enctype: 'encType',
maxlength: 'maxLength',
minlength: 'minLength',
readonly: 'readOnly',
novalidate: 'noValidate',
inputmode: 'inputMode',
spellcheck: 'spellCheck',
autofocus: 'autoFocus',
datetime: 'dateTime',
'accept-charset': 'acceptCharset',
}
const jsxName = (k) =>
JSX_NAMES[k] ??
(/^(aria|data)-/.test(k)
? k
: k.replace(/[-:]([a-z])/g, (_, c) => c.toUpperCase()))
const ident = (s) => /^[A-Za-z_$][\w$]*$/.test(s)
function jsxClass(value, css) {
const parts = String(value)
.split(/\s+/)
.filter(Boolean)
.map((c) =>
c.startsWith('$')
? c.slice(1)
: !css
? JSON.stringify(c)
: ident(c)
? `${css}.${c}`
: `${css}[${JSON.stringify(c)}]`,
)
if (!css && parts.every((p) => p.startsWith('"')))
return JSON.stringify(parts.map((p) => JSON.parse(p)).join(' '))
if (parts.length === 1) return `{${parts[0]}}`
return `{\`${parts.map((p) => (p.startsWith('"') ? JSON.parse(p) : `\${${p}}`)).join(' ')}\`}`
}
function jsxAttrs(attrs, css) {
let out = ''
for (const [k, v] of Object.entries(attrs)) {
if (v === false || v === null || v === undefined) continue
const name = jsxName(k)
if (k === 'style') {
const body = Object.entries(v)
.map(
([p, x]) =>
`${ident(p) ? p : JSON.stringify(p)}: ${typeof x === 'number' ? x : JSON.stringify(String(x))}`,
)
.join(', ')
out += ` style={{ ${body} }}`
} else if (k === 'class') out += ` className=${jsxClass(v, css)}`
else if (v === true) out += ` ${name}`
else if (typeof v === 'number') out += ` ${name}={${v}}`
else if (/["&\\\n{}]/.test(v)) out += ` ${name}={${JSON.stringify(v)}}`
else out += ` ${name}="${v}"`
}
return out
}
// JSX text that needs no escaping: no braces, angle brackets, ampersands,
// quotes or line breaks, and no space at either end (JSX trims spaces at
// line breaks and joins lines).
const plainText = (s) =>
/^[^{}<>&'"\s](?:[^{}<>&'"\n\r]*[^{}<>&'"\s])?$/.test(s)
/**
* The tree as indented JSX. `css` is the name of an imported CSS module
* object; without it, classes stay as strings.
*/
export function toJsx(node, { css, depth = 0 } = {}) {
const pad = ' '.repeat(depth)
if (!isEl(node)) return plainText(node) ? node : `{${JSON.stringify(node)}}`
const open = `<${node.tag}${jsxAttrs(node.attrs, css)}`
if (!node.children.length) return `${open} />`
const kids = node.children.map((c) => toJsx(c, { css, depth: depth + 1 }))
const one = kids.length === 1 && !isEl(node.children[0])
const line = `${open}>${kids.join('')}</${node.tag}>`
if (one && pad.length + line.length <= 100) return line
return `${open}>\n${kids.map((k) => `${pad} ${k}`).join('\n')}\n${pad}</${node.tag}>`
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |