@stencil/core 4.29.2-dev.1744261315.9aaccc5 → 4.29.2-dev.1745356698.fd7be97

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,5 +1,5 @@
1
1
  /*
2
- Stencil Hydrate Runner v4.29.2-dev.1744261315.9aaccc5 | MIT Licensed | https://stenciljs.com
2
+ Stencil Hydrate Runner v4.29.2-dev.1745356698.fd7be97 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  var __defProp = Object.defineProperty;
5
5
  var __export = (target, all) => {
@@ -14417,6 +14417,11 @@ var shouldIgnoreError = (msg) => {
14417
14417
  };
14418
14418
  var TASK_CANCELED_MSG = `task canceled`;
14419
14419
 
14420
+ // src/utils/regular-expression.ts
14421
+ var escapeRegExpSpecialCharacters = (text) => {
14422
+ return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
14423
+ };
14424
+
14420
14425
  // src/utils/remote-value.ts
14421
14426
  var RemoteValue = class _RemoteValue {
14422
14427
  /**
@@ -14631,7 +14636,15 @@ var _cssColonHostRe = new RegExp("(" + _polyfillHost + _parenSuffix, "gim");
14631
14636
  var _cssColonHostContextRe = new RegExp("(" + _polyfillHostContext + _parenSuffix, "gim");
14632
14637
  var _cssColonSlottedRe = new RegExp("(" + _polyfillSlotted + _parenSuffix, "gim");
14633
14638
  var _polyfillHostNoCombinator = _polyfillHost + "-no-combinator";
14634
- var createSupportsRuleRe = (selector) => new RegExp(`((?<!(^@supports(.*)))|(?<={.*))(${selector}\\b)`, "gim");
14639
+ var createSupportsRuleRe = (selector) => {
14640
+ const safeSelector = escapeRegExpSpecialCharacters(selector);
14641
+ return new RegExp(
14642
+ // First capture group: match any context before the selector that's not inside @supports selector()
14643
+ // Using negative lookahead to avoid matching inside @supports selector(...) condition
14644
+ `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector}))(${safeSelector}\\b)`,
14645
+ "g"
14646
+ );
14647
+ };
14635
14648
  var _colonSlottedRe = createSupportsRuleRe("::slotted");
14636
14649
  var _colonHostRe = createSupportsRuleRe(":host");
14637
14650
  var _colonHostContextRe = createSupportsRuleRe(":host-context");
@@ -15880,7 +15893,7 @@ function hydrateDocument(doc, options, asStream) {
15880
15893
  opts.destroyDocument = true;
15881
15894
  win2 = new MockWindow(doc);
15882
15895
  if (!asStream) {
15883
- return render(win2, opts, results).then(() => results);
15896
+ return render2(win2, opts, results).then(() => results);
15884
15897
  }
15885
15898
  return renderStream(win2, opts, results);
15886
15899
  } catch (e) {
@@ -15897,7 +15910,7 @@ function hydrateDocument(doc, options, asStream) {
15897
15910
  opts.destroyDocument = false;
15898
15911
  win2 = patchDomImplementation(doc, opts);
15899
15912
  if (!asStream) {
15900
- return render(win2, opts, results).then(() => results);
15913
+ return render2(win2, opts, results).then(() => results);
15901
15914
  }
15902
15915
  return renderStream(win2, opts, results);
15903
15916
  } catch (e) {
@@ -15912,7 +15925,7 @@ function hydrateDocument(doc, options, asStream) {
15912
15925
  renderBuildError(results, `Invalid html or document. Must be either a valid "html" string, or DOM "document".`);
15913
15926
  return Promise.resolve(results);
15914
15927
  }
15915
- async function render(win2, opts, results) {
15928
+ async function render2(win2, opts, results) {
15916
15929
  if ("process" in globalThis && typeof process.on === "function" && !process.__stencilErrors) {
15917
15930
  process.__stencilErrors = true;
15918
15931
  process.on("unhandledRejection", (e) => {
@@ -15937,7 +15950,7 @@ async function render(win2, opts, results) {
15937
15950
  }
15938
15951
  function renderStream(win2, opts, results) {
15939
15952
  async function* processRender() {
15940
- const renderResult = await render(win2, opts, results);
15953
+ const renderResult = await render2(win2, opts, results);
15941
15954
  yield renderResult.html;
15942
15955
  }
15943
15956
  return Readable.from(processRender());
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal",
3
- "version": "4.29.2-dev.1744261315.9aaccc5",
3
+ "version": "4.29.2-dev.1745356698.fd7be97",
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",
@@ -41,6 +41,7 @@ export {
41
41
  Method,
42
42
  Prop,
43
43
  readTask,
44
+ render,
44
45
  setAssetPath,
45
46
  setErrorHandler,
46
47
  setMode,
@@ -1,16 +1,17 @@
1
1
  export {
2
2
  Build,
3
+ forceUpdate,
3
4
  getAssetPath,
4
5
  getElement,
5
6
  getMode,
6
7
  getRenderingRef,
7
- forceUpdate,
8
8
  h,
9
9
  Host,
10
10
  readTask,
11
- setMode,
11
+ render,
12
12
  setAssetPath,
13
+ setErrorHandler,
14
+ setMode,
13
15
  setPlatformHelpers,
14
16
  writeTask,
15
- setErrorHandler,
16
17
  } from '../client/index.js';
@@ -260,6 +260,25 @@ export declare function setPlatformHelpers(helpers: {
260
260
  * @returns the base path
261
261
  */
262
262
  export declare function getAssetPath(path: string): string;
263
+ /**
264
+ * Method to render a virtual DOM tree to a container element.
265
+ *
266
+ * @example
267
+ * ```tsx
268
+ * import { render } from '@stencil/core';
269
+ *
270
+ * const vnode = (
271
+ * <div>
272
+ * <h1>Hello, world!</h1>
273
+ * </div>
274
+ * );
275
+ * render(vnode, document.body);
276
+ * ```
277
+ *
278
+ * @param vnode - The virtual DOM tree to render
279
+ * @param container - The container element to render the virtual DOM tree to
280
+ */
281
+ export declare function render(vnode: VNode, container: Element): void;
263
282
  /**
264
283
  * Used to manually set the base path where assets can be found. For lazy-loaded
265
284
  * builds the asset path is automatically set and assets copied to the correct
@@ -61,6 +61,7 @@ __export(index_exports, {
61
61
  registerHost: () => registerHost,
62
62
  registerInstance: () => registerInstance,
63
63
  registerModule: () => registerModule,
64
+ render: () => render,
64
65
  renderVdom: () => renderVdom,
65
66
  resetPlatform: () => resetPlatform,
66
67
  setAssetPath: () => setAssetPath,
@@ -1831,7 +1832,15 @@ var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
1831
1832
  var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g];
1832
1833
  var _selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$";
1833
1834
  var _polyfillHostRe = /-shadowcsshost/gim;
1834
- var createSupportsRuleRe = (selector) => new RegExp(`((?<!(^@supports(.*)))|(?<={.*))(${selector}\\b)`, "gim");
1835
+ var createSupportsRuleRe = (selector) => {
1836
+ const safeSelector2 = escapeRegExpSpecialCharacters(selector);
1837
+ return new RegExp(
1838
+ // First capture group: match any context before the selector that's not inside @supports selector()
1839
+ // Using negative lookahead to avoid matching inside @supports selector(...) condition
1840
+ `(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
1841
+ "g"
1842
+ );
1843
+ };
1835
1844
  var _colonSlottedRe = createSupportsRuleRe("::slotted");
1836
1845
  var _colonHostRe = createSupportsRuleRe(":host");
1837
1846
  var _colonHostContextRe = createSupportsRuleRe(":host-context");
@@ -1906,7 +1915,16 @@ var escapeBlocks = (input) => {
1906
1915
  return strEscapedBlocks;
1907
1916
  };
1908
1917
  var insertPolyfillHostInCssText = (cssText) => {
1918
+ const supportsBlocks = [];
1919
+ cssText = cssText.replace(/@supports\s+selector\s*\(\s*([^)]*)\s*\)/g, (_, selectorContent) => {
1920
+ const placeholder = `__supports_${supportsBlocks.length}__`;
1921
+ supportsBlocks.push(selectorContent);
1922
+ return `@supports selector(${placeholder})`;
1923
+ });
1909
1924
  cssText = cssText.replace(_colonHostContextRe, `$1${_polyfillHostContext}`).replace(_colonHostRe, `$1${_polyfillHost}`).replace(_colonSlottedRe, `$1${_polyfillSlotted}`);
1925
+ supportsBlocks.forEach((originalSelector, index) => {
1926
+ cssText = cssText.replace(`__supports_${index}__`, originalSelector);
1927
+ });
1910
1928
  return cssText;
1911
1929
  };
1912
1930
  var convertColonRule = (cssText, regExp, partReplacer) => {
@@ -2560,7 +2578,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2560
2578
  if (import_app_data12.BUILD.vdomAttribute) {
2561
2579
  updateElement(null, newVNode2, isSvgMode);
2562
2580
  }
2563
- if (import_app_data12.BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
2581
+ if ((import_app_data12.BUILD.scoped || import_app_data12.BUILD.hydrateServerSide && 128 /* shadowNeedsScopedCss */) && isDef(scopeId) && elm["s-si"] !== scopeId) {
2564
2582
  elm.classList.add(elm["s-si"] = scopeId);
2565
2583
  }
2566
2584
  if (newVNode2.$children$) {
@@ -2595,7 +2613,7 @@ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
2595
2613
  putBackInOriginalLocation(oldParentVNode.$elm$, false);
2596
2614
  }
2597
2615
  }
2598
- if (import_app_data12.BUILD.scoped) {
2616
+ if (import_app_data12.BUILD.scoped || import_app_data12.BUILD.hydrateServerSide && 128 /* shadowNeedsScopedCss */) {
2599
2617
  addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);
2600
2618
  }
2601
2619
  }
@@ -4176,6 +4194,20 @@ var setNonce = (nonce) => plt.$nonce$ = nonce;
4176
4194
  // src/runtime/platform-options.ts
4177
4195
  var setPlatformOptions = (opts) => Object.assign(plt, opts);
4178
4196
 
4197
+ // src/runtime/render.ts
4198
+ function render(vnode, container) {
4199
+ const cmpMeta = {
4200
+ $flags$: 0,
4201
+ $tagName$: container.tagName
4202
+ };
4203
+ const ref = {
4204
+ $flags$: 0,
4205
+ $cmpMeta$: cmpMeta,
4206
+ $hostElement$: container
4207
+ };
4208
+ renderVdom(ref, vnode);
4209
+ }
4210
+
4179
4211
  // src/runtime/vdom/vdom-annotations.ts
4180
4212
  var insertVdomAnnotations = (doc, staticComponents) => {
4181
4213
  if (doc != null) {
@@ -4363,6 +4395,7 @@ var insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, inde
4363
4395
  registerHost,
4364
4396
  registerInstance,
4365
4397
  registerModule,
4398
+ render,
4366
4399
  renderVdom,
4367
4400
  resetPlatform,
4368
4401
  setAssetPath,
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/internal/testing",
3
- "version": "4.29.2-dev.1744261315.9aaccc5",
3
+ "version": "4.29.2-dev.1745356698.fd7be97",
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.29.2-dev.1744261315.9aaccc5 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc (CommonJS) v4.29.2-dev.1745356698.fd7be97 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __defProp = Object.defineProperty;
package/mock-doc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Stencil Mock Doc v4.29.2-dev.1744261315.9aaccc5 | MIT Licensed | https://stenciljs.com
2
+ Stencil Mock Doc v4.29.2-dev.1745356698.fd7be97 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
 
5
5
  // src/runtime/runtime-constants.ts
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stencil/core/mock-doc",
3
- "version": "4.29.2-dev.1744261315.9aaccc5",
3
+ "version": "4.29.2-dev.1745356698.fd7be97",
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.29.2-dev.1744261315.9aaccc5",
3
+ "version": "4.29.2-dev.1745356698.fd7be97",
4
4
  "license": "MIT",
5
5
  "main": "./internal/stencil-core/index.cjs",
6
6
  "module": "./internal/stencil-core/index.js",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Stencil Screenshot v4.29.2-dev.1744261315.9aaccc5 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot v4.29.2-dev.1745356698.fd7be97 | 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.29.2-dev.1744261315.9aaccc5",
3
+ "version": "4.29.2-dev.1745356698.fd7be97",
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.29.2-dev.1744261315.9aaccc5 | MIT Licensed | https://stenciljs.com
2
+ Stencil Screenshot Pixel Match v4.29.2-dev.1745356698.fd7be97 | MIT Licensed | https://stenciljs.com
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;