@stencil/core 4.21.0 → 4.22.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal",
3
- "version": "4.21.0",
3
+ "version": "4.22.0",
4
4
  "description": "Stencil internals only to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -2,6 +2,7 @@ import type { ConfigFlags } from '../cli/config-flags';
2
2
  import type { PrerenderUrlResults, PrintLine } from '../internal';
3
3
  import type { BuildCtx, CompilerCtx } from './stencil-private';
4
4
  import type { JsonDocs } from './stencil-public-docs';
5
+ import type { ResolutionHandler } from './stencil-public-runtime';
5
6
  export * from './stencil-public-docs';
6
7
  /**
7
8
  * https://stenciljs.com/docs/config/
@@ -246,6 +247,7 @@ export interface StencilConfig {
246
247
  env?: {
247
248
  [prop: string]: string | undefined;
248
249
  };
250
+ docs?: StencilDocsConfig;
249
251
  globalScript?: string;
250
252
  srcIndexHtml?: string;
251
253
  watch?: boolean;
@@ -859,6 +861,11 @@ export interface SerializeDocumentOptions extends HydrateDocumentOptions {
859
861
  * @default true
860
862
  */
861
863
  fullDocument?: boolean;
864
+ /**
865
+ * Style modes to render the component in.
866
+ * @see https://stenciljs.com/docs/styling#style-modes
867
+ */
868
+ modes?: ResolutionHandler[];
862
869
  }
863
870
  export interface HydrateFactoryOptions extends SerializeDocumentOptions {
864
871
  serializeToHtml: boolean;
@@ -1558,6 +1565,33 @@ export interface CopyTask {
1558
1565
  */
1559
1566
  keepDirStructure?: boolean;
1560
1567
  }
1568
+ /**
1569
+ * Configuration for generating documentation from Stencil components.
1570
+ */
1571
+ export interface StencilDocsConfig {
1572
+ /**
1573
+ * Options for processing and rendering Markdown documentation files.
1574
+ */
1575
+ markdown?: {
1576
+ /**
1577
+ * Styling for how the target component will be represented within documentation (e.g., in component diagrams).
1578
+ */
1579
+ targetComponent?: {
1580
+ /**
1581
+ * Background color used for nodes representing the component in diagrams (e.g., Mermaid graphs).
1582
+ * Use standard color names or hex codes.
1583
+ * @example '#f0f0f0' (light gray)
1584
+ */
1585
+ background?: string;
1586
+ /**
1587
+ * Text color used within nodes representing the component in diagrams (e.g., Mermaid graphs).
1588
+ * Use standard color names or hex codes.
1589
+ * @example '#333' (dark gray)
1590
+ */
1591
+ textColor?: string;
1592
+ };
1593
+ };
1594
+ }
1561
1595
  export interface BundlingConfig {
1562
1596
  /**
1563
1597
  * @deprecated the `namedExports` field is no longer honored by `@rollup/plugin-commonjs` and is not used by Stencil.
@@ -1564,6 +1564,10 @@ export declare namespace JSXBase {
1564
1564
  onSubmitCapture?: (event: Event) => void;
1565
1565
  onInvalid?: (event: Event) => void;
1566
1566
  onInvalidCapture?: (event: Event) => void;
1567
+ onBeforeToggle?: (event: Event) => void;
1568
+ onBeforeToggleCapture?: (event: Event) => void;
1569
+ onToggle?: (event: Event) => void;
1570
+ onToggleCapture?: (event: Event) => void;
1567
1571
  onLoad?: (event: Event) => void;
1568
1572
  onLoadCapture?: (event: Event) => void;
1569
1573
  onError?: (event: Event) => void;
@@ -1017,7 +1017,7 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1017
1017
  if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1018
1018
  if (styleContainerNode.nodeName === "HEAD") {
1019
1019
  const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1020
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : document.querySelector("style");
1020
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1021
1021
  styleContainerNode.insertBefore(styleElm, referenceNode2);
1022
1022
  } else if ("host" in styleContainerNode) {
1023
1023
  styleContainerNode.prepend(styleElm);
@@ -2514,6 +2514,11 @@ var patchSlotAppendChild = (HostElementPrototype) => {
2514
2514
  const slotName = newChild["s-sn"] = getSlotName(newChild);
2515
2515
  const slotNode = getHostSlotNode(this.childNodes, slotName, this.tagName);
2516
2516
  if (slotNode) {
2517
+ const slotPlaceholder = document.createTextNode("");
2518
+ slotPlaceholder["s-nr"] = newChild;
2519
+ slotNode["s-cr"].parentNode.__appendChild(slotPlaceholder);
2520
+ newChild["s-ol"] = slotPlaceholder;
2521
+ newChild["s-sh"] = slotNode["s-hn"];
2517
2522
  const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2518
2523
  const appendAfter = slotChildNodes[slotChildNodes.length - 1];
2519
2524
  const insertedNode = insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
@@ -2555,6 +2560,7 @@ var patchSlotPrepend = (HostElementPrototype) => {
2555
2560
  slotPlaceholder["s-nr"] = newChild;
2556
2561
  slotNode["s-cr"].parentNode.__appendChild(slotPlaceholder);
2557
2562
  newChild["s-ol"] = slotPlaceholder;
2563
+ newChild["s-sh"] = slotNode["s-hn"];
2558
2564
  const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2559
2565
  const appendAfter = slotChildNodes[0];
2560
2566
  return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/testing",
3
- "version": "4.21.0",
3
+ "version": "4.22.0",
4
4
  "description": "Stencil internal testing platform to be imported by the Stencil Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "private": true
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc (CommonJS) v4.21.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc (CommonJS) v4.22.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __defProp = Object.defineProperty;
@@ -60,6 +60,7 @@ var CONTENT_REF_ID = "r";
60
60
  var ORG_LOCATION_ID = "o";
61
61
  var SLOT_NODE_ID = "s";
62
62
  var TEXT_NODE_ID = "t";
63
+ var HYDRATE_ID = "s-id";
63
64
  var XLINK_NS = "http://www.w3.org/1999/xlink";
64
65
 
65
66
  // src/mock-doc/attribute.ts
@@ -6438,6 +6439,13 @@ style="${cssText}">`;
6438
6439
  output.indent = output.indent + ((_h = opts.indentSpaces) != null ? _h : 0);
6439
6440
  }
6440
6441
  for (let i = 0; i < childNodeLength; i++) {
6442
+ const sId = node.attributes.getNamedItem(HYDRATE_ID);
6443
+ const isStencilDeclarativeShadowDOM = childNodes[i].nodeName.toLowerCase() === "template" && sId;
6444
+ if (isStencilDeclarativeShadowDOM) {
6445
+ yield `
6446
+ ${" ".repeat(output.indent)}<!--r.${sId.value}-->`;
6447
+ continue;
6448
+ }
6441
6449
  yield* streamToHtml(childNodes[i], opts, output);
6442
6450
  }
6443
6451
  if (ignoreTag === false) {
@@ -8926,6 +8934,21 @@ function resetPerformance(perf) {
8926
8934
  }
8927
8935
  }
8928
8936
 
8937
+ // src/mock-doc/resize-observer.ts
8938
+ var MockResizeObserver = class {
8939
+ constructor() {
8940
+ }
8941
+ disconnect() {
8942
+ }
8943
+ observe() {
8944
+ }
8945
+ takeRecords() {
8946
+ return [];
8947
+ }
8948
+ unobserve() {
8949
+ }
8950
+ };
8951
+
8929
8952
  // src/mock-doc/storage.ts
8930
8953
  var MockStorage = class {
8931
8954
  constructor() {
@@ -9165,6 +9188,9 @@ var MockWindow = class {
9165
9188
  get IntersectionObserver() {
9166
9189
  return MockIntersectionObserver;
9167
9190
  }
9191
+ get ResizeObserver() {
9192
+ return MockResizeObserver;
9193
+ }
9168
9194
  get localStorage() {
9169
9195
  if (this.__localStorage == null) {
9170
9196
  this.__localStorage = new MockStorage();
@@ -825,6 +825,13 @@ declare class MockResponse {
825
825
  text(): Promise<string>;
826
826
  clone(): MockResponse;
827
827
  }
828
+ declare class MockResizeObserver {
829
+ constructor();
830
+ disconnect(): void;
831
+ observe(): void;
832
+ takeRecords(): any[];
833
+ unobserve(): void;
834
+ }
828
835
  /**
829
836
  * Check whether an element of interest matches a given selector.
830
837
  *
@@ -963,6 +970,7 @@ declare class MockWindow {
963
970
  get HTMLElement(): any;
964
971
  set HTMLElement(htmlElementCstr: any);
965
972
  get IntersectionObserver(): typeof MockIntersectionObserver;
973
+ get ResizeObserver(): typeof MockResizeObserver;
966
974
  get localStorage(): MockStorage;
967
975
  set localStorage(locStorage: MockStorage);
968
976
  get location(): MockLocation;
package/mock-doc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc v4.21.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc v4.22.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/runtime/runtime-constants.ts
@@ -7,6 +7,7 @@ var CONTENT_REF_ID = "r";
7
7
  var ORG_LOCATION_ID = "o";
8
8
  var SLOT_NODE_ID = "s";
9
9
  var TEXT_NODE_ID = "t";
10
+ var HYDRATE_ID = "s-id";
10
11
  var XLINK_NS = "http://www.w3.org/1999/xlink";
11
12
 
12
13
  // src/mock-doc/attribute.ts
@@ -6385,6 +6386,13 @@ style="${cssText}">`;
6385
6386
  output.indent = output.indent + ((_h = opts.indentSpaces) != null ? _h : 0);
6386
6387
  }
6387
6388
  for (let i = 0; i < childNodeLength; i++) {
6389
+ const sId = node.attributes.getNamedItem(HYDRATE_ID);
6390
+ const isStencilDeclarativeShadowDOM = childNodes[i].nodeName.toLowerCase() === "template" && sId;
6391
+ if (isStencilDeclarativeShadowDOM) {
6392
+ yield `
6393
+ ${" ".repeat(output.indent)}<!--r.${sId.value}-->`;
6394
+ continue;
6395
+ }
6388
6396
  yield* streamToHtml(childNodes[i], opts, output);
6389
6397
  }
6390
6398
  if (ignoreTag === false) {
@@ -8873,6 +8881,21 @@ function resetPerformance(perf) {
8873
8881
  }
8874
8882
  }
8875
8883
 
8884
+ // src/mock-doc/resize-observer.ts
8885
+ var MockResizeObserver = class {
8886
+ constructor() {
8887
+ }
8888
+ disconnect() {
8889
+ }
8890
+ observe() {
8891
+ }
8892
+ takeRecords() {
8893
+ return [];
8894
+ }
8895
+ unobserve() {
8896
+ }
8897
+ };
8898
+
8876
8899
  // src/mock-doc/storage.ts
8877
8900
  var MockStorage = class {
8878
8901
  constructor() {
@@ -9112,6 +9135,9 @@ var MockWindow = class {
9112
9135
  get IntersectionObserver() {
9113
9136
  return MockIntersectionObserver;
9114
9137
  }
9138
+ get ResizeObserver() {
9139
+ return MockResizeObserver;
9140
+ }
9115
9141
  get localStorage() {
9116
9142
  if (this.__localStorage == null) {
9117
9143
  this.__localStorage = new MockStorage();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "4.21.0",
3
+ "version": "4.22.0",
4
4
  "description": "Mock window, document and DOM outside of a browser environment.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core",
3
- "version": "4.21.0",
3
+ "version": "4.22.0",
4
4
  "license": "MIT",
5
5
  "main": "./internal/stencil-core/index.cjs",
6
6
  "module": "./internal/stencil-core/index.js",
@@ -190,7 +190,7 @@
190
190
  "semver": "^7.3.7",
191
191
  "terser": "5.31.1",
192
192
  "tsx": "^4.10.3",
193
- "typescript": "~5.5.3",
193
+ "typescript": "~5.5.4",
194
194
  "webpack": "^5.75.0",
195
195
  "ws": "8.17.1"
196
196
  },
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot v4.21.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot v4.22.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/screenshot",
3
- "version": "4.21.0",
3
+ "version": "4.22.0",
4
4
  "description": "Stencil Screenshot.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot Pixel Match v4.21.0 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot Pixel Match v4.22.0 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;