@stencil/core 2.11.0-0 → 2.13.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/cli/index.cjs +20 -4
- package/cli/index.js +20 -4
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/stencil.js +211 -483
- 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 +1 -1
- package/internal/hydrate/index.js +2 -1
- package/internal/hydrate/package.json +1 -1
- 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/mock-doc/index.cjs +20 -2
- package/mock-doc/index.d.ts +1 -0
- package/mock-doc/index.js +20 -2
- package/mock-doc/package.json +1 -1
- package/package.json +6 -6
- package/readme.md +52 -85
- package/screenshot/package.json +1 -1
- package/sys/node/autoprefixer.js +2 -2
- package/sys/node/index.js +17 -16
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +419 -390
- package/testing/jest/jest-config.d.ts +11 -0
- package/testing/jest/jest-environment.d.ts +1 -0
- package/testing/jest/jest-preprocessor.d.ts +56 -8
- package/testing/jest/jest-runner.d.ts +4 -0
- package/testing/jest-preset.js +5 -0
- package/testing/package.json +1 -1
package/mock-doc/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Mock Doc (CommonJS) v2.
|
|
2
|
+
Stencil Mock Doc (CommonJS) v2.13.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
var mockDoc = (function(exports) {
|
|
5
5
|
'use strict';
|
|
@@ -547,7 +547,7 @@ class MockCSSStyleDeclaration {
|
|
|
547
547
|
const splt = rule.split(':');
|
|
548
548
|
if (splt.length > 1) {
|
|
549
549
|
const prop = splt[0].trim();
|
|
550
|
-
const value = splt
|
|
550
|
+
const value = splt.slice(1).join(':').trim();
|
|
551
551
|
if (prop !== '' && value !== '') {
|
|
552
552
|
this._styles.set(jsCaseToCssCase(prop), value);
|
|
553
553
|
}
|
|
@@ -629,6 +629,21 @@ class MockEvent {
|
|
|
629
629
|
stopImmediatePropagation() {
|
|
630
630
|
this.cancelBubble = true;
|
|
631
631
|
}
|
|
632
|
+
composedPath() {
|
|
633
|
+
const composedPath = [];
|
|
634
|
+
let currentElement = this.target;
|
|
635
|
+
while (currentElement) {
|
|
636
|
+
composedPath.push(currentElement);
|
|
637
|
+
if (!currentElement.parentElement && currentElement.nodeName === "#document" /* DOCUMENT_NODE */) {
|
|
638
|
+
// the current element doesn't have a parent, but we've detected it's our root document node. push the window
|
|
639
|
+
// object associated with the document onto the path
|
|
640
|
+
composedPath.push(currentElement.defaultView);
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
currentElement = currentElement.parentElement;
|
|
644
|
+
}
|
|
645
|
+
return composedPath;
|
|
646
|
+
}
|
|
632
647
|
}
|
|
633
648
|
class MockCustomEvent extends MockEvent {
|
|
634
649
|
constructor(type, customEventInitDic) {
|
|
@@ -1510,6 +1525,9 @@ class MockNode {
|
|
|
1510
1525
|
return null;
|
|
1511
1526
|
}
|
|
1512
1527
|
contains(otherNode) {
|
|
1528
|
+
if (otherNode === this) {
|
|
1529
|
+
return true;
|
|
1530
|
+
}
|
|
1513
1531
|
return this.childNodes.includes(otherNode);
|
|
1514
1532
|
}
|
|
1515
1533
|
removeChild(childNode) {
|
package/mock-doc/index.d.ts
CHANGED
package/mock-doc/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
Stencil Mock Doc v2.
|
|
2
|
+
Stencil Mock Doc v2.13.0 | MIT Licensed | https://stenciljs.com
|
|
3
3
|
*/
|
|
4
4
|
const CONTENT_REF_ID = 'r';
|
|
5
5
|
const ORG_LOCATION_ID = 'o';
|
|
@@ -544,7 +544,7 @@ class MockCSSStyleDeclaration {
|
|
|
544
544
|
const splt = rule.split(':');
|
|
545
545
|
if (splt.length > 1) {
|
|
546
546
|
const prop = splt[0].trim();
|
|
547
|
-
const value = splt
|
|
547
|
+
const value = splt.slice(1).join(':').trim();
|
|
548
548
|
if (prop !== '' && value !== '') {
|
|
549
549
|
this._styles.set(jsCaseToCssCase(prop), value);
|
|
550
550
|
}
|
|
@@ -626,6 +626,21 @@ class MockEvent {
|
|
|
626
626
|
stopImmediatePropagation() {
|
|
627
627
|
this.cancelBubble = true;
|
|
628
628
|
}
|
|
629
|
+
composedPath() {
|
|
630
|
+
const composedPath = [];
|
|
631
|
+
let currentElement = this.target;
|
|
632
|
+
while (currentElement) {
|
|
633
|
+
composedPath.push(currentElement);
|
|
634
|
+
if (!currentElement.parentElement && currentElement.nodeName === "#document" /* DOCUMENT_NODE */) {
|
|
635
|
+
// the current element doesn't have a parent, but we've detected it's our root document node. push the window
|
|
636
|
+
// object associated with the document onto the path
|
|
637
|
+
composedPath.push(currentElement.defaultView);
|
|
638
|
+
break;
|
|
639
|
+
}
|
|
640
|
+
currentElement = currentElement.parentElement;
|
|
641
|
+
}
|
|
642
|
+
return composedPath;
|
|
643
|
+
}
|
|
629
644
|
}
|
|
630
645
|
class MockCustomEvent extends MockEvent {
|
|
631
646
|
constructor(type, customEventInitDic) {
|
|
@@ -1507,6 +1522,9 @@ class MockNode {
|
|
|
1507
1522
|
return null;
|
|
1508
1523
|
}
|
|
1509
1524
|
contains(otherNode) {
|
|
1525
|
+
if (otherNode === this) {
|
|
1526
|
+
return true;
|
|
1527
|
+
}
|
|
1510
1528
|
return this.childNodes.includes(otherNode);
|
|
1511
1529
|
}
|
|
1512
1530
|
removeChild(childNode) {
|
package/mock-doc/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stencil/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./internal/stencil-core/index.cjs",
|
|
6
6
|
"module": "./internal/stencil-core/index.js",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/graceful-fs": "^4.1.5",
|
|
69
69
|
"@types/inquirer": "^7.3.1",
|
|
70
70
|
"@types/is-glob": "^4.0.1",
|
|
71
|
-
"@types/jest": "^
|
|
71
|
+
"@types/jest": "^27.0.3",
|
|
72
72
|
"@types/listr": "^0.14.2",
|
|
73
73
|
"@types/mime-types": "^2.1.0",
|
|
74
74
|
"@types/node": "^14.14.35",
|
|
@@ -98,9 +98,9 @@
|
|
|
98
98
|
"graceful-fs": "~4.2.6",
|
|
99
99
|
"hash.js": "^1.1.7",
|
|
100
100
|
"inquirer": "^7.3.3",
|
|
101
|
-
"jest": "^
|
|
102
|
-
"jest-cli": "^
|
|
103
|
-
"jest-environment-node": "^
|
|
101
|
+
"jest": "^27.4.5",
|
|
102
|
+
"jest-cli": "^27.4.5",
|
|
103
|
+
"jest-environment-node": "^27.4.4",
|
|
104
104
|
"listr": "^0.14.3",
|
|
105
105
|
"magic-string": "^0.25.7",
|
|
106
106
|
"merge-source-map": "^1.1.0",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"path-browserify": "^1.0.1",
|
|
114
114
|
"pixelmatch": "4.0.2",
|
|
115
115
|
"postcss": "^8.2.8",
|
|
116
|
-
"prettier": "2.
|
|
116
|
+
"prettier": "2.5.1",
|
|
117
117
|
"prompts": "2.4.0",
|
|
118
118
|
"puppeteer": "~10.0.0",
|
|
119
119
|
"rollup": "2.42.3",
|
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>
|