@fluentui/react-utilities 9.15.3 → 9.15.5
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 +21 -3
- package/dist/index.d.ts +19 -0
- package/lib/compose/{getSlots.js → deprecated/getSlots.js} +8 -3
- package/lib/compose/deprecated/getSlots.js.map +1 -0
- package/lib/compose/{getSlotsNext.js → deprecated/getSlotsNext.js} +9 -1
- package/lib/compose/deprecated/getSlotsNext.js.map +1 -0
- package/lib/compose/{resolveShorthand.js → deprecated/resolveShorthand.js} +6 -2
- package/lib/compose/deprecated/resolveShorthand.js.map +1 -0
- package/lib/compose/index.js +3 -3
- package/lib/compose/index.js.map +1 -1
- package/lib/index.js +4 -1
- package/lib/index.js.map +1 -1
- package/lib-commonjs/compose/{getSlots.js → deprecated/getSlots.js} +6 -3
- package/lib-commonjs/compose/deprecated/getSlots.js.map +1 -0
- package/lib-commonjs/compose/{getSlotsNext.js → deprecated/getSlotsNext.js} +7 -1
- package/lib-commonjs/compose/deprecated/getSlotsNext.js.map +1 -0
- package/lib-commonjs/compose/{resolveShorthand.js → deprecated/resolveShorthand.js} +1 -1
- package/lib-commonjs/compose/deprecated/resolveShorthand.js.map +1 -0
- package/lib-commonjs/compose/index.js +3 -3
- package/lib-commonjs/compose/index.js.map +1 -1
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +2 -2
- package/lib/compose/getSlots.js.map +0 -1
- package/lib/compose/getSlotsNext.js.map +0 -1
- package/lib/compose/resolveShorthand.js.map +0 -1
- package/lib-commonjs/compose/getSlots.js.map +0 -1
- package/lib-commonjs/compose/getSlotsNext.js.map +0 -1
- package/lib-commonjs/compose/resolveShorthand.js.map +0 -1
package/CHANGELOG.md
CHANGED
@@ -1,18 +1,36 @@
|
|
1
1
|
# Change Log - @fluentui/react-utilities
|
2
2
|
|
3
|
-
This log was last generated on
|
3
|
+
This log was last generated on Wed, 03 Jan 2024 09:22:09 GMT and should not be manually modified.
|
4
4
|
|
5
5
|
<!-- Start content -->
|
6
6
|
|
7
|
+
## [9.15.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.15.5)
|
8
|
+
|
9
|
+
Wed, 03 Jan 2024 09:22:09 GMT
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.15.4..@fluentui/react-utilities_v9.15.5)
|
11
|
+
|
12
|
+
### Patches
|
13
|
+
|
14
|
+
- chore: deprecate old slot API methods and types ([PR #29646](https://github.com/microsoft/fluentui/pull/29646) by bernardo.sunderhus@gmail.com)
|
15
|
+
|
16
|
+
## [9.15.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.15.4)
|
17
|
+
|
18
|
+
Mon, 18 Dec 2023 14:40:46 GMT
|
19
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.15.3..@fluentui/react-utilities_v9.15.4)
|
20
|
+
|
21
|
+
### Patches
|
22
|
+
|
23
|
+
- Bump @fluentui/react-shared-contexts to v9.13.2 ([PR #30103](https://github.com/microsoft/fluentui/pull/30103) by beachball)
|
24
|
+
|
7
25
|
## [9.15.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.15.3)
|
8
26
|
|
9
|
-
Thu, 14 Dec 2023 09:
|
27
|
+
Thu, 14 Dec 2023 09:58:46 GMT
|
10
28
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-utilities_v9.15.2..@fluentui/react-utilities_v9.15.3)
|
11
29
|
|
12
30
|
### Patches
|
13
31
|
|
14
32
|
- chore: disallow `window` and `document` access ([PR #29962](https://github.com/microsoft/fluentui/pull/29962) by seanmonahan@microsoft.com)
|
15
|
-
- Bump @fluentui/react-shared-contexts to v9.13.1 ([
|
33
|
+
- Bump @fluentui/react-shared-contexts to v9.13.1 ([PR #30056](https://github.com/microsoft/fluentui/pull/30056) by beachball)
|
16
34
|
|
17
35
|
## [9.15.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-utilities_v9.15.2)
|
18
36
|
|
package/dist/index.d.ts
CHANGED
@@ -219,6 +219,8 @@ export declare const getRTLSafeKey: (key: string, dir: 'ltr' | 'rtl') => string;
|
|
219
219
|
* anchor props. Note that this is only enforced at build time by Typescript -- there is no
|
220
220
|
* runtime code filtering props in this function.
|
221
221
|
*
|
222
|
+
* @deprecated use slot.always or slot.optional combined with assertSlots instead
|
223
|
+
*
|
222
224
|
* @param state - State including slot definitions
|
223
225
|
* @returns An object containing the `slots` map and `slotProps` map.
|
224
226
|
*/
|
@@ -234,6 +236,8 @@ export declare function getSlots<R extends SlotPropsRecord>(state: ComponentStat
|
|
234
236
|
* This is an internal temporary method, this method will cease to exist eventually!
|
235
237
|
*
|
236
238
|
* * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️
|
239
|
+
*
|
240
|
+
* @deprecated use slot.always or slot.optional combined with assertSlots instead
|
237
241
|
*/
|
238
242
|
export declare function getSlotsNext<R extends SlotPropsRecord>(state: ComponentState<R>): {
|
239
243
|
slots: Slots<R>;
|
@@ -413,6 +417,9 @@ export declare function mergeCallbacks<Args extends unknown[]>(callback1: ((...a
|
|
413
417
|
|
414
418
|
export declare type NativeTouchOrMouseEvent = MouseEvent | TouchEvent;
|
415
419
|
|
420
|
+
/**
|
421
|
+
* @deprecated - use slot.always or slot.optional combined with assertSlots instead
|
422
|
+
*/
|
416
423
|
declare type ObjectSlotProps<S extends SlotPropsRecord> = {
|
417
424
|
[K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? UnionToIntersection<JSX.IntrinsicElements[As]> : ExtractSlotProps<S[K]> extends React_2.ComponentType<infer P> ? P : ExtractSlotProps<S[K]>;
|
418
425
|
};
|
@@ -531,10 +538,13 @@ declare type ReplaceNullWithUndefined<T> = T extends null ? Exclude<T, null> | u
|
|
531
538
|
export declare function resetIdsForTests(): void;
|
532
539
|
|
533
540
|
/**
|
541
|
+
*
|
534
542
|
* Resolves shorthands into slot props, to ensure normalization of the signature
|
535
543
|
* being passed down to getSlots method
|
536
544
|
* @param value - the base shorthand props
|
537
545
|
* @param options - options to resolve shorthand props
|
546
|
+
*
|
547
|
+
* @deprecated use slot.always or slot.optional combined with assertSlots instead
|
538
548
|
*/
|
539
549
|
export declare const resolveShorthand: ResolveShorthandFunction<UnknownSlotProps>;
|
540
550
|
|
@@ -545,11 +555,17 @@ export declare const resolveShorthand: ResolveShorthandFunction<UnknownSlotProps
|
|
545
555
|
*/
|
546
556
|
declare function resolveShorthand_2<Props extends UnknownSlotProps | null | undefined>(value: Props | SlotShorthandValue): Props;
|
547
557
|
|
558
|
+
/**
|
559
|
+
* @deprecated use slot.always or slot.optional combined with assertSlots instead
|
560
|
+
*/
|
548
561
|
export declare type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {
|
549
562
|
<P extends Props>(value: P | SlotShorthandValue | undefined, options: ResolveShorthandOptions<P, true>): P;
|
550
563
|
<P extends Props>(value: P | SlotShorthandValue | null | undefined, options?: ResolveShorthandOptions<P, boolean>): P | undefined;
|
551
564
|
};
|
552
565
|
|
566
|
+
/**
|
567
|
+
* @deprecated - use slot.always or slot.optional combined with assertSlots instead
|
568
|
+
*/
|
553
569
|
export declare type ResolveShorthandOptions<Props, Required extends boolean = false> = Required extends true ? {
|
554
570
|
required: true;
|
555
571
|
defaultProps?: Props;
|
@@ -694,6 +710,9 @@ export declare type SlotPropsRecord = Record<string, UnknownSlotProps | SlotShor
|
|
694
710
|
|
695
711
|
export declare type SlotRenderFunction<Props> = (Component: React_2.ElementType<Props>, props: Omit<Props, 'as'>) => React_2.ReactNode;
|
696
712
|
|
713
|
+
/**
|
714
|
+
* @deprecated - use slot.always or slot.optional combined with assertSlots instead
|
715
|
+
*/
|
697
716
|
export declare type Slots<S extends SlotPropsRecord> = {
|
698
717
|
[K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As> ? As : ExtractSlotProps<S[K]> extends React_2.ComponentType<infer P> ? React_2.ElementType<NonNullable<P>> : React_2.ElementType<ExtractSlotProps<S[K]>>;
|
699
718
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as React from 'react';
|
2
|
-
import { omit } from '
|
3
|
-
import { isSlot } from '
|
4
|
-
import { SLOT_RENDER_FUNCTION_SYMBOL } from '
|
2
|
+
import { omit } from '../../utils/omit';
|
3
|
+
import { isSlot } from '../isSlot';
|
4
|
+
import { SLOT_RENDER_FUNCTION_SYMBOL } from '../constants';
|
5
5
|
/**
|
6
6
|
* Given the state and an array of slot names, will break out `slots` and `slotProps`
|
7
7
|
* collections.
|
@@ -16,17 +16,22 @@ import { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';
|
|
16
16
|
* anchor props. Note that this is only enforced at build time by Typescript -- there is no
|
17
17
|
* runtime code filtering props in this function.
|
18
18
|
*
|
19
|
+
* @deprecated use slot.always or slot.optional combined with assertSlots instead
|
20
|
+
*
|
19
21
|
* @param state - State including slot definitions
|
20
22
|
* @returns An object containing the `slots` map and `slotProps` map.
|
21
23
|
*/ export function getSlots(state) {
|
24
|
+
// eslint-disable-next-line deprecation/deprecation
|
22
25
|
const slots = {};
|
23
26
|
const slotProps = {};
|
24
27
|
const slotNames = Object.keys(state.components);
|
25
28
|
for (const slotName of slotNames){
|
26
29
|
const [slot, props] = getSlot(state, slotName);
|
30
|
+
// eslint-disable-next-line deprecation/deprecation
|
27
31
|
slots[slotName] = slot;
|
28
32
|
slotProps[slotName] = props;
|
29
33
|
}
|
34
|
+
// eslint-disable-next-line deprecation/deprecation
|
30
35
|
return {
|
31
36
|
slots,
|
32
37
|
slotProps: slotProps
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["getSlots.ts"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../../utils/omit';\nimport type {\n AsIntrinsicElement,\n ComponentState,\n ExtractSlotProps,\n SlotPropsRecord,\n SlotRenderFunction,\n UnionToIntersection,\n UnknownSlotProps,\n} from '../types';\nimport { isSlot } from '../isSlot';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from '../constants';\n\n/**\n * @deprecated - use slot.always or slot.optional combined with assertSlots instead\n */\nexport type Slots<S extends SlotPropsRecord> = {\n [K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // for slots with an `as` prop, the slot will be any one of the possible values of `as`\n As\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? React.ElementType<NonNullable<P>>\n : React.ElementType<ExtractSlotProps<S[K]>>;\n};\n\n/**\n * @deprecated - use slot.always or slot.optional combined with assertSlots instead\n */\nexport type ObjectSlotProps<S extends SlotPropsRecord> = {\n [K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // For intrinsic element types, return the intersection of all possible\n // element's props, to be compatible with the As type returned by Slots<>\n UnionToIntersection<JSX.IntrinsicElements[As]> // Slot<'div', 'span'>\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? P // Slot<typeof Button>\n : ExtractSlotProps<S[K]>; // Slot<ButtonProps>\n};\n\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n // eslint-disable-next-line deprecation/deprecation\n slots: Slots<R>;\n // eslint-disable-next-line deprecation/deprecation\n slotProps: ObjectSlotProps<R>;\n} {\n // eslint-disable-next-line deprecation/deprecation\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n // eslint-disable-next-line deprecation/deprecation\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line deprecation/deprecation\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlot<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, children, ...rest } = props as NonUndefined<typeof props>;\n\n const renderFunction = isSlot(props) ? props[SLOT_RENDER_FUNCTION_SYMBOL] : undefined;\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n if (renderFunction || typeof children === 'function') {\n const render = (renderFunction || children) as SlotRenderFunction<R[K]>;\n return [\n React.Fragment,\n {\n children: render(slot, rest as Omit<R[K], 'as'>),\n } as unknown as R[K],\n ];\n }\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = (shouldOmitAsProp ? omit(props, ['as']) : (props as UnknownSlotProps)) as R[K];\n return [slot, slotProps];\n}\n"],"names":["React","omit","isSlot","SLOT_RENDER_FUNCTION_SYMBOL","getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","undefined","as","asProp","children","rest","renderFunction","render","Fragment","shouldOmitAsProp"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,mBAAmB;AAUxC,SAASC,MAAM,QAAQ,YAAY;AACnC,SAASC,2BAA2B,QAAQ,eAAe;AA2B3D;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,SACdC,KAAwB;IAOxB,mDAAmD;IACnD,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC3D,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,OAAOO;QACrC,mDAAmD;QACnDN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,mDAAmD;IACnD,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE;AAEA,SAASQ,QACPV,KAAwB,EACxBO,QAAW;QAeTP,mBACcA;IAdhB,MAAMS,QAAQT,KAAK,CAACO,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC;YAAMA;SAAkB;IAClC;IAGA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGN;IAE1C,MAAMO,iBAAiBnB,OAAOY,SAASA,KAAK,CAACX,4BAA4B,GAAGa;IAE5E,MAAMH,OACJR,EAAAA,oBAAAA,MAAMM,UAAU,cAAhBN,wCAAAA,iBAAkB,CAACO,SAAS,MAAKI,aAAa,OAAOX,MAAMM,UAAU,CAACC,SAAS,KAAK,WAChFM,YAAUb,qBAAAA,MAAMM,UAAU,cAAhBN,yCAAAA,kBAAkB,CAACO,SAAS,KAAI,QAC1CP,MAAMM,UAAU,CAACC,SAAS;IAGhC,IAAIS,kBAAkB,OAAOF,aAAa,YAAY;QACpD,MAAMG,SAAUD,kBAAkBF;QAClC,OAAO;YACLnB,MAAMuB,QAAQ;YACd;gBACEJ,UAAUG,OAAOT,MAAMO;YACzB;SACD;IACH;IAEA,MAAMI,mBAAmB,OAAOX,SAAS,YAAYK;IACrD,MAAMX,YAAaiB,mBAAmBvB,KAAKa,OAAO;QAAC;KAAK,IAAKA;IAC7D,OAAO;QAACD;QAAMN;KAAU;AAC1B"}
|
@@ -6,21 +6,29 @@ import * as React from 'react';
|
|
6
6
|
* This is an internal temporary method, this method will cease to exist eventually!
|
7
7
|
*
|
8
8
|
* * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️
|
9
|
+
*
|
10
|
+
* @deprecated use slot.always or slot.optional combined with assertSlots instead
|
9
11
|
*/ export function getSlotsNext(state) {
|
12
|
+
// eslint-disable-next-line deprecation/deprecation
|
10
13
|
const slots = {};
|
11
14
|
const slotProps = {};
|
12
15
|
const slotNames = Object.keys(state.components);
|
13
16
|
for (const slotName of slotNames){
|
17
|
+
// eslint-disable-next-line deprecation/deprecation
|
14
18
|
const [slot, props] = getSlotNext(state, slotName);
|
19
|
+
// eslint-disable-next-line deprecation/deprecation
|
15
20
|
slots[slotName] = slot;
|
16
21
|
slotProps[slotName] = props;
|
17
22
|
}
|
23
|
+
// eslint-disable-next-line deprecation/deprecation
|
18
24
|
return {
|
19
25
|
slots,
|
20
26
|
slotProps: slotProps
|
21
27
|
};
|
22
28
|
}
|
23
|
-
|
29
|
+
/**
|
30
|
+
* @deprecated use slot.always or slot.optional combined with assertSlots instead
|
31
|
+
*/ function getSlotNext(state, slotName) {
|
24
32
|
var _state_components, _state_components1;
|
25
33
|
const props = state[slotName];
|
26
34
|
if (props === undefined) {
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["getSlotsNext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentState, SlotPropsRecord, UnknownSlotProps } from '../types';\nimport { ObjectSlotProps, Slots } from './getSlots';\n\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\nexport function getSlotsNext<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n // eslint-disable-next-line deprecation/deprecation\n slots: Slots<R>;\n // eslint-disable-next-line deprecation/deprecation\n slotProps: ObjectSlotProps<R>;\n} {\n // eslint-disable-next-line deprecation/deprecation\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n // eslint-disable-next-line deprecation/deprecation\n const [slot, props] = getSlotNext(state, slotName);\n // eslint-disable-next-line deprecation/deprecation\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line deprecation/deprecation\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\n/**\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\nfunction getSlotNext<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props as NonUndefined<typeof props>;\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps: UnknownSlotProps = shouldOmitAsProp ? propsWithoutAs : props;\n\n return [slot, slotProps as R[K]];\n}\n"],"names":["React","getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;;;;;;;;CASC,GACD,OAAO,SAASC,aACdC,KAAwB;IAOxB,mDAAmD;IACnD,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC3D,KAAK,MAAMC,YAAYJ,UAAW;QAChC,mDAAmD;QACnD,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzC,mDAAmD;QACnDN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,mDAAmD;IACnD,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE;AAEA;;CAEC,GACD,SAASQ,YACPV,KAAwB,EACxBO,QAAW;QAaTP,mBACcA;IAZhB,MAAMS,QAAQT,KAAK,CAACO,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC;YAAMA;SAAkB;IAClC;IAGA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAE,GAAGC,gBAAgB,GAAGL;IAE1C,MAAMD,OACJR,EAAAA,oBAAAA,MAAMM,UAAU,cAAhBN,wCAAAA,iBAAkB,CAACO,SAAS,MAAKI,aAAa,OAAOX,MAAMM,UAAU,CAACC,SAAS,KAAK,WAChFM,YAAUb,qBAAAA,MAAMM,UAAU,cAAhBN,yCAAAA,kBAAkB,CAACO,SAAS,KAAI,QAC1CP,MAAMM,UAAU,CAACC,SAAS;IAGhC,MAAMQ,mBAAmB,OAAOP,SAAS,YAAYK;IACrD,MAAMX,YAA8Ba,mBAAmBD,iBAAiBL;IAExE,OAAO;QAACD;QAAMN;KAAkB;AAClC"}
|
@@ -1,10 +1,14 @@
|
|
1
|
-
import * as slot from '
|
1
|
+
import * as slot from '../slot';
|
2
2
|
/**
|
3
|
+
*
|
3
4
|
* Resolves shorthands into slot props, to ensure normalization of the signature
|
4
5
|
* being passed down to getSlots method
|
5
6
|
* @param value - the base shorthand props
|
6
7
|
* @param options - options to resolve shorthand props
|
7
|
-
|
8
|
+
*
|
9
|
+
* @deprecated use slot.always or slot.optional combined with assertSlots instead
|
10
|
+
*/ // eslint-disable-next-line deprecation/deprecation
|
11
|
+
export const resolveShorthand = (value, options)=>slot.optional(value, {
|
8
12
|
...options,
|
9
13
|
renderByDefault: options === null || options === void 0 ? void 0 : options.required,
|
10
14
|
// elementType as undefined is the way to identify between a slot and a resolveShorthand call
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["resolveShorthand.ts"],"sourcesContent":["import * as slot from '../slot';\nimport type { SlotShorthandValue, UnknownSlotProps } from '../types';\n\n/**\n * @deprecated - use slot.always or slot.optional combined with assertSlots instead\n */\nexport type ResolveShorthandOptions<Props, Required extends boolean = false> = Required extends true\n ? { required: true; defaultProps?: Props }\n : { required?: Required; defaultProps?: Props };\n\n/**\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\nexport type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {\n // eslint-disable-next-line deprecation/deprecation\n <P extends Props>(value: P | SlotShorthandValue | undefined, options: ResolveShorthandOptions<P, true>): P;\n // eslint-disable-next-line deprecation/deprecation\n <P extends Props>(value: P | SlotShorthandValue | null | undefined, options?: ResolveShorthandOptions<P, boolean>):\n | P\n | undefined;\n};\n\n/**\n *\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */\n// eslint-disable-next-line deprecation/deprecation\nexport const resolveShorthand: ResolveShorthandFunction<UnknownSlotProps> = (value, options) =>\n slot.optional<UnknownSlotProps>(value, {\n ...options,\n renderByDefault: options?.required,\n // elementType as undefined is the way to identify between a slot and a resolveShorthand call\n // in the case elementType is undefined assertSlots will fail, ensuring it'll only work with slot method.\n elementType: undefined!,\n });\n"],"names":["slot","resolveShorthand","value","options","optional","renderByDefault","required","elementType","undefined"],"mappings":"AAAA,YAAYA,UAAU,UAAU;AAsBhC;;;;;;;;CAQC,GACD,mDAAmD;AACnD,OAAO,MAAMC,mBAA+D,CAACC,OAAOC,UAClFH,KAAKI,QAAQ,CAAmBF,OAAO;QACrC,GAAGC,OAAO;QACVE,eAAe,EAAEF,oBAAAA,8BAAAA,QAASG,QAAQ;QAClC,6FAA6F;QAC7F,yGAAyG;QACzGC,aAAaC;IACf,GAAG"}
|
package/lib/compose/index.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
import * as slot from './slot';
|
2
|
-
export * from './getSlots';
|
3
|
-
export * from './resolveShorthand';
|
4
2
|
export * from './types';
|
5
3
|
export * from './isResolvedShorthand';
|
6
4
|
export * from './constants';
|
7
|
-
export * from './getSlotsNext';
|
8
5
|
export * from './isSlot';
|
9
6
|
export * from './assertSlots';
|
10
7
|
export * from './getIntrinsicElementProps';
|
8
|
+
export * from './deprecated/getSlots';
|
9
|
+
export * from './deprecated/resolveShorthand';
|
10
|
+
export * from './deprecated/getSlotsNext';
|
11
11
|
export { slot };
|
package/lib/compose/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["import * as slot from './slot';\n\nexport * from './
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["import * as slot from './slot';\n\nexport * from './types';\nexport * from './isResolvedShorthand';\nexport * from './constants';\nexport * from './isSlot';\nexport * from './assertSlots';\nexport * from './getIntrinsicElementProps';\n\nexport * from './deprecated/getSlots';\nexport * from './deprecated/resolveShorthand';\nexport * from './deprecated/getSlotsNext';\n\nexport { slot };\nexport type { SlotOptions } from './slot';\n"],"names":["slot"],"mappings":"AAAA,YAAYA,UAAU,SAAS;AAE/B,cAAc,UAAU;AACxB,cAAc,wBAAwB;AACtC,cAAc,cAAc;AAC5B,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,6BAA6B;AAE3C,cAAc,wBAAwB;AACtC,cAAc,gCAAgC;AAC9C,cAAc,4BAA4B;AAE1C,SAASA,IAAI,GAAG"}
|
package/lib/index.js
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
export { slot, isSlot,
|
1
|
+
export { slot, isSlot, // eslint-disable-next-line deprecation/deprecation
|
2
|
+
getSlots, // eslint-disable-next-line deprecation/deprecation
|
3
|
+
getSlotsNext, assertSlots, // eslint-disable-next-line deprecation/deprecation
|
4
|
+
resolveShorthand, isResolvedShorthand, getIntrinsicElementProps, SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';
|
2
5
|
export { IdPrefixProvider, resetIdsForTests, useAnimationFrame, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';
|
3
6
|
export { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';
|
4
7
|
export { clamp, // eslint-disable-next-line deprecation/deprecation
|
package/lib/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.ts"],"sourcesContent":["export {\n slot,\n isSlot,\n getSlots,\n getSlotsNext,\n assertSlots,\n resolveShorthand,\n isResolvedShorthand,\n getIntrinsicElementProps,\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n ResolveShorthandFunction,\n ResolveShorthandOptions,\n Slot,\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n SlotComponentType,\n SlotOptions,\n InferredElementRefType,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useAnimationFrame,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n // eslint-disable-next-line deprecation/deprecation\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n\nexport type {\n SelectionMode,\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionItemId,\n SelectionHookParams,\n SelectionMethods,\n} from './selection/index';\nexport { useSelection } from './selection/index';\n\nexport { elementContains, setVirtualParent, getParent } from './virtualParent/index';\n"],"names":["slot","isSlot","getSlots","getSlotsNext","assertSlots","resolveShorthand","isResolvedShorthand","getIntrinsicElementProps","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useAnimationFrame","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords","useSelection","elementContains","setVirtualParent","getParent"],"mappings":"AAAA,SACEA,IAAI,EACJC,MAAM,
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export {\n slot,\n isSlot,\n // eslint-disable-next-line deprecation/deprecation\n getSlots,\n // eslint-disable-next-line deprecation/deprecation\n getSlotsNext,\n assertSlots,\n // eslint-disable-next-line deprecation/deprecation\n resolveShorthand,\n isResolvedShorthand,\n getIntrinsicElementProps,\n SLOT_ELEMENT_TYPE_SYMBOL,\n SLOT_RENDER_FUNCTION_SYMBOL,\n} from './compose/index';\nexport type {\n ExtractSlotProps,\n ComponentProps,\n ComponentState,\n ForwardRefComponent,\n // eslint-disable-next-line deprecation/deprecation\n ResolveShorthandFunction,\n // eslint-disable-next-line deprecation/deprecation\n ResolveShorthandOptions,\n Slot,\n // eslint-disable-next-line deprecation/deprecation\n Slots,\n SlotClassNames,\n SlotPropsRecord,\n SlotRenderFunction,\n SlotShorthandValue,\n UnknownSlotProps,\n SlotComponentType,\n SlotOptions,\n InferredElementRefType,\n} from './compose/index';\n\nexport {\n IdPrefixProvider,\n resetIdsForTests,\n useAnimationFrame,\n useControllableState,\n useEventCallback,\n useFirstMount,\n useForceUpdate,\n useId,\n useIsomorphicLayoutEffect,\n useMergedRefs,\n useOnClickOutside,\n useOnScrollOutside,\n usePrevious,\n useScrollbarWidth,\n useTimeout,\n} from './hooks/index';\nexport type { RefObjectFunction, UseControllableStateOptions, UseOnClickOrScrollOutsideOptions } from './hooks/index';\n\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\n\nexport {\n clamp,\n // eslint-disable-next-line deprecation/deprecation\n getNativeElementProps,\n getPartitionedNativeProps,\n getRTLSafeKey,\n mergeCallbacks,\n isHTMLElement,\n isInteractiveHTMLElement,\n omit,\n createPriorityQueue,\n} from './utils/index';\n\nexport type { PriorityQueue } from './utils/priorityQueue';\n\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\n\nexport type { FluentTriggerComponent, TriggerProps } from './trigger/index';\n\n/**\n * Event utils\n */\nexport type { NativeTouchOrMouseEvent, ReactTouchOrMouseEvent, TouchOrMouseEvent } from './events/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\n\nexport type {\n SelectionMode,\n OnSelectionChangeCallback,\n OnSelectionChangeData,\n SelectionItemId,\n SelectionHookParams,\n SelectionMethods,\n} from './selection/index';\nexport { useSelection } from './selection/index';\n\nexport { elementContains, setVirtualParent, getParent } from './virtualParent/index';\n"],"names":["slot","isSlot","getSlots","getSlotsNext","assertSlots","resolveShorthand","isResolvedShorthand","getIntrinsicElementProps","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useAnimationFrame","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords","useSelection","elementContains","setVirtualParent","getParent"],"mappings":"AAAA,SACEA,IAAI,EACJC,MAAM,EACN,mDAAmD;AACnDC,QAAQ,EACR,mDAAmD;AACnDC,YAAY,EACZC,WAAW,EACX,mDAAmD;AACnDC,gBAAgB,EAChBC,mBAAmB,EACnBC,wBAAwB,EACxBC,wBAAwB,EACxBC,2BAA2B,QACtB,kBAAkB;AAuBzB,SACEC,gBAAgB,EAChBC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,EACpBC,gBAAgB,EAChBC,aAAa,EACbC,cAAc,EACdC,KAAK,EACLC,yBAAyB,EACzBC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,WAAW,EACXC,iBAAiB,EACjBC,UAAU,QACL,gBAAgB;AAGvB,SAASC,SAAS,EAAEC,QAAQ,EAAEC,WAAW,QAAQ,cAAc;AAE/D,SACEC,KAAK,EACL,mDAAmD;AACnDC,qBAAqB,EACrBC,yBAAyB,EACzBC,aAAa,EACbC,cAAc,EACdC,aAAa,EACbC,wBAAwB,EACxBC,IAAI,EACJC,mBAAmB,QACd,gBAAgB;AAIvB,SAASC,2BAA2B,EAAEC,eAAe,EAAEC,eAAe,QAAQ,kBAAkB;AAQhG,SAASC,YAAY,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ,iBAAiB;AAUlF,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,SAASC,eAAe,EAAEC,gBAAgB,EAAEC,SAAS,QAAQ,wBAAwB"}
|
@@ -10,18 +10,21 @@ Object.defineProperty(exports, "getSlots", {
|
|
10
10
|
});
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
|
-
const _omit = require("
|
14
|
-
const _isSlot = require("
|
15
|
-
const _constants = require("
|
13
|
+
const _omit = require("../../utils/omit");
|
14
|
+
const _isSlot = require("../isSlot");
|
15
|
+
const _constants = require("../constants");
|
16
16
|
function getSlots(state) {
|
17
|
+
// eslint-disable-next-line deprecation/deprecation
|
17
18
|
const slots = {};
|
18
19
|
const slotProps = {};
|
19
20
|
const slotNames = Object.keys(state.components);
|
20
21
|
for (const slotName of slotNames){
|
21
22
|
const [slot, props] = getSlot(state, slotName);
|
23
|
+
// eslint-disable-next-line deprecation/deprecation
|
22
24
|
slots[slotName] = slot;
|
23
25
|
slotProps[slotName] = props;
|
24
26
|
}
|
27
|
+
// eslint-disable-next-line deprecation/deprecation
|
25
28
|
return {
|
26
29
|
slots,
|
27
30
|
slotProps: slotProps
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["getSlots.js"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../../utils/omit';\nimport { isSlot } from '../isSlot';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from '../constants';\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */ export function getSlots(state) {\n // eslint-disable-next-line deprecation/deprecation\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames){\n const [slot, props] = getSlot(state, slotName);\n // eslint-disable-next-line deprecation/deprecation\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line deprecation/deprecation\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlot(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [\n null,\n undefined\n ];\n }\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, children, ...rest } = props;\n const renderFunction = isSlot(props) ? props[SLOT_RENDER_FUNCTION_SYMBOL] : undefined;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n if (renderFunction || typeof children === 'function') {\n const render = renderFunction || children;\n return [\n React.Fragment,\n {\n children: render(slot, rest)\n }\n ];\n }\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? omit(props, [\n 'as'\n ]) : props;\n return [\n slot,\n slotProps\n ];\n}\n"],"names":["getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","_state_components","_state_components1","undefined","as","asProp","children","rest","renderFunction","isSlot","SLOT_RENDER_FUNCTION_SYMBOL","render","React","Fragment","shouldOmitAsProp","omit"],"mappings":";;;;+BAsBoBA;;;eAAAA;;;;iEAtBG;sBACF;wBACE;2BACqB;AAmBjC,SAASA,SAASC,KAAK;IAC9B,mDAAmD;IACnD,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAU;QAC7B,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,OAAOO;QACrC,mDAAmD;QACnDN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IAC1B;IACA,mDAAmD;IACnD,OAAO;QACHR;QACAC,WAAWA;IACf;AACJ;AACA,SAASQ,QAAQV,KAAK,EAAEO,QAAQ;IAC5B,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACrB,OAAO;YACH;YACAA;SACH;IACL;IACA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGR;IAC1C,MAAMS,iBAAiBC,IAAAA,cAAM,EAACV,SAASA,KAAK,CAACW,sCAA2B,CAAC,GAAGP;IAC5E,MAAML,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,QAAQK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,QAAQM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,IAAIW,kBAAkB,OAAOF,aAAa,YAAY;QAClD,MAAMK,SAASH,kBAAkBF;QACjC,OAAO;YACHM,OAAMC,QAAQ;YACd;gBACIP,UAAUK,OAAOb,MAAMS;YAC3B;SACH;IACL;IACA,MAAMO,mBAAmB,OAAOhB,SAAS,YAAYO;IACrD,MAAMb,YAAYsB,mBAAmBC,IAAAA,UAAI,EAAChB,OAAO;QAC7C;KACH,IAAIA;IACL,OAAO;QACHD;QACAN;KACH;AACL"}
|
@@ -11,20 +11,26 @@ Object.defineProperty(exports, "getSlotsNext", {
|
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
12
|
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
13
13
|
function getSlotsNext(state) {
|
14
|
+
// eslint-disable-next-line deprecation/deprecation
|
14
15
|
const slots = {};
|
15
16
|
const slotProps = {};
|
16
17
|
const slotNames = Object.keys(state.components);
|
17
18
|
for (const slotName of slotNames){
|
19
|
+
// eslint-disable-next-line deprecation/deprecation
|
18
20
|
const [slot, props] = getSlotNext(state, slotName);
|
21
|
+
// eslint-disable-next-line deprecation/deprecation
|
19
22
|
slots[slotName] = slot;
|
20
23
|
slotProps[slotName] = props;
|
21
24
|
}
|
25
|
+
// eslint-disable-next-line deprecation/deprecation
|
22
26
|
return {
|
23
27
|
slots,
|
24
28
|
slotProps: slotProps
|
25
29
|
};
|
26
30
|
}
|
27
|
-
|
31
|
+
/**
|
32
|
+
* @deprecated use slot.always or slot.optional combined with assertSlots instead
|
33
|
+
*/ function getSlotNext(state, slotName) {
|
28
34
|
var _state_components, _state_components1;
|
29
35
|
const props = state[slotName];
|
30
36
|
if (props === undefined) {
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["getSlotsNext.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */ export function getSlotsNext(state) {\n // eslint-disable-next-line deprecation/deprecation\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames){\n // eslint-disable-next-line deprecation/deprecation\n const [slot, props] = getSlotNext(state, slotName);\n // eslint-disable-next-line deprecation/deprecation\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n // eslint-disable-next-line deprecation/deprecation\n return {\n slots,\n slotProps: slotProps\n };\n}\n/**\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */ function getSlotNext(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [\n null,\n undefined\n ];\n }\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? propsWithoutAs : props;\n return [\n slot,\n slotProps\n ];\n}\n"],"names":["getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","_state_components","_state_components1","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":";;;;+BAUoBA;;;eAAAA;;;;iEAVG;AAUZ,SAASA,aAAaC,KAAK;IAClC,mDAAmD;IACnD,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAU;QAC7B,mDAAmD;QACnD,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzC,mDAAmD;QACnDN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IAC1B;IACA,mDAAmD;IACnD,OAAO;QACHR;QACAC,WAAWA;IACf;AACJ;AACA;;CAEC,GAAG,SAASQ,YAAYV,KAAK,EAAEO,QAAQ;IACpC,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACrB,OAAO;YACH;YACAA;SACH;IACL;IACA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAE,GAAGC,gBAAgB,GAAGP;IAC1C,MAAMD,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,QAAQK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,QAAQM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,MAAMU,mBAAmB,OAAOT,SAAS,YAAYO;IACrD,MAAMb,YAAYe,mBAAmBD,iBAAiBP;IACtD,OAAO;QACHD;QACAN;KACH;AACL"}
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "resolveShorthand", {
|
|
9
9
|
}
|
10
10
|
});
|
11
11
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
12
|
-
const _slot = /*#__PURE__*/ _interop_require_wildcard._(require("
|
12
|
+
const _slot = /*#__PURE__*/ _interop_require_wildcard._(require("../slot"));
|
13
13
|
const resolveShorthand = (value, options)=>_slot.optional(value, {
|
14
14
|
...options,
|
15
15
|
renderByDefault: options === null || options === void 0 ? void 0 : options.required,
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["resolveShorthand.js"],"sourcesContent":["import * as slot from '../slot';\n/**\n *\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n *\n * @deprecated use slot.always or slot.optional combined with assertSlots instead\n */ // eslint-disable-next-line deprecation/deprecation\nexport const resolveShorthand = (value, options)=>slot.optional(value, {\n ...options,\n renderByDefault: options === null || options === void 0 ? void 0 : options.required,\n // elementType as undefined is the way to identify between a slot and a resolveShorthand call\n // in the case elementType is undefined assertSlots will fail, ensuring it'll only work with slot method.\n elementType: undefined\n });\n"],"names":["resolveShorthand","value","options","slot","optional","renderByDefault","required","elementType","undefined"],"mappings":";;;;+BAUaA;;;eAAAA;;;;gEAVS;AAUf,MAAMA,mBAAmB,CAACC,OAAOC,UAAUC,MAAKC,QAAQ,CAACH,OAAO;QAC/D,GAAGC,OAAO;QACVG,iBAAiBH,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQI,QAAQ;QACnF,6FAA6F;QAC7F,yGAAyG;QACzGC,aAAaC;IACjB"}
|
@@ -11,12 +11,12 @@ Object.defineProperty(exports, "slot", {
|
|
11
11
|
const _export_star = require("@swc/helpers/_/_export_star");
|
12
12
|
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
13
13
|
const _slot = /*#__PURE__*/ _interop_require_wildcard._(require("./slot"));
|
14
|
-
_export_star._(require("./getSlots"), exports);
|
15
|
-
_export_star._(require("./resolveShorthand"), exports);
|
16
14
|
_export_star._(require("./types"), exports);
|
17
15
|
_export_star._(require("./isResolvedShorthand"), exports);
|
18
16
|
_export_star._(require("./constants"), exports);
|
19
|
-
_export_star._(require("./getSlotsNext"), exports);
|
20
17
|
_export_star._(require("./isSlot"), exports);
|
21
18
|
_export_star._(require("./assertSlots"), exports);
|
22
19
|
_export_star._(require("./getIntrinsicElementProps"), exports);
|
20
|
+
_export_star._(require("./deprecated/getSlots"), exports);
|
21
|
+
_export_star._(require("./deprecated/resolveShorthand"), exports);
|
22
|
+
_export_star._(require("./deprecated/getSlotsNext"), exports);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["import * as slot from './slot';\nexport * from './
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["import * as slot from './slot';\nexport * from './types';\nexport * from './isResolvedShorthand';\nexport * from './constants';\nexport * from './isSlot';\nexport * from './assertSlots';\nexport * from './getIntrinsicElementProps';\nexport * from './deprecated/getSlots';\nexport * from './deprecated/resolveShorthand';\nexport * from './deprecated/getSlotsNext';\nexport { slot };\n"],"names":["slot"],"mappings":";;;;+BAUSA;;;eAAAA;;;;;gEAVa;uBACR;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA;uBACA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["index.js"],"sourcesContent":["export { slot, isSlot,
|
1
|
+
{"version":3,"sources":["index.js"],"sourcesContent":["export { slot, isSlot, // eslint-disable-next-line deprecation/deprecation\ngetSlots, // eslint-disable-next-line deprecation/deprecation\ngetSlotsNext, assertSlots, // eslint-disable-next-line deprecation/deprecation\nresolveShorthand, isResolvedShorthand, getIntrinsicElementProps, SLOT_ELEMENT_TYPE_SYMBOL, SLOT_RENDER_FUNCTION_SYMBOL } from './compose/index';\nexport { IdPrefixProvider, resetIdsForTests, useAnimationFrame, useControllableState, useEventCallback, useFirstMount, useForceUpdate, useId, useIsomorphicLayoutEffect, useMergedRefs, useOnClickOutside, useOnScrollOutside, usePrevious, useScrollbarWidth, useTimeout } from './hooks/index';\nexport { canUseDOM, useIsSSR, SSRProvider } from './ssr/index';\nexport { clamp, // eslint-disable-next-line deprecation/deprecation\ngetNativeElementProps, getPartitionedNativeProps, getRTLSafeKey, mergeCallbacks, isHTMLElement, isInteractiveHTMLElement, omit, createPriorityQueue } from './utils/index';\nexport { applyTriggerPropsToChildren, getTriggerChild, isFluentTrigger } from './trigger/index';\nexport { isTouchEvent, isMouseEvent, getEventClientCoords } from './events/index';\nexport { useSelection } from './selection/index';\nexport { elementContains, setVirtualParent, getParent } from './virtualParent/index';\n"],"names":["slot","isSlot","getSlots","getSlotsNext","assertSlots","resolveShorthand","isResolvedShorthand","getIntrinsicElementProps","SLOT_ELEMENT_TYPE_SYMBOL","SLOT_RENDER_FUNCTION_SYMBOL","IdPrefixProvider","resetIdsForTests","useAnimationFrame","useControllableState","useEventCallback","useFirstMount","useForceUpdate","useId","useIsomorphicLayoutEffect","useMergedRefs","useOnClickOutside","useOnScrollOutside","usePrevious","useScrollbarWidth","useTimeout","canUseDOM","useIsSSR","SSRProvider","clamp","getNativeElementProps","getPartitionedNativeProps","getRTLSafeKey","mergeCallbacks","isHTMLElement","isInteractiveHTMLElement","omit","createPriorityQueue","applyTriggerPropsToChildren","getTriggerChild","isFluentTrigger","isTouchEvent","isMouseEvent","getEventClientCoords","useSelection","elementContains","setVirtualParent","getParent"],"mappings":";;;;;;;;;;;IAASA,IAAI;eAAJA,WAAI;;IAAEC,MAAM;eAANA,aAAM;;IACrBC,QAAQ;eAARA,eAAQ;;IACRC,YAAY;eAAZA,mBAAY;;IAAEC,WAAW;eAAXA,kBAAW;;IACzBC,gBAAgB;eAAhBA,uBAAgB;;IAAEC,mBAAmB;eAAnBA,0BAAmB;;IAAEC,wBAAwB;eAAxBA,+BAAwB;;IAAEC,wBAAwB;eAAxBA,+BAAwB;;IAAEC,2BAA2B;eAA3BA,kCAA2B;;IAC7GC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,oBAAoB;eAApBA,4BAAoB;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,cAAc;eAAdA,sBAAc;;IAAEC,KAAK;eAALA,aAAK;;IAAEC,yBAAyB;eAAzBA,iCAAyB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,kBAAkB;eAAlBA,0BAAkB;;IAAEC,WAAW;eAAXA,mBAAW;;IAAEC,iBAAiB;eAAjBA,yBAAiB;;IAAEC,UAAU;eAAVA,kBAAU;;IAChQC,SAAS;eAATA,iBAAS;;IAAEC,QAAQ;eAARA,gBAAQ;;IAAEC,WAAW;eAAXA,mBAAW;;IAChCC,KAAK;eAALA,aAAK;;IACdC,qBAAqB;eAArBA,6BAAqB;;IAAEC,yBAAyB;eAAzBA,iCAAyB;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,cAAc;eAAdA,sBAAc;;IAAEC,aAAa;eAAbA,qBAAa;;IAAEC,wBAAwB;eAAxBA,gCAAwB;;IAAEC,IAAI;eAAJA,YAAI;;IAAEC,mBAAmB;eAAnBA,2BAAmB;;IAC1IC,2BAA2B;eAA3BA,mCAA2B;;IAAEC,eAAe;eAAfA,uBAAe;;IAAEC,eAAe;eAAfA,uBAAe;;IAC7DC,YAAY;eAAZA,oBAAY;;IAAEC,YAAY;eAAZA,oBAAY;;IAAEC,oBAAoB;eAApBA,4BAAoB;;IAChDC,YAAY;eAAZA,oBAAY;;IACZC,eAAe;eAAfA,uBAAe;;IAAEC,gBAAgB;eAAhBA,wBAAgB;;IAAEC,SAAS;eAATA,iBAAS;;;uBARyE;wBACmJ;wBAChO;wBAE0G;wBAC7E;wBACb;wBACpC;wBACgC"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@fluentui/react-utilities",
|
3
|
-
"version": "9.15.
|
3
|
+
"version": "9.15.5",
|
4
4
|
"description": "A set of general React-specific utilities.",
|
5
5
|
"main": "lib-commonjs/index.js",
|
6
6
|
"module": "lib/index.js",
|
@@ -32,7 +32,7 @@
|
|
32
32
|
},
|
33
33
|
"dependencies": {
|
34
34
|
"@fluentui/keyboard-keys": "^9.0.7",
|
35
|
-
"@fluentui/react-shared-contexts": "^9.13.
|
35
|
+
"@fluentui/react-shared-contexts": "^9.13.2",
|
36
36
|
"@swc/helpers": "^0.5.1"
|
37
37
|
},
|
38
38
|
"peerDependencies": {
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["getSlots.ts"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../utils/omit';\nimport type {\n AsIntrinsicElement,\n ComponentState,\n ExtractSlotProps,\n SlotPropsRecord,\n SlotRenderFunction,\n UnionToIntersection,\n UnknownSlotProps,\n} from './types';\nimport { isSlot } from './isSlot';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n\nexport type Slots<S extends SlotPropsRecord> = {\n [K in keyof S]: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // for slots with an `as` prop, the slot will be any one of the possible values of `as`\n As\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? React.ElementType<NonNullable<P>>\n : React.ElementType<ExtractSlotProps<S[K]>>;\n};\n\nexport type ObjectSlotProps<S extends SlotPropsRecord> = {\n [K in keyof S]-?: ExtractSlotProps<S[K]> extends AsIntrinsicElement<infer As>\n ? // For intrinsic element types, return the intersection of all possible\n // element's props, to be compatible with the As type returned by Slots<>\n UnionToIntersection<JSX.IntrinsicElements[As]> // Slot<'div', 'span'>\n : ExtractSlotProps<S[K]> extends React.ComponentType<infer P>\n ? P // Slot<typeof Button>\n : ExtractSlotProps<S[K]>; // Slot<ButtonProps>\n};\n\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */\nexport function getSlots<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlot<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, children, ...rest } = props as NonUndefined<typeof props>;\n\n const renderFunction = isSlot(props) ? props[SLOT_RENDER_FUNCTION_SYMBOL] : undefined;\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n if (renderFunction || typeof children === 'function') {\n const render = (renderFunction || children) as SlotRenderFunction<R[K]>;\n return [\n React.Fragment,\n {\n children: render(slot, rest as Omit<R[K], 'as'>),\n } as unknown as R[K],\n ];\n }\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = (shouldOmitAsProp ? omit(props, ['as']) : (props as UnknownSlotProps)) as R[K];\n return [slot, slotProps];\n}\n"],"names":["React","omit","isSlot","SLOT_RENDER_FUNCTION_SYMBOL","getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","undefined","as","asProp","children","rest","renderFunction","render","Fragment","shouldOmitAsProp"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,QAAQ,gBAAgB;AAUrC,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,2BAA2B,QAAQ,cAAc;AAqB1D;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,SAASC,SACdC,KAAwB;IAKxB,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC3D,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,OAAOO;QACrCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE;AAEA,SAASQ,QACPV,KAAwB,EACxBO,QAAW;QAeTP,mBACcA;IAdhB,MAAMS,QAAQT,KAAK,CAACO,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC;YAAMA;SAAkB;IAClC;IAGA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGN;IAE1C,MAAMO,iBAAiBnB,OAAOY,SAASA,KAAK,CAACX,4BAA4B,GAAGa;IAE5E,MAAMH,OACJR,EAAAA,oBAAAA,MAAMM,UAAU,cAAhBN,wCAAAA,iBAAkB,CAACO,SAAS,MAAKI,aAAa,OAAOX,MAAMM,UAAU,CAACC,SAAS,KAAK,WAChFM,YAAUb,qBAAAA,MAAMM,UAAU,cAAhBN,yCAAAA,kBAAkB,CAACO,SAAS,KAAI,QAC1CP,MAAMM,UAAU,CAACC,SAAS;IAGhC,IAAIS,kBAAkB,OAAOF,aAAa,YAAY;QACpD,MAAMG,SAAUD,kBAAkBF;QAClC,OAAO;YACLnB,MAAMuB,QAAQ;YACd;gBACEJ,UAAUG,OAAOT,MAAMO;YACzB;SACD;IACH;IAEA,MAAMI,mBAAmB,OAAOX,SAAS,YAAYK;IACrD,MAAMX,YAAaiB,mBAAmBvB,KAAKa,OAAO;QAAC;KAAK,IAAKA;IAC7D,OAAO;QAACD;QAAMN;KAAU;AAC1B"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["getSlotsNext.ts"],"sourcesContent":["import * as React from 'react';\nimport type { ComponentState, SlotPropsRecord, UnknownSlotProps } from './types';\nimport { ObjectSlotProps, Slots } from './getSlots';\n\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n */\nexport function getSlotsNext<R extends SlotPropsRecord>(\n state: ComponentState<R>,\n): {\n slots: Slots<R>;\n slotProps: ObjectSlotProps<R>;\n} {\n const slots = {} as Slots<R>;\n const slotProps = {} as R;\n\n const slotNames: (keyof R)[] = Object.keys(state.components);\n for (const slotName of slotNames) {\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot as Slots<R>[typeof slotName];\n slotProps[slotName] = props;\n }\n return { slots, slotProps: slotProps as unknown as ObjectSlotProps<R> };\n}\n\nfunction getSlotNext<R extends SlotPropsRecord, K extends keyof R>(\n state: ComponentState<R>,\n slotName: K,\n): readonly [React.ElementType<R[K]> | null, R[K]] {\n const props = state[slotName];\n\n if (props === undefined) {\n return [null, undefined as R[K]];\n }\n\n type NonUndefined<T> = T extends undefined ? never : T;\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props as NonUndefined<typeof props>;\n\n const slot = (\n state.components?.[slotName] === undefined || typeof state.components[slotName] === 'string'\n ? asProp || state.components?.[slotName] || 'div'\n : state.components[slotName]\n ) as React.ElementType<R[K]>;\n\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps: UnknownSlotProps = shouldOmitAsProp ? propsWithoutAs : props;\n\n return [slot, slotProps as R[K]];\n}\n"],"names":["React","getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAI/B;;;;;;;CAOC,GACD,OAAO,SAASC,aACdC,KAAwB;IAKxB,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IAEnB,MAAMC,YAAyBC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC3D,KAAK,MAAMC,YAAYJ,UAAW;QAChC,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IACxB;IACA,OAAO;QAAER;QAAOC,WAAWA;IAA2C;AACxE;AAEA,SAASQ,YACPV,KAAwB,EACxBO,QAAW;QAaTP,mBACcA;IAZhB,MAAMS,QAAQT,KAAK,CAACO,SAAS;IAE7B,IAAIE,UAAUE,WAAW;QACvB,OAAO;YAAC;YAAMA;SAAkB;IAClC;IAGA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAE,GAAGC,gBAAgB,GAAGL;IAE1C,MAAMD,OACJR,EAAAA,oBAAAA,MAAMM,UAAU,cAAhBN,wCAAAA,iBAAkB,CAACO,SAAS,MAAKI,aAAa,OAAOX,MAAMM,UAAU,CAACC,SAAS,KAAK,WAChFM,YAAUb,qBAAAA,MAAMM,UAAU,cAAhBN,yCAAAA,kBAAkB,CAACO,SAAS,KAAI,QAC1CP,MAAMM,UAAU,CAACC,SAAS;IAGhC,MAAMQ,mBAAmB,OAAOP,SAAS,YAAYK;IACrD,MAAMX,YAA8Ba,mBAAmBD,iBAAiBL;IAExE,OAAO;QAACD;QAAMN;KAAkB;AAClC"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["resolveShorthand.ts"],"sourcesContent":["import * as slot from './slot';\nimport type { SlotShorthandValue, UnknownSlotProps } from './types';\n\nexport type ResolveShorthandOptions<Props, Required extends boolean = false> = Required extends true\n ? { required: true; defaultProps?: Props }\n : { required?: Required; defaultProps?: Props };\n\nexport type ResolveShorthandFunction<Props extends UnknownSlotProps = UnknownSlotProps> = {\n <P extends Props>(value: P | SlotShorthandValue | undefined, options: ResolveShorthandOptions<P, true>): P;\n <P extends Props>(value: P | SlotShorthandValue | null | undefined, options?: ResolveShorthandOptions<P, boolean>):\n | P\n | undefined;\n};\n\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */\nexport const resolveShorthand: ResolveShorthandFunction<UnknownSlotProps> = (value, options) =>\n slot.optional<UnknownSlotProps>(value, {\n ...options,\n renderByDefault: options?.required,\n // elementType as undefined is the way to identify between a slot and a resolveShorthand call\n // in the case elementType is undefined assertSlots will fail, ensuring it'll only work with slot method.\n elementType: undefined!,\n });\n"],"names":["slot","resolveShorthand","value","options","optional","renderByDefault","required","elementType","undefined"],"mappings":"AAAA,YAAYA,UAAU,SAAS;AAc/B;;;;;CAKC,GACD,OAAO,MAAMC,mBAA+D,CAACC,OAAOC,UAClFH,KAAKI,QAAQ,CAAmBF,OAAO;QACrC,GAAGC,OAAO;QACVE,eAAe,EAAEF,oBAAAA,8BAAAA,QAASG,QAAQ;QAClC,6FAA6F;QAC7F,yGAAyG;QACzGC,aAAaC;IACf,GAAG"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["getSlots.js"],"sourcesContent":["import * as React from 'react';\nimport { omit } from '../utils/omit';\nimport { isSlot } from './isSlot';\nimport { SLOT_RENDER_FUNCTION_SYMBOL } from './constants';\n/**\n * Given the state and an array of slot names, will break out `slots` and `slotProps`\n * collections.\n *\n * The root is derived from a mix of `components` props and `as` prop.\n *\n * Slots will render as null if they are rendered as primitives with undefined children.\n *\n * The slotProps will always omit the `as` prop within them, and for slots that are string\n * primitives, the props will be filtered according to the slot type by the type system.\n * For example, if the slot is rendered `as: 'a'`, the props will be filtered for acceptable\n * anchor props. Note that this is only enforced at build time by Typescript -- there is no\n * runtime code filtering props in this function.\n *\n * @param state - State including slot definitions\n * @returns An object containing the `slots` map and `slotProps` map.\n */ export function getSlots(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames){\n const [slot, props] = getSlot(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlot(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [\n null,\n undefined\n ];\n }\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, children, ...rest } = props;\n const renderFunction = isSlot(props) ? props[SLOT_RENDER_FUNCTION_SYMBOL] : undefined;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n if (renderFunction || typeof children === 'function') {\n const render = renderFunction || children;\n return [\n React.Fragment,\n {\n children: render(slot, rest)\n }\n ];\n }\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? omit(props, [\n 'as'\n ]) : props;\n return [\n slot,\n slotProps\n ];\n}\n"],"names":["getSlots","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlot","_state_components","_state_components1","undefined","as","asProp","children","rest","renderFunction","isSlot","SLOT_RENDER_FUNCTION_SYMBOL","render","React","Fragment","shouldOmitAsProp","omit"],"mappings":";;;;+BAoBoBA;;;eAAAA;;;;iEApBG;sBACF;wBACE;2BACqB;AAiBjC,SAASA,SAASC,KAAK;IAC9B,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAU;QAC7B,MAAM,CAACK,MAAMC,MAAM,GAAGC,QAAQV,OAAOO;QACrCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IAC1B;IACA,OAAO;QACHR;QACAC,WAAWA;IACf;AACJ;AACA,SAASQ,QAAQV,KAAK,EAAEO,QAAQ;IAC5B,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACrB,OAAO;YACH;YACAA;SACH;IACL;IACA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAEC,QAAQ,EAAE,GAAGC,MAAM,GAAGR;IAC1C,MAAMS,iBAAiBC,IAAAA,cAAM,EAACV,SAASA,KAAK,CAACW,sCAA2B,CAAC,GAAGP;IAC5E,MAAML,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,QAAQK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,QAAQM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,IAAIW,kBAAkB,OAAOF,aAAa,YAAY;QAClD,MAAMK,SAASH,kBAAkBF;QACjC,OAAO;YACHM,OAAMC,QAAQ;YACd;gBACIP,UAAUK,OAAOb,MAAMS;YAC3B;SACH;IACL;IACA,MAAMO,mBAAmB,OAAOhB,SAAS,YAAYO;IACrD,MAAMb,YAAYsB,mBAAmBC,IAAAA,UAAI,EAAChB,OAAO;QAC7C;KACH,IAAIA;IACL,OAAO;QACHD;QACAN;KACH;AACL"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["getSlotsNext.js"],"sourcesContent":["import * as React from 'react';\n/**\n * Similar to `getSlots`, main difference is that it's compatible with new custom jsx pragma\n *\n * @internal\n * This is an internal temporary method, this method will cease to exist eventually!\n *\n * * ❗️❗️ **DO NOT USE IT EXTERNALLY** ❗️❗️\n */ export function getSlotsNext(state) {\n const slots = {};\n const slotProps = {};\n const slotNames = Object.keys(state.components);\n for (const slotName of slotNames){\n const [slot, props] = getSlotNext(state, slotName);\n slots[slotName] = slot;\n slotProps[slotName] = props;\n }\n return {\n slots,\n slotProps: slotProps\n };\n}\nfunction getSlotNext(state, slotName) {\n var _state_components, _state_components1;\n const props = state[slotName];\n if (props === undefined) {\n return [\n null,\n undefined\n ];\n }\n // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339)\n const { as: asProp, ...propsWithoutAs } = props;\n const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName];\n const shouldOmitAsProp = typeof slot === 'string' && asProp;\n const slotProps = shouldOmitAsProp ? propsWithoutAs : props;\n return [\n slot,\n slotProps\n ];\n}\n"],"names":["getSlotsNext","state","slots","slotProps","slotNames","Object","keys","components","slotName","slot","props","getSlotNext","_state_components","_state_components1","undefined","as","asProp","propsWithoutAs","shouldOmitAsProp"],"mappings":";;;;+BAQoBA;;;eAAAA;;;;iEARG;AAQZ,SAASA,aAAaC,KAAK;IAClC,MAAMC,QAAQ,CAAC;IACf,MAAMC,YAAY,CAAC;IACnB,MAAMC,YAAYC,OAAOC,IAAI,CAACL,MAAMM,UAAU;IAC9C,KAAK,MAAMC,YAAYJ,UAAU;QAC7B,MAAM,CAACK,MAAMC,MAAM,GAAGC,YAAYV,OAAOO;QACzCN,KAAK,CAACM,SAAS,GAAGC;QAClBN,SAAS,CAACK,SAAS,GAAGE;IAC1B;IACA,OAAO;QACHR;QACAC,WAAWA;IACf;AACJ;AACA,SAASQ,YAAYV,KAAK,EAAEO,QAAQ;IAChC,IAAII,mBAAmBC;IACvB,MAAMH,QAAQT,KAAK,CAACO,SAAS;IAC7B,IAAIE,UAAUI,WAAW;QACrB,OAAO;YACH;YACAA;SACH;IACL;IACA,yFAAyF;IACzF,MAAM,EAAEC,IAAIC,MAAM,EAAE,GAAGC,gBAAgB,GAAGP;IAC1C,MAAMD,OAAO,AAAC,CAAA,AAACG,CAAAA,oBAAoBX,MAAMM,UAAU,AAAD,MAAO,QAAQK,sBAAsB,KAAK,IAAI,KAAK,IAAIA,iBAAiB,CAACJ,SAAS,AAAD,MAAOM,aAAa,OAAOb,MAAMM,UAAU,CAACC,SAAS,KAAK,WAAWQ,UAAW,CAAA,AAACH,CAAAA,qBAAqBZ,MAAMM,UAAU,AAAD,MAAO,QAAQM,uBAAuB,KAAK,IAAI,KAAK,IAAIA,kBAAkB,CAACL,SAAS,AAAD,KAAM,QAAQP,MAAMM,UAAU,CAACC,SAAS;IACnX,MAAMU,mBAAmB,OAAOT,SAAS,YAAYO;IACrD,MAAMb,YAAYe,mBAAmBD,iBAAiBP;IACtD,OAAO;QACHD;QACAN;KACH;AACL"}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["resolveShorthand.js"],"sourcesContent":["import * as slot from './slot';\n/**\n * Resolves shorthands into slot props, to ensure normalization of the signature\n * being passed down to getSlots method\n * @param value - the base shorthand props\n * @param options - options to resolve shorthand props\n */ export const resolveShorthand = (value, options)=>slot.optional(value, {\n ...options,\n renderByDefault: options === null || options === void 0 ? void 0 : options.required,\n // elementType as undefined is the way to identify between a slot and a resolveShorthand call\n // in the case elementType is undefined assertSlots will fail, ensuring it'll only work with slot method.\n elementType: undefined\n });\n"],"names":["resolveShorthand","value","options","slot","optional","renderByDefault","required","elementType","undefined"],"mappings":";;;;+BAMiBA;;;eAAAA;;;;gEANK;AAMX,MAAMA,mBAAmB,CAACC,OAAOC,UAAUC,MAAKC,QAAQ,CAACH,OAAO;QACnE,GAAGC,OAAO;QACVG,iBAAiBH,YAAY,QAAQA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQI,QAAQ;QACnF,6FAA6F;QAC7F,yGAAyG;QACzGC,aAAaC;IACjB"}
|