@stencil/core 5.0.0-next.0 → 5.0.0-rc.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.
Files changed (58) hide show
  1. package/README.md +94 -0
  2. package/bin/stencil.mjs +1 -1
  3. package/dist/app-data/index.d.ts +2 -0
  4. package/dist/{runtime/app-data → app-data}/index.js +23 -15
  5. package/dist/{runtime/app-globals → app-globals}/index.js +1 -2
  6. package/dist/client-BMtGBEQV.mjs +2498 -0
  7. package/dist/compiler/browser.d.ts +1573 -0
  8. package/dist/compiler/browser.js +16998 -0
  9. package/dist/compiler/index.d.mts +284 -7
  10. package/dist/compiler/index.mjs +3 -9
  11. package/dist/compiler/utils/index.d.mts +272 -3
  12. package/dist/compiler/utils/index.mjs +4 -5
  13. package/dist/{transpile-CJQcQEVa.mjs → compiler-C_Y38j4m.mjs} +20984 -15554
  14. package/dist/declarations/stencil-ext-modules.d.ts +8 -8
  15. package/dist/declarations/stencil-public-compiler.d.ts +1016 -840
  16. package/dist/declarations/stencil-public-compiler.js +3 -5
  17. package/dist/declarations/stencil-public-docs.d.ts +441 -376
  18. package/dist/declarations/stencil-public-docs.js +0 -0
  19. package/dist/declarations/stencil-public-runtime.d.ts +361 -113
  20. package/dist/fragment-Di1hWOC8.mjs +4 -0
  21. package/dist/helpers-pTCZhNi0.mjs +529 -0
  22. package/dist/{index-szczUd2l.d.mts → index-CFiy6MZ3.d.mts} +1471 -2044
  23. package/dist/index-CViiWNQ9.d.mts +104 -0
  24. package/dist/{stencil-private-Cgcr414u.d.ts → index-XQHZl0MW.d.ts} +308 -114
  25. package/dist/index.d.mts +14 -2
  26. package/dist/index.mjs +171 -4
  27. package/dist/jsx-runtime.d.mts +24 -0
  28. package/dist/jsx-runtime.mjs +3 -0
  29. package/dist/mock-doc.mjs +2 -3
  30. package/dist/{node-sys-BGURUNOZ.mjs → node-Bkq8vRnu.mjs} +176 -197
  31. package/dist/rolldown-runtime-BhDjJH2R.mjs +15 -0
  32. package/dist/{client-DR9zhmKG.mjs → runtime/client/lazy.js} +3794 -2659
  33. package/dist/runtime/client/{index.d.ts → runtime.d.ts} +516 -227
  34. package/dist/runtime/client/{index.js → runtime.js} +3596 -2857
  35. package/dist/runtime/index.d.ts +90 -72
  36. package/dist/runtime/index.js +3528 -2897
  37. package/dist/runtime/server/index.d.mts +243 -219
  38. package/dist/runtime/server/index.mjs +3770 -3352
  39. package/dist/runtime/server/runner.d.mts +114 -47
  40. package/dist/runtime/server/runner.mjs +12710 -763
  41. package/dist/signals/index.d.ts +58 -0
  42. package/dist/signals/index.js +182 -0
  43. package/dist/sys/node/index.d.mts +1 -3
  44. package/dist/sys/node/index.mjs +2 -7
  45. package/dist/sys/node/worker.d.mts +1 -1
  46. package/dist/sys/node/worker.mjs +3 -12
  47. package/dist/testing/index.d.mts +4763 -12
  48. package/dist/testing/index.mjs +7945 -618
  49. package/dist/util-CP6-333M.mjs +731 -0
  50. package/dist/validation-C1mr0klL.mjs +825 -0
  51. package/package.json +91 -59
  52. package/dist/chunk-ClPoSABd.mjs +0 -21
  53. package/dist/index-Bxo2jCf6.d.mts +0 -77
  54. package/dist/runtime/app-data/index.d.ts +0 -30
  55. package/dist/serialize-BJvhE9aQ.mjs +0 -775
  56. package/dist/validation-BdcPruW_.mjs +0 -1451
  57. /package/{LICENSE.md → LICENSE} +0 -0
  58. /package/dist/{runtime/app-globals → app-globals}/index.d.ts +0 -0
package/dist/index.d.mts CHANGED
@@ -1,6 +1,9 @@
1
1
  /// <reference path="./declarations/stencil-ext-modules.d.ts" />
2
2
 
3
- export type { StencilConfig as Config, PrerenderConfig } from './declarations/stencil-public-compiler';
3
+ export type {
4
+ StencilConfig as Config,
5
+ PrerenderConfig,
6
+ } from './declarations/stencil-public-compiler';
4
7
 
5
8
  export type {
6
9
  ChildNode,
@@ -8,8 +11,10 @@ export type {
8
11
  ComponentDidUpdate,
9
12
  ComponentInterface,
10
13
  ComponentOptions,
14
+ ComponentShouldUpdateChanges,
11
15
  ComponentWillLoad,
12
16
  ComponentWillUpdate,
17
+ ErrorHandler,
13
18
  EventEmitter,
14
19
  EventOptions,
15
20
  FunctionalComponent,
@@ -22,6 +27,10 @@ export type {
22
27
  PropOptions,
23
28
  QueueApi,
24
29
  RafCallback,
30
+ ReactiveController,
31
+ ReactiveControllerHostInterface,
32
+ ResolutionHandler,
33
+ TagTransformer,
25
34
  VNode,
26
35
  VNodeData,
27
36
  } from './declarations/stencil-public-runtime';
@@ -41,15 +50,17 @@ export {
41
50
  getElement,
42
51
  getMode,
43
52
  getRenderingRef,
53
+ getShadowRoot,
44
54
  h,
45
55
  Host,
46
56
  Listen,
47
57
  Method,
48
58
  MixedInCtor,
49
59
  Mixin,
50
- MixinFactory,
51
60
  Prop,
52
61
  readTask,
62
+ ReactiveControllerHost,
63
+ registerSideEffectStyleTarget,
53
64
  render,
54
65
  resolveVar,
55
66
  setAssetPath,
@@ -60,6 +71,7 @@ export {
60
71
  setTagTransformer,
61
72
  State,
62
73
  transformTag,
74
+ unregisterSideEffectStyleTarget,
63
75
  Watch,
64
76
  writeTask,
65
77
  } from './declarations/stencil-public-runtime';
package/dist/index.mjs CHANGED
@@ -1,4 +1,171 @@
1
- import { S as setErrorHandler, _ as setAssetPath, b as setPlatformHelpers, d as getMode, f as setMode, g as getAssetPath, h, m as Host, n as render, o as forceUpdate, r as Mixin, s as getRenderingRef, u as getElement, v as readTask, w as Build, y as writeTask } from "./client-DR9zhmKG.mjs";
2
- import "./serialize-BJvhE9aQ.mjs";
3
-
4
- export { Build, Host, Mixin, forceUpdate, getAssetPath, getElement, getMode, getRenderingRef, h, readTask, render, setAssetPath, setErrorHandler, setMode, setPlatformHelpers, writeTask };
1
+ import { C as Build, S as setErrorHandler, _ as getAssetPath, a as transformTag, b as writeTask, c as Mixin, d as Host, f as h, g as getShadowRoot, h as getElement, i as setTagTransformer, l as getMode, m as getRenderingRef, o as render, p as forceUpdate, s as ReactiveControllerHost, u as setMode, v as setAssetPath, x as setPlatformHelpers, y as readTask } from "./client-BMtGBEQV.mjs";
2
+ import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
3
+ //#region src/client/client-decorators.ts
4
+ /**
5
+ * Runtime stubs for Stencil decorators.
6
+ *
7
+ * These decorators are compile-time metadata flags that Stencil's compiler parses
8
+ * and transforms. At runtime, they do nothing - the actual component behavior is
9
+ * wired up by the compiled output, not by these decorators.
10
+ *
11
+ * These stubs exist so that:
12
+ * 1. Component classes can be instantiated directly in tests without going through
13
+ * Stencil's full compilation pipeline
14
+ * 2. The decorators don't throw "X is not a function" errors when used outside
15
+ * of Stencil's build process
16
+ */
17
+ /**
18
+ * No-op class decorator stub for @Component()
19
+ * @param _opts - component options (ignored at runtime)
20
+ * @returns a class decorator that returns the target unchanged
21
+ */
22
+ const Component = (_opts) => (target) => target;
23
+ /**
24
+ * No-op property decorator stub for @Element()
25
+ * @returns a property decorator that does nothing
26
+ */
27
+ const Element = () => () => {};
28
+ /**
29
+ * No-op property decorator stub for @Event()
30
+ * @param _opts - event options (ignored at runtime)
31
+ * @returns a property decorator that does nothing
32
+ */
33
+ const Event = (_opts) => () => {};
34
+ /**
35
+ * No-op property decorator stub for @AttachInternals()
36
+ * @param _opts - attach internals options (ignored at runtime)
37
+ * @returns a property decorator that does nothing
38
+ */
39
+ const AttachInternals = (_opts) => () => {};
40
+ /**
41
+ * No-op method decorator stub for @Listen()
42
+ * @param _eventName - event name to listen for (ignored at runtime)
43
+ * @param _opts - listen options (ignored at runtime)
44
+ * @returns a method decorator that does nothing
45
+ */
46
+ const Listen = (_eventName, _opts) => () => {};
47
+ /**
48
+ * No-op method decorator stub for @Method()
49
+ * @param _opts - method options (ignored at runtime)
50
+ * @returns a method decorator that does nothing
51
+ */
52
+ const Method = (_opts) => () => {};
53
+ /**
54
+ * No-op property decorator stub for @Prop()
55
+ * @param _opts - prop options (ignored at runtime)
56
+ * @returns a property decorator that does nothing
57
+ */
58
+ const Prop = (_opts) => () => {};
59
+ /**
60
+ * No-op property decorator stub for @State()
61
+ * @returns a property decorator that does nothing
62
+ */
63
+ const State = () => () => {};
64
+ /**
65
+ * No-op method decorator stub for @Watch()
66
+ * @param _propName - property name to watch (ignored at runtime)
67
+ * @param _opts - watch options (ignored at runtime)
68
+ * @returns a method decorator that does nothing
69
+ */
70
+ const Watch = (_propName, _opts) => () => {};
71
+ /**
72
+ * No-op method decorator stub for @PropSerialize()
73
+ * @param _propName - property name to serialize (ignored at runtime)
74
+ * @returns a method decorator that does nothing
75
+ */
76
+ const PropSerialize = (_propName) => () => {};
77
+ /**
78
+ * No-op method decorator stub for @AttrDeserialize()
79
+ * @param _propName - property name to deserialize (ignored at runtime)
80
+ * @returns a method decorator that does nothing
81
+ */
82
+ const AttrDeserialize = (_propName) => () => {};
83
+ /**
84
+ * No-op compile-time utility stub for resolveVar()
85
+ * At runtime, this just returns the string representation of whatever is passed in.
86
+ * @param variable - the variable to resolve
87
+ * @returns the string representation of the variable
88
+ */
89
+ const resolveVar = (variable) => String(variable);
90
+ //#endregion
91
+ //#region src/runtime/inject-side-effect-style.ts
92
+ const styleSheets = /* @__PURE__ */ new Map();
93
+ const knownRoots = /* @__PURE__ */ new Set();
94
+ const adoptedRoots = /* @__PURE__ */ new WeakMap();
95
+ const knownFontFaces = /* @__PURE__ */ new Set();
96
+ const adopt = (root, sheet) => {
97
+ let roots = adoptedRoots.get(sheet);
98
+ if (!roots) {
99
+ roots = /* @__PURE__ */ new WeakSet();
100
+ adoptedRoots.set(sheet, roots);
101
+ }
102
+ if (!roots.has(root)) {
103
+ roots.add(root);
104
+ root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet];
105
+ }
106
+ };
107
+ /**
108
+ * Registers a root (a shadow root, or `document`) to receive every side-effect CSS import
109
+ * (a plain, non-component `import './foo.css'`), now and in future. Call in `connectedCallback`,
110
+ * paired with `unregisterSideEffectStyleTarget` in `disconnectedCallback` so the registry doesn't
111
+ * hold disconnected roots forever.
112
+ * @param root the root to register
113
+ */
114
+ function registerSideEffectStyleTarget(root) {
115
+ knownRoots.add(root);
116
+ for (const sheet of styleSheets.values()) adopt(root, sheet);
117
+ }
118
+ /**
119
+ * Removes a root registered via `registerSideEffectStyleTarget` - call in `disconnectedCallback`.
120
+ * @param root the root to unregister
121
+ */
122
+ function unregisterSideEffectStyleTarget(root) {
123
+ knownRoots.delete(root);
124
+ }
125
+ const FONT_FACE_RE = /@font-face\s*\{[^{}]*\}/g;
126
+ /**
127
+ * Splits `@font-face` rules out of a CSS text - exported standalone (from private
128
+ * module state - usually 3rd party node_modules) exported for testing
129
+ * @param cssText the CSS text to split
130
+ * @returns the font-face rules joined together (`null` if there were none) and the remaining CSS
131
+ */
132
+ function splitFontFaces(cssText) {
133
+ const fontFaces = cssText.match(FONT_FACE_RE);
134
+ if (!fontFaces) return {
135
+ fontFaceText: null,
136
+ rest: cssText
137
+ };
138
+ return {
139
+ fontFaceText: fontFaces.join("\n"),
140
+ rest: cssText.replace(FONT_FACE_RE, "")
141
+ };
142
+ }
143
+ /**
144
+ * Applies plain (non-component) CSS text to every registered root - respects shadow DOM
145
+ * encapsulation instead of always reaching for the top-level document. Not meant to be called
146
+ * directly: this is what the compiler's CSS-to-ESM output calls for CSS with no Stencil `tag`
147
+ * (i.e. not a component's own `styleUrl`), typically a third-party dependency's CSS import.
148
+ *
149
+ * `@font-face` rules are pulled out and adopted onto top-level `document` not per-root
150
+ * (Chromium (https://issues.chromium.org/issues/41085401) per-root never loads).
151
+ * @param cssText the CSS text to apply
152
+ */
153
+ function injectSideEffectStyle(cssText) {
154
+ const { fontFaceText, rest } = splitFontFaces(cssText);
155
+ if (fontFaceText && !knownFontFaces.has(fontFaceText)) {
156
+ knownFontFaces.add(fontFaceText);
157
+ const fontFaceSheet = new CSSStyleSheet();
158
+ fontFaceSheet.replaceSync(fontFaceText);
159
+ document.adoptedStyleSheets = [...document.adoptedStyleSheets, fontFaceSheet];
160
+ }
161
+ if (!rest.trim()) return;
162
+ let sheet = styleSheets.get(rest);
163
+ if (!sheet) {
164
+ sheet = new CSSStyleSheet();
165
+ sheet.replaceSync(rest);
166
+ styleSheets.set(rest, sheet);
167
+ }
168
+ for (const root of knownRoots) adopt(root, sheet);
169
+ }
170
+ //#endregion
171
+ export { AttachInternals, AttrDeserialize, Build, Component, Element, Event, Fragment, Host, Listen, Method, Mixin, Prop, PropSerialize, ReactiveControllerHost, State, Watch, forceUpdate, getAssetPath, getElement, getMode, getRenderingRef, getShadowRoot, h, injectSideEffectStyle, readTask, registerSideEffectStyleTarget, render, resolveVar, setAssetPath, setErrorHandler, setMode, setPlatformHelpers, setTagTransformer, transformTag, unregisterSideEffectStyleTarget, writeTask };
@@ -0,0 +1,24 @@
1
+ import type { VNode, JSXBase, JSX as LocalJSX } from './declarations/stencil-public-runtime';
2
+
3
+ export { Fragment } from './declarations/stencil-public-runtime';
4
+ export function jsx(type: any, props: any, key?: string): VNode;
5
+ export function jsxs(type: any, props: any, key?: string): VNode;
6
+ export function jsxDEV(type: any, props: any, key?: string): VNode;
7
+
8
+ export namespace JSX {
9
+ type BaseElements = LocalJSX.IntrinsicElements & JSXBase.IntrinsicElements;
10
+
11
+ export type IntrinsicElements = {
12
+ [K in keyof BaseElements]: BaseElements[K] & { children?: any };
13
+ } & {
14
+ [tagName: string]: any;
15
+ };
16
+
17
+ export type Element = VNode;
18
+
19
+ // Functional components receive children as their 2nd argument, never via props
20
+ export interface IntrinsicAttributes {
21
+ key?: string | number;
22
+ children?: any;
23
+ }
24
+ }
@@ -0,0 +1,3 @@
1
+ import { n as jsxDEV, r as jsxs, t as jsx } from "./client-BMtGBEQV.mjs";
2
+ import { t as Fragment } from "./fragment-Di1hWOC8.mjs";
3
+ export { Fragment, jsx, jsxDEV, jsxs };
package/dist/mock-doc.mjs CHANGED
@@ -1,3 +1,2 @@
1
- export * from "@stencil/mock-doc"
2
-
3
- export { };
1
+ export * from "@stencil/mock-doc";
2
+ export {};