@uifabricshared/foundation-compose 1.15.17 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,48 @@
1
1
  # Change Log - @uifabricshared/foundation-compose
2
2
 
3
+ ## 1.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - d7adbdd: # Migration from Beachball to Changesets
8
+
9
+ 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.
10
+
11
+ All 75 affected packages receive a minor version bump to acknowledge the accumulated changes from the beachball era.
12
+
13
+ ## What Changed
14
+
15
+ Going forward, all version management uses Changesets via `yarn changeset`. The following beachball infrastructure has been removed:
16
+
17
+ - ❌ 440+ beachball change files from `change/` directory
18
+ - ❌ `beachball` package dependency
19
+ - ❌ Beachball scripts from `package.json`
20
+ - ❌ `beachball.config.js` configuration file
21
+ - ❌ Beachball publish steps from Azure Pipelines
22
+
23
+ ## New Workflow
24
+
25
+ ✅ **Create changes**: Run `yarn changeset` to document changes
26
+ ✅ **Version bump PRs**: Automatically created by GitHub Actions
27
+ ✅ **Publishing**: Handled by Azure Pipelines using `changeset publish`
28
+ ✅ **Validation**: CI validates changesets and blocks major version bumps
29
+
30
+ For details, see `CHANGESETS_SETUP.md` and `CONTRIBUTING.md`.
31
+
32
+ ### Patch Changes
33
+
34
+ - 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.
35
+ - Updated dependencies [d7adbdd]
36
+ - Updated dependencies [d1d8c26]
37
+ - @fluentui-react-native/default-theme@0.27.0
38
+ - @fluentui-react-native/framework-base@0.3.0
39
+ - @fluentui-react-native/theme-types@0.44.0
40
+ - @uifabricshared/foundation-composable@0.14.0
41
+ - @uifabricshared/foundation-settings@0.16.0
42
+ - @uifabricshared/foundation-tokens@0.16.0
43
+ - @uifabricshared/themed-settings@0.13.0
44
+ - @uifabricshared/theming-ramp@0.21.0
45
+
3
46
  <!-- This log was last generated on Tue, 05 Aug 2025 18:50:39 GMT and should not be manually modified. -->
4
47
 
5
48
  <!-- Start content -->
@@ -1413,131 +1456,173 @@ Thu, 16 Apr 2020 23:57:38 GMT
1413
1456
  - publish with correct main/module references (jasonmo@microsoft.com)
1414
1457
 
1415
1458
  ## 1.5.16
1459
+
1416
1460
  Thu, 09 Apr 2020 18:39:15 GMT
1417
1461
 
1418
1462
  ### Patches
1419
1463
 
1420
1464
  - merge conflicts (ppatboyd@outlook.com)
1465
+
1421
1466
  ## 1.5.14
1467
+
1422
1468
  Fri, 03 Apr 2020 20:40:51 GMT
1423
1469
 
1424
1470
  ### Patches
1425
1471
 
1426
1472
  - switch the bin name from just-script to fluent-scripts to disambiguate names (jasonmo@microsoft.com)
1473
+
1427
1474
  ## 1.5.13
1475
+
1428
1476
  Tue, 31 Mar 2020 18:01:09 GMT
1429
1477
 
1430
1478
  ### Patches
1431
1479
 
1432
1480
  - Merge branch 'sammy/checkboxV1' of https://github.com/samuelfreiberg/fluentui-react-native into sammy/checkboxV1 (safreibe@microsoft.com)
1481
+
1433
1482
  ## 1.5.12
1483
+
1434
1484
  Mon, 30 Mar 2020 16:27:00 GMT
1435
1485
 
1436
1486
  ### Patches
1437
1487
 
1438
1488
  - Update main attribute to specify TypeScript index file. (kinhln@microsoft.com)
1489
+
1439
1490
  ## 1.5.9
1491
+
1440
1492
  Wed, 11 Mar 2020 17:57:52 GMT
1441
1493
 
1442
1494
  ### Patches
1443
1495
 
1444
1496
  - 🐛 Use weak map to avoid copying theme cache when resolving child themes (adrum@microsoft.com)
1497
+
1445
1498
  ## 1.5.7
1499
+
1446
1500
  Tue, 10 Mar 2020 22:28:00 GMT
1447
1501
 
1448
1502
  ### Patches
1449
1503
 
1450
1504
  - switch symbol based caching to use WeakMaps (jasonmo@microsoft.com)
1505
+
1451
1506
  ## 1.5.4
1507
+
1452
1508
  Fri, 28 Feb 2020 00:04:18 GMT
1453
1509
 
1454
1510
  ### Patches
1455
1511
 
1456
1512
  - split hooks into dedicated files (jasonmo@microsoft.com)
1513
+
1457
1514
  ## 1.5.3
1515
+
1458
1516
  Thu, 20 Feb 2020 01:36:35 GMT
1459
1517
 
1460
1518
  ### Patches
1461
1519
 
1462
1520
  - restructure directories in project (jasonmo@microsoft.com)
1521
+
1463
1522
  ## 1.5.2
1523
+
1464
1524
  Fri, 07 Feb 2020 00:29:25 GMT
1465
1525
 
1466
1526
  ### Patches
1467
1527
 
1468
1528
  - clean up just tasks and remove unnecessary webpack configs (jasonmo@microsoft.com)
1529
+
1469
1530
  ## 1.5.1
1531
+
1470
1532
  Thu, 06 Feb 2020 01:00:13 GMT
1471
1533
 
1472
1534
  ### Patches
1473
1535
 
1474
1536
  - clean up just tasks and remove unnecessary webpack configs (jasonmo@microsoft.com)
1537
+
1475
1538
  ## 1.5.0
1539
+
1476
1540
  Fri, 13 Dec 2019 21:50:31 GMT
1477
1541
 
1478
1542
  ### Minor changes
1479
1543
 
1480
1544
  - 🐛 Add missing tokens typing to theme definitions (adrum@microsoft.com)
1545
+
1481
1546
  ## 1.4.0
1547
+
1482
1548
  Wed, 20 Nov 2019 19:51:16 GMT
1483
1549
 
1484
1550
  ### Minor changes
1485
1551
 
1486
1552
  - changes styleFactories to styles (jasonmo360@gmail.com)
1553
+
1487
1554
  ## 1.3.0
1555
+
1488
1556
  Wed, 20 Nov 2019 19:37:06 GMT
1489
1557
 
1490
1558
  ### Minor changes
1491
1559
 
1492
1560
  - 📦 fix package entrypoints to distinguish CJS/ES6 (adrum@microsoft.com)
1561
+
1493
1562
  ## 1.2.0
1563
+
1494
1564
  Tue, 19 Nov 2019 22:37:36 GMT
1495
1565
 
1496
1566
  ### Minor changes
1497
1567
 
1498
1568
  - add token support to settings, change to type objects (jasonmo@microsoft.com)
1569
+
1499
1570
  ## 1.1.3
1571
+
1500
1572
  Fri, 01 Nov 2019 16:51:54 GMT
1501
1573
 
1502
1574
  ### Patches
1503
1575
 
1504
1576
  - fix version references for packages (jasonmo@microsoft.com)
1577
+
1505
1578
  ## 1.1.2
1579
+
1506
1580
  Tue, 15 Oct 2019 02:11:41 GMT
1507
1581
 
1508
1582
  ### Patches
1509
1583
 
1510
1584
  - api-extractor setup (taamireh@microsoft.com)
1585
+
1511
1586
  ## 1.1.1
1587
+
1512
1588
  Thu, 26 Sep 2019 19:45:56 GMT
1513
1589
 
1514
1590
  ### Patches
1515
1591
 
1516
- - remove _parent from component settings and stop using augment platform theme for settings (jasonmo360@gmail.com)
1592
+ - remove \_parent from component settings and stop using augment platform theme for settings (jasonmo360@gmail.com)
1593
+
1517
1594
  ## 1.1.0
1595
+
1518
1596
  Wed, 25 Sep 2019 23:15:41 GMT
1519
1597
 
1520
1598
  ### Minor changes
1521
1599
 
1522
1600
  - Get new compose infrastructure working (jasonmo@microsoft.com)
1601
+
1523
1602
  ## 1.0.2
1603
+
1524
1604
  Thu, 19 Sep 2019 23:21:48 GMT
1525
1605
 
1526
1606
  ### Patches
1527
1607
 
1528
1608
  - force publish (taamireh@microsoft.com)
1609
+
1529
1610
  ## 1.0.1
1611
+
1530
1612
  Thu, 19 Sep 2019 00:21:30 GMT
1531
1613
 
1532
1614
  ### Patches
1533
1615
 
1534
1616
  - change scope names (taamireh@microsoft.com)
1617
+
1535
1618
  ## 1.0.0
1619
+
1536
1620
  Sat, 14 Sep 2019 01:56:36 GMT
1537
1621
 
1538
1622
  ### Major
1539
1623
 
1540
1624
  - switch implementations to use new customized settings (jasonmo@microsoft.com)
1625
+
1541
1626
  ### Patches
1542
1627
 
1543
1628
  - Begin turning on some linting rules (taamireh@microsoft.com)
package/lib/compose.d.ts CHANGED
@@ -8,5 +8,10 @@ import { INativeSlotType, IExtractProps, IExtractSlotProps, IExtractState } from
8
8
  * @param inputComponent - component definition for the component to be created. See IComposeOptions for more details.
9
9
  * @param base - optional base component to compose, this can be an intrinsic, a stock element, or another composable
10
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
11
+ export declare function compose<TType>(
12
+ inputComponent: Partial<
13
+ IComposeOptions<IExtractProps<TType>, IExtractSlotProps<TType>, IExtractTokens<TType>, IExtractState<TType>, IExtractStatics<TType>>
14
+ >,
15
+ base?: INativeSlotType,
16
+ ): IComposeReturnType<IExtractProps<TType>, IExtractSlotProps<TType>, IExtractTokens<TType>, IExtractState<TType>, IExtractStatics<TType>>;
17
+ //# sourceMappingURL=compose.d.ts.map
package/lib/compose.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable */
2
- import { composable, } from '@uifabricshared/foundation-composable';
2
+ import { composable } from '@uifabricshared/foundation-composable';
3
3
  import { initializeStyling, getOptionsFromObj } from './useStyling';
4
4
  import { immutableMerge } from '@fluentui-react-native/framework-base';
5
5
  /**
@@ -10,11 +10,11 @@ import { immutableMerge } from '@fluentui-react-native/framework-base';
10
10
  * @param base - component to use as a baseline (if it exists)
11
11
  */
12
12
  function _getComponentOptions(inputComponent, base) {
13
- if (base) {
14
- const mergedSettings = { settings: [].concat(base.settings || [], inputComponent.settings || []).filter((v) => v) };
15
- return immutableMerge(base, inputComponent, mergedSettings);
16
- }
17
- return inputComponent;
13
+ if (base) {
14
+ const mergedSettings = { settings: [].concat(base.settings || [], inputComponent.settings || []).filter((v) => v) };
15
+ return immutableMerge(base, inputComponent, mergedSettings);
16
+ }
17
+ return inputComponent;
18
18
  }
19
19
  /**
20
20
  * Assembles a higher order component, optionally composing a base HOC or base primitive control. The compose pattern
@@ -25,24 +25,24 @@ function _getComponentOptions(inputComponent, base) {
25
25
  * @param base - optional base component to compose, this can be an intrinsic, a stock element, or another composable
26
26
  */
27
27
  export function compose(inputComponent, base) {
28
- // get merged options for the component
29
- const 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
- const 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 = (...settings) => {
39
- return compose({ settings }, Component);
40
- };
41
- // set up the compose handler
42
- Component.compose = (newOptions) => {
43
- return compose(newOptions, Component);
44
- };
45
- // now return the newly created component
46
- return Component;
28
+ // get merged options for the component
29
+ const 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
+ const 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 = (...settings) => {
39
+ return compose({ settings }, Component);
40
+ };
41
+ // set up the compose handler
42
+ Component.compose = (newOptions) => {
43
+ return compose(newOptions, Component);
44
+ };
45
+ // now return the newly created component
46
+ return Component;
47
47
  }
48
- //# sourceMappingURL=compose.js.map
48
+ //# sourceMappingURL=compose.js.map
@@ -1 +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,uCAAuC,CAAC;AAGvE;;;;;;GAMG;AACH,SAAS,oBAAoB,CAO3B,cAAuF,EACvF,IAAqE;IAErE,IAAI,IAAI,EAAE;QACR,MAAM,cAAc,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,EAAE,cAAc,CAA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ChH,OAAO,OAAO,CAAQ,UAAU,EAAE,SAAS,CAAC,CAAC;IAAA,CAC9C,CAAC;IAEF,yCAAyC;IACzC,OAAO,SAAS,CAAC;AAAA,CAClB"}
@@ -1,32 +1,48 @@
1
- import { IRenderData, IComposableDefinition, IComposableType, IExtractSlotProps, IExtractProps, IExtractState } from '@uifabricshared/foundation-composable';
1
+ import {
2
+ IRenderData,
3
+ IComposableDefinition,
4
+ IComposableType,
5
+ IExtractSlotProps,
6
+ IExtractProps,
7
+ IExtractState,
8
+ } from '@uifabricshared/foundation-composable';
2
9
  import { ISlotProps, IComponentSettings, IWithTokens, IOverrideLookup } from '@uifabricshared/foundation-settings';
3
10
  import { ISettingsEntry } from '@uifabricshared/themed-settings';
4
11
  import { ITheme } from '@uifabricshared/theming-ramp';
5
12
  import { IStyleFactories, IComponentTokens } from '@uifabricshared/foundation-tokens';
6
13
  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;
14
+ export interface IComposeType<
15
+ TProps extends object = object,
16
+ TSlotProps extends ISlotProps = ISlotProps<TProps>,
17
+ TState extends object = object,
18
+ TTokens extends object = object,
19
+ TStatics extends object = object,
20
+ > extends IComposableType<TProps, TSlotProps, TState> {
21
+ /**
22
+ * Any statics to attach to the component
23
+ */
24
+ statics: TStatics;
25
+ /**
26
+ * Token props for this component
27
+ */
28
+ tokens: TTokens;
16
29
  }
17
30
  type IStaticsFragment<TStatics extends object> = {
18
- statics: TStatics;
31
+ statics: TStatics;
19
32
  };
20
33
  export type IExtractStatics<T> = T extends IStaticsFragment<infer U> ? U : object;
21
34
  type ITokensFragment<TTokens extends object> = {
22
- tokens: TTokens;
35
+ tokens: TTokens;
23
36
  };
24
37
  export type IExtractTokens<T> = T extends ITokensFragment<infer U> ? U : object;
25
38
  /**
26
39
  * Function signature for useStyling as implemented by compose. This adds the lookup function to enable
27
40
  * more control over how overrides are applied.
28
41
  */
29
- export type IDefineUseComposeStyling<TProps, TSlotProps extends ISlotProps, TTokens extends object> = (props: TProps, lookup?: IOverrideLookup) => IWithTokens<TSlotProps, TTokens>;
42
+ export type IDefineUseComposeStyling<TProps, TSlotProps extends ISlotProps, TTokens extends object> = (
43
+ props: TProps,
44
+ lookup?: IOverrideLookup,
45
+ ) => IWithTokens<TSlotProps, TTokens>;
30
46
  export type IUseComposeStyling<T> = IDefineUseComposeStyling<IExtractProps<T>, IExtractSlotProps<T>, IExtractTokens<T>>;
31
47
  /**
32
48
  * Array of:
@@ -36,50 +52,67 @@ export type IUseComposeStyling<T> = IDefineUseComposeStyling<IExtractProps<T>, I
36
52
  *
37
53
  * These settings are layered together in order to produce the merged settings for a component
38
54
  */
39
- export type IDefineComposeSettings<TSlotProps extends ISlotProps, TTokens extends object> = ISettingsEntry<IComponentSettings<IWithTokens<TSlotProps, TTokens>>, ITheme>[];
55
+ export type IDefineComposeSettings<TSlotProps extends ISlotProps, TTokens extends object> = ISettingsEntry<
56
+ IComponentSettings<IWithTokens<TSlotProps, TTokens>>,
57
+ ITheme
58
+ >[];
40
59
  export type IComposeSettings<T> = IDefineComposeSettings<IExtractSlotProps<T>, IExtractTokens<T>>;
41
60
  /**
42
61
  * Settings which dictate the behavior of useStyling, as implemented by the compose package. These are
43
62
  * separated from IComponentOptions to allow the styling portion to be used independently if so desired.
44
63
  */
45
64
  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>;
65
+ /**
66
+ * settings used to build up the style definitions
67
+ */
68
+ settings?: IDefineComposeSettings<TSlotProps, TTokens>;
69
+ /**
70
+ * factories for producing styles from tokens
71
+ */
72
+ styles?: IStyleFactories<TSlotProps, TTokens, ITheme>;
73
+ /**
74
+ * The input tokens processed, built into functions, with the keys built into a map.
75
+ *
76
+ * This gets set automatically when the component is set up for the first time and should not be set by hand.
77
+ */
78
+ resolvedTokens?: IComponentTokens<TSlotProps, TTokens, ITheme>;
60
79
  }
61
80
  /**
62
81
  * Options to be used with compose. These drive the actual behavior of the component and are comprised of styling
63
82
  * options as well as options which configure composable.
64
83
  */
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;
84
+ export interface IComposeOptions<
85
+ TProps extends object = object,
86
+ TSlotProps extends ISlotProps = ISlotProps<TProps>,
87
+ TTokens extends object = object,
88
+ TState extends object = object,
89
+ TStatics extends object = object,
90
+ > extends IComposableDefinition<TProps, TSlotProps, TState>,
91
+ IStylingSettings<TSlotProps, TTokens> {
92
+ /**
93
+ * Add an additional option to use styling to allow for injecting override lookup functions
94
+ */
95
+ useStyling?: IDefineUseComposeStyling<TProps, TSlotProps, TTokens>;
96
+ /**
97
+ * Use prepare props will take the more opinionated version of useStyling
98
+ */
99
+ usePrepareProps?: (props: TProps, useStyling: IDefineUseComposeStyling<TProps, TSlotProps, TTokens>) => IRenderData<TSlotProps, TState>;
100
+ /**
101
+ * Optional statics to attach to the component. This is primary used to attach a sub-component to a parent component
102
+ */
103
+ statics?: TStatics;
78
104
  }
79
105
  /**
80
106
  * The signature of the component returned from compose.
81
107
  */
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 & {
108
+ export type IComposeReturnType<
109
+ TProps extends object,
110
+ TSlotProps extends ISlotProps,
111
+ TTokens extends object,
112
+ TState extends object = object,
113
+ TStatics extends object = object,
114
+ > = React.FunctionComponent<TProps> &
115
+ TStatics & {
83
116
  /**
84
117
  * composable options, used by composable for chaining objects. For compose this also includes the extensions
85
118
  * such as settings or token information.
@@ -88,17 +121,27 @@ export type IComposeReturnType<TProps extends object, TSlotProps extends ISlotPr
88
121
  /**
89
122
  * shorthand function for doing quick customizations of a component by appending to settings
90
123
  */
91
- customize: (...settings: IDefineComposeSettings<TSlotProps, TTokens>) => IComposeReturnType<TProps, TSlotProps, TTokens, TState, TStatics>;
124
+ customize: (
125
+ ...settings: IDefineComposeSettings<TSlotProps, TTokens>
126
+ ) => IComposeReturnType<TProps, TSlotProps, TTokens, TState, TStatics>;
92
127
  /**
93
128
  * helper function to quickly add new partial options to the base component. The primary advantage is that
94
129
  * this is strongly typed for the component type which avoids needing to pass all the type parameters correctly.
95
130
  */
96
- compose: (newOptions: Partial<IComposeOptions<TProps, TSlotProps, TTokens, TState, TStatics>>) => IComposeReturnType<TProps, TSlotProps, TTokens, TState, TStatics>;
97
- };
131
+ compose: (
132
+ newOptions: Partial<IComposeOptions<TProps, TSlotProps, TTokens, TState, TStatics>>,
133
+ ) => IComposeReturnType<TProps, TSlotProps, TTokens, TState, TStatics>;
134
+ };
98
135
  /**
99
136
  * A shorthand for typecasting a component into a more specific type, used for dealing with multiple platforms in
100
137
  * react-native
101
138
  */
102
- export type IComposeTypecast<TType> = IComposeReturnType<IExtractProps<TType>, IExtractSlotProps<TType>, IExtractTokens<TType>, IExtractState<TType>, IExtractStatics<TType>>;
139
+ export type IComposeTypecast<TType> = IComposeReturnType<
140
+ IExtractProps<TType>,
141
+ IExtractSlotProps<TType>,
142
+ IExtractTokens<TType>,
143
+ IExtractState<TType>,
144
+ IExtractStatics<TType>
145
+ >;
103
146
  export {};
104
- //# sourceMappingURL=compose.types.d.ts.map
147
+ //# sourceMappingURL=compose.types.d.ts.map
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable */
2
2
  export {};
3
- //# sourceMappingURL=compose.types.js.map
3
+ //# sourceMappingURL=compose.types.js.map
package/lib/index.d.ts CHANGED
@@ -1,4 +1,16 @@
1
- export type { IComposeOptions, IComposeReturnType, IComposeSettings, IComposeType, IComposeTypecast, IDefineComposeSettings, IDefineUseComposeStyling, IExtractStatics, IExtractTokens, IStylingSettings, IUseComposeStyling, } from './compose.types';
1
+ export type {
2
+ IComposeOptions,
3
+ IComposeReturnType,
4
+ IComposeSettings,
5
+ IComposeType,
6
+ IComposeTypecast,
7
+ IDefineComposeSettings,
8
+ IDefineUseComposeStyling,
9
+ IExtractStatics,
10
+ IExtractTokens,
11
+ IStylingSettings,
12
+ IUseComposeStyling,
13
+ } from './compose.types';
2
14
  export { compose } from './compose';
3
15
  export { initializeStyling } from './useStyling';
4
- //# sourceMappingURL=index.d.ts.map
16
+ //# sourceMappingURL=index.d.ts.map
package/lib/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export { compose } from './compose';
2
2
  export { initializeStyling } from './useStyling';
3
- //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -8,5 +8,11 @@ export declare function getOptionsFromObj<TComponent>(obj: any): TComponent | un
8
8
  * @param options - style settings to configure this function. Note that this should be scoped to a single component.
9
9
  * @param name - optional base name to use as a cache key
10
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
11
+ export declare function initializeStyling<
12
+ TProps extends object,
13
+ TSlotProps extends ISlotProps,
14
+ TTokens extends object,
15
+ TState extends object,
16
+ TStatics extends object,
17
+ >(options: IComposeOptions<TProps, TSlotProps, TTokens, TState, TStatics>): IDefineUseComposeStyling<TProps, TSlotProps, TTokens>;
18
+ //# sourceMappingURL=useStyling.d.ts.map
package/lib/useStyling.js CHANGED
@@ -7,32 +7,32 @@ import { defaultFluentTheme } from '@fluentui-react-native/default-theme';
7
7
  import { getMemoCache } from '@fluentui-react-native/framework-base';
8
8
  /* tslint:disable-next-line no-any */
9
9
  export function getOptionsFromObj(obj) {
10
- const objType = obj && typeof obj;
11
- return ((objType === 'object' || objType === 'function') && obj.__composable) || undefined;
10
+ const objType = obj && typeof obj;
11
+ return ((objType === 'object' || objType === 'function') && obj.__composable) || undefined;
12
12
  }
13
13
  function _getSettingsFromTheme(theme, name) {
14
- return getSettings(theme, name);
14
+ return getSettings(theme, name);
15
15
  }
16
16
  function _getHasToken(slots) {
17
- const slotTokens = {};
18
- Object.keys(slots).forEach((slotName) => {
19
- const slot = slots[slotName];
20
- const slotType = (typeof slot !== 'object' ? slot : slot.slotType);
21
- const options = getOptionsFromObj(slotType);
22
- slotTokens[slotName] = (options && options.resolvedTokens && options.resolvedTokens.tokenKeys) || undefined;
23
- });
24
- return (target, key) => {
25
- return slotTokens[target] && slotTokens[target].hasOwnProperty(key);
26
- };
17
+ const slotTokens = {};
18
+ Object.keys(slots).forEach((slotName) => {
19
+ const slot = slots[slotName];
20
+ const slotType = typeof slot !== 'object' ? slot : slot.slotType;
21
+ const options = getOptionsFromObj(slotType);
22
+ slotTokens[slotName] = (options && options.resolvedTokens && options.resolvedTokens.tokenKeys) || undefined;
23
+ });
24
+ return (target, key) => {
25
+ return slotTokens[target] && slotTokens[target].hasOwnProperty(key);
26
+ };
27
27
  }
28
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
- const theme = useTheme() || defaultFluentTheme;
31
- // resolve the array of settings for these options
32
- lookupOverride = lookupOverride || props;
33
- const { settings, getMemoValue } = getThemedSettings(options.settings, theme, instanceMemoCache, lookupOverride, _getSettingsFromTheme);
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));
29
+ // get the theme value from the context (or the default theme if it is not set)
30
+ const theme = useTheme() || defaultFluentTheme;
31
+ // resolve the array of settings for these options
32
+ lookupOverride = lookupOverride || props;
33
+ const { settings, getMemoValue } = getThemedSettings(options.settings, theme, instanceMemoCache, lookupOverride, _getSettingsFromTheme);
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
36
  }
37
37
  /**
38
38
  * return a useStyling implementation, in the form of IUseComposeStyling, based on the passed in styleSettings. The
@@ -42,14 +42,14 @@ function useStylingCore(props, options, instanceMemoCache, lookupOverride) {
42
42
  * @param name - optional base name to use as a cache key
43
43
  */
44
44
  export function initializeStyling(options) {
45
- // process the tokens and get them ready to render
46
- const { styles, slots } = options;
47
- options.resolvedTokens = buildComponentTokens(styles, _getHasToken(slots));
48
- // memo cache root for this component, keyed on options
49
- const getMemoValue = getMemoCache(options);
50
- // create a useStyling implementation for this component type (per type, not per instance)
51
- return (props, lookupOverride) => {
52
- return useStylingCore(props, options, getMemoValue, lookupOverride);
53
- };
45
+ // process the tokens and get them ready to render
46
+ const { styles, slots } = options;
47
+ options.resolvedTokens = buildComponentTokens(styles, _getHasToken(slots));
48
+ // memo cache root for this component, keyed on options
49
+ const getMemoValue = getMemoCache(options);
50
+ // create a useStyling implementation for this component type (per type, not per instance)
51
+ return (props, lookupOverride) => {
52
+ return useStylingCore(props, options, getMemoValue, lookupOverride);
53
+ };
54
54
  }
55
- //# sourceMappingURL=useStyling.js.map
55
+ //# sourceMappingURL=useStyling.js.map
@@ -1 +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,uCAAuC,CAAC;AAEnF,qCAAqC;AACrC,MAAM,UAAU,iBAAiB,CAAa,GAAQ;IACpD,MAAM,OAAO,GAAG,GAAG,IAAI,OAAO,GAAG,CAAC;IAClC,OAAO,CAAC,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,UAAU,CAAC,IAAK,GAA2C,CAAC,YAAY,CAAC,IAAI,SAAS,CAAC;AACtI,CAAC;AAED,SAAS,qBAAqB,CAAC,KAAa,EAAE,IAAY;IACxD,OAAO,WAAW,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,YAAY,CACnB,KAAiE;IAEjE,MAAM,UAAU,GAA8F,EAAE,CAAC;IACjH,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;QACtC,MAAM,IAAI,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC7B,MAAM,QAAQ,GAAG,CAAC,OAAO,IAAI,KAAK,QAAQ,CA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