Skip to content

Commit bcce1d0

Browse files
react: update output target options
1 parent 4630095 commit bcce1d0

File tree

10 files changed

+101
-41
lines changed
  • docs/framework-integration
  • versioned_docs
    • version-v4.21/framework-integration
    • version-v4.22/framework-integration
    • version-v4.23/framework-integration
    • version-v4.24/framework-integration
    • version-v4.25/framework-integration
    • version-v4.26/framework-integration
    • version-v4.27/framework-integration
    • version-v4.28/framework-integration
    • version-v4.29/framework-integration

10 files changed

+101
-41
lines changed

docs/framework-integration/react.md

+46-16
Original file line numberDiff line numberDiff line change
@@ -395,13 +395,13 @@ export default App;
395395

396396
## API
397397

398-
### esModule
398+
### outDir
399399

400-
**Optional**
400+
**Required**
401401

402-
**Type: `boolean`**
402+
**Type: `string`**
403403

404-
If `true`, the output target will generate a separate ES module for each React component wrapper. Defaults to `false`.
404+
The directory where the React components will be generated. Accepts a relative path from the Stencil project's root directory.
405405

406406
### excludeComponents
407407

@@ -411,29 +411,23 @@ If `true`, the output target will generate a separate ES module for each React c
411411

412412
An array of component tag names to exclude from the React output target. Useful if you want to prevent certain web components from being in the React library.
413413

414-
### experimentalUseClient
414+
### stencilPackageName
415415

416416
**Optional**
417417

418-
**Type: `boolean`**
419-
420-
If `true`, the generated output target will include the [use client;](https://react.dev/reference/react/use-client) directive.
421-
422-
### outDir
423-
424-
**Required**
425-
426418
**Type: `string`**
427419

428-
The directory where the React components will be generated. Accepts a relative path from the Stencil project's root directory.
420+
The name of the package that exports the Stencil components. Defaults to the `package.json` detected by the Stencil compiler.
429421

430-
### stencilPackageName
422+
### customElementsDir
431423

432424
**Optional**
433425

434426
**Type: `string`**
435427

436-
The name of the package that exports the Stencil components. Defaults to the package.json detected by the Stencil compiler.
428+
The directory where the custom elements are saved.
429+
430+
This value is automatically detected from the Stencil configuration file for the dist-custom-elements output target. If you are working in an environment that uses absolute paths, consider setting this value manually.
437431

438432
### hydrateModule
439433

@@ -477,6 +471,42 @@ frameworks. This may be useful if you would like to generally ignore some compon
477471
rendered on the server or if you like roll out SSR support for your design system one component at
478472
a time.
479473

474+
### esModules
475+
476+
**Optional**
477+
478+
**Default: `true`**
479+
480+
**Type: `boolean`**
481+
482+
If `true`, the output target will generate a separate ES module for each React component wrapper. Defaults to `false`.
483+
484+
### serializeShadowRoot
485+
486+
**Optional**
487+
488+
**Default: `'declarative-shadow-dom'`**
489+
490+
**Type: `'declarative-shadow-dom' | 'scoped' | { 'declarative-shadow-dom'?: string[]; scoped?: string[]; }**
491+
492+
Configure how Stencil serializes the components shadow root.
493+
- If set to `declarative-shadow-dom` the component will be rendered within a Declarative Shadow DOM.
494+
- If set to `scoped` Stencil will render the contents of the shadow root as a `scoped: true` component
495+
and the shadow DOM will be created during client-side hydration.
496+
- Alternatively you can mix and match the two by providing an object with `declarative-shadow-dom` and `scoped` keys,
497+
the value arrays containing the tag names of the components that should be rendered in that mode.
498+
499+
**Examples:**
500+
501+
- `{ 'declarative-shadow-dom': ['my-component-1', 'another-component'], default: 'scoped' }`
502+
Render all components as `scoped` apart from `my-component-1` and `another-component`
503+
- `{ 'scoped': ['an-option-component'], default: 'declarative-shadow-dom' }`
504+
Render all components within `declarative-shadow-dom` apart from `an-option-component`
505+
- `'scoped'` Render all components as `scoped`
506+
- `false` disables shadow root serialization
507+
508+
*NOTE* `true` has been deprecated in favor of `declarative-shadow-dom` and `scoped`
509+
480510
## FAQ's
481511

482512
### What is the best format to write event names?

versioned_docs/version-v4.21/framework-integration/react.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ export default App;
367367

368368
## API
369369

370-
### esModule
370+
### esModules
371371

372372
**Optional**
373373

versioned_docs/version-v4.22/framework-integration/react.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ export default App;
393393

394394
## API
395395

396-
### esModule
396+
### esModules
397397

398398
**Optional**
399399

versioned_docs/version-v4.23/framework-integration/react.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ Please be aware of the following limitations when working with server side rende
459459

460460
## API
461461

462-
### esModule
462+
### esModules
463463

464464
**Optional**
465465

versioned_docs/version-v4.24/framework-integration/react.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ Please be aware of the following limitations when working with server side rende
459459

460460
## API
461461

462-
### esModule
462+
### esModules
463463

464464
**Optional**
465465

versioned_docs/version-v4.25/framework-integration/react.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ Please be aware of the following limitations when working with server side rende
459459

460460
## API
461461

462-
### esModule
462+
### esModules
463463

464464
**Optional**
465465

versioned_docs/version-v4.26/framework-integration/react.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ Please be aware of the following limitations when working with server side rende
459459

460460
## API
461461

462-
### esModule
462+
### esModules
463463

464464
**Optional**
465465

versioned_docs/version-v4.27/framework-integration/react.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ Please be aware of the following limitations when working with server side rende
459459

460460
## API
461461

462-
### esModule
462+
### esModules
463463

464464
**Optional**
465465

versioned_docs/version-v4.28/framework-integration/react.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ Please be aware of the following limitations when working with server side rende
459459

460460
## API
461461

462-
### esModule
462+
### esModules
463463

464464
**Optional**
465465

versioned_docs/version-v4.29/framework-integration/react.md

+47-17
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ In your `react-library` project, create a project specific `tsconfig.json` that
163163
"moduleResolution": "bundler",
164164
"skipLibCheck": true,
165165
"jsx": "react",
166-
"allowSyntheticDefaultImports": true,
166+
167167
"declarationDir": "./dist/types"
168168
},
169169
"include": ["lib"],
@@ -395,13 +395,13 @@ export default App;
395395

396396
## API
397397

398-
### esModule
398+
### outDir
399399

400-
**Optional**
400+
**Required**
401401

402-
**Type: `boolean`**
402+
**Type: `string`**
403403

404-
If `true`, the output target will generate a separate ES module for each React component wrapper. Defaults to `false`.
404+
The directory where the React components will be generated. Accepts a relative path from the Stencil project's root directory.
405405

406406
### excludeComponents
407407

@@ -411,29 +411,23 @@ If `true`, the output target will generate a separate ES module for each React c
411411

412412
An array of component tag names to exclude from the React output target. Useful if you want to prevent certain web components from being in the React library.
413413

414-
### experimentalUseClient
414+
### stencilPackageName
415415

416416
**Optional**
417417

418-
**Type: `boolean`**
419-
420-
If `true`, the generated output target will include the [use client;](https://react.dev/reference/react/use-client) directive.
421-
422-
### outDir
423-
424-
**Required**
425-
426418
**Type: `string`**
427419

428-
The directory where the React components will be generated. Accepts a relative path from the Stencil project's root directory.
420+
The name of the package that exports the Stencil components. Defaults to the `package.json` detected by the Stencil compiler.
429421

430-
### stencilPackageName
422+
### customElementsDir
431423

432424
**Optional**
433425

434426
**Type: `string`**
435427

436-
The name of the package that exports the Stencil components. Defaults to the package.json detected by the Stencil compiler.
428+
The directory where the custom elements are saved.
429+
430+
This value is automatically detected from the Stencil configuration file for the dist-custom-elements output target. If you are working in an environment that uses absolute paths, consider setting this value manually.
437431

438432
### hydrateModule
439433

@@ -477,6 +471,42 @@ frameworks. This may be useful if you would like to generally ignore some compon
477471
rendered on the server or if you like roll out SSR support for your design system one component at
478472
a time.
479473

474+
### esModules
475+
476+
**Optional**
477+
478+
**Default: `true`**
479+
480+
**Type: `boolean`**
481+
482+
If `true`, the output target will generate a separate ES module for each React component wrapper. Defaults to `false`.
483+
484+
### serializeShadowRoot
485+
486+
**Optional**
487+
488+
**Default: `'declarative-shadow-dom'`**
489+
490+
**Type: `'declarative-shadow-dom' | 'scoped' | { 'declarative-shadow-dom'?: string[]; scoped?: string[]; }**
491+
492+
Configure how Stencil serializes the components shadow root.
493+
- If set to `declarative-shadow-dom` the component will be rendered within a Declarative Shadow DOM.
494+
- If set to `scoped` Stencil will render the contents of the shadow root as a `scoped: true` component
495+
and the shadow DOM will be created during client-side hydration.
496+
- Alternatively you can mix and match the two by providing an object with `declarative-shadow-dom` and `scoped` keys,
497+
the value arrays containing the tag names of the components that should be rendered in that mode.
498+
499+
**Examples:**
500+
501+
- `{ 'declarative-shadow-dom': ['my-component-1', 'another-component'], default: 'scoped' }`
502+
Render all components as `scoped` apart from `my-component-1` and `another-component`
503+
- `{ 'scoped': ['an-option-component'], default: 'declarative-shadow-dom' }`
504+
Render all components within `declarative-shadow-dom` apart from `an-option-component`
505+
- `'scoped'` Render all components as `scoped`
506+
- `false` disables shadow root serialization
507+
508+
*NOTE* `true` has been deprecated in favor of `declarative-shadow-dom` and `scoped`
509+
480510
## FAQ's
481511

482512
### What is the best format to write event names?

0 commit comments

Comments
 (0)