diff --git a/CHANGELOG.md b/CHANGELOG.md index fd4d56b7..9b29db33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,46 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.0](https://github.com/TrigenSoftware/nano_kit/compare/v1.0.0...v1.1.0) (2026-08-03) + +### ✨ Highlights + +#### Self-closing tags in rich text (`@nano_kit/intl`) + +`rich` (and `mapTags`) now understand self-closing tags like `
` and `
` — handy for line breaks and other void elements in translations. Handlers for such tags are called with empty chunks. Unknown self-closing tags are still stripped as markup. + +```tsx +const [$t] = messages('pages', { + sticker: rich({ + br: () => '\n' + }) +}) + +// 'First line
second line' → ['First line', '\n', 'second line'] +``` + +#### Rich tag handlers receive an unique index (`@nano_kit/intl`) + +Every tag handler now gets an unique index as the second argument — use it as a `key` for framework nodes: + +```tsx +const [$t] = messages('pages', { + sticker: rich({ + title: (chunks, i) => {chunks}, + br: (_, i) =>
+ }) +}) +``` + +No more `key` warnings and `Children.toArray(t.sticker)` workarounds in React. + +Bonus: `mapTags` is now reentrant — nested calls from tag handlers no longer clobber the outer call's parsing state. + +### Features + +* **intl:** pass unique index to rich tag handlers to use as framework key ([#187](https://github.com/TrigenSoftware/nano_kit/issues/187)) ([5b4008b](https://github.com/TrigenSoftware/nano_kit/commit/5b4008b2bba8196a66aa5e30e49bde84783cc2a6)) +* **intl:** support self-closing tags in rich-text formatter ([#185](https://github.com/TrigenSoftware/nano_kit/issues/185)) ([fa4fcb8](https://github.com/TrigenSoftware/nano_kit/commit/fa4fcb8e64b5afafd1f407328f72f7bf32c3d384)) + ## [1.0.0](https://github.com/TrigenSoftware/nano_kit/compare/v1.0.0-alpha.1...v1.0.0) (2026-07-22) ### Nano Kit 1.0 🎉 diff --git a/package.json b/package.json index fdb39ee2..3a52a2af 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "nano_kit", "type": "module", "private": true, - "version": "1.0.0", + "version": "1.1.0", "description": "A small Direct DOM library for creating user interfaces.", "author": "dangreen", "license": "MIT", diff --git a/packages/intl/CHANGELOG.md b/packages/intl/CHANGELOG.md index c5d35b25..d8fe79ca 100644 --- a/packages/intl/CHANGELOG.md +++ b/packages/intl/CHANGELOG.md @@ -3,6 +3,46 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.0](https://github.com/TrigenSoftware/nano_kit/compare/v1.0.0...v1.1.0) (2026-08-03) + +### ✨ Highlights + +#### Self-closing tags in rich text (`@nano_kit/intl`) + +`rich` (and `mapTags`) now understand self-closing tags like `
` and `
` — handy for line breaks and other void elements in translations. Handlers for such tags are called with empty chunks. Unknown self-closing tags are still stripped as markup. + +```tsx +const [$t] = messages('pages', { + sticker: rich({ + br: () => '\n' + }) +}) + +// 'First line
second line' → ['First line', '\n', 'second line'] +``` + +#### Rich tag handlers receive an unique index (`@nano_kit/intl`) + +Every tag handler now gets an unique index as the second argument — use it as a `key` for framework nodes: + +```tsx +const [$t] = messages('pages', { + sticker: rich({ + title: (chunks, i) => {chunks}, + br: (_, i) =>
+ }) +}) +``` + +No more `key` warnings and `Children.toArray(t.sticker)` workarounds in React. + +Bonus: `mapTags` is now reentrant — nested calls from tag handlers no longer clobber the outer call's parsing state. + +### Features + +* pass unique index to rich tag handlers to use as framework key ([#187](https://github.com/TrigenSoftware/nano_kit/issues/187)) ([5b4008b](https://github.com/TrigenSoftware/nano_kit/commit/5b4008b2bba8196a66aa5e30e49bde84783cc2a6)) +* support self-closing tags in rich-text formatter ([#185](https://github.com/TrigenSoftware/nano_kit/issues/185)) ([fa4fcb8](https://github.com/TrigenSoftware/nano_kit/commit/fa4fcb8e64b5afafd1f407328f72f7bf32c3d384)) + ## [1.0.0](https://github.com/TrigenSoftware/nano_kit/compare/v1.0.0-alpha.1...v1.0.0) (2026-07-22) ### Nano Kit 1.0 🎉 diff --git a/packages/intl/package.json b/packages/intl/package.json index c83fcd12..96b895ae 100644 --- a/packages/intl/package.json +++ b/packages/intl/package.json @@ -1,7 +1,7 @@ { "name": "@nano_kit/intl", "type": "module", - "version": "1.0.0", + "version": "1.1.0", "description": "A lightweight internationalization library for Nano Kit applications.", "author": "dangreen", "license": "MIT",