- Add 72 missing HTML and SVG elements to the remote-dom component registry (48 HTML + 24 SVG), bringing the total from 47 to 119 supported elements - HTML additions include semantic inline text (b, i, u, s, mark, sub, sup, kbd, etc.), description lists, ruby annotations, structural elements (figure, details, dialog), and form utilities (fieldset, progress, meter, optgroup) - SVG additions include containers (svg, g, defs), shapes (path, circle, rect, line, polygon), text (text, tspan), gradients (linearGradient, radialGradient, stop), and utilities (clipPath, mask, foreignObject, marker) - Add htmlTag override to support SVG elements with camelCase names (e.g. clipPath, foreignObject) while keeping custom element tags lowercase per the Web Components spec
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { z } from 'zod';
|
|
|
|
export const PropertySchemaZ = z.object({
|
|
type: z.enum(['string', 'number', 'boolean']),
|
|
optional: z.boolean(),
|
|
});
|
|
|
|
export const HtmlElementConfigZ = z.object({
|
|
tag: z.string().regex(/^html-[a-z0-9]+$/, 'Tag must start with "html-"'),
|
|
name: z
|
|
.string()
|
|
.regex(/^Html[A-Z]/, 'Name must be PascalCase starting with Html'),
|
|
properties: z.record(z.string(), PropertySchemaZ),
|
|
events: z.array(z.string()).optional(),
|
|
htmlTag: z.string().optional(),
|
|
});
|
|
|
|
export const HtmlElementConfigArrayZ = z.array(HtmlElementConfigZ);
|
|
|
|
export const ComponentSchemaZ = z.object({
|
|
name: z.string().min(1),
|
|
customElementName: z.string().min(1),
|
|
properties: z.record(z.string(), PropertySchemaZ),
|
|
events: z.array(z.string()).readonly(),
|
|
htmlTag: z.string().optional(),
|
|
customHostRenderer: z.string().optional(),
|
|
customHostRendererPath: z.string().optional(),
|
|
});
|
|
|
|
export type PropertySchema = z.infer<typeof PropertySchemaZ>;
|
|
export type HtmlElementConfig = z.infer<typeof HtmlElementConfigZ>;
|
|
export type ComponentSchema = z.infer<typeof ComponentSchemaZ>;
|