@automattic/interpolate-components 1.1.2 → 1.2.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/CHANGELOG.md ADDED
@@ -0,0 +1,35 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [1.2.0]
11
+
12
+ ### Added
13
+
14
+ - Add TypeScript type declarations [#58711](https://github.com/Automattic/wp-calypso/pull/58711)
15
+
16
+ ## [1.1.2]
17
+
18
+ ### Changed
19
+
20
+ - Rename package from `interpolate-components` to `@automattic/interpolate-components` ([#56933](https://github.com/Automattic/wp-calypso/pull/56933))
21
+ - Move into [Automattic/wp-calypso](https://github.com/Automattic/wp-calypso/tree/trunk/packages/interpolate-components) repository ([#56933](https://github.com/Automattic/wp-calypso/pull/56933))
22
+
23
+ ### Removed
24
+
25
+ - Drop support for React versions below `16.2` ([#56933](https://github.com/Automattic/wp-calypso/pull/56933), [#57564](https://github.com/Automattic/wp-calypso/pull/57564))
26
+
27
+ ## [Older releases]
28
+
29
+ `1.1.2` is the first release of `@automattic/interpolate-components`. Older releases can be found
30
+ under `interpolate-components`.
31
+
32
+ [unreleased]: https://github.com/Automattic/wp-calypso/tree/HEAD/packages/interpolate-components
33
+ [1.2.0]: https://github.com/Automattic/wp-calypso/tree/%40automattic/interpolate-components%401.2.0/packages/interpolate-components
34
+ [1.1.2]: https://github.com/Automattic/wp-calypso/tree/%40automattic/interpolate-components%401.1.2/packages/interpolate-components
35
+ [older releases]: https://github.com/Automattic/interpolate-components
package/README.md CHANGED
@@ -7,7 +7,7 @@ Interpolate-Components allows us to work with structured markup as strings and t
7
7
  `interpolateComponents` takes a single options object as an argument and returns a React element containing structured descendent components which can be rendered into a document. The option attributes are:
8
8
 
9
9
  - **mixedString** A string that contains component tokens to be interpolated
10
- - **components** An object with components assigned to named attributes
10
+ - **components** (optional) An object with components assigned to named attributes. If not provided, `mixedString` is returned.
11
11
  - **throwErrors** (optional) Whether errors should be thrown (as in pre-production environments) or we should more gracefully return the un-interpolated original string (as in production). This is optional and is `false` by default.
12
12
 
13
13
  ## Component tokens
package/package.json CHANGED
@@ -1,35 +1,42 @@
1
1
  {
2
- "name": "@automattic/interpolate-components",
3
- "version": "1.1.2",
4
- "description": "Convert strings into structured React components",
5
- "main": "dist/cjs/index.js",
6
- "module": "dist/esm/index.js",
7
- "calypso:src": "src/index.js",
8
- "sideEffects": false,
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/Automattic/wp-calypso.git",
12
- "directory": "packages/interpolate-components"
13
- },
14
- "author": "Automattic Inc.",
15
- "license": "GPL-2.0-or-later",
16
- "publishConfig": {
17
- "access": "public"
18
- },
19
- "bugs": {
20
- "url": "https://github.com/Automattic/wp-calypso/issues"
21
- },
22
- "homepage": "https://github.com/Automattic/wp-calypso/tree/HEAD/packages/interpolate-components#readme",
23
- "devDependencies": {
24
- "@automattic/calypso-typescript-config": "^1.0.0",
25
- "react-dom": "^17.0.2"
26
- },
27
- "peerDependencies": {
28
- "react": ">=16.2.0"
29
- },
30
- "scripts": {
31
- "clean": "npx rimraf dist",
32
- "build": "transpile",
33
- "prepack": "yarn run clean && yarn run build"
34
- }
35
- }
2
+ "name": "@automattic/interpolate-components",
3
+ "version": "1.2.0",
4
+ "description": "Convert strings into structured React components",
5
+ "main": "dist/cjs/index.js",
6
+ "module": "dist/esm/index.js",
7
+ "calypso:src": "src/index.js",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/Automattic/wp-calypso.git",
12
+ "directory": "packages/interpolate-components"
13
+ },
14
+ "author": "Automattic Inc.",
15
+ "license": "GPL-2.0-or-later",
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/Automattic/wp-calypso/issues"
21
+ },
22
+ "homepage": "https://github.com/Automattic/wp-calypso/tree/HEAD/packages/interpolate-components#readme",
23
+ "devDependencies": {
24
+ "@automattic/calypso-typescript-config": "^1.0.0",
25
+ "react-dom": "^17.0.2"
26
+ },
27
+ "peerDependencies": {
28
+ "@types/react": ">=16.1.0",
29
+ "react": ">=16.2.0"
30
+ },
31
+ "peerDependenciesMeta": {
32
+ "@types/react": {
33
+ "optional": true
34
+ }
35
+ },
36
+ "scripts": {
37
+ "clean": "npx rimraf dist",
38
+ "build": "../../node_modules/.bin/transpile",
39
+ "prepack": "yarn run clean && yarn run build"
40
+ },
41
+ "types": "types"
42
+ }
@@ -0,0 +1,7 @@
1
+ interface InterpolateOptions {
2
+ mixedString: string;
3
+ components?: Record< string, JSX.Element >;
4
+ throwErrors?: boolean;
5
+ }
6
+
7
+ export default function interpolate( options: InterpolateOptions ): JSX.Element;