@stencil/core 2.10.0 → 2.12.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/cli/index.cjs +25 -4
- package/cli/index.js +25 -4
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +527 -715
- package/compiler/stencil.min.js +2 -2
- package/dependencies.json +1 -1
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +2 -2
- package/internal/app-data/package.json +1 -1
- package/internal/client/css-shim.js +1 -1
- package/internal/client/dom.js +1 -1
- package/internal/client/index.js +11 -7
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/patch-esm.js +1 -1
- package/internal/client/shadow-css.js +9 -10
- package/internal/hydrate/index.js +2 -1
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/shadow-css.js +59 -62
- package/internal/package.json +1 -1
- package/internal/stencil-public-compiler.d.ts +1 -1
- package/internal/stencil-public-runtime.d.ts +6 -4
- package/internal/testing/index.js +15 -13
- package/internal/testing/package.json +1 -1
- package/internal/testing/shadow-css.js +54 -57
- package/mock-doc/index.cjs +5 -2
- package/mock-doc/index.js +5 -2
- package/mock-doc/package.json +1 -1
- package/package.json +12 -7
- package/readme.md +52 -85
- package/screenshot/package.json +1 -1
- package/sys/node/autoprefixer.js +2 -2
- package/sys/node/index.js +14 -13
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +79 -71
- package/testing/jest/jest-environment.d.ts +1 -0
- package/testing/jest/jest-preprocessor.d.ts +56 -8
- package/testing/jest-preset.js +5 -0
- package/testing/package.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.12.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./internal/stencil-core/index.cjs",
|
|
6
6
|
"module": "./internal/stencil-core/index.js",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"test": "jest --coverage",
|
|
45
45
|
"test.analysis": "cd test && npm run build",
|
|
46
46
|
"test.dist": "node scripts --validate-build",
|
|
47
|
-
"
|
|
47
|
+
"//": "TODO(STENCIL-71): Add 'npm test &&' to the 'test.end-to-end' test",
|
|
48
|
+
"test.end-to-end": "cd test/end-to-end && npm ci && npm run test.dist",
|
|
48
49
|
"test.jest": "jest",
|
|
49
50
|
"test.karma": "cd test/karma && npm ci && npm run karma",
|
|
50
51
|
"test.karma.prod": "cd test/karma && npm ci && npm run karma.prod",
|
|
@@ -98,9 +99,9 @@
|
|
|
98
99
|
"graceful-fs": "~4.2.6",
|
|
99
100
|
"hash.js": "^1.1.7",
|
|
100
101
|
"inquirer": "^7.3.3",
|
|
101
|
-
"jest": "^
|
|
102
|
-
"jest-cli": "^
|
|
103
|
-
"jest-environment-node": "^
|
|
102
|
+
"jest": "^27.4.3",
|
|
103
|
+
"jest-cli": "^27.4.3",
|
|
104
|
+
"jest-environment-node": "^27.4.2",
|
|
104
105
|
"listr": "^0.14.3",
|
|
105
106
|
"magic-string": "^0.25.7",
|
|
106
107
|
"merge-source-map": "^1.1.0",
|
|
@@ -113,7 +114,7 @@
|
|
|
113
114
|
"path-browserify": "^1.0.1",
|
|
114
115
|
"pixelmatch": "4.0.2",
|
|
115
116
|
"postcss": "^8.2.8",
|
|
116
|
-
"prettier": "2.
|
|
117
|
+
"prettier": "2.5.1",
|
|
117
118
|
"prompts": "2.4.0",
|
|
118
119
|
"puppeteer": "~10.0.0",
|
|
119
120
|
"rollup": "2.42.3",
|
|
@@ -148,5 +149,9 @@
|
|
|
148
149
|
"pwa",
|
|
149
150
|
"progressive web app"
|
|
150
151
|
],
|
|
151
|
-
"prettier": "@ionic/prettier-config"
|
|
152
|
+
"prettier": "@ionic/prettier-config",
|
|
153
|
+
"volta": {
|
|
154
|
+
"node": "16.13.0",
|
|
155
|
+
"npm": "8.1.1"
|
|
156
|
+
}
|
|
152
157
|
}
|
package/readme.md
CHANGED
|
@@ -1,34 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="#">
|
|
3
|
+
<img alt="stencil-logo" src="https://github.com/ionic-team/stencil/blob/main/stencil-logo.png" width="60">
|
|
4
|
+
</a>
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<h1 align="center">
|
|
8
|
+
Stencil
|
|
9
|
+
</h1>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
A compiler for generating <a href="https://www.webcomponents.org/introduction">Web Components</a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://www.npmjs.com/package/@stencil/core">
|
|
17
|
+
<img src="https://img.shields.io/npm/v/@stencil/core.svg" alt="StencilJS is released under the MIT license." /></a>
|
|
18
|
+
<a href="https://github.com/ionic-team/stencil/blob/main/LICENSE.md">
|
|
19
|
+
<img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="StencilJS is released under the MIT license." />
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://github.com/ionic-team/stencil/blob/main/.github/CONTRIBUTING.md">
|
|
22
|
+
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome!" />
|
|
23
|
+
</a>
|
|
24
|
+
<a href="https://twitter.com/stenciljs">
|
|
25
|
+
<img src="https://img.shields.io/twitter/follow/stenciljs.svg?label=Follow%20@stenciljs" alt="Follow @stenciljs">
|
|
26
|
+
</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<h2 align="center">
|
|
30
|
+
<a href="https://stenciljs.com/docs/getting-started#starting-a-new-project">Quick Start</a>
|
|
31
|
+
<span> · </span>
|
|
32
|
+
<a href="https://stenciljs.com/docs/introduction">Documentation</a>
|
|
33
|
+
<span> · </span>
|
|
34
|
+
<a href="https://github.com/ionic-team/stencil/blob/main/.github/CONTRIBUTING.md">Contribute</a>
|
|
35
|
+
<span> · </span>
|
|
36
|
+
<a href="https://ionicframework.com/blog/tag/stencil/">Blog</a>
|
|
37
|
+
<br />
|
|
38
|
+
Community:
|
|
39
|
+
<a href="https://stencil-worldwide.herokuapp.com">Slack</a>
|
|
40
|
+
<span> · </span>
|
|
41
|
+
<a href="https://forum.ionicframework.com/c/stencil/21/">Forums</a>
|
|
42
|
+
<span> · </span>
|
|
43
|
+
<a href="https://twitter.com/stenciljs">Twitter</a>
|
|
44
|
+
</h2>
|
|
45
|
+
|
|
46
|
+
[Stencil](https://stenciljs.com/) is a simple compiler for generating Web Components and static site generated progressive web apps (PWA). Stencil was built by the [Ionic](https://ionic.io/) team for its next generation of performant mobile and desktop Web Components.
|
|
47
|
+
|
|
48
|
+
Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. It combines TypeScript, JSX, an asynchronous rendering pipeline to ensure smooth running animations and lazy-loading, to generate 100% standards-based Web Components that run on both [modern browsers and legacy browsers](https://stenciljs.com/docs/browser-support).
|
|
15
49
|
|
|
16
50
|
Stencil components are just Web Components, so they work in any major framework or with no framework at all. In many cases, Stencil can be used as a drop in replacement for traditional frontend frameworks given the capabilities now available in the browser, though using it as such is certainly not required.
|
|
17
51
|
|
|
18
52
|
Stencil also enables a number of key capabilities on top of Web Components, in particular Server Side Rendering (SSR) without the need to run a headless browser, pre-rendering, and objects-as-properties (instead of just strings).
|
|
19
53
|
|
|
20
|
-
*Note: Stencil and [Ionic Framework](https://ionicframework.com/) are completely independent projects. Stencil does not prescribe any specific UI framework, but Ionic Framework is the largest user of Stencil (today!)*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
## Why Stencil?
|
|
24
|
-
|
|
25
|
-
Stencil is a new approach to a popular idea: building fast and feature-rich apps in the browser. Stencil was created to take advantage of major new capabilities available natively in the browser, such as Custom Elements v1, enabling developers to ship far less code and build faster apps that are compatible with any and all frameworks.
|
|
26
|
-
|
|
27
|
-
Stencil is also a solution to organizations and library authors struggling to build reusable components across a diverse spectrum of frontend frameworks, each with their own component system. Stencil components work in React, Vue, Angular and Ember, as well as they work with jQuery or with no framework at all, because they are just plain HTML elements.
|
|
28
|
-
|
|
29
|
-
Compared to using Custom Elements directly, inside of every Stencil component is an efficient JSX rendering system, asynchronous rendering pipeline to prevent jank, and more. This makes Stencil components more performant while maintaining full compatibility with plain Custom Elements. Think of Stencil as creating pre-baked Custom Elements as if you wrote in those features yourself.
|
|
30
|
-
|
|
31
|
-
|
|
32
54
|
## Getting Started
|
|
33
55
|
|
|
34
56
|
To create a new project using an interactive cli, run:
|
|
@@ -43,7 +65,6 @@ To start developing your new Stencil project, run:
|
|
|
43
65
|
npm start
|
|
44
66
|
```
|
|
45
67
|
|
|
46
|
-
|
|
47
68
|
## Creating components
|
|
48
69
|
|
|
49
70
|
Stencil components are TypeScript classes with decorator metadata. The decorators themselves are purely build-time annotations so the compiler can read metadata about each component, and removed entirely for smaller efficient components.
|
|
@@ -60,7 +81,6 @@ import { Component, Prop, h } from '@stencil/core';
|
|
|
60
81
|
export class MyComponent {
|
|
61
82
|
|
|
62
83
|
@Prop() first: string;
|
|
63
|
-
|
|
64
84
|
@Prop() last: string;
|
|
65
85
|
|
|
66
86
|
render() {
|
|
@@ -73,66 +93,13 @@ export class MyComponent {
|
|
|
73
93
|
}
|
|
74
94
|
```
|
|
75
95
|
|
|
76
|
-
Note: the `.tsx` extension is required, as this is the standard for TypeScript classes that use JSX.
|
|
77
|
-
|
|
78
96
|
To use this component, just use it like any other HTML element:
|
|
79
97
|
|
|
80
98
|
```html
|
|
81
99
|
<my-component first="Stencil" last="JS"></my-component>
|
|
82
100
|
```
|
|
83
101
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
### Components
|
|
90
|
-
|
|
91
|
-
| Decorator | Description |
|
|
92
|
-
| -------------- | --- |
|
|
93
|
-
| `@Component()` | Indicate a class is a Stencil component. |
|
|
94
|
-
| | |
|
|
95
|
-
| `@Prop()` | Creates a property that will exist on the element and be data-bound to this component. |
|
|
96
|
-
| `@State()` | Creates a local state variable that will not be placed on the element. |
|
|
97
|
-
| `@Method()` | Expose specific methods to be publicly accessible. |
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
## Why "Stencil?"
|
|
101
|
-
|
|
102
|
-
A Stencil is a tool artists use for drawing perfect shapes easily. We want Stencil to be a similar tool for web developers: a tool that helps web developers build powerful Web Components and apps that use them, but without creating non-standard runtime requirements.
|
|
103
|
-
|
|
104
|
-
Stencil is a tool developers use to create Web Components with some powerful features baked in, but it gets out of the way at runtime.
|
|
105
|
-
|
|
106
|
-
- [Using Web Components in Ionic - Polymer Summit](https://youtu.be/UfD-k7aHkQE)
|
|
107
|
-
- [Stencil: A built-time approach to the web - JSConf EU](https://youtu.be/M1F81V-NhP0)
|
|
108
|
-
- [Architecting A Component Compiler - dotJS](https://youtu.be/RZ6MLELGsD8)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
## Related
|
|
112
|
-
|
|
113
|
-
- [Stencil Documentation](https://stenciljs.com/)
|
|
114
|
-
- [Stencil Worldwide Slack](https://stencil-worldwide.herokuapp.com)
|
|
115
|
-
- [Ionic](https://ionicframework.com/)
|
|
116
|
-
- [Ionic Worldwide Slack](http://ionicworldwide.herokuapp.com/)
|
|
117
|
-
- [Ionicons](http://ionicons.com/)
|
|
118
|
-
- [Capacitor](https://capacitorjs.com/)
|
|
119
|
-
|
|
120
|
-
## Testing powered by
|
|
121
|
-
<a target="_blank" href="https://www.browserstack.com/"><img width="200" src="https://www.browserstack.com/images/layout/browserstack-logo-600x315.png"></a><br>
|
|
122
|
-
[BrowserStack Open-Source Program](https://www.browserstack.com/open-source)
|
|
123
|
-
|
|
124
|
-
## License
|
|
125
|
-
|
|
126
|
-
- [MIT](https://raw.githubusercontent.com/ionic-team/stencil/main/LICENSE.md)
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
[npm-badge]: https://img.shields.io/npm/v/@stencil/core.svg
|
|
130
|
-
[npm-badge-url]: https://www.npmjs.com/package/@stencil/core
|
|
131
|
-
[npm-license]: https://img.shields.io/npm/l/@stencil/core.svg
|
|
132
|
-
[npm-license-url]: https://github.com/ionic-team/stencil/blob/main/LICENSE
|
|
133
|
-
[circle-badge]: https://circleci.com/gh/ionic-team/stencil.svg?style=shield
|
|
134
|
-
[circle-badge-url]: https://circleci.com/gh/ionic-team/stencil
|
|
135
|
-
[browserstack-badge]: https://www.browserstack.com/automate/badge.svg?badge_key=WVNVbkRJdDBJQnBEMzZuWUdlMEZuTjlPUm9sOHZsSVNkUlJTRkJVQkx0ST0tLTFhbk5jRUNEVWxJL1J0SVR0WUFndnc9PQ==--90c84981a2ed2ede760ca48fbfc3fdd5b71d3e5e
|
|
136
|
-
[browserstack-badge-url]: https://www.browserstack.com/automate/public-build/WVNVbkRJdDBJQnBEMzZuWUdlMEZuTjlPUm9sOHZsSVNkUlJTRkJVQkx0ST0tLTFhbk5jRUNEVWxJL1J0SVR0WUFndnc9PQ==--90c84981a2ed2ede760ca48fbfc3fdd5b71d3e5e
|
|
137
|
-
[appveyor-badge]: https://ci.appveyor.com/api/projects/status/92d75dgkohgyap5r/branch/master?svg=true
|
|
138
|
-
[appveyor-badge-url]: https://ci.appveyor.com/project/Ionitron/stencil/branch/master
|
|
102
|
+
## Thanks
|
|
103
|
+
Stencil's internal testing suite is supported by the [BrowserStack Open-Source Program](https://www.browserstack.com/open-source)
|
|
104
|
+
<br>
|
|
105
|
+
<a target="_blank" href="https://www.browserstack.com/"><img width="200" src="https://www.browserstack.com/images/layout/browserstack-logo-600x315.png"></a>
|