Skip to content

Commit e8056f0

Browse files
committed
updating packages to use npm instead of jsr.
1 parent 82ef1f2 commit e8056f0

2 files changed

Lines changed: 0 additions & 194 deletions

File tree

CHANGELOG.md

Lines changed: 0 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -4,177 +4,3 @@ All notable changes to jsx-lit will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project tries to adhere with [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7-
8-
## [1.1.0] - 2025-06-14
9-
10-
### Added
11-
- **Function Components Support**: Full support for JSX function components that return JSX
12-
- Function components are compiled to efficient call expressions with props objects
13-
- Children are automatically passed via the `children` property in props
14-
- Support for multiple children (passed as arrays) and single children (passed directly)
15-
- Zero runtime overhead with compile-time transformation
16-
17-
- **`toTag()` Utility Function**: New utility for creating dynamic tag name objects
18-
- Required for dynamic tag names to compile to static templates
19-
- Creates objects with `.tag` property that jsx-lit detects for compilation
20-
- Provides TypeScript support for HTML element tag names
21-
- Essential for proper dynamic tag usage: `const Tag = toTag('div'); <Tag.tag>Content</Tag.tag>`
22-
23-
- **Library Components**: Utility components for common rendering patterns
24-
- **`For` Component**: Declarative list rendering with optional keys and separators
25-
- Automatically uses `map`, `repeat`, or `join` directives based on props
26-
- `<For each={items} key={item => item.id}>{(item, index) => <div>{item}</div>}</For>`
27-
- Supports separators: `<For each={items} separator={<hr />}>{...}</For>`
28-
- **`Show` Component**: Type-safe conditional rendering with optional fallback
29-
- Uses lit-html's `when` directive with strong TypeScript inference
30-
- `<Show when={user}>{(user) => <div>Welcome {user.name}!</div>}</Show>`
31-
- Supports fallback: `<Show when={condition}>{trueCase} {falseCase}</Show>`
32-
- **`Choose` Component**: Multi-condition rendering similar to switch statements
33-
- Evaluates condition-output pairs in order, renders first match
34-
- `<Choose value={status}>{[condition, output]} {[condition2, output2]}</Choose>`
35-
- Supports default cases and complex conditional logic
36-
37-
### Changed
38-
- **Attribute Binding Default**: Expressions in JSX attributes now bind as HTML attributes by default instead of properties
39-
- `<input value={value} />` now compiles to `value=${value}` (attribute binding)
40-
- Use `as.prop` to force property binding: `<input value={as.prop(value)} />`
41-
- Use `as.bool` to force boolean attribute binding: `<button disabled={as.bool(flag)} />`
42-
- Alternative syntax: `<input value={prop => value} />` or `<button disabled={bool => flag} />`
43-
44-
- **Enhanced Binding Control**: Improved binding control functions for more precise control
45-
- Better TypeScript integration and error messages
46-
- More consistent compilation output
47-
48-
- **Custom Element Integration**: Improved `toJSX()` function for better type safety
49-
- Enhanced TypeScript intellisense and type checking
50-
- Better integration with dynamic tag name features
51-
52-
### Enhanced
53-
- **Dynamic Tag Names**: Enhanced support for conditional and polymorphic element types with **required `.tag` property pattern**
54-
- **Error Handling**: Better error messages and validation during compilation
55-
- **Type Safety**: Improved TypeScript definitions and JSX type support
56-
- **New `toTag()` Utility**: Function to create dynamic tag objects with proper `.tag` property structure
57-
58-
### Critical Breaking Change: Dynamic Tag Names
59-
60-
**IMPORTANT**: Dynamic tag names now require the `.tag` property pattern for proper compilation to static templates.
61-
62-
```tsx
63-
// ❌ OLD WAY - No longer works correctly
64-
const Tag = condition ? 'div' : 'span';
65-
return <Tag>Content</Tag>; // Won't compile to static templates
66-
67-
// ✅ NEW WAY - Required .tag property pattern
68-
import { toTag } from 'jsx-lit';
69-
70-
const Tag = toTag(condition ? 'div' : 'span');
71-
return <Tag.tag>Content</Tag.tag>; // Compiles to efficient static templates
72-
```
73-
74-
**Why This Change**: jsx-lit's compiler specifically looks for the `.tag` property pattern to detect and transform dynamic tags into efficient lit-html static templates. This pattern ensures optimal performance and proper compilation.
75-
76-
### Migration Guide for Dynamic Tags
77-
78-
If you were using dynamic tag names in previous versions, you need to update your code:
79-
80-
```tsx
81-
// ❌ Before v1.1.0
82-
const ElementType = condition ? 'div' : 'span';
83-
return <ElementType>Content</ElementType>;
84-
85-
// ✅ After v1.1.0 - Required pattern for proper compilation
86-
import { toTag } from 'jsx-lit';
87-
88-
const ElementType = toTag(condition ? 'div' : 'span');
89-
return <ElementType.tag>Content</ElementType.tag>;
90-
```
91-
92-
**Custom Elements with Dynamic Usage**:
93-
```tsx
94-
// ❌ Before - External variable creation
95-
import { toJSX } from 'jsx-lit';
96-
const Button = toJSX(MyButton);
97-
98-
// ✅ After - Static property in class + toTag for dynamic usage
99-
export class MyButton extends LitElement {
100-
static tagName = 'my-button';
101-
static tag = toJSX(MyButton);
102-
}
103-
104-
// For dynamic usage
105-
const ButtonTag = toTag(MyButton.tag);
106-
const InputTag = toTag(MyInput.tag);
107-
const Component = useButton ? ButtonTag : InputTag;
108-
return <Component.tag>Content</Component.tag>;
109-
```
110-
111-
### Examples
112-
113-
**Function Components (New)**:
114-
```tsx
115-
// Before: Not supported
116-
const MyButton = () => <button>Click me</button>;
117-
<MyButton /> // ❌ Error
118-
119-
// After: Full support
120-
const MyButton = ({ label, onClick }) => (
121-
<button on-click={onClick}>{label}</button>
122-
);
123-
<MyButton label="Click me" onClick={handler} /> // ✅ Works
124-
125-
// Compiles to:
126-
html`${MyButton({ label: "Click me", onClick: handler })}`
127-
```
128-
129-
**Library Components (New)**:
130-
```tsx
131-
// For component - List rendering
132-
<For each={items} key={(item) => item.id} separator={<hr />}>
133-
{(item, index) => <div>{item.name}</div>}
134-
</For>
135-
136-
// Show component - Conditional rendering
137-
<Show when={user}>
138-
{(user) => <div>Welcome {user.name}!</div>}
139-
</Show>
140-
141-
// Choose component - Multi-condition rendering
142-
<Choose value={status}>
143-
{[
144-
(status) => status === 'loading',
145-
() => <div>Loading...</div>
146-
]}
147-
{[
148-
(status) => status === 'error',
149-
(status) => <div>Error: {status}</div>
150-
]}
151-
</Choose>
152-
```
153-
154-
**Property Binding (Changed)**:
155-
```tsx
156-
// Before: Property binding by default
157-
<input value={value} /> // → .value=${value}
158-
159-
// After: Attribute binding by default
160-
<input value={value} /> // → value=${value}
161-
162-
// Use as.prop for property binding
163-
<input value={as.prop(value)} /> // → .value=${value}
164-
165-
// Alternative syntax
166-
<input value={prop => value} /> // → .value=${value}
167-
```
168-
169-
## [1.0.4] - Previous Release
170-
171-
### Features
172-
- Custom JSX compiler with zero runtime overhead
173-
- React JSX runtime support for easier migration
174-
- Vite plugin integration
175-
- TypeScript support with full type safety
176-
- Lit directive integration (classMap, styleMap, ref, etc.)
177-
- Event handler transformation (`on-*` to `@*`)
178-
- Spread syntax support
179-
- Dynamic tag names with **required `.tag` property pattern** and `toTag()` utility
180-
- Custom element integration with `toJSX()` function and static `.tag` properties

jsr.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)