@fluentui-react-native/composition 0.11.12 → 0.12.1
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 +1 -1
- package/CHANGELOG.md +52 -2
- package/lib/composeFactory.d.ts +3 -3
- package/lib/composeFactory.d.ts.map +1 -1
- package/lib/composeFactory.js.map +1 -1
- package/lib/composeFactory.test.js +15 -8
- package/lib/composeFactory.test.js.map +1 -1
- package/lib-commonjs/composeFactory.d.ts +3 -3
- package/lib-commonjs/composeFactory.d.ts.map +1 -1
- package/lib-commonjs/composeFactory.js +1 -2
- package/lib-commonjs/composeFactory.js.map +1 -1
- package/lib-commonjs/composeFactory.test.js +32 -15
- package/lib-commonjs/composeFactory.test.js.map +1 -1
- package/lib-commonjs/index.js +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +39 -44
- package/src/__snapshots__/composeFactory.test.tsx.snap +1 -1
- package/src/composeFactory.test.tsx +13 -8
- package/src/composeFactory.ts +17 -9
package/CHANGELOG.json
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,62 @@
|
|
|
1
1
|
# Change Log - @fluentui-react-native/composition
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 0.12.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0d6e9c1: chore: migrate to `oxfmt`
|
|
8
|
+
- ac6e7af: Ensure packages have a default export that references the typescript entrypoint and clean up build dependency ordering
|
|
9
|
+
- Updated dependencies [0d6e9c1]
|
|
10
|
+
- Updated dependencies [ac6e7af]
|
|
11
|
+
- @fluentui-react-native/use-styling@0.14.1
|
|
12
|
+
- @fluentui-react-native/use-slots@0.11.1
|
|
13
|
+
- @fluentui-react-native/framework-base@0.3.1
|
|
14
|
+
|
|
15
|
+
## 0.12.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- d7adbdd: # Migration from Beachball to Changesets
|
|
20
|
+
|
|
21
|
+
This changeset represents the migration from Beachball to Changesets for version management and consolidates all changes from 440+ beachball change files that were in the `change/` directory.
|
|
22
|
+
|
|
23
|
+
All 75 affected packages receive a minor version bump to acknowledge the accumulated changes from the beachball era.
|
|
24
|
+
|
|
25
|
+
## What Changed
|
|
26
|
+
|
|
27
|
+
Going forward, all version management uses Changesets via `yarn changeset`. The following beachball infrastructure has been removed:
|
|
28
|
+
|
|
29
|
+
- ❌ 440+ beachball change files from `change/` directory
|
|
30
|
+
- ❌ `beachball` package dependency
|
|
31
|
+
- ❌ Beachball scripts from `package.json`
|
|
32
|
+
- ❌ `beachball.config.js` configuration file
|
|
33
|
+
- ❌ Beachball publish steps from Azure Pipelines
|
|
34
|
+
|
|
35
|
+
## New Workflow
|
|
36
|
+
|
|
37
|
+
✅ **Create changes**: Run `yarn changeset` to document changes
|
|
38
|
+
✅ **Version bump PRs**: Automatically created by GitHub Actions
|
|
39
|
+
✅ **Publishing**: Handled by Azure Pipelines using `changeset publish`
|
|
40
|
+
✅ **Validation**: CI validates changesets and blocks major version bumps
|
|
41
|
+
|
|
42
|
+
For details, see `CHANGESETS_SETUP.md` and `CONTRIBUTING.md`.
|
|
43
|
+
|
|
44
|
+
### Patch Changes
|
|
45
|
+
|
|
46
|
+
- d1d8c26: We were pinning @types/react and react-native-macos via resolutions. This fixes that which uncovered a bunch of type inconsistencies that needed to be addressed.
|
|
47
|
+
- Updated dependencies [d7adbdd]
|
|
48
|
+
- Updated dependencies [d1d8c26]
|
|
49
|
+
- @fluentui-react-native/framework-base@0.3.0
|
|
50
|
+
- @fluentui-react-native/use-slots@0.11.0
|
|
51
|
+
- @fluentui-react-native/use-styling@0.14.0
|
|
52
|
+
|
|
53
|
+
<!-- This log was last generated on Tue, 05 Aug 2025 18:50:42 GMT and should not be manually modified. -->
|
|
4
54
|
|
|
5
55
|
<!-- Start content -->
|
|
6
56
|
|
|
7
57
|
## 0.11.12
|
|
8
58
|
|
|
9
|
-
Tue, 05 Aug 2025 18:
|
|
59
|
+
Tue, 05 Aug 2025 18:50:42 GMT
|
|
10
60
|
|
|
11
61
|
### Patches
|
|
12
62
|
|
package/lib/composeFactory.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComposableFunction } from '@fluentui-react-native/framework-base';
|
|
1
|
+
import type { ComposableFunction, FinalRender } from '@fluentui-react-native/framework-base';
|
|
2
2
|
import type { UseSlotOptions, Slots } from '@fluentui-react-native/use-slots';
|
|
3
3
|
import type { UseStylingOptions, TokenSettings, ThemeHelper, HasLayer } from '@fluentui-react-native/use-styling';
|
|
4
4
|
export type UseStyledSlots<TProps, TSlotProps> = (props: TProps, lookup?: HasLayer) => Slots<TSlotProps>;
|
|
@@ -11,7 +11,7 @@ export type ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics
|
|
|
11
11
|
/**
|
|
12
12
|
* staged render function that takes props and a useSlots hook as an input
|
|
13
13
|
*/
|
|
14
|
-
useRender: (props: TProps, useSlots: UseStyledSlots<TProps, TSlotProps>) =>
|
|
14
|
+
useRender: (props: TProps, useSlots: UseStyledSlots<TProps, TSlotProps>) => FinalRender<TProps>;
|
|
15
15
|
/**
|
|
16
16
|
* optional statics to attach to the component
|
|
17
17
|
*/
|
|
@@ -20,7 +20,7 @@ export type ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics
|
|
|
20
20
|
export type ComposeFactoryComponent<TProps, TSlotProps, TTokens, TTheme, TStatics extends object = object> = ComposableFunction<TProps> & {
|
|
21
21
|
__options: ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics>;
|
|
22
22
|
customize: (...tokens: TokenSettings<TTokens, TTheme>[]) => ComposeFactoryComponent<TProps, TSlotProps, TTokens, TTheme, TStatics>;
|
|
23
|
-
compose
|
|
23
|
+
compose<TOverrideSlotProps = TSlotProps>(options: Partial<ComposeFactoryOptions<TProps, TOverrideSlotProps, TTokens, TTheme, TStatics>>): ComposeFactoryComponent<TProps, TOverrideSlotProps, TTokens, TTheme, TStatics>;
|
|
24
24
|
} & TStatics;
|
|
25
25
|
export declare function composeFactory<TProps, TSlotProps, TTokens, TTheme, TStatics extends object = object>(options: ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics>, themeHelper: ThemeHelper<TTheme>, base?: ComposeFactoryComponent<TProps, TSlotProps, TTokens, TTheme, TStatics>): ComposeFactoryComponent<TProps, TSlotProps, TTokens, TTheme, TStatics>;
|
|
26
26
|
//# sourceMappingURL=composeFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeFactory.d.ts","sourceRoot":"","sources":["../src/composeFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"composeFactory.d.ts","sourceRoot":"","sources":["../src/composeFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAE7F,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAG9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAElH,MAAM,MAAM,cAAc,CAAC,MAAM,EAAE,UAAU,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,KAAK,KAAK,CAAC,UAAU,CAAC,CAAC;AAEzG,MAAM,MAAM,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,iBAAiB,CAC1H,MAAM,EACN,UAAU,EACV,OAAO,EACP,MAAM,CACP,GACC,cAAc,CAAC,UAAU,CAAC,GAAG;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,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AAE,QAAQ,CAAC,GAC5E,uBAAuB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,CA8CxE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeFactory.js","sourceRoot":"","sources":["../src/composeFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAqCrE;;GAEG;AACH,MAAM,YAAY,GAAiB;IACjC,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,IAAI;CACb,CAAC;AAEF,MAAM,UAAU,cAAc,CAC5B,OAA6E,EAC7E,WAAgC,EAChC,IAA6E;
|
|
1
|
+
{"version":3,"file":"composeFactory.js","sourceRoot":"","sources":["../src/composeFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAE3E,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAqCrE;;GAEG;AACH,MAAM,YAAY,GAAiB;IACjC,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,IAAI;CACb,CAAC;AAEF,MAAM,UAAU,cAAc,CAC5B,OAA6E,EAC7E,WAAgC,EAChC,IAA6E,EACL;IAIxE,gDAAgD;IAChD,MAAM,WAAW,GAAiB,IAAI,EAAE,SAAyB,CAAC;IAClE,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAe,YAAY,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC;IAE9G,iDAAiD;IACjD,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAe,CAAC;IAE5H,6EAA6E;IAC7E,MAAM,QAAQ,GAAG,aAAa,CAAC,OAAO,CAAuC,CAAC;IAE9E,6BAA6B;IAC7B,MAAM,SAAS,GAAG,eAAe,CAAS,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAmB,CAAC;IAE3G,oDAAoD;IACpD,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAC5C,SAAS,CAAC,SAAS,GAAG,OAAO,CAAC;IAC9B,SAAS,CAAC,SAAS,GAAG,CAAC,GAAG,MAA8B,EAAE,EAAE,CAC1D,cAAc,CACZ,kBAAkB,CAAC,YAAY,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAkB,CAAC,EAC7E,WAAW,CACZ,CAAC;IAEJ,SAAS,CAAC,OAAO,GAAG,CAClB,aAAoG,EACpG,EAAE,CACF,cAAc,CACZ,kBAAkB,CAAC,YAAY,EAAE,OAAO,EAAE,aAAuB,CAMhE,EACD,WAAW,CACZ,CAAC;IAEJ,8BAA8B;IAC9B,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,SAAS,CAAC;AAAA,CAClB"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@fluentui-react-native/framework-base/jsx-runtime";
|
|
2
|
+
/** @jsxImportSource @fluentui-react-native/framework-base */
|
|
3
|
+
import { act } from 'react';
|
|
1
4
|
import { View, Text } from 'react-native';
|
|
2
|
-
import { withSlots } from '@fluentui-react-native/framework-base';
|
|
3
5
|
import * as renderer from 'react-test-renderer';
|
|
4
6
|
import { composeFactory } from './composeFactory';
|
|
5
7
|
const theme = {
|
|
@@ -35,8 +37,7 @@ const Base = composeFactory({
|
|
|
35
37
|
},
|
|
36
38
|
useRender: (props, useSlots) => {
|
|
37
39
|
const Slots = useSlots(props);
|
|
38
|
-
return (extra) => (
|
|
39
|
-
withSlots(Slots.content, null, "Hello")));
|
|
40
|
+
return (extra) => (_jsx(Slots.outer, { ...mergeProps(props, extra), children: _jsx(Slots.content, { children: "Hello" }) }));
|
|
40
41
|
},
|
|
41
42
|
}, themeHelper);
|
|
42
43
|
const Customized = Base.customize({ backgroundColor: 'pink' });
|
|
@@ -48,12 +49,18 @@ const mixinStyle = {
|
|
|
48
49
|
};
|
|
49
50
|
describe('composeFactory test suite', () => {
|
|
50
51
|
it('Base component render', () => {
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
let component;
|
|
53
|
+
act(() => {
|
|
54
|
+
component = renderer.create(_jsx(Base, { style: mixinStyle }));
|
|
55
|
+
});
|
|
56
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
53
57
|
});
|
|
54
|
-
it('
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
it('Customized component render', () => {
|
|
59
|
+
let component;
|
|
60
|
+
act(() => {
|
|
61
|
+
component = renderer.create(_jsx(Customized, { style: mixinStyle }));
|
|
62
|
+
});
|
|
63
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
57
64
|
});
|
|
58
65
|
});
|
|
59
66
|
//# sourceMappingURL=composeFactory.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeFactory.test.js","sourceRoot":"","sources":["../src/composeFactory.test.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"composeFactory.test.js","sourceRoot":"","sources":["../src/composeFactory.test.tsx"],"names":[],"mappings":";AAAA,6DAA6D;AAC7D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,CAAC;IAAA,CAC/C,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComposableFunction } from '@fluentui-react-native/framework-base';
|
|
1
|
+
import type { ComposableFunction, FinalRender } from '@fluentui-react-native/framework-base';
|
|
2
2
|
import type { UseSlotOptions, Slots } from '@fluentui-react-native/use-slots';
|
|
3
3
|
import type { UseStylingOptions, TokenSettings, ThemeHelper, HasLayer } from '@fluentui-react-native/use-styling';
|
|
4
4
|
export type UseStyledSlots<TProps, TSlotProps> = (props: TProps, lookup?: HasLayer) => Slots<TSlotProps>;
|
|
@@ -11,7 +11,7 @@ export type ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics
|
|
|
11
11
|
/**
|
|
12
12
|
* staged render function that takes props and a useSlots hook as an input
|
|
13
13
|
*/
|
|
14
|
-
useRender: (props: TProps, useSlots: UseStyledSlots<TProps, TSlotProps>) =>
|
|
14
|
+
useRender: (props: TProps, useSlots: UseStyledSlots<TProps, TSlotProps>) => FinalRender<TProps>;
|
|
15
15
|
/**
|
|
16
16
|
* optional statics to attach to the component
|
|
17
17
|
*/
|
|
@@ -20,7 +20,7 @@ export type ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics
|
|
|
20
20
|
export type ComposeFactoryComponent<TProps, TSlotProps, TTokens, TTheme, TStatics extends object = object> = ComposableFunction<TProps> & {
|
|
21
21
|
__options: ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics>;
|
|
22
22
|
customize: (...tokens: TokenSettings<TTokens, TTheme>[]) => ComposeFactoryComponent<TProps, TSlotProps, TTokens, TTheme, TStatics>;
|
|
23
|
-
compose
|
|
23
|
+
compose<TOverrideSlotProps = TSlotProps>(options: Partial<ComposeFactoryOptions<TProps, TOverrideSlotProps, TTokens, TTheme, TStatics>>): ComposeFactoryComponent<TProps, TOverrideSlotProps, TTokens, TTheme, TStatics>;
|
|
24
24
|
} & TStatics;
|
|
25
25
|
export declare function composeFactory<TProps, TSlotProps, TTokens, TTheme, TStatics extends object = object>(options: ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics>, themeHelper: ThemeHelper<TTheme>, base?: ComposeFactoryComponent<TProps, TSlotProps, TTokens, TTheme, TStatics>): ComposeFactoryComponent<TProps, TSlotProps, TTokens, TTheme, TStatics>;
|
|
26
26
|
//# sourceMappingURL=composeFactory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeFactory.d.ts","sourceRoot":"","sources":["../src/composeFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"composeFactory.d.ts","sourceRoot":"","sources":["../src/composeFactory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAE7F,OAAO,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,kCAAkC,CAAC;AAG9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAElH,MAAM,MAAM,cAAc,CAAC,MAAM,EAAE,UAAU,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,QAAQ,KAAK,KAAK,CAAC,UAAU,CAAC,CAAC;AAEzG,MAAM,MAAM,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAS,MAAM,GAAG,MAAM,IAAI,iBAAiB,CAC1H,MAAM,EACN,UAAU,EACV,OAAO,EACP,MAAM,CACP,GACC,cAAc,CAAC,UAAU,CAAC,GAAG;IAC3B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QA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,EAAE,MAAM,EAAE,QAAQ,CAAC,CA8CxE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.composeFactory =
|
|
3
|
+
exports.composeFactory = composeFactory;
|
|
4
4
|
const framework_base_1 = require("@fluentui-react-native/framework-base");
|
|
5
5
|
const framework_base_2 = require("@fluentui-react-native/framework-base");
|
|
6
6
|
const use_slots_1 = require("@fluentui-react-native/use-slots");
|
|
@@ -33,5 +33,4 @@ function composeFactory(options, themeHelper, base) {
|
|
|
33
33
|
}
|
|
34
34
|
return component;
|
|
35
35
|
}
|
|
36
|
-
exports.composeFactory = composeFactory;
|
|
37
36
|
//# sourceMappingURL=composeFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeFactory.js","sourceRoot":"","sources":["../src/composeFactory.ts"],"names":[],"mappings":";;;AACA,0EAA2E;AAE3E,0EAAwE;AAExE,gEAAiE;AACjE,oEAAqE;AAqCrE;;GAEG;AACH,MAAM,YAAY,GAAiB;IACjC,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,IAAI;CACb,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"composeFactory.js","sourceRoot":"","sources":["../src/composeFactory.ts"],"names":[],"mappings":";;;AACA,0EAA2E;AAE3E,0EAAwE;AAExE,gEAAiE;AACjE,oEAAqE;AAqCrE;;GAEG;AACH,MAAM,YAAY,GAAiB;IACjC,MAAM,EAAE,aAAa;IACrB,MAAM,EAAE,IAAI;CACb,CAAC;AAEF,wBACE,OAA6E,EAC7E,WAAgC,EAChC,IAA6E,EACL;IAIxE,gDAAgD;IAChD,MAAM,WAAW,GAAiB,IAAI,EAAE,SAAyB,CAAC;IAClE,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,IAAA,mCAAkB,EAAe,YAAY,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,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|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const jsx_runtime_1 = require("@fluentui-react-native/framework-base/jsx-runtime");
|
|
37
|
+
/** @jsxImportSource @fluentui-react-native/framework-base */
|
|
38
|
+
const react_1 = require("react");
|
|
26
39
|
const react_native_1 = require("react-native");
|
|
27
|
-
const framework_base_1 = require("@fluentui-react-native/framework-base");
|
|
28
40
|
const renderer = __importStar(require("react-test-renderer"));
|
|
29
41
|
const composeFactory_1 = require("./composeFactory");
|
|
30
42
|
const theme = {
|
|
@@ -60,8 +72,7 @@ const Base = (0, composeFactory_1.composeFactory)({
|
|
|
60
72
|
},
|
|
61
73
|
useRender: (props, useSlots) => {
|
|
62
74
|
const Slots = useSlots(props);
|
|
63
|
-
return (extra) => (
|
|
64
|
-
(0, framework_base_1.withSlots)(Slots.content, null, "Hello")));
|
|
75
|
+
return (extra) => (jsx_runtime_1.jsx(Slots.outer, { ...mergeProps(props, extra), children: jsx_runtime_1.jsx(Slots.content, { children: "Hello" }) }));
|
|
65
76
|
},
|
|
66
77
|
}, themeHelper);
|
|
67
78
|
const Customized = Base.customize({ backgroundColor: 'pink' });
|
|
@@ -73,12 +84,18 @@ const mixinStyle = {
|
|
|
73
84
|
};
|
|
74
85
|
describe('composeFactory test suite', () => {
|
|
75
86
|
it('Base component render', () => {
|
|
76
|
-
|
|
77
|
-
|
|
87
|
+
let component;
|
|
88
|
+
(0, react_1.act)(() => {
|
|
89
|
+
component = renderer.create(jsx_runtime_1.jsx(Base, { style: mixinStyle }));
|
|
90
|
+
});
|
|
91
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
78
92
|
});
|
|
79
|
-
it('
|
|
80
|
-
|
|
81
|
-
|
|
93
|
+
it('Customized component render', () => {
|
|
94
|
+
let component;
|
|
95
|
+
(0, react_1.act)(() => {
|
|
96
|
+
component = renderer.create(jsx_runtime_1.jsx(Customized, { style: mixinStyle }));
|
|
97
|
+
});
|
|
98
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
82
99
|
});
|
|
83
100
|
});
|
|
84
101
|
//# sourceMappingURL=composeFactory.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeFactory.test.js","sourceRoot":"","sources":["../src/composeFactory.test.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"composeFactory.test.js","sourceRoot":"","sources":["../src/composeFactory.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAA6D;AAC7D,iCAA4B;AAE5B,+CAA0C;AAG1C,MAAY,QAAQ,gDAA4B;AAGhD,qDAAkD;AAYlD,MAAM,KAAK,GAAU;IACnB,MAAM,EAAE;QACN,eAAe,EAAE,OAAO;QACxB,KAAK,EAAE,OAAO;KACf;IACD,UAAU,EAAE,EAAE;CACf,CAAC;AAYF,MAAM,WAAW,GAAuB;IACtC,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK;IACrB,gBAAgB,EA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AE,CAAC,CAAC;AAE/D,MAAM,UAAU,GAAG;IACjB,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,CAAC;CACf,CAAC;AAEF,QAAQ,CAAC,2BAA2B,EAAE,GAAG,EAAE,CAAC;IAC1C,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE,CAAC;QAChC,IAAI,SAAqC,CAAC;QAC1C,IAAA,WAAG,EAAC,GAAG,EAAE,CAAC;YACR,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,kBAAC,IAAI,IAAC,KAAK,EAAE,UAAU,GAAI,CAAC,CAAC;QAAA,CAC1D,CAAC,CAAC;QACH,MAAM,CAAC,SAAU,CAAC,MAAM,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;IAAA,CAC/C,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE,CAAC;QACtC,IAAI,SAAqC,CAAC;QAC1C,IAAA,WAAG,EAAC,GAAG,EAAE,CAAC;YACR,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,kBAAC,UAAU,IAAC,KAAK,EAAE,UAAU,GAAI,CAAC,CAAC;QAAA,CAChE,CAAC,CAAC;QACH,MAAM,CAAC,SAAU,CAAC,MAAM,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;IAAA,CAC/C,CAAC,CAAC;AAAA,CACJ,CAAC,CAAC"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.composeFactory = void 0;
|
|
4
|
-
|
|
4
|
+
const composeFactory_1 = require("./composeFactory");
|
|
5
5
|
Object.defineProperty(exports, "composeFactory", { enumerable: true, get: function () { return composeFactory_1.composeFactory; } });
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAAzC,gHAAA,cAAc,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-react-native/composition",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Composition factories for building HOCs",
|
|
5
|
+
"keywords": [],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "",
|
|
5
8
|
"repository": {
|
|
6
9
|
"type": "git",
|
|
7
10
|
"url": "https://github.com/microsoft/fluentui-react-native",
|
|
@@ -9,75 +12,67 @@
|
|
|
9
12
|
},
|
|
10
13
|
"main": "lib-commonjs/index.js",
|
|
11
14
|
"module": "lib/index.js",
|
|
12
|
-
"
|
|
15
|
+
"types": "lib/index.d.ts",
|
|
13
16
|
"exports": {
|
|
14
17
|
".": {
|
|
18
|
+
"types": "./lib/index.d.ts",
|
|
15
19
|
"import": "./lib/index.js",
|
|
16
20
|
"require": "./lib-commonjs/index.js",
|
|
17
|
-
"
|
|
21
|
+
"default": "./src/index.ts"
|
|
18
22
|
}
|
|
19
23
|
},
|
|
20
|
-
"typings": "lib/index.d.ts",
|
|
21
24
|
"scripts": {
|
|
22
25
|
"build": "fluentui-scripts build",
|
|
26
|
+
"build-cjs": "tsgo --outDir lib-commonjs",
|
|
27
|
+
"build-core": "tsgo --outDir lib --module esnext --moduleResolution bundler",
|
|
23
28
|
"clean": "fluentui-scripts clean",
|
|
24
29
|
"depcheck": "fluentui-scripts depcheck",
|
|
25
|
-
"just": "fluentui-scripts",
|
|
26
30
|
"lint": "fluentui-scripts eslint",
|
|
31
|
+
"lint-package": "fluentui-scripts lint-package",
|
|
32
|
+
"format": "fluentui-scripts format",
|
|
27
33
|
"start": "fluentui-scripts dev",
|
|
28
34
|
"start-test": "fluentui-scripts jest-watch",
|
|
29
35
|
"test": "fluentui-scripts jest",
|
|
30
|
-
"update-snapshots": "fluentui-scripts jest -u"
|
|
31
|
-
"prettier": "fluentui-scripts prettier",
|
|
32
|
-
"prettier-fix": "fluentui-scripts prettier --fix true"
|
|
36
|
+
"update-snapshots": "fluentui-scripts jest -u"
|
|
33
37
|
},
|
|
34
|
-
"keywords": [],
|
|
35
|
-
"author": "",
|
|
36
|
-
"license": "MIT",
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@fluentui-react-native/framework-base": "0.
|
|
39
|
-
"@fluentui-react-native/use-slots": "0.
|
|
40
|
-
"@fluentui-react-native/use-styling": "0.
|
|
39
|
+
"@fluentui-react-native/framework-base": "0.3.1",
|
|
40
|
+
"@fluentui-react-native/use-slots": "0.11.1",
|
|
41
|
+
"@fluentui-react-native/use-styling": "0.14.1"
|
|
41
42
|
},
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"@babel/core": "^7.20.0",
|
|
44
45
|
"@fluentui-react-native/babel-config": "0.1.1",
|
|
45
|
-
"@fluentui-react-native/eslint-config-rules": "0.1.
|
|
46
|
-
"@fluentui-react-native/jest-config": "0.1.
|
|
47
|
-
"@fluentui-react-native/
|
|
48
|
-
"@react-native/
|
|
49
|
-
"@react-native/
|
|
50
|
-
"@types/react": "
|
|
51
|
-
"@types/react-test-renderer": "^
|
|
52
|
-
"react": "
|
|
53
|
-
"react-native": "^0.
|
|
54
|
-
"react-test-renderer": "
|
|
46
|
+
"@fluentui-react-native/eslint-config-rules": "0.1.2",
|
|
47
|
+
"@fluentui-react-native/jest-config": "0.1.0",
|
|
48
|
+
"@fluentui-react-native/kit-config": "0.1.2",
|
|
49
|
+
"@fluentui-react-native/scripts": "0.1.0",
|
|
50
|
+
"@react-native/babel-preset": "^0.81.0",
|
|
51
|
+
"@types/react": "~19.1.0",
|
|
52
|
+
"@types/react-test-renderer": "^19.1.0",
|
|
53
|
+
"react": "19.1.0",
|
|
54
|
+
"react-native": "^0.81.0",
|
|
55
|
+
"react-test-renderer": "19.1.0"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
57
|
-
"react": "18.2.0",
|
|
58
|
-
"react
|
|
58
|
+
"@types/react": "~18.2.0 || ~19.0.0 || ~19.1.0",
|
|
59
|
+
"react": "18.2.0 || 19.0.0 || 19.1.0"
|
|
60
|
+
},
|
|
61
|
+
"peerDependenciesMeta": {
|
|
62
|
+
"@types/react": {
|
|
63
|
+
"optional": true
|
|
64
|
+
}
|
|
59
65
|
},
|
|
60
66
|
"rnx-kit": {
|
|
61
67
|
"kitType": "library",
|
|
62
68
|
"alignDeps": {
|
|
63
|
-
"presets": [
|
|
64
|
-
"microsoft/react-native"
|
|
65
|
-
],
|
|
66
|
-
"requirements": {
|
|
67
|
-
"development": [
|
|
68
|
-
"react-native@0.74"
|
|
69
|
-
],
|
|
70
|
-
"production": [
|
|
71
|
-
"react-native@0.73 || 0.74"
|
|
72
|
-
]
|
|
73
|
-
},
|
|
74
69
|
"capabilities": [
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"core
|
|
78
|
-
"
|
|
79
|
-
"react-test-renderer"
|
|
70
|
+
"core-dev-only",
|
|
71
|
+
"react-test-renderer",
|
|
72
|
+
"tools-core",
|
|
73
|
+
"tools-jest"
|
|
80
74
|
]
|
|
81
|
-
}
|
|
75
|
+
},
|
|
76
|
+
"extends": "@fluentui-react-native/kit-config"
|
|
82
77
|
}
|
|
83
|
-
}
|
|
78
|
+
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
/** @
|
|
2
|
-
|
|
1
|
+
/** @jsxImportSource @fluentui-react-native/framework-base */
|
|
2
|
+
import { act } from 'react';
|
|
3
3
|
import type { ViewProps, TextProps, ColorValue } from 'react-native';
|
|
4
4
|
import { View, Text } from 'react-native';
|
|
5
5
|
|
|
6
|
-
import { withSlots } from '@fluentui-react-native/framework-base';
|
|
7
6
|
import type { ThemeHelper } from '@fluentui-react-native/use-styling';
|
|
8
7
|
import * as renderer from 'react-test-renderer';
|
|
9
8
|
|
|
@@ -88,12 +87,18 @@ const mixinStyle = {
|
|
|
88
87
|
|
|
89
88
|
describe('composeFactory test suite', () => {
|
|
90
89
|
it('Base component render', () => {
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
let component: renderer.ReactTestRenderer;
|
|
91
|
+
act(() => {
|
|
92
|
+
component = renderer.create(<Base style={mixinStyle} />);
|
|
93
|
+
});
|
|
94
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
93
95
|
});
|
|
94
96
|
|
|
95
|
-
it('
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
it('Customized component render', () => {
|
|
98
|
+
let component: renderer.ReactTestRenderer;
|
|
99
|
+
act(() => {
|
|
100
|
+
component = renderer.create(<Customized style={mixinStyle} />);
|
|
101
|
+
});
|
|
102
|
+
expect(component!.toJSON()).toMatchSnapshot();
|
|
98
103
|
});
|
|
99
104
|
});
|
package/src/composeFactory.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MergeOptions } from '@fluentui-react-native/framework-base';
|
|
2
2
|
import { immutableMergeCore } from '@fluentui-react-native/framework-base';
|
|
3
|
-
import type { ComposableFunction } from '@fluentui-react-native/framework-base';
|
|
3
|
+
import type { ComposableFunction, FinalRender } from '@fluentui-react-native/framework-base';
|
|
4
4
|
import { stagedComponent } from '@fluentui-react-native/framework-base';
|
|
5
5
|
import type { UseSlotOptions, Slots } from '@fluentui-react-native/use-slots';
|
|
6
6
|
import { buildUseSlots } from '@fluentui-react-native/use-slots';
|
|
@@ -25,7 +25,7 @@ export type ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics
|
|
|
25
25
|
/**
|
|
26
26
|
* staged render function that takes props and a useSlots hook as an input
|
|
27
27
|
*/
|
|
28
|
-
useRender: (props: TProps, useSlots: UseStyledSlots<TProps, TSlotProps>) =>
|
|
28
|
+
useRender: (props: TProps, useSlots: UseStyledSlots<TProps, TSlotProps>) => FinalRender<TProps>;
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* optional statics to attach to the component
|
|
@@ -36,9 +36,9 @@ export type ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics
|
|
|
36
36
|
export type ComposeFactoryComponent<TProps, TSlotProps, TTokens, TTheme, TStatics extends object = object> = ComposableFunction<TProps> & {
|
|
37
37
|
__options: ComposeFactoryOptions<TProps, TSlotProps, TTokens, TTheme, TStatics>;
|
|
38
38
|
customize: (...tokens: TokenSettings<TTokens, TTheme>[]) => ComposeFactoryComponent<TProps, TSlotProps, TTokens, TTheme, TStatics>;
|
|
39
|
-
compose
|
|
40
|
-
options: Partial<ComposeFactoryOptions<TProps,
|
|
41
|
-
)
|
|
39
|
+
compose<TOverrideSlotProps = TSlotProps>(
|
|
40
|
+
options: Partial<ComposeFactoryOptions<TProps, TOverrideSlotProps, TTokens, TTheme, TStatics>>,
|
|
41
|
+
): ComposeFactoryComponent<TProps, TOverrideSlotProps, TTokens, TTheme, TStatics>;
|
|
42
42
|
} & TStatics;
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -62,7 +62,7 @@ export function composeFactory<TProps, TSlotProps, TTokens, TTheme, TStatics ext
|
|
|
62
62
|
options = baseOptions ? immutableMergeCore<LocalOptions>(mergeOptions, baseOptions, options) : { ...options };
|
|
63
63
|
|
|
64
64
|
// build styling if styling options are specified
|
|
65
|
-
options.useStyling = options.slotProps || options.tokens ? buildUseStyling(options, themeHelper) : () => ({} as TSlotProps
|
|
65
|
+
options.useStyling = options.slotProps || options.tokens ? buildUseStyling(options, themeHelper) : () => ({}) as TSlotProps;
|
|
66
66
|
|
|
67
67
|
// build the slots hook, which will use the styling hook if it has been built
|
|
68
68
|
const useSlots = buildUseSlots(options) as UseStyledSlots<TProps, TSlotProps>;
|
|
@@ -79,9 +79,17 @@ export function composeFactory<TProps, TSlotProps, TTokens, TTheme, TStatics ext
|
|
|
79
79
|
themeHelper,
|
|
80
80
|
);
|
|
81
81
|
|
|
82
|
-
component.compose =
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
component.compose = <TOverrideSlotProps = TSlotProps>(
|
|
83
|
+
customOptions: Partial<ComposeFactoryOptions<TProps, TOverrideSlotProps, TTokens, TTheme, TStatics>>,
|
|
84
|
+
) =>
|
|
85
|
+
composeFactory<TProps, TOverrideSlotProps, TTokens, TTheme, TStatics>(
|
|
86
|
+
immutableMergeCore(mergeOptions, options, customOptions as object) as unknown as ComposeFactoryOptions<
|
|
87
|
+
TProps,
|
|
88
|
+
TOverrideSlotProps,
|
|
89
|
+
TTokens,
|
|
90
|
+
TTheme,
|
|
91
|
+
TStatics
|
|
92
|
+
>,
|
|
85
93
|
themeHelper,
|
|
86
94
|
);
|
|
87
95
|
|