@uifabricshared/foundation-compose 1.13.7 → 1.13.8
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 +28 -1
- package/CHANGELOG.md +12 -2
- package/lib/compose.d.ts +12 -0
- package/lib/compose.d.ts.map +1 -0
- package/lib/compose.js +52 -0
- package/lib/compose.js.map +1 -0
- package/lib/compose.types.d.ts +104 -0
- package/lib/compose.types.d.ts.map +1 -0
- package/lib/compose.types.js +3 -0
- package/lib/compose.types.js.map +1 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -0
- package/lib/useStyling.d.ts +12 -0
- package/lib/useStyling.d.ts.map +1 -0
- package/lib/useStyling.js +55 -0
- package/lib/useStyling.js.map +1 -0
- package/package.json +3 -3
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,34 @@
|
|
|
2
2
|
"name": "@uifabricshared/foundation-compose",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 21 Mar 2023 21:51:13 GMT",
|
|
6
|
+
"tag": "@uifabricshared/foundation-compose_v1.13.8",
|
|
7
|
+
"version": "1.13.8",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "krsiler@microsoft.com",
|
|
12
|
+
"package": "@uifabricshared/foundation-compose",
|
|
13
|
+
"commit": "e706a7afbd63d528878eadd179d5a91210ed62f6",
|
|
14
|
+
"comment": "Trigger manual bump (no changes)"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@uifabricshared/foundation-compose",
|
|
19
|
+
"comment": "Bump @fluentui-react-native/default-theme to v0.18.2",
|
|
20
|
+
"commit": "e706a7afbd63d528878eadd179d5a91210ed62f6"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@uifabricshared/foundation-compose",
|
|
25
|
+
"comment": "Bump @uifabricshared/foundation-tokens to v0.12.31",
|
|
26
|
+
"commit": "e706a7afbd63d528878eadd179d5a91210ed62f6"
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"date": "Sat, 18 Mar 2023 17:22:31 GMT",
|
|
6
33
|
"tag": "@uifabricshared/foundation-compose_v1.13.7",
|
|
7
34
|
"version": "1.13.7",
|
|
8
35
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# Change Log - @uifabricshared/foundation-compose
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 21 Mar 2023 21:51:13 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.13.8
|
|
8
|
+
|
|
9
|
+
Tue, 21 Mar 2023 21:51:13 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Trigger manual bump (no changes) (krsiler@microsoft.com)
|
|
14
|
+
- Bump @fluentui-react-native/default-theme to v0.18.2
|
|
15
|
+
- Bump @uifabricshared/foundation-tokens to v0.12.31
|
|
16
|
+
|
|
7
17
|
## 1.13.7
|
|
8
18
|
|
|
9
|
-
Sat, 18 Mar 2023 17:
|
|
19
|
+
Sat, 18 Mar 2023 17:22:31 GMT
|
|
10
20
|
|
|
11
21
|
### Patches
|
|
12
22
|
|
package/lib/compose.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IComposeOptions, IComposeReturnType, IExtractStatics, IExtractTokens } from './compose.types';
|
|
2
|
+
import { INativeSlotType, IExtractProps, IExtractSlotProps, IExtractState } from '@uifabricshared/foundation-composable';
|
|
3
|
+
/**
|
|
4
|
+
* Assembles a higher order component, optionally composing a base HOC or base primitive control. The compose pattern
|
|
5
|
+
* allows a greater degree of customization than is available via props and allows for customization without adding
|
|
6
|
+
* additional layers to the react hierarchy.
|
|
7
|
+
*
|
|
8
|
+
* @param inputComponent - component definition for the component to be created. See IComposeOptions for more details.
|
|
9
|
+
* @param base - optional base component to compose, this can be an intrinsic, a stock element, or another composable
|
|
10
|
+
*/
|
|
11
|
+
export declare function compose<TType>(inputComponent: Partial<IComposeOptions<IExtractProps<TType>, IExtractSlotProps<TType>, IExtractTokens<TType>, IExtractState<TType>, IExtractStatics<TType>>>, base?: INativeSlotType): IComposeReturnType<IExtractProps<TType>, IExtractSlotProps<TType>, IExtractTokens<TType>, IExtractState<TType>, IExtractStatics<TType>>;
|
|
12
|
+
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../src/compose.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,cAAc,EAA0B,MAAM,iBAAiB,CAAC;AAC/H,OAAO,EAEL,eAAe,EAEf,aAAa,EACb,iBAAiB,EACjB,aAAa,EACd,MAAM,uCAAuC,CAAC;AA6B/C;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAC3B,cAAc,EAAE,OAAO,CACrB,eAAe,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CACrI,EACD,IAAI,CAAC,EAAE,eAAe,GACrB,kBAAkB,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,iBAAiB,CAAC,KAAK,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,eAAe,CAAC,KAAK,CAAC,CAAC,CAkCzI"}
|
package/lib/compose.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { composable, } from '@uifabricshared/foundation-composable';
|
|
3
|
+
import { initializeStyling, getOptionsFromObj } from './useStyling';
|
|
4
|
+
import { immutableMerge } from '@fluentui-react-native/immutable-merge';
|
|
5
|
+
/**
|
|
6
|
+
* Merge current and base options together to form the new object definition. These objects will merge with the
|
|
7
|
+
* exception of settings which will be appended
|
|
8
|
+
*
|
|
9
|
+
* @param inputComponent - input component
|
|
10
|
+
* @param base - component to use as a baseline (if it exists)
|
|
11
|
+
*/
|
|
12
|
+
function _getComponentOptions(inputComponent, base) {
|
|
13
|
+
if (base) {
|
|
14
|
+
var mergedSettings = { settings: [].concat(base.settings || [], inputComponent.settings || []).filter(function (v) { return v; }) };
|
|
15
|
+
return immutableMerge(base, inputComponent, mergedSettings);
|
|
16
|
+
}
|
|
17
|
+
return inputComponent;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Assembles a higher order component, optionally composing a base HOC or base primitive control. The compose pattern
|
|
21
|
+
* allows a greater degree of customization than is available via props and allows for customization without adding
|
|
22
|
+
* additional layers to the react hierarchy.
|
|
23
|
+
*
|
|
24
|
+
* @param inputComponent - component definition for the component to be created. See IComposeOptions for more details.
|
|
25
|
+
* @param base - optional base component to compose, this can be an intrinsic, a stock element, or another composable
|
|
26
|
+
*/
|
|
27
|
+
export function compose(inputComponent, base) {
|
|
28
|
+
// get merged options for the component
|
|
29
|
+
var options = _getComponentOptions(inputComponent, base && getOptionsFromObj(base));
|
|
30
|
+
// set up the styling injection function
|
|
31
|
+
options.useStyling = initializeStyling(options);
|
|
32
|
+
// use composable to create the function implementation
|
|
33
|
+
var Component = composable(options);
|
|
34
|
+
// attach extra information to the returned function component
|
|
35
|
+
Component.displayName = options.displayName;
|
|
36
|
+
Object.assign(Component, options.statics);
|
|
37
|
+
// set up the customize handler
|
|
38
|
+
Component.customize = function () {
|
|
39
|
+
var settings = [];
|
|
40
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
41
|
+
settings[_i] = arguments[_i];
|
|
42
|
+
}
|
|
43
|
+
return compose({ settings: settings }, Component);
|
|
44
|
+
};
|
|
45
|
+
// set up the compose handler
|
|
46
|
+
Component.compose = function (newOptions) {
|
|
47
|
+
return compose(newOptions, Component);
|
|
48
|
+
};
|
|
49
|
+
// now return the newly created component
|
|
50
|
+
return Component;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=compose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.js","sourceRoot":"","sources":["../src/compose.tsx"],"names":[],"mappings":"AAAA,oBAAoB;AAGpB,OAAO,EACL,UAAU,GAMX,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAGxE;;;;;;GAMG;AACH,SAAS,oBAAoB,CAO3B,cAAuF,EACvF,IAAqE;IAErE,IAAI,IAAI,EAAE;QACR,IAAM,cAAc,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,EAAE,cAAc,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,EAAD,CAAC,CAAC,EAAE,CAAC;QACpH,OAAO,cAAc,CAAC,IAAI,EAAE,cAAc,EAAE,cAAc,CAAmE,CAAC;KAC/H;IACD,OAAO,cAAgF,CAAC;AAC1F,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CACrB,cAEC,EACD,IAAsB;IAUtB,uCAAuC;IACvC,IAAM,OAAO,GAAG,oBAAoB,CAAqD,cAAc,EAAE,IAAI,IAAI,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC;IAE1I,wCAAwC;IACxC,OAAO,CAAC,UAAU,GAAG,iBAAiB,CAAqD,OAAO,CAAC,CAAC;IAEpG,uDAAuD;IACvD,IAAM,SAAS,GAAG,UAAU,CAAiD,OAAc,CAAgB,CAAC;IAE5G,8DAA8D;IAC9D,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAC5C,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1C,+BAA+B;IAC/B,SAAS,CAAC,SAAS,GAAG;QAAC,kBAA0D;aAA1D,UAA0D,EAA1D,qBAA0D,EAA1D,IAA0D;YAA1D,6BAA0D;;QAC/E,OAAO,OAAO,CAAC,EAAE,QAAQ,UAAA,EAAE,EAAE,SAAS,CAAC,CAAC;IAC1C,CAAC,CAAC;IAEF,6BAA6B;IAC7B,SAAS,CAAC,OAAO,GAAG,UAAC,UAAwF;QAC3G,OAAO,OAAO,CAAQ,UAAU,EAAE,SAAS,CAAC,CAAC;IAC/C,CAAC,CAAC;IAEF,yCAAyC;IACzC,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { IRenderData, IComposableDefinition, IComposableType, IExtractSlotProps, IExtractProps, IExtractState } from '@uifabricshared/foundation-composable';
|
|
2
|
+
import { ISlotProps, IComponentSettings, IWithTokens, IOverrideLookup } from '@uifabricshared/foundation-settings';
|
|
3
|
+
import { ISettingsEntry } from '@uifabricshared/themed-settings';
|
|
4
|
+
import { ITheme } from '@uifabricshared/theming-ramp';
|
|
5
|
+
import { IStyleFactories, IComponentTokens } from '@uifabricshared/foundation-tokens';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
export interface IComposeType<TProps extends object = object, TSlotProps extends ISlotProps = ISlotProps<TProps>, TState extends object = object, TTokens extends object = object, TStatics extends object = object> extends IComposableType<TProps, TSlotProps, TState> {
|
|
8
|
+
/**
|
|
9
|
+
* Any statics to attach to the component
|
|
10
|
+
*/
|
|
11
|
+
statics: TStatics;
|
|
12
|
+
/**
|
|
13
|
+
* Token props for this component
|
|
14
|
+
*/
|
|
15
|
+
tokens: TTokens;
|
|
16
|
+
}
|
|
17
|
+
type IStaticsFragment<TStatics extends object> = {
|
|
18
|
+
statics: TStatics;
|
|
19
|
+
};
|
|
20
|
+
export type IExtractStatics<T> = T extends IStaticsFragment<infer U> ? U : object;
|
|
21
|
+
type ITokensFragment<TTokens extends object> = {
|
|
22
|
+
tokens: TTokens;
|
|
23
|
+
};
|
|
24
|
+
export type IExtractTokens<T> = T extends ITokensFragment<infer U> ? U : object;
|
|
25
|
+
/**
|
|
26
|
+
* Function signature for useStyling as implemented by compose. This adds the lookup function to enable
|
|
27
|
+
* more control over how overrides are applied.
|
|
28
|
+
*/
|
|
29
|
+
export type IDefineUseComposeStyling<TProps, TSlotProps extends ISlotProps, TTokens extends object> = (props: TProps, lookup?: IOverrideLookup) => IWithTokens<TSlotProps, TTokens>;
|
|
30
|
+
export type IUseComposeStyling<T> = IDefineUseComposeStyling<IExtractProps<T>, IExtractSlotProps<T>, IExtractTokens<T>>;
|
|
31
|
+
/**
|
|
32
|
+
* Array of:
|
|
33
|
+
* IComponentSettings for the component
|
|
34
|
+
* string - name of the entry to query in the theme
|
|
35
|
+
* `theme => IComponentSettings` function
|
|
36
|
+
*
|
|
37
|
+
* These settings are layered together in order to produce the merged settings for a component
|
|
38
|
+
*/
|
|
39
|
+
export type IDefineComposeSettings<TSlotProps extends ISlotProps, TTokens extends object> = ISettingsEntry<IComponentSettings<IWithTokens<TSlotProps, TTokens>>, ITheme>[];
|
|
40
|
+
export type IComposeSettings<T> = IDefineComposeSettings<IExtractSlotProps<T>, IExtractTokens<T>>;
|
|
41
|
+
/**
|
|
42
|
+
* Settings which dictate the behavior of useStyling, as implemented by the compose package. These are
|
|
43
|
+
* separated from IComponentOptions to allow the styling portion to be used independently if so desired.
|
|
44
|
+
*/
|
|
45
|
+
export interface IStylingSettings<TSlotProps extends ISlotProps, TTokens extends object> {
|
|
46
|
+
/**
|
|
47
|
+
* settings used to build up the style definitions
|
|
48
|
+
*/
|
|
49
|
+
settings?: IDefineComposeSettings<TSlotProps, TTokens>;
|
|
50
|
+
/**
|
|
51
|
+
* factories for producing styles from tokens
|
|
52
|
+
*/
|
|
53
|
+
styles?: IStyleFactories<TSlotProps, TTokens, ITheme>;
|
|
54
|
+
/**
|
|
55
|
+
* The input tokens processed, built into functions, with the keys built into a map.
|
|
56
|
+
*
|
|
57
|
+
* This gets set automatically when the component is set up for the first time and should not be set by hand.
|
|
58
|
+
*/
|
|
59
|
+
resolvedTokens?: IComponentTokens<TSlotProps, TTokens, ITheme>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Options to be used with compose. These drive the actual behavior of the component and are comprised of styling
|
|
63
|
+
* options as well as options which configure composable.
|
|
64
|
+
*/
|
|
65
|
+
export interface IComposeOptions<TProps extends object = object, TSlotProps extends ISlotProps = ISlotProps<TProps>, TTokens extends object = object, TState extends object = object, TStatics extends object = object> extends IComposableDefinition<TProps, TSlotProps, TState>, IStylingSettings<TSlotProps, TTokens> {
|
|
66
|
+
/**
|
|
67
|
+
* Add an additional option to use styling to allow for injecting override lookup functions
|
|
68
|
+
*/
|
|
69
|
+
useStyling?: IDefineUseComposeStyling<TProps, TSlotProps, TTokens>;
|
|
70
|
+
/**
|
|
71
|
+
* Use prepare props will take the more opinionated version of useStyling
|
|
72
|
+
*/
|
|
73
|
+
usePrepareProps?: (props: TProps, useStyling: IDefineUseComposeStyling<TProps, TSlotProps, TTokens>) => IRenderData<TSlotProps, TState>;
|
|
74
|
+
/**
|
|
75
|
+
* Optional statics to attach to the component. This is primary used to attach a sub-component to a parent component
|
|
76
|
+
*/
|
|
77
|
+
statics?: TStatics;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* The signature of the component returned from compose.
|
|
81
|
+
*/
|
|
82
|
+
export type IComposeReturnType<TProps extends object, TSlotProps extends ISlotProps, TTokens extends object, TState extends object = object, TStatics extends object = object> = React.FunctionComponent<TProps> & TStatics & {
|
|
83
|
+
/**
|
|
84
|
+
* composable options, used by composable for chaining objects. For compose this also includes the extensions
|
|
85
|
+
* such as settings or token information.
|
|
86
|
+
*/
|
|
87
|
+
__composable: IComposeOptions<TProps, TSlotProps, TTokens, TState, TStatics>;
|
|
88
|
+
/**
|
|
89
|
+
* shorthand function for doing quick customizations of a component by appending to settings
|
|
90
|
+
*/
|
|
91
|
+
customize: (...settings: IDefineComposeSettings<TSlotProps, TTokens>) => IComposeReturnType<TProps, TSlotProps, TTokens, TState, TStatics>;
|
|
92
|
+
/**
|
|
93
|
+
* helper function to quickly add new partial options to the base component. The primary advantage is that
|
|
94
|
+
* this is strongly typed for the component type which avoids needing to pass all the type parameters correctly.
|
|
95
|
+
*/
|
|
96
|
+
compose: (newOptions: Partial<IComposeOptions<TProps, TSlotProps, TTokens, TState, TStatics>>) => IComposeReturnType<TProps, TSlotProps, TTokens, TState, TStatics>;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* A shorthand for typecasting a component into a more specific type, used for dealing with multiple platforms in
|
|
100
|
+
* react-native
|
|
101
|
+
*/
|
|
102
|
+
export type IComposeTypecast<TType> = IComposeReturnType<IExtractProps<TType>, IExtractSlotProps<TType>, IExtractTokens<TType>, IExtractState<TType>, IExtractStatics<TType>>;
|
|
103
|
+
export {};
|
|
104
|
+
//# sourceMappingURL=compose.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.types.d.ts","sourceRoot":"","sources":["../src/compose.types.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,aAAa,EACd,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AACnH,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CA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B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.types.js","sourceRoot":"","sources":["../src/compose.types.ts"],"names":[],"mappings":"AAAA,oBAAoB"}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { IComposeOptions, IComposeReturnType, IComposeSettings, IComposeType, IComposeTypecast, IDefineComposeSettings, IDefineUseComposeStyling, IExtractStatics, IExtractTokens, IStylingSettings, IUseComposeStyling, } from './compose.types';
|
|
2
|
+
export { compose } from './compose';
|
|
3
|
+
export { initializeStyling } from './useStyling';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,sBAAsB,EACtB,wBAAwB,EACxB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
|
package/lib/index.js
ADDED
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ISlotProps } from '@uifabricshared/foundation-settings';
|
|
2
|
+
import { IComposeOptions, IDefineUseComposeStyling } from './compose.types';
|
|
3
|
+
export declare function getOptionsFromObj<TComponent>(obj: any): TComponent | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* return a useStyling implementation, in the form of IUseComposeStyling, based on the passed in styleSettings. The
|
|
6
|
+
* styleSettings will be captured in the created closure and will be set up to enable the appropriate levels of caching.
|
|
7
|
+
*
|
|
8
|
+
* @param options - style settings to configure this function. Note that this should be scoped to a single component.
|
|
9
|
+
* @param name - optional base name to use as a cache key
|
|
10
|
+
*/
|
|
11
|
+
export declare function initializeStyling<TProps extends object, TSlotProps extends ISlotProps, TTokens extends object, TState extends object, TStatics extends object>(options: IComposeOptions<TProps, TSlotProps, TTokens, TState, TStatics>): IDefineUseComposeStyling<TProps, TSlotProps, TTokens>;
|
|
12
|
+
//# sourceMappingURL=useStyling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStyling.d.ts","sourceRoot":"","sources":["../src/useStyling.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAoD,MAAM,qCAAqC,CAAC;AAOnH,OAAO,EAAE,eAAe,EAAoB,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAI9F,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAG9E;AAqDD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,SAAS,MAAM,EACrB,UAAU,SAAS,UAAU,EAC7B,OAAO,SAAS,MAAM,EACtB,MAAM,SAAS,MAAM,EACrB,QAAQ,SAAS,MAAM,EACvB,OAAO,EAAE,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,GAAG,wBAAwB,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,CAYhI"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
import { getThemedSettings } from '@uifabricshared/themed-settings';
|
|
3
|
+
import { getSettings, returnAsSlotProps } from '@uifabricshared/theming-ramp';
|
|
4
|
+
import { processTokens, buildComponentTokens } from '@uifabricshared/foundation-tokens';
|
|
5
|
+
import { useTheme } from '@fluentui-react-native/theme-types';
|
|
6
|
+
import { defaultFluentTheme } from '@fluentui-react-native/default-theme';
|
|
7
|
+
import { getMemoCache } from '@fluentui-react-native/memo-cache';
|
|
8
|
+
/* tslint:disable-next-line no-any */
|
|
9
|
+
export function getOptionsFromObj(obj) {
|
|
10
|
+
var objType = obj && typeof obj;
|
|
11
|
+
return ((objType === 'object' || objType === 'function') && obj.__composable) || undefined;
|
|
12
|
+
}
|
|
13
|
+
function _getSettingsFromTheme(theme, name) {
|
|
14
|
+
return getSettings(theme, name);
|
|
15
|
+
}
|
|
16
|
+
function _getHasToken(slots) {
|
|
17
|
+
var slotTokens = {};
|
|
18
|
+
Object.keys(slots).forEach(function (slotName) {
|
|
19
|
+
var slot = slots[slotName];
|
|
20
|
+
var slotType = (typeof slot !== 'object' ? slot : slot.slotType);
|
|
21
|
+
var options = getOptionsFromObj(slotType);
|
|
22
|
+
slotTokens[slotName] = (options && options.resolvedTokens && options.resolvedTokens.tokenKeys) || undefined;
|
|
23
|
+
});
|
|
24
|
+
return function (target, key) {
|
|
25
|
+
return slotTokens[target] && slotTokens[target].hasOwnProperty(key);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function useStylingCore(props, options, instanceMemoCache, lookupOverride) {
|
|
29
|
+
// get the theme value from the context (or the default theme if it is not set)
|
|
30
|
+
var theme = useTheme() || defaultFluentTheme;
|
|
31
|
+
// resolve the array of settings for these options
|
|
32
|
+
lookupOverride = lookupOverride || props;
|
|
33
|
+
var _a = getThemedSettings(options.settings, theme, instanceMemoCache, lookupOverride, _getSettingsFromTheme), settings = _a.settings, getMemoValue = _a.getMemoValue;
|
|
34
|
+
// finish by processing the tokens and turning IComponentSettings into ISlotProps (this removes things like _overrides)
|
|
35
|
+
return returnAsSlotProps(processTokens(props, theme, settings, options.resolvedTokens, getMemoValue));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* return a useStyling implementation, in the form of IUseComposeStyling, based on the passed in styleSettings. The
|
|
39
|
+
* styleSettings will be captured in the created closure and will be set up to enable the appropriate levels of caching.
|
|
40
|
+
*
|
|
41
|
+
* @param options - style settings to configure this function. Note that this should be scoped to a single component.
|
|
42
|
+
* @param name - optional base name to use as a cache key
|
|
43
|
+
*/
|
|
44
|
+
export function initializeStyling(options) {
|
|
45
|
+
// process the tokens and get them ready to render
|
|
46
|
+
var styles = options.styles, slots = options.slots;
|
|
47
|
+
options.resolvedTokens = buildComponentTokens(styles, _getHasToken(slots));
|
|
48
|
+
// memo cache root for this component, keyed on options
|
|
49
|
+
var getMemoValue = getMemoCache(options);
|
|
50
|
+
// create a useStyling implementation for this component type (per type, not per instance)
|
|
51
|
+
return function (props, lookupOverride) {
|
|
52
|
+
return useStylingCore(props, options, getMemoValue, lookupOverride);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=useStyling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStyling.js","sourceRoot":"","sources":["../src/useStyling.ts"],"names":[],"mappings":"AAAA,oBAAoB;AAGpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAU,WAAW,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtF,OAAO,EAAoB,aAAa,EAAmB,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAC3H,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,OAAO,EAAE,YAAY,EAAgB,MAAM,mCAAmC,CAAC;AAE/E,qCAAqC;AACrC,MAAM,UAAU,iBAAiB,CAAa,GAAQ;IACpD,IAAM,OAAO,GAAG,GAAG,IAAI,OAAO,GAAG,CAAC;IAClC,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,UAAU,CAAC,IAAK,GAA2C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;IAEF,uHAAuH;IACvH,OAAO,iBAAiB,CACtB,aAAa,CACX,KAA2B,EAC3B,KAAK,EACL,QAAe,EACf,OAAO,CAAC,cAAc,EACtB,YAAiC,CAClC,CACkC,CAAC;AACxC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAM/B,OAAuE;IACvE,kDAAkD;IAC1C,IAAA,MAAM,GAAY,OAAO,OAAnB,EAAE,KAAK,GAAK,OAAO,MAAZ,CAAa;IAClC,OAAO,CAAC,cAAc,GAAG,oBAAoB,CAA8B,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;IAExG,uDAAuD;IACvD,IAAM,YAAY,GAAG,YAAY,CAAa,OAAO,CAAC,CAAC;IAEvD,0FAA0F;IAC1F,OAAO,UAAC,KAAa,EAAE,cAAgC;QACrD,OAAO,cAAc,CAA8B,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;IACnG,CAAC,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uifabricshared/foundation-compose",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.8",
|
|
4
4
|
"description": "Compose infrastructure",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"author": "",
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@fluentui-react-native/default-theme": ">=0.18.
|
|
30
|
+
"@fluentui-react-native/default-theme": ">=0.18.2 <1.0.0",
|
|
31
31
|
"@fluentui-react-native/immutable-merge": "^1.1.8",
|
|
32
32
|
"@fluentui-react-native/memo-cache": "^1.1.8",
|
|
33
33
|
"@fluentui-react-native/theme-types": ">=0.31.0 <1.0.0",
|
|
34
34
|
"@uifabricshared/themed-settings": ">=0.9.3 <1.0.0",
|
|
35
35
|
"@uifabricshared/foundation-composable": ">=0.11.3 <1.0.0",
|
|
36
36
|
"@uifabricshared/foundation-settings": ">=0.12.3 <1.0.0",
|
|
37
|
-
"@uifabricshared/foundation-tokens": ">=0.12.
|
|
37
|
+
"@uifabricshared/foundation-tokens": ">=0.12.31 <1.0.0",
|
|
38
38
|
"@uifabricshared/theming-ramp": ">=0.17.22 <1.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|