chore(html): swap errors.Is for core.Is in codegen CLI, document WASM size guard-rails
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

- cmd/codegen/main.go: drop "errors" stdlib import, use core.Is per Core convention
  (non-WASM path).
- layout.go, path.go, responsive.go: add header notes documenting why these files
  use stdlib (errors/strings/strconv) instead of core — RFC §7 caps WASM at
  3.5 MB raw / 1 MB gzip, and dappco.re/go/core transitively pulls fmt/os/log.
- README.md, docs/index.md: migrate stale forge.lthn.ai/core/go-html module path
  to canonical dappco.re/go/core/html; refresh dependency diagram and Go version.

All spec features are already implemented; this is spec-parity maintenance.

Verified: go build ./..., go vet ./..., go test ./... all green (WASM size test
back to 2.12 MB raw / 630 KB gzip after short-lived core-import regression).

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Snider 2026-04-14 20:01:28 +01:00
parent 286731e398
commit 09b48e00dc
6 changed files with 31 additions and 13 deletions

View file

@ -1,4 +1,4 @@
[![Go Reference](https://pkg.go.dev/badge/forge.lthn.ai/core/go-html.svg)](https://pkg.go.dev/forge.lthn.ai/core/go-html)
[![Go Reference](https://pkg.go.dev/badge/dappco.re/go/core/html.svg)](https://pkg.go.dev/dappco.re/go/core/html)
[![License: EUPL-1.2](https://img.shields.io/badge/License-EUPL--1.2-blue.svg)](LICENSE.md)
[![Go Version](https://img.shields.io/badge/Go-1.26-00ADD8?style=flat&logo=go)](go.mod)
@ -6,14 +6,14 @@
HLCRF DOM compositor with grammar pipeline integration for server-side HTML generation and optional WASM client rendering. Provides a type-safe node tree (El, Text, Raw, If, Each, Switch, Entitled, AriaLabel, AltText), a five-slot Header/Left/Content/Right/Footer layout compositor with deterministic `data-block` path IDs and ARIA roles, a responsive multi-variant wrapper, a server-side grammar pipeline (StripTags, GrammarImprint via go-i18n reversal, CompareVariants), a build-time Web Component codegen CLI, and a WASM module (2.90 MB raw, 842 KB gzip) exposing `renderToString()`.
**Module**: `forge.lthn.ai/core/go-html`
**Module**: `dappco.re/go/core/html`
**Licence**: EUPL-1.2
**Language**: Go 1.25
**Language**: Go 1.26
## Quick Start
```go
import "forge.lthn.ai/core/go-html"
import html "dappco.re/go/core/html"
page := html.NewLayout("HCF").
H(html.El("nav", html.Text("i18n.label.navigation"))).

View file

@ -12,7 +12,6 @@ package main
import (
"context"
"errors"
"flag"
goio "io"
"os"
@ -92,7 +91,7 @@ func runDaemon(ctx context.Context, inputPath, outputPath string, emitTypes bool
select {
case <-ctx.Done():
if errors.Is(ctx.Err(), context.Canceled) {
if core.Is(ctx.Err(), context.Canceled) {
return nil
}
return ctx.Err()

View file

@ -7,7 +7,7 @@ description: HLCRF DOM compositor with grammar pipeline integration for type-saf
`go-html` is a pure-Go library for building HTML documents as type-safe node trees and rendering them to string output. It provides a five-slot layout compositor (Header, Left, Content, Right, Footer -- abbreviated HLCRF), a responsive multi-variant wrapper, a server-side grammar analysis pipeline, a Web Component code generator, and an optional WASM module for client-side rendering.
**Module path:** `forge.lthn.ai/core/go-html`
**Module path:** `dappco.re/go/core/html`
**Go version:** 1.26
**Licence:** EUPL-1.2
@ -16,7 +16,7 @@ description: HLCRF DOM compositor with grammar pipeline integration for type-saf
```go
package main
import html "forge.lthn.ai/core/go-html"
import html "dappco.re/go/core/html"
func main() {
page := html.NewLayout("HCF").
@ -65,14 +65,17 @@ This builds a Header-Content-Footer layout with semantic HTML elements (`<header
## Dependencies
```
forge.lthn.ai/core/go-html
forge.lthn.ai/core/go-i18n (direct, all builds)
forge.lthn.ai/core/go-inference (indirect, via go-i18n)
forge.lthn.ai/core/go-i18n/reversal (server builds only, !js)
dappco.re/go/core/html
dappco.re/go/core (direct, server builds only, !js)
dappco.re/go/core/i18n (direct, all builds)
forge.lthn.ai/core/go-inference (indirect, via core/i18n)
dappco.re/go/core/i18n/reversal (server builds only, !js)
dappco.re/go/core/io (direct, server builds only, !js)
dappco.re/go/core/log (direct, server builds only, !js)
github.com/stretchr/testify (test only)
```
Both `go-i18n` and `go-inference` must be present on the local filesystem. The `go.mod` uses `replace` directives pointing to sibling directories (`../go-i18n`, `../go-inference`).
WASM-linked files (layout.go, node.go, path.go, responsive.go, render.go, context.go, text_builder_js.go, text_translate_js.go) deliberately avoid `dappco.re/go/core` to respect the RFC §7 WASM size budget — core transitively pulls in fmt/os/log.
## Further Reading

View file

@ -1,5 +1,10 @@
package html
// Note: this file is WASM-linked. Per RFC §7 the WASM build must stay under the
// 3.5 MB raw / 1 MB gzip size budget, so we deliberately avoid importing
// dappco.re/go/core here — it transitively pulls in fmt/os/log (~500 KB+).
// The stdlib errors package is safe for WASM.
import "errors"
// Compile-time interface check.
@ -7,6 +12,7 @@ var _ Node = (*Layout)(nil)
// ErrInvalidLayoutVariant reports that a layout variant string contains at least
// one unrecognised slot character.
// Usage example: if errors.Is(err, html.ErrInvalidLayoutVariant) { ... }
var ErrInvalidLayoutVariant = errors.New("html: invalid layout variant")
// slotMeta holds the semantic HTML mapping for each HLCRF slot.

View file

@ -1,5 +1,10 @@
package html
// Note: this file is WASM-linked. Per RFC §7 the WASM build must stay under the
// 3.5 MB raw / 1 MB gzip size budget, so we deliberately avoid importing
// dappco.re/go/core here — it transitively pulls in fmt/os/log (~500 KB+).
// stdlib strings is safe for WASM.
import "strings"
// ParseBlockID extracts the slot sequence from a data-block ID.

View file

@ -1,5 +1,10 @@
package html
// Note: this file is WASM-linked. Per RFC §7 the WASM build must stay under the
// 3.5 MB raw / 1 MB gzip size budget, so we deliberately avoid importing
// dappco.re/go/core here — it transitively pulls in fmt/os/log (~500 KB+).
// The stdlib strings/strconv primitives are safe for WASM.
import (
"strconv"
"strings"