@jasonshimmy/custom-elements-runtime 3.0.0 → 3.1.0
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/README.md +118 -81
- package/dist/custom-elements-runtime.cjs.js +3 -3
- package/dist/custom-elements-runtime.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.es.js +77 -72
- package/dist/custom-elements-runtime.es.js.map +1 -1
- package/dist/custom-elements-runtime.jit-css.cjs.js +1 -1
- package/dist/custom-elements-runtime.jit-css.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.jit-css.es.js +25 -26
- package/dist/custom-elements-runtime.jit-css.es.js.map +1 -1
- package/dist/custom-elements-runtime.router.cjs.js +8 -8
- package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.router.es.js +134 -134
- package/dist/custom-elements-runtime.router.es.js.map +1 -1
- package/dist/custom-elements-runtime.ssr-middleware.cjs.js +2 -0
- package/dist/custom-elements-runtime.ssr-middleware.cjs.js.map +1 -0
- package/dist/custom-elements-runtime.ssr-middleware.es.js +63 -0
- package/dist/custom-elements-runtime.ssr-middleware.es.js.map +1 -0
- package/dist/custom-elements-runtime.ssr.cjs.js +3 -1
- package/dist/custom-elements-runtime.ssr.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.ssr.es.js +137 -39
- package/dist/custom-elements-runtime.ssr.es.js.map +1 -1
- package/dist/custom-elements-runtime.vite-plugin.cjs.js +1 -1
- package/dist/custom-elements-runtime.vite-plugin.cjs.js.map +1 -1
- package/dist/custom-elements-runtime.vite-plugin.es.js +81 -49
- package/dist/custom-elements-runtime.vite-plugin.es.js.map +1 -1
- package/dist/hooks-B50HhrHh.cjs +6 -0
- package/dist/hooks-B50HhrHh.cjs.map +1 -0
- package/dist/hooks-Cze3o-F7.js +1462 -0
- package/dist/hooks-Cze3o-F7.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/namespace-helpers-D4wC2-qA.js +61 -0
- package/dist/namespace-helpers-D4wC2-qA.js.map +1 -0
- package/dist/namespace-helpers-ckeEOxpR.cjs +2 -0
- package/dist/namespace-helpers-ckeEOxpR.cjs.map +1 -0
- package/dist/router/matcher.d.ts +14 -0
- package/dist/runtime/component/factory.d.ts +16 -2
- package/dist/runtime/hydration.d.ts +33 -0
- package/dist/runtime/ssr-context.d.ts +45 -0
- package/dist/runtime/types.d.ts +18 -0
- package/dist/runtime/vdom-ssr-dsd.d.ts +58 -0
- package/dist/ssr-middleware.d.ts +125 -0
- package/dist/ssr.d.ts +95 -33
- package/dist/template-compiler-Cshhqxyd.cjs +23 -0
- package/dist/template-compiler-Cshhqxyd.cjs.map +1 -0
- package/dist/{template-compiler-B5uN1EQw.js → template-compiler-DtpNsqE-.js} +1296 -1283
- package/dist/template-compiler-DtpNsqE-.js.map +1 -0
- package/dist/vite-plugin.d.ts +94 -4
- package/package.json +6 -1
- package/dist/helpers-CweFZFWU.js +0 -987
- package/dist/helpers-CweFZFWU.js.map +0 -1
- package/dist/helpers-DeWjSmOl.cjs +0 -5
- package/dist/helpers-DeWjSmOl.cjs.map +0 -1
- package/dist/hooks-BrrLKSub.cjs +0 -3
- package/dist/hooks-BrrLKSub.cjs.map +0 -1
- package/dist/hooks-DyShDHKo.js +0 -403
- package/dist/hooks-DyShDHKo.js.map +0 -1
- package/dist/namespace-helpers-CnpZ5__p.js +0 -45
- package/dist/namespace-helpers-CnpZ5__p.js.map +0 -1
- package/dist/namespace-helpers-CyIDtI97.cjs +0 -2
- package/dist/namespace-helpers-CyIDtI97.cjs.map +0 -1
- package/dist/template-compiler-B5uN1EQw.js.map +0 -1
- package/dist/template-compiler-Cx623BSB.cjs +0 -23
- package/dist/template-compiler-Cx623BSB.cjs.map +0 -1
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Vite
|
|
2
|
+
* Vite plugins for build-time JIT CSS generation and SSR configuration.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* eliminating all runtime parsing cost for projects with static class lists.
|
|
4
|
+
* Two plugins are exported:
|
|
6
5
|
*
|
|
7
|
-
*
|
|
6
|
+
* - **`cerJITCSS`** — Scans source files for utility class names and emits
|
|
7
|
+
* pre-generated CSS, eliminating all runtime parsing cost for projects with
|
|
8
|
+
* static class lists.
|
|
9
|
+
*
|
|
10
|
+
* - **`cerPlugin`** — All-in-one plugin combining `cerJITCSS` with SSR
|
|
11
|
+
* configuration. Exposes a `virtual:cer-ssr-config` module containing the
|
|
12
|
+
* resolved SSR render options so server entry files can import and use them
|
|
13
|
+
* without duplication.
|
|
14
|
+
*
|
|
15
|
+
* @example cerJITCSS only
|
|
8
16
|
* ```ts
|
|
9
17
|
* // vite.config.ts
|
|
10
18
|
* import { defineConfig } from 'vite';
|
|
@@ -20,6 +28,33 @@
|
|
|
20
28
|
* ],
|
|
21
29
|
* });
|
|
22
30
|
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example cerPlugin with SSR
|
|
33
|
+
* ```ts
|
|
34
|
+
* // vite.config.ts
|
|
35
|
+
* import { defineConfig } from 'vite';
|
|
36
|
+
* import { cerPlugin } from '@jasonshimmy/custom-elements-runtime/vite-plugin';
|
|
37
|
+
*
|
|
38
|
+
* export default defineConfig({
|
|
39
|
+
* plugins: [
|
|
40
|
+
* cerPlugin({
|
|
41
|
+
* content: ['./src/**\/*.{ts,tsx,html}'],
|
|
42
|
+
* ssr: {
|
|
43
|
+
* dsd: true,
|
|
44
|
+
* jit: { extendedColors: true },
|
|
45
|
+
* },
|
|
46
|
+
* }),
|
|
47
|
+
* ],
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* Then in your server entry:
|
|
52
|
+
* ```ts
|
|
53
|
+
* import ssrConfig from 'virtual:cer-ssr-config';
|
|
54
|
+
* import { renderToStringWithJITCSS } from '@jasonshimmy/custom-elements-runtime/ssr';
|
|
55
|
+
*
|
|
56
|
+
* const { htmlWithStyles } = renderToStringWithJITCSS(appVNode, ssrConfig);
|
|
57
|
+
* ```
|
|
23
58
|
*/
|
|
24
59
|
import type { Plugin } from 'vite';
|
|
25
60
|
import { type JITCSSOptions } from './runtime/style';
|
|
@@ -45,6 +80,61 @@ export interface CerJITCSSPluginOptions extends JITCSSOptions {
|
|
|
45
80
|
*/
|
|
46
81
|
virtualModule?: boolean;
|
|
47
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* SSR render options exposed via `virtual:cer-ssr-config`.
|
|
85
|
+
*/
|
|
86
|
+
export interface CerSSROptions {
|
|
87
|
+
/**
|
|
88
|
+
* Emit Declarative Shadow DOM output for registered custom elements.
|
|
89
|
+
* @default true
|
|
90
|
+
*/
|
|
91
|
+
dsd?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Append the DSD polyfill `<script>` for browsers without native support.
|
|
94
|
+
* @default true
|
|
95
|
+
*/
|
|
96
|
+
dsdPolyfill?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* JIT CSS options forwarded to the SSR render pass.
|
|
99
|
+
*/
|
|
100
|
+
jit?: JITCSSOptions;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Options for the combined {@link cerPlugin}.
|
|
104
|
+
*/
|
|
105
|
+
export interface CerPluginOptions extends Partial<CerJITCSSPluginOptions> {
|
|
106
|
+
/**
|
|
107
|
+
* SSR configuration. When provided, a `virtual:cer-ssr-config` module is
|
|
108
|
+
* registered so server entry files can import the resolved render options:
|
|
109
|
+
*
|
|
110
|
+
* ```ts
|
|
111
|
+
* import ssrConfig from 'virtual:cer-ssr-config';
|
|
112
|
+
* import { renderToStringWithJITCSS } from '@jasonshimmy/custom-elements-runtime/ssr';
|
|
113
|
+
*
|
|
114
|
+
* const { htmlWithStyles } = renderToStringWithJITCSS(appVNode, ssrConfig);
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
ssr?: CerSSROptions;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* All-in-one Vite plugin combining build-time JIT CSS generation with SSR
|
|
121
|
+
* configuration. Returns an array of plugins so it can be spread directly
|
|
122
|
+
* into the `plugins` array without nesting.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* // vite.config.ts
|
|
127
|
+
* export default defineConfig({
|
|
128
|
+
* plugins: [
|
|
129
|
+
* cerPlugin({
|
|
130
|
+
* content: ['./src/**\/*.{ts,html}'],
|
|
131
|
+
* ssr: { dsd: true, jit: { extendedColors: true } },
|
|
132
|
+
* }),
|
|
133
|
+
* ],
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
export declare function cerPlugin(options: CerPluginOptions): Plugin[];
|
|
48
138
|
/**
|
|
49
139
|
* Vite plugin that performs a build-time scan of source files and emits
|
|
50
140
|
* pre-generated JIT CSS as a file and/or `virtual:cer-jit-css` module.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jasonshimmy/custom-elements-runtime",
|
|
3
3
|
"description": "A powerful, modern, and lightweight runtime for creating reactive web components with TypeScript",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.1.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"web-components",
|
|
@@ -164,6 +164,11 @@
|
|
|
164
164
|
"types": "./dist/vite-plugin.d.ts",
|
|
165
165
|
"import": "./dist/custom-elements-runtime.vite-plugin.es.js",
|
|
166
166
|
"require": "./dist/custom-elements-runtime.vite-plugin.cjs.js"
|
|
167
|
+
},
|
|
168
|
+
"./ssr-middleware": {
|
|
169
|
+
"types": "./dist/ssr-middleware.d.ts",
|
|
170
|
+
"import": "./dist/custom-elements-runtime.ssr-middleware.es.js",
|
|
171
|
+
"require": "./dist/custom-elements-runtime.ssr-middleware.cjs.js"
|
|
167
172
|
}
|
|
168
173
|
},
|
|
169
174
|
"publishConfig": {
|