@fluentui/react-jsx-runtime 9.0.0-alpha.9 → 9.0.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.json +112 -1
- package/CHANGELOG.md +57 -2
- package/README.md +46 -2
- package/dist/index.d.ts +1 -1
- package/lib/createElement.js +12 -11
- package/lib/createElement.js.map +1 -1
- package/lib/jsx/createElementFromSlotComponent.js +15 -0
- package/lib/jsx/createElementFromSlotComponent.js.map +1 -0
- package/lib/jsx/jsxDEVFromSlotComponent.js +16 -0
- package/lib/jsx/jsxDEVFromSlotComponent.js.map +1 -0
- package/lib/jsx/jsxDynamicFromSlotComponent.js +18 -0
- package/lib/jsx/jsxDynamicFromSlotComponent.js.map +1 -0
- package/lib/jsx/jsxStaticFromSlotComponent.js +18 -0
- package/lib/jsx/jsxStaticFromSlotComponent.js.map +1 -0
- package/lib/jsx-dev-runtime.js +17 -0
- package/lib/jsx-dev-runtime.js.map +1 -0
- package/lib/jsx-runtime.js +30 -0
- package/lib/jsx-runtime.js.map +1 -0
- package/lib/utils/DevRuntime.js +2 -0
- package/lib/utils/DevRuntime.js.map +1 -0
- package/lib/utils/Runtime.js +2 -0
- package/lib/utils/Runtime.js.map +1 -0
- package/lib/utils/createCompatSlotComponent.js +11 -0
- package/lib/utils/createCompatSlotComponent.js.map +1 -0
- package/lib/utils/getMetadataFromSlotComponent.js +16 -0
- package/lib/utils/getMetadataFromSlotComponent.js.map +1 -0
- package/lib/utils/types.js +1 -0
- package/lib/utils/types.js.map +1 -0
- package/lib-commonjs/createElement.js +14 -19
- package/lib-commonjs/createElement.js.map +1 -1
- package/lib-commonjs/jsx/createElementFromSlotComponent.js +21 -0
- package/lib-commonjs/jsx/createElementFromSlotComponent.js.map +1 -0
- package/lib-commonjs/jsx/jsxDEVFromSlotComponent.js +25 -0
- package/lib-commonjs/jsx/jsxDEVFromSlotComponent.js.map +1 -0
- package/lib-commonjs/jsx/jsxDynamicFromSlotComponent.js +25 -0
- package/lib-commonjs/jsx/jsxDynamicFromSlotComponent.js.map +1 -0
- package/lib-commonjs/jsx/jsxStaticFromSlotComponent.js +25 -0
- package/lib-commonjs/jsx/jsxStaticFromSlotComponent.js.map +1 -0
- package/lib-commonjs/jsx-dev-runtime.js +31 -0
- package/lib-commonjs/jsx-dev-runtime.js.map +1 -0
- package/lib-commonjs/jsx-runtime.js +45 -0
- package/lib-commonjs/jsx-runtime.js.map +1 -0
- package/lib-commonjs/utils/DevRuntime.js +11 -0
- package/lib-commonjs/utils/DevRuntime.js.map +1 -0
- package/lib-commonjs/utils/Runtime.js +11 -0
- package/lib-commonjs/utils/Runtime.js.map +1 -0
- package/lib-commonjs/utils/createCompatSlotComponent.js +17 -0
- package/lib-commonjs/utils/createCompatSlotComponent.js.map +1 -0
- package/lib-commonjs/utils/getMetadataFromSlotComponent.js +22 -0
- package/lib-commonjs/utils/getMetadataFromSlotComponent.js.map +1 -0
- package/lib-commonjs/utils/types.js +4 -0
- package/lib-commonjs/utils/types.js.map +1 -0
- package/package.json +17 -6
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,118 @@
|
|
|
2
2
|
"name": "@fluentui/react-jsx-runtime",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "Wed,
|
|
5
|
+
"date": "Wed, 16 Aug 2023 17:38:21 GMT",
|
|
6
|
+
"tag": "@fluentui/react-jsx-runtime_v9.0.0",
|
|
7
|
+
"version": "9.0.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
12
|
+
"package": "@fluentui/react-jsx-runtime",
|
|
13
|
+
"commit": "7e2ba9c3e9e9e426e18bc5861fd84211400780ac",
|
|
14
|
+
"comment": "chore: release stable version"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"date": "Wed, 16 Aug 2023 11:38:33 GMT",
|
|
21
|
+
"tag": "@fluentui/react-jsx-runtime_v9.0.0-alpha.16",
|
|
22
|
+
"version": "9.0.0-alpha.16",
|
|
23
|
+
"comments": {
|
|
24
|
+
"prerelease": [
|
|
25
|
+
{
|
|
26
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
27
|
+
"package": "@fluentui/react-jsx-runtime",
|
|
28
|
+
"commit": "d40ea6e1d43cd21d1404d9c71018d822958c6644",
|
|
29
|
+
"comment": "feat: supports new automatic JSX runtime"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"date": "Fri, 11 Aug 2023 12:14:26 GMT",
|
|
36
|
+
"tag": "@fluentui/react-jsx-runtime_v9.0.0-alpha.15",
|
|
37
|
+
"version": "9.0.0-alpha.15",
|
|
38
|
+
"comments": {
|
|
39
|
+
"prerelease": [
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui/react-jsx-runtime",
|
|
43
|
+
"comment": "Bump @fluentui/react-utilities to v9.11.1",
|
|
44
|
+
"commit": "a77bcda1628e8b20b113d0237317efd7ebbc5294"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"date": "Fri, 04 Aug 2023 08:52:55 GMT",
|
|
51
|
+
"tag": "@fluentui/react-jsx-runtime_v9.0.0-alpha.13",
|
|
52
|
+
"version": "9.0.0-alpha.13",
|
|
53
|
+
"comments": {
|
|
54
|
+
"prerelease": [
|
|
55
|
+
{
|
|
56
|
+
"author": "bernardo.sunderhus@gmail.com",
|
|
57
|
+
"package": "@fluentui/react-jsx-runtime",
|
|
58
|
+
"commit": "6a8afe2b7becaf1b10cbc9ae98b39d352b8c7026",
|
|
59
|
+
"comment": "chore: update createElement to support new slot methods"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"author": "beachball",
|
|
63
|
+
"package": "@fluentui/react-jsx-runtime",
|
|
64
|
+
"comment": "Bump @fluentui/react-utilities to v9.11.0",
|
|
65
|
+
"commit": "0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"date": "Thu, 13 Jul 2023 21:25:42 GMT",
|
|
72
|
+
"tag": "@fluentui/react-jsx-runtime_v9.0.0-alpha.11",
|
|
73
|
+
"version": "9.0.0-alpha.11",
|
|
74
|
+
"comments": {
|
|
75
|
+
"none": [
|
|
76
|
+
{
|
|
77
|
+
"author": "martinhochel@microsoft.com",
|
|
78
|
+
"package": "@fluentui/react-jsx-runtime",
|
|
79
|
+
"commit": "8a9e1018f2abb2c7608c49d32acf44e93c43cba6",
|
|
80
|
+
"comment": "chore: update devDependencies to use * for inner workspace dependencies"
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"date": "Tue, 11 Jul 2023 18:46:36 GMT",
|
|
87
|
+
"tag": "@fluentui/react-jsx-runtime_v9.0.0-alpha.11",
|
|
88
|
+
"version": "9.0.0-alpha.11",
|
|
89
|
+
"comments": {
|
|
90
|
+
"prerelease": [
|
|
91
|
+
{
|
|
92
|
+
"author": "beachball",
|
|
93
|
+
"package": "@fluentui/react-jsx-runtime",
|
|
94
|
+
"comment": "Bump @fluentui/react-conformance-griffel to v9.0.0",
|
|
95
|
+
"commit": "f958e7e175264e289a6ecdc5b108e826f6b34e74"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"date": "Mon, 03 Jul 2023 11:57:14 GMT",
|
|
102
|
+
"tag": "@fluentui/react-jsx-runtime_v9.0.0-alpha.10",
|
|
103
|
+
"version": "9.0.0-alpha.10",
|
|
104
|
+
"comments": {
|
|
105
|
+
"prerelease": [
|
|
106
|
+
{
|
|
107
|
+
"author": "beachball",
|
|
108
|
+
"package": "@fluentui/react-jsx-runtime",
|
|
109
|
+
"comment": "Bump @fluentui/react-utilities to v9.10.1",
|
|
110
|
+
"commit": "61633ba5de03e0ddf4839dba6da325e30c7ce9bd"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"date": "Wed, 28 Jun 2023 11:12:27 GMT",
|
|
6
117
|
"tag": "@fluentui/react-jsx-runtime_v9.0.0-alpha.9",
|
|
7
118
|
"version": "9.0.0-alpha.9",
|
|
8
119
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,67 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-jsx-runtime
|
|
2
2
|
|
|
3
|
-
This log was last generated on Wed,
|
|
3
|
+
This log was last generated on Wed, 16 Aug 2023 17:38:21 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-jsx-runtime_v9.0.0)
|
|
8
|
+
|
|
9
|
+
Wed, 16 Aug 2023 17:38:21 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-jsx-runtime_v9.0.0-alpha.16..@fluentui/react-jsx-runtime_v9.0.0)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- chore: release stable version ([PR #28880](https://github.com/microsoft/fluentui/pull/28880) by bernardo.sunderhus@gmail.com)
|
|
15
|
+
|
|
16
|
+
## [9.0.0-alpha.16](https://github.com/microsoft/fluentui/tree/@fluentui/react-jsx-runtime_v9.0.0-alpha.16)
|
|
17
|
+
|
|
18
|
+
Wed, 16 Aug 2023 11:38:33 GMT
|
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-jsx-runtime_v9.0.0-alpha.15..@fluentui/react-jsx-runtime_v9.0.0-alpha.16)
|
|
20
|
+
|
|
21
|
+
### Changes
|
|
22
|
+
|
|
23
|
+
- feat: supports new automatic JSX runtime ([PR #28810](https://github.com/microsoft/fluentui/pull/28810) by bernardo.sunderhus@gmail.com)
|
|
24
|
+
|
|
25
|
+
## [9.0.0-alpha.15](https://github.com/microsoft/fluentui/tree/@fluentui/react-jsx-runtime_v9.0.0-alpha.15)
|
|
26
|
+
|
|
27
|
+
Fri, 11 Aug 2023 12:14:26 GMT
|
|
28
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-jsx-runtime_v9.0.0-alpha.13..@fluentui/react-jsx-runtime_v9.0.0-alpha.15)
|
|
29
|
+
|
|
30
|
+
### Changes
|
|
31
|
+
|
|
32
|
+
- Bump @fluentui/react-utilities to v9.11.1 ([PR #28808](https://github.com/microsoft/fluentui/pull/28808) by beachball)
|
|
33
|
+
|
|
34
|
+
## [9.0.0-alpha.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-jsx-runtime_v9.0.0-alpha.13)
|
|
35
|
+
|
|
36
|
+
Fri, 04 Aug 2023 08:52:55 GMT
|
|
37
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-jsx-runtime_v9.0.0-alpha.11..@fluentui/react-jsx-runtime_v9.0.0-alpha.13)
|
|
38
|
+
|
|
39
|
+
### Changes
|
|
40
|
+
|
|
41
|
+
- chore: update createElement to support new slot methods ([PR #28373](https://github.com/microsoft/fluentui/pull/28373) by bernardo.sunderhus@gmail.com)
|
|
42
|
+
- Bump @fluentui/react-utilities to v9.11.0 ([commit](https://github.com/microsoft/fluentui/commit/0bf7d9438c1d0ff90cd2b28bc4cceb4f807afbca) by beachball)
|
|
43
|
+
|
|
44
|
+
## [9.0.0-alpha.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-jsx-runtime_v9.0.0-alpha.11)
|
|
45
|
+
|
|
46
|
+
Tue, 11 Jul 2023 18:46:36 GMT
|
|
47
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-jsx-runtime_v9.0.0-alpha.10..@fluentui/react-jsx-runtime_v9.0.0-alpha.11)
|
|
48
|
+
|
|
49
|
+
### Changes
|
|
50
|
+
|
|
51
|
+
- Bump @fluentui/react-conformance-griffel to v9.0.0 ([PR #28491](https://github.com/microsoft/fluentui/pull/28491) by beachball)
|
|
52
|
+
|
|
53
|
+
## [9.0.0-alpha.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-jsx-runtime_v9.0.0-alpha.10)
|
|
54
|
+
|
|
55
|
+
Mon, 03 Jul 2023 11:57:14 GMT
|
|
56
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-jsx-runtime_v9.0.0-alpha.9..@fluentui/react-jsx-runtime_v9.0.0-alpha.10)
|
|
57
|
+
|
|
58
|
+
### Changes
|
|
59
|
+
|
|
60
|
+
- Bump @fluentui/react-utilities to v9.10.1 ([PR #28412](https://github.com/microsoft/fluentui/pull/28412) by beachball)
|
|
61
|
+
|
|
7
62
|
## [9.0.0-alpha.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-jsx-runtime_v9.0.0-alpha.9)
|
|
8
63
|
|
|
9
|
-
Wed, 28 Jun 2023 11:
|
|
64
|
+
Wed, 28 Jun 2023 11:12:27 GMT
|
|
10
65
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-jsx-runtime_v9.0.0-alpha.8..@fluentui/react-jsx-runtime_v9.0.0-alpha.9)
|
|
11
66
|
|
|
12
67
|
### Changes
|
package/README.md
CHANGED
|
@@ -1,5 +1,49 @@
|
|
|
1
1
|
# @fluentui/react-jsx-runtime
|
|
2
2
|
|
|
3
|
-
**React
|
|
3
|
+
**React JSX runtime for [Fluent UI React](https://react.fluentui.dev/)**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[Fluent UI React](https://react.fluentui.dev/) requires the usage of a custom JSX runtime to support the [slots API](https://react.fluentui.dev/?path=/docs/concepts-developer-customizing-components-with-slots--page)
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
This library should only be used in the case where you are trying to use the internal slot API of Fluent UI React. If you are not using the internal slot API, you should not need to use this library.
|
|
10
|
+
|
|
11
|
+
In case you want to re-compose a component and redeclare its render method then this API will be necessary, here's our documentation on [Rendering a component with slots](https://react.fluentui.dev/?path=/docs/concepts-developer-customizing-components-with-slots--page#rendering-components-with-slots)
|
|
12
|
+
|
|
13
|
+
To properly render a component with slots the `createElement` method of `@fluentui/react-jsx-runtime` can be used as a replacement for `React.createElement`:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
/** @jsxRuntime classic */
|
|
17
|
+
/** @jsx createElement */
|
|
18
|
+
|
|
19
|
+
// createElement custom JSX pragma is required to support slot creation
|
|
20
|
+
import { createElement } from '@fluentui/react-jsx-runtime';
|
|
21
|
+
import { assertSlots } from '@fluentui/react-utilities';
|
|
22
|
+
|
|
23
|
+
const renderButton_unstable = (state: ButtonState) => {
|
|
24
|
+
const { iconOnly, iconPosition } = state;
|
|
25
|
+
|
|
26
|
+
assertSlots<ButtonSlots>(state);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<state.root>
|
|
30
|
+
{iconPosition !== 'after' && state.icon && <state.icon />}
|
|
31
|
+
{!iconOnly && state.root.children}
|
|
32
|
+
{iconPosition === 'after' && state.icon && <state.icon />}
|
|
33
|
+
</state.root>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
In case you're using typescript or any modern javascript transpiler, you can use [JSX import source](https://www.typescriptlang.org/tsconfig#jsxImportSource) feature instead of depending on declaring the runtime on every file
|
|
39
|
+
|
|
40
|
+
In TSC case you can simply add this do `tsconfig.json` file:
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"compilerOptions": {
|
|
45
|
+
"jsx": "react-jsx",
|
|
46
|
+
"jsxImportSource": "@fluentui/react-jsx-runtime"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Fragment } from 'react';
|
|
2
2
|
import * as React_2 from 'react';
|
|
3
3
|
|
|
4
|
-
export declare function createElement<P extends {}>(type: React_2.ElementType<P>, props?: P | null, ...children: React_2.ReactNode[]): React_2.ReactElement<P
|
|
4
|
+
export declare function createElement<P extends {}>(type: React_2.ElementType<P>, props?: P | null, ...children: React_2.ReactNode[]): React_2.ReactElement<P>;
|
|
5
5
|
|
|
6
6
|
export { Fragment }
|
|
7
7
|
|
package/lib/createElement.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { isSlot } from '@fluentui/react-utilities';
|
|
3
|
+
import { createElementFromSlotComponent } from './jsx/createElementFromSlotComponent';
|
|
4
|
+
import { createCompatSlotComponent } from './utils/createCompatSlotComponent';
|
|
3
5
|
export function createElement(type, props, ...children) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
renderProps.children = React.createElement(React.Fragment, {}, ...overrideChildren);
|
|
6
|
+
// TODO:
|
|
7
|
+
// this is for backwards compatibility with getSlotsNext
|
|
8
|
+
// it should be removed once getSlotsNext is obsolete
|
|
9
|
+
if (isSlot(props)) {
|
|
10
|
+
return createElementFromSlotComponent(createCompatSlotComponent(type, props), children);
|
|
10
11
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return
|
|
12
|
+
if (isSlot(type)) {
|
|
13
|
+
return createElementFromSlotComponent(type, children);
|
|
14
|
+
}
|
|
15
|
+
return React.createElement(type, props, ...children);
|
|
15
16
|
}
|
package/lib/createElement.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["createElement.ts"],"sourcesContent":["import * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["createElement.ts"],"sourcesContent":["import * as React from 'react';\nimport { isSlot } from '@fluentui/react-utilities';\nimport { createElementFromSlotComponent } from './jsx/createElementFromSlotComponent';\nimport { createCompatSlotComponent } from './utils/createCompatSlotComponent';\n\nexport function createElement<P extends {}>(\n type: React.ElementType<P>,\n props?: P | null,\n ...children: React.ReactNode[]\n): React.ReactElement<P> {\n // TODO:\n // this is for backwards compatibility with getSlotsNext\n // it should be removed once getSlotsNext is obsolete\n if (isSlot<P>(props)) {\n return createElementFromSlotComponent(createCompatSlotComponent(type, props), children);\n }\n if (isSlot<P>(type)) {\n return createElementFromSlotComponent(type, children);\n }\n return React.createElement(type, props, ...children);\n}\n"],"names":["React","isSlot","createElementFromSlotComponent","createCompatSlotComponent","createElement","type","props","children"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,MAAM,QAAQ,4BAA4B;AACnD,SAASC,8BAA8B,QAAQ,uCAAuC;AACtF,SAASC,yBAAyB,QAAQ,oCAAoC;AAE9E,OAAO,SAASC,cACdC,IAA0B,EAC1BC,KAAgB,EAChB,GAAGC,QAA2B,EACP;IACvB,QAAQ;IACR,wDAAwD;IACxD,qDAAqD;IACrD,IAAIN,OAAUK,QAAQ;QACpB,OAAOJ,+BAA+BC,0BAA0BE,MAAMC,QAAQC;IAChF,CAAC;IACD,IAAIN,OAAUI,OAAO;QACnB,OAAOH,+BAA+BG,MAAME;IAC9C,CAAC;IACD,OAAOP,MAAMI,aAAa,CAACC,MAAMC,UAAUC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* creates a ReactElement from a slot declaration
|
|
6
|
+
*/ export function createElementFromSlotComponent(type, overrideChildren) {
|
|
7
|
+
const { elementType , renderFunction , props } = getMetadataFromSlotComponent(type);
|
|
8
|
+
if (renderFunction) {
|
|
9
|
+
if (overrideChildren.length > 0) {
|
|
10
|
+
props.children = React.createElement(React.Fragment, {}, ...overrideChildren);
|
|
11
|
+
}
|
|
12
|
+
return React.createElement(React.Fragment, {}, renderFunction(elementType, props));
|
|
13
|
+
}
|
|
14
|
+
return React.createElement(elementType, props, ...overrideChildren);
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createElementFromSlotComponent.ts"],"sourcesContent":["import * as React from 'react';\nimport type { SlotComponentType, UnknownSlotProps } from '@fluentui/react-utilities';\nimport { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';\n\n/**\n * @internal\n * creates a ReactElement from a slot declaration\n */\nexport function createElementFromSlotComponent<Props extends UnknownSlotProps>(\n type: SlotComponentType<Props>,\n overrideChildren: React.ReactNode[],\n): React.ReactElement<Props> {\n const { elementType, renderFunction, props } = getMetadataFromSlotComponent(type);\n\n if (renderFunction) {\n if (overrideChildren.length > 0) {\n props.children = React.createElement(React.Fragment, {}, ...overrideChildren);\n }\n\n return React.createElement(\n React.Fragment,\n {},\n renderFunction(elementType as React.ElementType<Props>, props),\n ) as React.ReactElement<Props>;\n }\n\n return React.createElement(elementType, props, ...overrideChildren);\n}\n"],"names":["React","getMetadataFromSlotComponent","createElementFromSlotComponent","type","overrideChildren","elementType","renderFunction","props","length","children","createElement","Fragment"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,4BAA4B,QAAQ,wCAAwC;AAErF;;;CAGC,GACD,OAAO,SAASC,+BACdC,IAA8B,EAC9BC,gBAAmC,EACR;IAC3B,MAAM,EAAEC,YAAW,EAAEC,eAAc,EAAEC,MAAK,EAAE,GAAGN,6BAA6BE;IAE5E,IAAIG,gBAAgB;QAClB,IAAIF,iBAAiBI,MAAM,GAAG,GAAG;YAC/BD,MAAME,QAAQ,GAAGT,MAAMU,aAAa,CAACV,MAAMW,QAAQ,EAAE,CAAC,MAAMP;QAC9D,CAAC;QAED,OAAOJ,MAAMU,aAAa,CACxBV,MAAMW,QAAQ,EACd,CAAC,GACDL,eAAeD,aAAyCE;IAE5D,CAAC;IAED,OAAOP,MAAMU,aAAa,CAACL,aAAaE,UAAUH;AACpD,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';
|
|
3
|
+
import { DevRuntime } from '../utils/DevRuntime';
|
|
4
|
+
export function jsxDEVFromSlotComponent(type, overrideProps, key, source, self) {
|
|
5
|
+
const { elementType , renderFunction , props: slotProps } = getMetadataFromSlotComponent(type);
|
|
6
|
+
const props = {
|
|
7
|
+
...slotProps,
|
|
8
|
+
...overrideProps
|
|
9
|
+
};
|
|
10
|
+
if (renderFunction) {
|
|
11
|
+
return DevRuntime.jsxDEV(React.Fragment, {
|
|
12
|
+
children: renderFunction(elementType, props)
|
|
13
|
+
}, key, source, self);
|
|
14
|
+
}
|
|
15
|
+
return DevRuntime.jsxDEV(elementType, props, key, source, self);
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["jsxDEVFromSlotComponent.ts"],"sourcesContent":["import * as React from 'react';\nimport type { SlotComponentType, UnknownSlotProps } from '@fluentui/react-utilities';\nimport { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';\nimport { DevRuntime } from '../utils/DevRuntime';\n\nexport function jsxDEVFromSlotComponent<Props extends UnknownSlotProps>(\n type: SlotComponentType<Props>,\n overrideProps: Props | null,\n key?: React.Key,\n source?: unknown,\n self?: unknown,\n): React.ReactElement<Props> {\n const { elementType, renderFunction, props: slotProps } = getMetadataFromSlotComponent(type);\n\n const props: Props = { ...slotProps, ...overrideProps };\n\n if (renderFunction) {\n return DevRuntime.jsxDEV(\n React.Fragment,\n {\n children: renderFunction(elementType, props),\n },\n key,\n source,\n self,\n ) as React.ReactElement<Props>;\n }\n\n return DevRuntime.jsxDEV(elementType, props, key, source, self);\n}\n"],"names":["React","getMetadataFromSlotComponent","DevRuntime","jsxDEVFromSlotComponent","type","overrideProps","key","source","self","elementType","renderFunction","props","slotProps","jsxDEV","Fragment","children"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,4BAA4B,QAAQ,wCAAwC;AACrF,SAASC,UAAU,QAAQ,sBAAsB;AAEjD,OAAO,SAASC,wBACdC,IAA8B,EAC9BC,aAA2B,EAC3BC,GAAe,EACfC,MAAgB,EAChBC,IAAc,EACa;IAC3B,MAAM,EAAEC,YAAW,EAAEC,eAAc,EAAEC,OAAOC,UAAS,EAAE,GAAGX,6BAA6BG;IAEvF,MAAMO,QAAe;QAAE,GAAGC,SAAS;QAAE,GAAGP,aAAa;IAAC;IAEtD,IAAIK,gBAAgB;QAClB,OAAOR,WAAWW,MAAM,CACtBb,MAAMc,QAAQ,EACd;YACEC,UAAUL,eAAeD,aAAaE;QACxC,GACAL,KACAC,QACAC;IAEJ,CAAC;IAED,OAAON,WAAWW,MAAM,CAACJ,aAAaE,OAAOL,KAAKC,QAAQC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';
|
|
3
|
+
import { Runtime } from '../utils/Runtime';
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/ export function jsxDynamicFromSlotComponent(type, overrideProps, key) {
|
|
7
|
+
const { elementType , renderFunction , props: slotProps } = getMetadataFromSlotComponent(type);
|
|
8
|
+
const props = {
|
|
9
|
+
...slotProps,
|
|
10
|
+
...overrideProps
|
|
11
|
+
};
|
|
12
|
+
if (renderFunction) {
|
|
13
|
+
return Runtime.jsx(React.Fragment, {
|
|
14
|
+
children: renderFunction(elementType, props)
|
|
15
|
+
}, key);
|
|
16
|
+
}
|
|
17
|
+
return Runtime.jsx(elementType, props, key);
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["jsxDynamicFromSlotComponent.ts"],"sourcesContent":["import * as React from 'react';\nimport type { SlotComponentType, UnknownSlotProps } from '@fluentui/react-utilities';\nimport { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';\nimport { Runtime } from '../utils/Runtime';\n\n/**\n * @internal\n */\nexport function jsxDynamicFromSlotComponent<Props extends UnknownSlotProps>(\n type: SlotComponentType<Props>,\n overrideProps: Props | null,\n key?: React.Key,\n): React.ReactElement<Props> {\n const { elementType, renderFunction, props: slotProps } = getMetadataFromSlotComponent(type);\n\n const props: Props = { ...slotProps, ...overrideProps };\n\n if (renderFunction) {\n return Runtime.jsx(\n React.Fragment,\n {\n children: renderFunction(elementType, props),\n },\n key,\n ) as React.ReactElement<Props>;\n }\n\n return Runtime.jsx(elementType, props, key);\n}\n"],"names":["React","getMetadataFromSlotComponent","Runtime","jsxDynamicFromSlotComponent","type","overrideProps","key","elementType","renderFunction","props","slotProps","jsx","Fragment","children"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,4BAA4B,QAAQ,wCAAwC;AACrF,SAASC,OAAO,QAAQ,mBAAmB;AAE3C;;CAEC,GACD,OAAO,SAASC,4BACdC,IAA8B,EAC9BC,aAA2B,EAC3BC,GAAe,EACY;IAC3B,MAAM,EAAEC,YAAW,EAAEC,eAAc,EAAEC,OAAOC,UAAS,EAAE,GAAGT,6BAA6BG;IAEvF,MAAMK,QAAe;QAAE,GAAGC,SAAS;QAAE,GAAGL,aAAa;IAAC;IAEtD,IAAIG,gBAAgB;QAClB,OAAON,QAAQS,GAAG,CAChBX,MAAMY,QAAQ,EACd;YACEC,UAAUL,eAAeD,aAAaE;QACxC,GACAH;IAEJ,CAAC;IAED,OAAOJ,QAAQS,GAAG,CAACJ,aAAaE,OAAOH;AACzC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';
|
|
3
|
+
import { Runtime } from '../utils/Runtime';
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
*/ export function jsxStaticFromSlotComponent(type, overrideProps, key) {
|
|
7
|
+
const { elementType , renderFunction , props: slotProps } = getMetadataFromSlotComponent(type);
|
|
8
|
+
const props = {
|
|
9
|
+
...slotProps,
|
|
10
|
+
...overrideProps
|
|
11
|
+
};
|
|
12
|
+
if (renderFunction) {
|
|
13
|
+
return Runtime.jsxs(React.Fragment, {
|
|
14
|
+
children: renderFunction(elementType, props)
|
|
15
|
+
}, key);
|
|
16
|
+
}
|
|
17
|
+
return Runtime.jsxs(elementType, props, key);
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["jsxStaticFromSlotComponent.ts"],"sourcesContent":["import * as React from 'react';\nimport type { SlotComponentType, UnknownSlotProps } from '@fluentui/react-utilities';\nimport { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';\nimport { Runtime } from '../utils/Runtime';\n\n/**\n * @internal\n */\nexport function jsxStaticFromSlotComponent<Props extends UnknownSlotProps>(\n type: SlotComponentType<Props>,\n overrideProps: Props | null,\n key?: React.Key,\n): React.ReactElement<Props> {\n const { elementType, renderFunction, props: slotProps } = getMetadataFromSlotComponent(type);\n\n const props: Props = { ...slotProps, ...overrideProps };\n\n if (renderFunction) {\n return Runtime.jsxs(\n React.Fragment,\n {\n children: renderFunction(elementType, props),\n },\n key,\n ) as React.ReactElement<Props>;\n }\n\n return Runtime.jsxs(elementType, props, key);\n}\n"],"names":["React","getMetadataFromSlotComponent","Runtime","jsxStaticFromSlotComponent","type","overrideProps","key","elementType","renderFunction","props","slotProps","jsxs","Fragment","children"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAE/B,SAASC,4BAA4B,QAAQ,wCAAwC;AACrF,SAASC,OAAO,QAAQ,mBAAmB;AAE3C;;CAEC,GACD,OAAO,SAASC,2BACdC,IAA8B,EAC9BC,aAA2B,EAC3BC,GAAe,EACY;IAC3B,MAAM,EAAEC,YAAW,EAAEC,eAAc,EAAEC,OAAOC,UAAS,EAAE,GAAGT,6BAA6BG;IAEvF,MAAMK,QAAe;QAAE,GAAGC,SAAS;QAAE,GAAGL,aAAa;IAAC;IAEtD,IAAIG,gBAAgB;QAClB,OAAON,QAAQS,IAAI,CACjBX,MAAMY,QAAQ,EACd;YACEC,UAAUL,eAAeD,aAAaE;QACxC,GACAH;IAEJ,CAAC;IAED,OAAOJ,QAAQS,IAAI,CAACJ,aAAaE,OAAOH;AAC1C,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { isSlot } from '@fluentui/react-utilities';
|
|
2
|
+
import { jsxDEVFromSlotComponent } from './jsx/jsxDEVFromSlotComponent';
|
|
3
|
+
import { createCompatSlotComponent } from './utils/createCompatSlotComponent';
|
|
4
|
+
import { DevRuntime } from './utils/DevRuntime';
|
|
5
|
+
export { Fragment } from 'react';
|
|
6
|
+
export function jsxDEV(type, props, key, source, self) {
|
|
7
|
+
// TODO:
|
|
8
|
+
// this is for backwards compatibility with getSlotsNext
|
|
9
|
+
// it should be removed once getSlotsNext is obsolete
|
|
10
|
+
if (isSlot(props)) {
|
|
11
|
+
return jsxDEVFromSlotComponent(createCompatSlotComponent(type, props), null, key, source, self);
|
|
12
|
+
}
|
|
13
|
+
if (isSlot(type)) {
|
|
14
|
+
return jsxDEVFromSlotComponent(type, props, key, source, self);
|
|
15
|
+
}
|
|
16
|
+
return DevRuntime.jsxDEV(type, props, key, source, self);
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["jsx-dev-runtime.ts"],"sourcesContent":["import type * as React from 'react';\nimport { isSlot } from '@fluentui/react-utilities';\nimport { jsxDEVFromSlotComponent } from './jsx/jsxDEVFromSlotComponent';\nimport { createCompatSlotComponent } from './utils/createCompatSlotComponent';\nimport { DevRuntime } from './utils/DevRuntime';\n\nexport { Fragment } from 'react';\n\nexport function jsxDEV<P extends {}>(\n type: React.ElementType<P>,\n props: P,\n key?: React.Key,\n source?: boolean,\n self?: unknown,\n): React.ReactElement<P> {\n // TODO:\n // this is for backwards compatibility with getSlotsNext\n // it should be removed once getSlotsNext is obsolete\n if (isSlot<P>(props)) {\n return jsxDEVFromSlotComponent(createCompatSlotComponent(type, props), null, key, source, self);\n }\n if (isSlot<P>(type)) {\n return jsxDEVFromSlotComponent(type, props, key, source, self);\n }\n return DevRuntime.jsxDEV(type, props, key, source, self);\n}\n"],"names":["isSlot","jsxDEVFromSlotComponent","createCompatSlotComponent","DevRuntime","Fragment","jsxDEV","type","props","key","source","self"],"mappings":"AACA,SAASA,MAAM,QAAQ,4BAA4B;AACnD,SAASC,uBAAuB,QAAQ,gCAAgC;AACxE,SAASC,yBAAyB,QAAQ,oCAAoC;AAC9E,SAASC,UAAU,QAAQ,qBAAqB;AAEhD,SAASC,QAAQ,QAAQ,QAAQ;AAEjC,OAAO,SAASC,OACdC,IAA0B,EAC1BC,KAAQ,EACRC,GAAe,EACfC,MAAgB,EAChBC,IAAc,EACS;IACvB,QAAQ;IACR,wDAAwD;IACxD,qDAAqD;IACrD,IAAIV,OAAUO,QAAQ;QACpB,OAAON,wBAAwBC,0BAA0BI,MAAMC,QAAQ,IAAI,EAAEC,KAAKC,QAAQC;IAC5F,CAAC;IACD,IAAIV,OAAUM,OAAO;QACnB,OAAOL,wBAAwBK,MAAMC,OAAOC,KAAKC,QAAQC;IAC3D,CAAC;IACD,OAAOP,WAAWE,MAAM,CAACC,MAAMC,OAAOC,KAAKC,QAAQC;AACrD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isSlot } from '@fluentui/react-utilities';
|
|
2
|
+
import { jsxDynamicFromSlotComponent } from './jsx/jsxDynamicFromSlotComponent';
|
|
3
|
+
import { jsxStaticFromSlotComponent } from './jsx/jsxStaticFromSlotComponent';
|
|
4
|
+
import { createCompatSlotComponent } from './utils/createCompatSlotComponent';
|
|
5
|
+
import { Runtime } from './utils/Runtime';
|
|
6
|
+
export { Fragment } from 'react';
|
|
7
|
+
export function jsx(type, props, key) {
|
|
8
|
+
// TODO:
|
|
9
|
+
// this is for backwards compatibility with getSlotsNext
|
|
10
|
+
// it should be removed once getSlotsNext is obsolete
|
|
11
|
+
if (isSlot(props)) {
|
|
12
|
+
return jsxDynamicFromSlotComponent(createCompatSlotComponent(type, props), null, key);
|
|
13
|
+
}
|
|
14
|
+
if (isSlot(type)) {
|
|
15
|
+
return jsxDynamicFromSlotComponent(type, props, key);
|
|
16
|
+
}
|
|
17
|
+
return Runtime.jsx(type, props, key);
|
|
18
|
+
}
|
|
19
|
+
export function jsxs(type, props, key) {
|
|
20
|
+
// TODO:
|
|
21
|
+
// this is for backwards compatibility with getSlotsNext
|
|
22
|
+
// it should be removed once getSlotsNext is obsolete
|
|
23
|
+
if (isSlot(props)) {
|
|
24
|
+
return jsxStaticFromSlotComponent(createCompatSlotComponent(type, props), null, key);
|
|
25
|
+
}
|
|
26
|
+
if (isSlot(type)) {
|
|
27
|
+
return jsxStaticFromSlotComponent(type, props, key);
|
|
28
|
+
}
|
|
29
|
+
return Runtime.jsxs(type, props, key);
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["jsx-runtime.ts"],"sourcesContent":["import type * as React from 'react';\nimport { isSlot } from '@fluentui/react-utilities';\nimport { jsxDynamicFromSlotComponent } from './jsx/jsxDynamicFromSlotComponent';\nimport { jsxStaticFromSlotComponent } from './jsx/jsxStaticFromSlotComponent';\nimport { createCompatSlotComponent } from './utils/createCompatSlotComponent';\nimport { Runtime } from './utils/Runtime';\n\nexport { Fragment } from 'react';\n\nexport function jsx<P extends {}>(type: React.ElementType<P>, props: P, key?: React.Key): React.ReactElement<P> {\n // TODO:\n // this is for backwards compatibility with getSlotsNext\n // it should be removed once getSlotsNext is obsolete\n if (isSlot<P>(props)) {\n return jsxDynamicFromSlotComponent(createCompatSlotComponent(type, props), null, key);\n }\n if (isSlot<P>(type)) {\n return jsxDynamicFromSlotComponent(type, props, key);\n }\n return Runtime.jsx(type, props, key);\n}\n\nexport function jsxs<P extends {}>(type: React.ElementType<P>, props: P, key?: React.Key): React.ReactElement<P> {\n // TODO:\n // this is for backwards compatibility with getSlotsNext\n // it should be removed once getSlotsNext is obsolete\n if (isSlot<P>(props)) {\n return jsxStaticFromSlotComponent(createCompatSlotComponent(type, props), null, key);\n }\n if (isSlot<P>(type)) {\n return jsxStaticFromSlotComponent(type, props, key);\n }\n return Runtime.jsxs(type, props, key);\n}\n"],"names":["isSlot","jsxDynamicFromSlotComponent","jsxStaticFromSlotComponent","createCompatSlotComponent","Runtime","Fragment","jsx","type","props","key","jsxs"],"mappings":"AACA,SAASA,MAAM,QAAQ,4BAA4B;AACnD,SAASC,2BAA2B,QAAQ,oCAAoC;AAChF,SAASC,0BAA0B,QAAQ,mCAAmC;AAC9E,SAASC,yBAAyB,QAAQ,oCAAoC;AAC9E,SAASC,OAAO,QAAQ,kBAAkB;AAE1C,SAASC,QAAQ,QAAQ,QAAQ;AAEjC,OAAO,SAASC,IAAkBC,IAA0B,EAAEC,KAAQ,EAAEC,GAAe,EAAyB;IAC9G,QAAQ;IACR,wDAAwD;IACxD,qDAAqD;IACrD,IAAIT,OAAUQ,QAAQ;QACpB,OAAOP,4BAA4BE,0BAA0BI,MAAMC,QAAQ,IAAI,EAAEC;IACnF,CAAC;IACD,IAAIT,OAAUO,OAAO;QACnB,OAAON,4BAA4BM,MAAMC,OAAOC;IAClD,CAAC;IACD,OAAOL,QAAQE,GAAG,CAACC,MAAMC,OAAOC;AAClC,CAAC;AAED,OAAO,SAASC,KAAmBH,IAA0B,EAAEC,KAAQ,EAAEC,GAAe,EAAyB;IAC/G,QAAQ;IACR,wDAAwD;IACxD,qDAAqD;IACrD,IAAIT,OAAUQ,QAAQ;QACpB,OAAON,2BAA2BC,0BAA0BI,MAAMC,QAAQ,IAAI,EAAEC;IAClF,CAAC;IACD,IAAIT,OAAUO,OAAO;QACnB,OAAOL,2BAA2BK,MAAMC,OAAOC;IACjD,CAAC;IACD,OAAOL,QAAQM,IAAI,CAACH,MAAMC,OAAOC;AACnC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DevRuntime.ts"],"sourcesContent":["import * as ReactDevRuntime from 'react/jsx-dev-runtime';\nimport type { JSXRuntime } from './types';\n\nexport const DevRuntime = ReactDevRuntime as {\n jsxDEV: JSXRuntime;\n};\n"],"names":["ReactDevRuntime","DevRuntime"],"mappings":"AAAA,YAAYA,qBAAqB,wBAAwB;AAGzD,OAAO,MAAMC,aAAaD,gBAExB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Runtime.ts"],"sourcesContent":["import * as ReactRuntime from 'react/jsx-runtime';\nimport type { JSXRuntime } from './types';\n\nexport const Runtime = ReactRuntime as {\n jsx: JSXRuntime;\n jsxs: JSXRuntime;\n};\n"],"names":["ReactRuntime","Runtime"],"mappings":"AAAA,YAAYA,kBAAkB,oBAAoB;AAGlD,OAAO,MAAMC,UAAUD,aAGrB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { SLOT_ELEMENT_TYPE_SYMBOL } from '@fluentui/react-utilities';
|
|
3
|
+
// TODO:
|
|
4
|
+
// this is for backwards compatibility with getSlotsNext
|
|
5
|
+
// it should be removed once getSlotsNext is obsolete
|
|
6
|
+
export function createCompatSlotComponent(type, props) {
|
|
7
|
+
return {
|
|
8
|
+
...props,
|
|
9
|
+
[SLOT_ELEMENT_TYPE_SYMBOL]: type
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createCompatSlotComponent.ts"],"sourcesContent":["import * as React from 'react';\nimport { SLOT_ELEMENT_TYPE_SYMBOL } from '@fluentui/react-utilities';\nimport type { SlotComponentType } from '@fluentui/react-utilities';\n\n// TODO:\n// this is for backwards compatibility with getSlotsNext\n// it should be removed once getSlotsNext is obsolete\nexport function createCompatSlotComponent<P extends {}>(type: React.ElementType<P>, props: P): SlotComponentType<P> {\n return {\n ...props,\n [SLOT_ELEMENT_TYPE_SYMBOL]: type,\n } as SlotComponentType<P>;\n}\n"],"names":["React","SLOT_ELEMENT_TYPE_SYMBOL","createCompatSlotComponent","type","props"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,QAAQ,4BAA4B;AAGrE,QAAQ;AACR,wDAAwD;AACxD,qDAAqD;AACrD,OAAO,SAASC,0BAAwCC,IAA0B,EAAEC,KAAQ,EAAwB;IAClH,OAAO;QACL,GAAGA,KAAK;QACR,CAACH,yBAAyB,EAAEE;IAC9B;AACF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from '@fluentui/react-utilities';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
*/ export function getMetadataFromSlotComponent(type) {
|
|
5
|
+
const { as , [SLOT_ELEMENT_TYPE_SYMBOL]: baseElementType , [SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction , ...propsWithoutMetadata } = type;
|
|
6
|
+
const props = propsWithoutMetadata;
|
|
7
|
+
const elementType = typeof baseElementType === 'string' ? as !== null && as !== void 0 ? as : baseElementType : baseElementType;
|
|
8
|
+
if (typeof elementType !== 'string' && as) {
|
|
9
|
+
props.as = as;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
elementType,
|
|
13
|
+
props,
|
|
14
|
+
renderFunction
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["getMetadataFromSlotComponent.ts"],"sourcesContent":["import type * as React from 'react';\nimport { SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from '@fluentui/react-utilities';\nimport type { SlotComponentType, UnknownSlotProps } from '@fluentui/react-utilities';\n\n/**\n * @internal\n */\nexport function getMetadataFromSlotComponent<Props extends UnknownSlotProps>(type: SlotComponentType<Props>) {\n const {\n as,\n [SLOT_ELEMENT_TYPE_SYMBOL]: baseElementType,\n [SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction,\n ...propsWithoutMetadata\n } = type;\n const props = propsWithoutMetadata as UnknownSlotProps as Props;\n\n const elementType = (\n typeof baseElementType === 'string' ? as ?? baseElementType : baseElementType\n ) as React.ElementType<Props>;\n\n if (typeof elementType !== 'string' && as) {\n props.as = as;\n }\n return { elementType, props, renderFunction };\n}\n"],"names":["SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","getMetadataFromSlotComponent","type","as","baseElementType","renderFunction","propsWithoutMetadata","props","elementType"],"mappings":"AACA,SAASA,wBAAwB,EAAEC,2BAA2B,QAAQ,4BAA4B;AAGlG;;CAEC,GACD,OAAO,SAASC,6BAA6DC,IAA8B,EAAE;IAC3G,MAAM,EACJC,GAAE,EACF,CAACJ,yBAAyB,EAAEK,gBAAe,EAC3C,CAACJ,4BAA4B,EAAEK,eAAc,EAC7C,GAAGC,sBACJ,GAAGJ;IACJ,MAAMK,QAAQD;IAEd,MAAME,cACJ,OAAOJ,oBAAoB,WAAWD,eAAAA,gBAAAA,KAAMC,eAAe,GAAGA,eAAe;IAG/E,IAAI,OAAOI,gBAAgB,YAAYL,IAAI;QACzCI,MAAMJ,EAAE,GAAGA;IACb,CAAC;IACD,OAAO;QAAEK;QAAaD;QAAOF;IAAe;AAC9C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["types.ts"],"sourcesContent":["import type * as React from 'react';\n\nexport type JSXRuntime = <P extends {}>(\n type: React.ElementType<P>,\n props: P | null,\n key?: React.Key,\n source?: unknown,\n self?: unknown,\n) => React.ReactElement<P>;\n"],"names":[],"mappings":"AAAA,WAQ2B"}
|
|
@@ -2,29 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", {
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
createElement: ()=>createElement,
|
|
13
|
-
hasRenderFunction: ()=>hasRenderFunction
|
|
5
|
+
Object.defineProperty(exports, "createElement", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>createElement
|
|
14
8
|
});
|
|
15
9
|
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
16
10
|
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
17
11
|
const _reactUtilities = require("@fluentui/react-utilities");
|
|
12
|
+
const _createElementFromSlotComponent = require("./jsx/createElementFromSlotComponent");
|
|
13
|
+
const _createCompatSlotComponent = require("./utils/createCompatSlotComponent");
|
|
18
14
|
function createElement(type, props, ...children) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
renderProps.children = /*#__PURE__*/ _react.createElement(_react.Fragment, {}, ...overrideChildren);
|
|
15
|
+
// TODO:
|
|
16
|
+
// this is for backwards compatibility with getSlotsNext
|
|
17
|
+
// it should be removed once getSlotsNext is obsolete
|
|
18
|
+
if ((0, _reactUtilities.isSlot)(props)) {
|
|
19
|
+
return (0, _createElementFromSlotComponent.createElementFromSlotComponent)((0, _createCompatSlotComponent.createCompatSlotComponent)(type, props), children);
|
|
25
20
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return
|
|
21
|
+
if ((0, _reactUtilities.isSlot)(type)) {
|
|
22
|
+
return (0, _createElementFromSlotComponent.createElementFromSlotComponent)(type, children);
|
|
23
|
+
}
|
|
24
|
+
return /*#__PURE__*/ _react.createElement(type, props, ...children);
|
|
30
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["createElement.js"],"sourcesContent":["import * as React from 'react';\nimport {
|
|
1
|
+
{"version":3,"sources":["createElement.js"],"sourcesContent":["import * as React from 'react';\nimport { isSlot } from '@fluentui/react-utilities';\nimport { createElementFromSlotComponent } from './jsx/createElementFromSlotComponent';\nimport { createCompatSlotComponent } from './utils/createCompatSlotComponent';\nexport function createElement(type, props, ...children) {\n // TODO:\n // this is for backwards compatibility with getSlotsNext\n // it should be removed once getSlotsNext is obsolete\n if (isSlot(props)) {\n return createElementFromSlotComponent(createCompatSlotComponent(type, props), children);\n }\n if (isSlot(type)) {\n return createElementFromSlotComponent(type, children);\n }\n return React.createElement(type, props, ...children);\n}\n"],"names":["createElement","type","props","children","isSlot","createElementFromSlotComponent","createCompatSlotComponent","React"],"mappings":";;;;+BAIgBA;;aAAAA;;;6DAJO;gCACA;gDACwB;2CACL;AACnC,SAASA,cAAcC,IAAI,EAAEC,KAAK,EAAE,GAAGC,QAAQ,EAAE;IACpD,QAAQ;IACR,wDAAwD;IACxD,qDAAqD;IACrD,IAAIC,IAAAA,sBAAM,EAACF,QAAQ;QACf,OAAOG,IAAAA,8DAA8B,EAACC,IAAAA,oDAAyB,EAACL,MAAMC,QAAQC;IAClF,CAAC;IACD,IAAIC,IAAAA,sBAAM,EAACH,OAAO;QACd,OAAOI,IAAAA,8DAA8B,EAACJ,MAAME;IAChD,CAAC;IACD,qBAAOI,OAAMP,aAAa,CAACC,MAAMC,UAAUC;AAC/C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "createElementFromSlotComponent", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>createElementFromSlotComponent
|
|
8
|
+
});
|
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
|
+
const _getMetadataFromSlotComponent = require("../utils/getMetadataFromSlotComponent");
|
|
12
|
+
function createElementFromSlotComponent(type, overrideChildren) {
|
|
13
|
+
const { elementType , renderFunction , props } = (0, _getMetadataFromSlotComponent.getMetadataFromSlotComponent)(type);
|
|
14
|
+
if (renderFunction) {
|
|
15
|
+
if (overrideChildren.length > 0) {
|
|
16
|
+
props.children = /*#__PURE__*/ _react.createElement(_react.Fragment, {}, ...overrideChildren);
|
|
17
|
+
}
|
|
18
|
+
return /*#__PURE__*/ _react.createElement(_react.Fragment, {}, renderFunction(elementType, props));
|
|
19
|
+
}
|
|
20
|
+
return /*#__PURE__*/ _react.createElement(elementType, props, ...overrideChildren);
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createElementFromSlotComponent.js"],"sourcesContent":["import * as React from 'react';\nimport { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';\n/**\n * @internal\n * creates a ReactElement from a slot declaration\n */ export function createElementFromSlotComponent(type, overrideChildren) {\n const { elementType , renderFunction , props } = getMetadataFromSlotComponent(type);\n if (renderFunction) {\n if (overrideChildren.length > 0) {\n props.children = React.createElement(React.Fragment, {}, ...overrideChildren);\n }\n return React.createElement(React.Fragment, {}, renderFunction(elementType, props));\n }\n return React.createElement(elementType, props, ...overrideChildren);\n}\n"],"names":["createElementFromSlotComponent","type","overrideChildren","elementType","renderFunction","props","getMetadataFromSlotComponent","length","children","React","createElement","Fragment"],"mappings":";;;;+BAKoBA;;aAAAA;;;6DALG;8CACsB;AAIlC,SAASA,+BAA+BC,IAAI,EAAEC,gBAAgB,EAAE;IACvE,MAAM,EAAEC,YAAW,EAAGC,eAAc,EAAGC,MAAK,EAAG,GAAGC,IAAAA,0DAA4B,EAACL;IAC/E,IAAIG,gBAAgB;QAChB,IAAIF,iBAAiBK,MAAM,GAAG,GAAG;YAC7BF,MAAMG,QAAQ,iBAAGC,OAAMC,aAAa,CAACD,OAAME,QAAQ,EAAE,CAAC,MAAMT;QAChE,CAAC;QACD,qBAAOO,OAAMC,aAAa,CAACD,OAAME,QAAQ,EAAE,CAAC,GAAGP,eAAeD,aAAaE;IAC/E,CAAC;IACD,qBAAOI,OAAMC,aAAa,CAACP,aAAaE,UAAUH;AACtD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "jsxDEVFromSlotComponent", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>jsxDEVFromSlotComponent
|
|
8
|
+
});
|
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
|
+
const _getMetadataFromSlotComponent = require("../utils/getMetadataFromSlotComponent");
|
|
12
|
+
const _devRuntime = require("../utils/DevRuntime");
|
|
13
|
+
function jsxDEVFromSlotComponent(type, overrideProps, key, source, self) {
|
|
14
|
+
const { elementType , renderFunction , props: slotProps } = (0, _getMetadataFromSlotComponent.getMetadataFromSlotComponent)(type);
|
|
15
|
+
const props = {
|
|
16
|
+
...slotProps,
|
|
17
|
+
...overrideProps
|
|
18
|
+
};
|
|
19
|
+
if (renderFunction) {
|
|
20
|
+
return _devRuntime.DevRuntime.jsxDEV(_react.Fragment, {
|
|
21
|
+
children: renderFunction(elementType, props)
|
|
22
|
+
}, key, source, self);
|
|
23
|
+
}
|
|
24
|
+
return _devRuntime.DevRuntime.jsxDEV(elementType, props, key, source, self);
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["jsxDEVFromSlotComponent.js"],"sourcesContent":["import * as React from 'react';\nimport { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';\nimport { DevRuntime } from '../utils/DevRuntime';\nexport function jsxDEVFromSlotComponent(type, overrideProps, key, source, self) {\n const { elementType , renderFunction , props: slotProps } = getMetadataFromSlotComponent(type);\n const props = {\n ...slotProps,\n ...overrideProps\n };\n if (renderFunction) {\n return DevRuntime.jsxDEV(React.Fragment, {\n children: renderFunction(elementType, props)\n }, key, source, self);\n }\n return DevRuntime.jsxDEV(elementType, props, key, source, self);\n}\n"],"names":["jsxDEVFromSlotComponent","type","overrideProps","key","source","self","elementType","renderFunction","props","slotProps","getMetadataFromSlotComponent","DevRuntime","jsxDEV","React","Fragment","children"],"mappings":";;;;+BAGgBA;;aAAAA;;;6DAHO;8CACsB;4BAClB;AACpB,SAASA,wBAAwBC,IAAI,EAAEC,aAAa,EAAEC,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAE;IAC5E,MAAM,EAAEC,YAAW,EAAGC,eAAc,EAAGC,OAAOC,UAAS,EAAG,GAAGC,IAAAA,0DAA4B,EAACT;IAC1F,MAAMO,QAAQ;QACV,GAAGC,SAAS;QACZ,GAAGP,aAAa;IACpB;IACA,IAAIK,gBAAgB;QAChB,OAAOI,sBAAU,CAACC,MAAM,CAACC,OAAMC,QAAQ,EAAE;YACrCC,UAAUR,eAAeD,aAAaE;QAC1C,GAAGL,KAAKC,QAAQC;IACpB,CAAC;IACD,OAAOM,sBAAU,CAACC,MAAM,CAACN,aAAaE,OAAOL,KAAKC,QAAQC;AAC9D"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "jsxDynamicFromSlotComponent", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>jsxDynamicFromSlotComponent
|
|
8
|
+
});
|
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
|
+
const _getMetadataFromSlotComponent = require("../utils/getMetadataFromSlotComponent");
|
|
12
|
+
const _runtime = require("../utils/Runtime");
|
|
13
|
+
function jsxDynamicFromSlotComponent(type, overrideProps, key) {
|
|
14
|
+
const { elementType , renderFunction , props: slotProps } = (0, _getMetadataFromSlotComponent.getMetadataFromSlotComponent)(type);
|
|
15
|
+
const props = {
|
|
16
|
+
...slotProps,
|
|
17
|
+
...overrideProps
|
|
18
|
+
};
|
|
19
|
+
if (renderFunction) {
|
|
20
|
+
return _runtime.Runtime.jsx(_react.Fragment, {
|
|
21
|
+
children: renderFunction(elementType, props)
|
|
22
|
+
}, key);
|
|
23
|
+
}
|
|
24
|
+
return _runtime.Runtime.jsx(elementType, props, key);
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["jsxDynamicFromSlotComponent.js"],"sourcesContent":["import * as React from 'react';\nimport { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';\nimport { Runtime } from '../utils/Runtime';\n/**\n * @internal\n */ export function jsxDynamicFromSlotComponent(type, overrideProps, key) {\n const { elementType , renderFunction , props: slotProps } = getMetadataFromSlotComponent(type);\n const props = {\n ...slotProps,\n ...overrideProps\n };\n if (renderFunction) {\n return Runtime.jsx(React.Fragment, {\n children: renderFunction(elementType, props)\n }, key);\n }\n return Runtime.jsx(elementType, props, key);\n}\n"],"names":["jsxDynamicFromSlotComponent","type","overrideProps","key","elementType","renderFunction","props","slotProps","getMetadataFromSlotComponent","Runtime","jsx","React","Fragment","children"],"mappings":";;;;+BAKoBA;;aAAAA;;;6DALG;8CACsB;yBACrB;AAGb,SAASA,4BAA4BC,IAAI,EAAEC,aAAa,EAAEC,GAAG,EAAE;IACtE,MAAM,EAAEC,YAAW,EAAGC,eAAc,EAAGC,OAAOC,UAAS,EAAG,GAAGC,IAAAA,0DAA4B,EAACP;IAC1F,MAAMK,QAAQ;QACV,GAAGC,SAAS;QACZ,GAAGL,aAAa;IACpB;IACA,IAAIG,gBAAgB;QAChB,OAAOI,gBAAO,CAACC,GAAG,CAACC,OAAMC,QAAQ,EAAE;YAC/BC,UAAUR,eAAeD,aAAaE;QAC1C,GAAGH;IACP,CAAC;IACD,OAAOM,gBAAO,CAACC,GAAG,CAACN,aAAaE,OAAOH;AAC3C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "jsxStaticFromSlotComponent", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>jsxStaticFromSlotComponent
|
|
8
|
+
});
|
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
|
+
const _getMetadataFromSlotComponent = require("../utils/getMetadataFromSlotComponent");
|
|
12
|
+
const _runtime = require("../utils/Runtime");
|
|
13
|
+
function jsxStaticFromSlotComponent(type, overrideProps, key) {
|
|
14
|
+
const { elementType , renderFunction , props: slotProps } = (0, _getMetadataFromSlotComponent.getMetadataFromSlotComponent)(type);
|
|
15
|
+
const props = {
|
|
16
|
+
...slotProps,
|
|
17
|
+
...overrideProps
|
|
18
|
+
};
|
|
19
|
+
if (renderFunction) {
|
|
20
|
+
return _runtime.Runtime.jsxs(_react.Fragment, {
|
|
21
|
+
children: renderFunction(elementType, props)
|
|
22
|
+
}, key);
|
|
23
|
+
}
|
|
24
|
+
return _runtime.Runtime.jsxs(elementType, props, key);
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["jsxStaticFromSlotComponent.js"],"sourcesContent":["import * as React from 'react';\nimport { getMetadataFromSlotComponent } from '../utils/getMetadataFromSlotComponent';\nimport { Runtime } from '../utils/Runtime';\n/**\n * @internal\n */ export function jsxStaticFromSlotComponent(type, overrideProps, key) {\n const { elementType , renderFunction , props: slotProps } = getMetadataFromSlotComponent(type);\n const props = {\n ...slotProps,\n ...overrideProps\n };\n if (renderFunction) {\n return Runtime.jsxs(React.Fragment, {\n children: renderFunction(elementType, props)\n }, key);\n }\n return Runtime.jsxs(elementType, props, key);\n}\n"],"names":["jsxStaticFromSlotComponent","type","overrideProps","key","elementType","renderFunction","props","slotProps","getMetadataFromSlotComponent","Runtime","jsxs","React","Fragment","children"],"mappings":";;;;+BAKoBA;;aAAAA;;;6DALG;8CACsB;yBACrB;AAGb,SAASA,2BAA2BC,IAAI,EAAEC,aAAa,EAAEC,GAAG,EAAE;IACrE,MAAM,EAAEC,YAAW,EAAGC,eAAc,EAAGC,OAAOC,UAAS,EAAG,GAAGC,IAAAA,0DAA4B,EAACP;IAC1F,MAAMK,QAAQ;QACV,GAAGC,SAAS;QACZ,GAAGL,aAAa;IACpB;IACA,IAAIG,gBAAgB;QAChB,OAAOI,gBAAO,CAACC,IAAI,CAACC,OAAMC,QAAQ,EAAE;YAChCC,UAAUR,eAAeD,aAAaE;QAC1C,GAAGH;IACP,CAAC;IACD,OAAOM,gBAAO,CAACC,IAAI,CAACN,aAAaE,OAAOH;AAC5C"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
Fragment: ()=>_react.Fragment,
|
|
13
|
+
jsxDEV: ()=>jsxDEV
|
|
14
|
+
});
|
|
15
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
|
16
|
+
const _jsxDEVFromSlotComponent = require("./jsx/jsxDEVFromSlotComponent");
|
|
17
|
+
const _createCompatSlotComponent = require("./utils/createCompatSlotComponent");
|
|
18
|
+
const _devRuntime = require("./utils/DevRuntime");
|
|
19
|
+
const _react = require("react");
|
|
20
|
+
function jsxDEV(type, props, key, source, self) {
|
|
21
|
+
// TODO:
|
|
22
|
+
// this is for backwards compatibility with getSlotsNext
|
|
23
|
+
// it should be removed once getSlotsNext is obsolete
|
|
24
|
+
if ((0, _reactUtilities.isSlot)(props)) {
|
|
25
|
+
return (0, _jsxDEVFromSlotComponent.jsxDEVFromSlotComponent)((0, _createCompatSlotComponent.createCompatSlotComponent)(type, props), null, key, source, self);
|
|
26
|
+
}
|
|
27
|
+
if ((0, _reactUtilities.isSlot)(type)) {
|
|
28
|
+
return (0, _jsxDEVFromSlotComponent.jsxDEVFromSlotComponent)(type, props, key, source, self);
|
|
29
|
+
}
|
|
30
|
+
return _devRuntime.DevRuntime.jsxDEV(type, props, key, source, self);
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["jsx-dev-runtime.js"],"sourcesContent":["import { isSlot } from '@fluentui/react-utilities';\nimport { jsxDEVFromSlotComponent } from './jsx/jsxDEVFromSlotComponent';\nimport { createCompatSlotComponent } from './utils/createCompatSlotComponent';\nimport { DevRuntime } from './utils/DevRuntime';\nexport { Fragment } from 'react';\nexport function jsxDEV(type, props, key, source, self) {\n // TODO:\n // this is for backwards compatibility with getSlotsNext\n // it should be removed once getSlotsNext is obsolete\n if (isSlot(props)) {\n return jsxDEVFromSlotComponent(createCompatSlotComponent(type, props), null, key, source, self);\n }\n if (isSlot(type)) {\n return jsxDEVFromSlotComponent(type, props, key, source, self);\n }\n return DevRuntime.jsxDEV(type, props, key, source, self);\n}\n"],"names":["Fragment","jsxDEV","type","props","key","source","self","isSlot","jsxDEVFromSlotComponent","createCompatSlotComponent","DevRuntime"],"mappings":";;;;;;;;;;;IAISA,QAAQ,MAARA,eAAQ;IACDC,MAAM,MAANA;;gCALO;yCACiB;2CACE;4BACf;uBACF;AAClB,SAASA,OAAOC,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEC,MAAM,EAAEC,IAAI,EAAE;IACnD,QAAQ;IACR,wDAAwD;IACxD,qDAAqD;IACrD,IAAIC,IAAAA,sBAAM,EAACJ,QAAQ;QACf,OAAOK,IAAAA,gDAAuB,EAACC,IAAAA,oDAAyB,EAACP,MAAMC,QAAQ,IAAI,EAAEC,KAAKC,QAAQC;IAC9F,CAAC;IACD,IAAIC,IAAAA,sBAAM,EAACL,OAAO;QACd,OAAOM,IAAAA,gDAAuB,EAACN,MAAMC,OAAOC,KAAKC,QAAQC;IAC7D,CAAC;IACD,OAAOI,sBAAU,CAACT,MAAM,CAACC,MAAMC,OAAOC,KAAKC,QAAQC;AACvD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
Fragment: ()=>_react.Fragment,
|
|
13
|
+
jsx: ()=>jsx,
|
|
14
|
+
jsxs: ()=>jsxs
|
|
15
|
+
});
|
|
16
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
|
17
|
+
const _jsxDynamicFromSlotComponent = require("./jsx/jsxDynamicFromSlotComponent");
|
|
18
|
+
const _jsxStaticFromSlotComponent = require("./jsx/jsxStaticFromSlotComponent");
|
|
19
|
+
const _createCompatSlotComponent = require("./utils/createCompatSlotComponent");
|
|
20
|
+
const _runtime = require("./utils/Runtime");
|
|
21
|
+
const _react = require("react");
|
|
22
|
+
function jsx(type, props, key) {
|
|
23
|
+
// TODO:
|
|
24
|
+
// this is for backwards compatibility with getSlotsNext
|
|
25
|
+
// it should be removed once getSlotsNext is obsolete
|
|
26
|
+
if ((0, _reactUtilities.isSlot)(props)) {
|
|
27
|
+
return (0, _jsxDynamicFromSlotComponent.jsxDynamicFromSlotComponent)((0, _createCompatSlotComponent.createCompatSlotComponent)(type, props), null, key);
|
|
28
|
+
}
|
|
29
|
+
if ((0, _reactUtilities.isSlot)(type)) {
|
|
30
|
+
return (0, _jsxDynamicFromSlotComponent.jsxDynamicFromSlotComponent)(type, props, key);
|
|
31
|
+
}
|
|
32
|
+
return _runtime.Runtime.jsx(type, props, key);
|
|
33
|
+
}
|
|
34
|
+
function jsxs(type, props, key) {
|
|
35
|
+
// TODO:
|
|
36
|
+
// this is for backwards compatibility with getSlotsNext
|
|
37
|
+
// it should be removed once getSlotsNext is obsolete
|
|
38
|
+
if ((0, _reactUtilities.isSlot)(props)) {
|
|
39
|
+
return (0, _jsxStaticFromSlotComponent.jsxStaticFromSlotComponent)((0, _createCompatSlotComponent.createCompatSlotComponent)(type, props), null, key);
|
|
40
|
+
}
|
|
41
|
+
if ((0, _reactUtilities.isSlot)(type)) {
|
|
42
|
+
return (0, _jsxStaticFromSlotComponent.jsxStaticFromSlotComponent)(type, props, key);
|
|
43
|
+
}
|
|
44
|
+
return _runtime.Runtime.jsxs(type, props, key);
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["jsx-runtime.js"],"sourcesContent":["import { isSlot } from '@fluentui/react-utilities';\nimport { jsxDynamicFromSlotComponent } from './jsx/jsxDynamicFromSlotComponent';\nimport { jsxStaticFromSlotComponent } from './jsx/jsxStaticFromSlotComponent';\nimport { createCompatSlotComponent } from './utils/createCompatSlotComponent';\nimport { Runtime } from './utils/Runtime';\nexport { Fragment } from 'react';\nexport function jsx(type, props, key) {\n // TODO:\n // this is for backwards compatibility with getSlotsNext\n // it should be removed once getSlotsNext is obsolete\n if (isSlot(props)) {\n return jsxDynamicFromSlotComponent(createCompatSlotComponent(type, props), null, key);\n }\n if (isSlot(type)) {\n return jsxDynamicFromSlotComponent(type, props, key);\n }\n return Runtime.jsx(type, props, key);\n}\nexport function jsxs(type, props, key) {\n // TODO:\n // this is for backwards compatibility with getSlotsNext\n // it should be removed once getSlotsNext is obsolete\n if (isSlot(props)) {\n return jsxStaticFromSlotComponent(createCompatSlotComponent(type, props), null, key);\n }\n if (isSlot(type)) {\n return jsxStaticFromSlotComponent(type, props, key);\n }\n return Runtime.jsxs(type, props, key);\n}\n"],"names":["Fragment","jsx","jsxs","type","props","key","isSlot","jsxDynamicFromSlotComponent","createCompatSlotComponent","Runtime","jsxStaticFromSlotComponent"],"mappings":";;;;;;;;;;;IAKSA,QAAQ,MAARA,eAAQ;IACDC,GAAG,MAAHA;IAYAC,IAAI,MAAJA;;gCAlBO;6CACqB;4CACD;2CACD;yBAClB;uBACC;AAClB,SAASD,IAAIE,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAE;IAClC,QAAQ;IACR,wDAAwD;IACxD,qDAAqD;IACrD,IAAIC,IAAAA,sBAAM,EAACF,QAAQ;QACf,OAAOG,IAAAA,wDAA2B,EAACC,IAAAA,oDAAyB,EAACL,MAAMC,QAAQ,IAAI,EAAEC;IACrF,CAAC;IACD,IAAIC,IAAAA,sBAAM,EAACH,OAAO;QACd,OAAOI,IAAAA,wDAA2B,EAACJ,MAAMC,OAAOC;IACpD,CAAC;IACD,OAAOI,gBAAO,CAACR,GAAG,CAACE,MAAMC,OAAOC;AACpC;AACO,SAASH,KAAKC,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAE;IACnC,QAAQ;IACR,wDAAwD;IACxD,qDAAqD;IACrD,IAAIC,IAAAA,sBAAM,EAACF,QAAQ;QACf,OAAOM,IAAAA,sDAA0B,EAACF,IAAAA,oDAAyB,EAACL,MAAMC,QAAQ,IAAI,EAAEC;IACpF,CAAC;IACD,IAAIC,IAAAA,sBAAM,EAACH,OAAO;QACd,OAAOO,IAAAA,sDAA0B,EAACP,MAAMC,OAAOC;IACnD,CAAC;IACD,OAAOI,gBAAO,CAACP,IAAI,CAACC,MAAMC,OAAOC;AACrC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "DevRuntime", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>DevRuntime
|
|
8
|
+
});
|
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
10
|
+
const _jsxDevRuntime = /*#__PURE__*/ _interopRequireWildcard(require("react/jsx-dev-runtime"));
|
|
11
|
+
const DevRuntime = _jsxDevRuntime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["DevRuntime.js"],"sourcesContent":["import * as ReactDevRuntime from 'react/jsx-dev-runtime';\nexport const DevRuntime = ReactDevRuntime;\n"],"names":["DevRuntime","ReactDevRuntime"],"mappings":";;;;+BACaA;;aAAAA;;;qEADoB;AAC1B,MAAMA,aAAaC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "Runtime", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>Runtime
|
|
8
|
+
});
|
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
10
|
+
const _jsxRuntime = /*#__PURE__*/ _interopRequireWildcard(require("react/jsx-runtime"));
|
|
11
|
+
const Runtime = _jsxRuntime;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Runtime.js"],"sourcesContent":["import * as ReactRuntime from 'react/jsx-runtime';\nexport const Runtime = ReactRuntime;\n"],"names":["Runtime","ReactRuntime"],"mappings":";;;;+BACaA;;aAAAA;;;kEADiB;AACvB,MAAMA,UAAUC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "createCompatSlotComponent", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>createCompatSlotComponent
|
|
8
|
+
});
|
|
9
|
+
const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
|
|
10
|
+
const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
|
|
11
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
|
12
|
+
function createCompatSlotComponent(type, props) {
|
|
13
|
+
return {
|
|
14
|
+
...props,
|
|
15
|
+
[_reactUtilities.SLOT_ELEMENT_TYPE_SYMBOL]: type
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["createCompatSlotComponent.js"],"sourcesContent":["import * as React from 'react';\nimport { SLOT_ELEMENT_TYPE_SYMBOL } from '@fluentui/react-utilities';\n// TODO:\n// this is for backwards compatibility with getSlotsNext\n// it should be removed once getSlotsNext is obsolete\nexport function createCompatSlotComponent(type, props) {\n return {\n ...props,\n [SLOT_ELEMENT_TYPE_SYMBOL]: type\n };\n}\n"],"names":["createCompatSlotComponent","type","props","SLOT_ELEMENT_TYPE_SYMBOL"],"mappings":";;;;+BAKgBA;;aAAAA;;;6DALO;gCACkB;AAIlC,SAASA,0BAA0BC,IAAI,EAAEC,KAAK,EAAE;IACnD,OAAO;QACH,GAAGA,KAAK;QACR,CAACC,wCAAwB,CAAC,EAAEF;IAChC;AACJ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "getMetadataFromSlotComponent", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>getMetadataFromSlotComponent
|
|
8
|
+
});
|
|
9
|
+
const _reactUtilities = require("@fluentui/react-utilities");
|
|
10
|
+
function getMetadataFromSlotComponent(type) {
|
|
11
|
+
const { as , [_reactUtilities.SLOT_ELEMENT_TYPE_SYMBOL]: baseElementType , [_reactUtilities.SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction , ...propsWithoutMetadata } = type;
|
|
12
|
+
const props = propsWithoutMetadata;
|
|
13
|
+
const elementType = typeof baseElementType === 'string' ? as !== null && as !== void 0 ? as : baseElementType : baseElementType;
|
|
14
|
+
if (typeof elementType !== 'string' && as) {
|
|
15
|
+
props.as = as;
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
elementType,
|
|
19
|
+
props,
|
|
20
|
+
renderFunction
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["getMetadataFromSlotComponent.js"],"sourcesContent":["import { SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from '@fluentui/react-utilities';\n/**\n * @internal\n */ export function getMetadataFromSlotComponent(type) {\n const { as , [SLOT_ELEMENT_TYPE_SYMBOL]: baseElementType , [SLOT_RENDER_FUNCTION_SYMBOL]: renderFunction , ...propsWithoutMetadata } = type;\n const props = propsWithoutMetadata;\n const elementType = typeof baseElementType === 'string' ? as !== null && as !== void 0 ? as : baseElementType : baseElementType;\n if (typeof elementType !== 'string' && as) {\n props.as = as;\n }\n return {\n elementType,\n props,\n renderFunction\n };\n}\n"],"names":["getMetadataFromSlotComponent","type","as","SLOT_ELEMENT_TYPE_SYMBOL","baseElementType","SLOT_RENDER_FUNCTION_SYMBOL","renderFunction","propsWithoutMetadata","props","elementType"],"mappings":";;;;+BAGoBA;;aAAAA;;gCAHkD;AAG3D,SAASA,6BAA6BC,IAAI,EAAE;IACnD,MAAM,EAAEC,GAAE,EAAG,CAACC,wCAAwB,CAAC,EAAEC,gBAAe,EAAG,CAACC,2CAA2B,CAAC,EAAEC,eAAc,EAAG,GAAGC,sBAAsB,GAAGN;IACvI,MAAMO,QAAQD;IACd,MAAME,cAAc,OAAOL,oBAAoB,WAAWF,OAAO,IAAI,IAAIA,OAAO,KAAK,IAAIA,KAAKE,eAAe,GAAGA,eAAe;IAC/H,IAAI,OAAOK,gBAAgB,YAAYP,IAAI;QACvCM,MAAMN,EAAE,GAAGA;IACf,CAAC;IACD,OAAO;QACHO;QACAD;QACAF;IACJ;AACJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui/react-jsx-runtime",
|
|
3
|
-
"version": "9.0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "9.0.0",
|
|
4
|
+
"description": "Custom JSX runtime for @fluentui/react-components",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@fluentui/eslint-plugin": "*",
|
|
27
27
|
"@fluentui/react-conformance": "*",
|
|
28
|
-
"@fluentui/react-conformance-griffel": "
|
|
28
|
+
"@fluentui/react-conformance-griffel": "*",
|
|
29
29
|
"@fluentui/scripts-api-extractor": "*",
|
|
30
30
|
"@fluentui/scripts-tasks": "*"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@fluentui/react-utilities": "^9.
|
|
33
|
+
"@fluentui/react-utilities": "^9.11.1",
|
|
34
34
|
"@swc/helpers": "^0.4.14"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
@@ -40,8 +40,7 @@
|
|
|
40
40
|
"beachball": {
|
|
41
41
|
"disallowedChangeTypes": [
|
|
42
42
|
"major",
|
|
43
|
-
"
|
|
44
|
-
"patch"
|
|
43
|
+
"prerelease"
|
|
45
44
|
]
|
|
46
45
|
},
|
|
47
46
|
"exports": {
|
|
@@ -51,6 +50,18 @@
|
|
|
51
50
|
"import": "./lib/index.js",
|
|
52
51
|
"require": "./lib-commonjs/index.js"
|
|
53
52
|
},
|
|
53
|
+
"./jsx-dev-runtime": {
|
|
54
|
+
"types": "./dist/jsx-dev-runtime.d.ts",
|
|
55
|
+
"node": "./lib-commonjs/jsx-dev-runtime.js",
|
|
56
|
+
"import": "./lib/jsx-dev-runtime.js",
|
|
57
|
+
"require": "./lib-commonjs/jsx-dev-runtime.js"
|
|
58
|
+
},
|
|
59
|
+
"./jsx-runtime": {
|
|
60
|
+
"types": "./dist/jsx-runtime.d.ts",
|
|
61
|
+
"node": "./lib-commonjs/jsx-runtime.js",
|
|
62
|
+
"import": "./lib/jsx-runtime.js",
|
|
63
|
+
"require": "./lib-commonjs/jsx-runtime.js"
|
|
64
|
+
},
|
|
54
65
|
"./package.json": "./package.json"
|
|
55
66
|
}
|
|
56
67
|
}
|