@jasonshimmy/custom-elements-runtime 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +93 -5
- package/dist/custom-elements-runtime.cjs.js +19 -19
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +2811 -1953
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.umd.js +18 -18
- package/dist/custom-elements-runtime.umd.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/runtime/component.d.ts +10 -10
- package/dist/runtime/event-manager.d.ts +9 -23
- package/dist/runtime/helpers.d.ts +4 -0
- package/dist/runtime/hooks.d.ts +5 -2
- package/dist/runtime/reactive.d.ts +1 -4
- package/dist/runtime/scheduler.d.ts +0 -4
- package/dist/runtime/style.d.ts +1 -1
- package/dist/runtime/transition-utils.d.ts +12 -0
- package/dist/runtime/types.d.ts +2 -0
- package/dist/runtime/vdom-model-helpers.d.ts +28 -0
- package/dist/runtime/vdom.d.ts +1 -1
- package/dist/transitions.d.ts +240 -0
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jason Shimkoski
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://patreon.com/jshimkoski)
|
|
4
4
|
|
|
5
|
-
> **
|
|
5
|
+
> **The Complete Web Components Framework**
|
|
6
6
|
|
|
7
7
|
Build modern components with strict TypeScript, zero dependencies, and a clean functional API. Designed for speed, standards compliance, and productivity.
|
|
8
8
|
|
|
@@ -24,10 +24,11 @@ Build modern components with strict TypeScript, zero dependencies, and a clean f
|
|
|
24
24
|
1. **Install:** `npm install @jasonshimmy/custom-elements-runtime`
|
|
25
25
|
2. **Create a Component:**
|
|
26
26
|
```ts
|
|
27
|
-
import { component, ref, html, useEmit } from '@jasonshimmy/custom-elements-runtime';
|
|
27
|
+
import { component, ref, html, useEmit, useProps } from '@jasonshimmy/custom-elements-runtime';
|
|
28
28
|
|
|
29
|
-
component('my-counter', (
|
|
30
|
-
const
|
|
29
|
+
component('my-counter', () => {
|
|
30
|
+
const props = useProps({ initialCount: 0 });
|
|
31
|
+
const count = ref(props.initialCount);
|
|
31
32
|
const emit = useEmit();
|
|
32
33
|
|
|
33
34
|
const handleClick = () => {
|
|
@@ -61,6 +62,83 @@ component('my-counter', ({ initialCount = 0 }) => {
|
|
|
61
62
|
```
|
|
62
63
|
4. **Enjoy instant reactivity and type safety!**
|
|
63
64
|
|
|
65
|
+
## 📦 Complete API Reference
|
|
66
|
+
|
|
67
|
+
### Core API
|
|
68
|
+
```ts
|
|
69
|
+
import {
|
|
70
|
+
// Component Creation
|
|
71
|
+
component,
|
|
72
|
+
|
|
73
|
+
// Template & Styling
|
|
74
|
+
html,
|
|
75
|
+
css,
|
|
76
|
+
|
|
77
|
+
// Reactive State
|
|
78
|
+
ref,
|
|
79
|
+
computed,
|
|
80
|
+
watch,
|
|
81
|
+
|
|
82
|
+
// Hooks
|
|
83
|
+
useProps,
|
|
84
|
+
useEmit,
|
|
85
|
+
useOnConnected,
|
|
86
|
+
useOnDisconnected,
|
|
87
|
+
useOnAttributeChanged,
|
|
88
|
+
useOnError,
|
|
89
|
+
useStyle,
|
|
90
|
+
|
|
91
|
+
// Directives
|
|
92
|
+
when,
|
|
93
|
+
each,
|
|
94
|
+
match,
|
|
95
|
+
anchorBlock,
|
|
96
|
+
|
|
97
|
+
// Directive Enhancements
|
|
98
|
+
unless,
|
|
99
|
+
whenEmpty,
|
|
100
|
+
whenNotEmpty,
|
|
101
|
+
eachWhere,
|
|
102
|
+
switchOnLength,
|
|
103
|
+
eachGroup,
|
|
104
|
+
eachPage,
|
|
105
|
+
switchOnPromise,
|
|
106
|
+
whenMedia,
|
|
107
|
+
responsive,
|
|
108
|
+
mediaVariants,
|
|
109
|
+
responsiveOrder,
|
|
110
|
+
|
|
111
|
+
// Transitions
|
|
112
|
+
Transition,
|
|
113
|
+
TransitionGroup,
|
|
114
|
+
transitionPresets,
|
|
115
|
+
createTransitionPreset,
|
|
116
|
+
getTransitionStyleSheet,
|
|
117
|
+
|
|
118
|
+
// Event Bus
|
|
119
|
+
eventBus,
|
|
120
|
+
emit, // Shorthand for eventBus.emit
|
|
121
|
+
on, // Shorthand for eventBus.on
|
|
122
|
+
off, // Shorthand for eventBus.off
|
|
123
|
+
once, // Shorthand for eventBus.once
|
|
124
|
+
listen, // DOM event listener wrapper
|
|
125
|
+
|
|
126
|
+
// Store
|
|
127
|
+
createStore,
|
|
128
|
+
|
|
129
|
+
// Router
|
|
130
|
+
useRouter,
|
|
131
|
+
initRouter,
|
|
132
|
+
matchRoute,
|
|
133
|
+
matchRouteSSR,
|
|
134
|
+
parseQuery,
|
|
135
|
+
|
|
136
|
+
// SSR & Types
|
|
137
|
+
renderToString,
|
|
138
|
+
VNode,
|
|
139
|
+
} from '@jasonshimmy/custom-elements-runtime';
|
|
140
|
+
```
|
|
141
|
+
|
|
64
142
|
## 📖 Documentation Index
|
|
65
143
|
|
|
66
144
|
Explore the complete documentation for every runtime feature:
|
|
@@ -71,9 +149,19 @@ Explore the complete documentation for every runtime feature:
|
|
|
71
149
|
### 🏗️ **Core Features**
|
|
72
150
|
- [🧩 Template](./docs/template.md) - Template syntax and html function
|
|
73
151
|
- [🧭 Directives](./docs/directives.md) - Conditional rendering with `when`, `each`, and `match`
|
|
74
|
-
- [🛠️ Directive Enhancements](./docs/directive-enhancements.md) - Advanced directive utilities
|
|
152
|
+
- [🛠️ Directive Enhancements](./docs/directive-enhancements.md) - Advanced directive utilities:
|
|
153
|
+
- `unless` - Inverse of `when`
|
|
154
|
+
- `whenEmpty` / `whenNotEmpty` - Collection checks
|
|
155
|
+
- `eachWhere` - Filtered iteration
|
|
156
|
+
- `switchOnLength` - Render based on array length
|
|
157
|
+
- `eachGroup` - Group and render items
|
|
158
|
+
- `eachPage` - Pagination support
|
|
159
|
+
- `switchOnPromise` - Async state rendering
|
|
160
|
+
- `whenMedia` - Media query responsive rendering
|
|
161
|
+
- `responsive` - Responsive utilities
|
|
75
162
|
- [🔗 Bindings](./docs/bindings.md) - Data binding with `:prop`, `@event`, `:model`, `:class`, `:style`
|
|
76
163
|
- [🔔 Events Deep Dive](./docs/events-deep-dive.md) - Custom event emission and handling patterns
|
|
164
|
+
- [🎬 Transitions Guide](./docs/transitions.md) - Animation and transition effects
|
|
77
165
|
|
|
78
166
|
### 🎨 **Styling**
|
|
79
167
|
- [🎨 JIT CSS](./docs/jit-css.md) - On-demand utility-first styling system
|