@fluentui/react-tabster 9.22.3 → 9.22.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 CHANGED
@@ -1,12 +1,30 @@
1
1
  # Change Log - @fluentui/react-tabster
2
2
 
3
- This log was last generated on Tue, 23 Jul 2024 20:09:20 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 15 Aug 2024 13:46:54 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.22.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.22.5)
8
+
9
+ Thu, 15 Aug 2024 13:46:54 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.22.4..@fluentui/react-tabster_v9.22.5)
11
+
12
+ ### Patches
13
+
14
+ - chore: simplifies useMergedTabsterAttributes internals ([PR #32303](https://github.com/microsoft/fluentui/pull/32303) by bernardo.sunderhus@gmail.com)
15
+
16
+ ## [9.22.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.22.4)
17
+
18
+ Thu, 15 Aug 2024 08:22:14 GMT
19
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.22.3..@fluentui/react-tabster_v9.22.4)
20
+
21
+ ### Patches
22
+
23
+ - chore: ensures useMergedTabsterAttributes supports Partial attributes ([PR #32300](https://github.com/microsoft/fluentui/pull/32300) by bernardo.sunderhus@gmail.com)
24
+
7
25
  ## [9.22.3](https://github.com/microsoft/fluentui/tree/@fluentui/react-tabster_v9.22.3)
8
26
 
9
- Tue, 23 Jul 2024 20:09:20 GMT
27
+ Tue, 23 Jul 2024 20:13:14 GMT
10
28
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-tabster_v9.22.2..@fluentui/react-tabster_v9.22.3)
11
29
 
12
30
  ### Patches
package/dist/index.d.ts CHANGED
@@ -1453,7 +1453,7 @@ export declare function useKeyboardNavAttribute<E extends HTMLElement>(): RefObj
1453
1453
  * @param attributes - collection of tabster attributes from other react-tabster hooks
1454
1454
  * @returns single merged tabster attribute
1455
1455
  */
1456
- export declare const useMergedTabsterAttributes_unstable: (...attributes: Types.TabsterDOMAttribute[]) => Types.TabsterDOMAttribute;
1456
+ export declare const useMergedTabsterAttributes_unstable: (...attributes: Partial<Types.TabsterDOMAttribute>[]) => Types.TabsterDOMAttribute;
1457
1457
 
1458
1458
  /**
1459
1459
  * Applies modal dialog behaviour through DOM attributes
@@ -9,39 +9,67 @@ import { TABSTER_ATTRIBUTE_NAME } from 'tabster';
9
9
  * @returns single merged tabster attribute
10
10
  */ export const useMergedTabsterAttributes_unstable = (...attributes)=>{
11
11
  'use no memo';
12
- const stringAttributes = attributes.map((attribute)=>attribute[TABSTER_ATTRIBUTE_NAME]).filter(Boolean);
13
- return React.useMemo(()=>{
14
- let attribute = stringAttributes[0];
15
- attributes.shift();
16
- for (const attr of stringAttributes){
17
- attribute = mergeAttributes(attribute, attr);
12
+ const stringAttributes = attributes.reduce((acc, curr)=>{
13
+ if (curr[TABSTER_ATTRIBUTE_NAME]) {
14
+ acc.push(curr[TABSTER_ATTRIBUTE_NAME]);
18
15
  }
19
- return {
20
- [TABSTER_ATTRIBUTE_NAME]: attribute
21
- };
16
+ return acc;
17
+ }, []);
18
+ if (process.env.NODE_ENV !== 'production') {
19
+ // ignoring rules of hooks because this is a condition based on the environment
20
+ // it's safe to ignore the rule
21
+ // eslint-disable-next-line react-hooks/rules-of-hooks
22
+ useWarnIfUnstableAttributes(stringAttributes);
23
+ }
24
+ return React.useMemo(()=>({
25
+ [TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined
26
+ }), // disable exhaustive-deps because we want to memoize the result of the reduction
27
+ // this is safe because the collection of attributes is not expected to change at runtime
22
28
  // eslint-disable-next-line react-hooks/exhaustive-deps
23
- }, stringAttributes);
29
+ stringAttributes);
24
30
  };
25
- function mergeAttributes(a, b) {
26
- if (!b) {
27
- return a;
28
- }
29
- let aParsed = {};
30
- let bParsed = {};
31
- if (a) {
32
- try {
33
- aParsed = JSON.parse(a);
34
- // eslint-disable-next-line no-empty
35
- } catch {}
31
+ /**
32
+ * Merges two JSON strings into one.
33
+ */ const mergeJSONStrings = (a, b)=>JSON.stringify(Object.assign(safelyParseJSON(a), safelyParseJSON(b)));
34
+ /**
35
+ * Tries to parse a JSON string and returns an object.
36
+ * If the JSON string is invalid, an empty object is returned.
37
+ */ const safelyParseJSON = (json)=>{
38
+ try {
39
+ return JSON.parse(json);
40
+ } catch {
41
+ return {};
36
42
  }
37
- if (b) {
38
- try {
39
- bParsed = JSON.parse(b);
40
- // eslint-disable-next-line no-empty
41
- } catch {}
43
+ };
44
+ /**
45
+ * Helper hook that ensures that the attributes passed to the hook are stable.
46
+ * This is necessary because the attributes are expected to not change at runtime.
47
+ *
48
+ * This hook will console.warn if the attributes change at runtime.
49
+ */ const useWarnIfUnstableAttributes = (attributes)=>{
50
+ 'use no memo';
51
+ const initialAttributesRef = React.useRef(attributes);
52
+ let isStable = initialAttributesRef.current.length === attributes.length;
53
+ if (initialAttributesRef.current !== attributes && isStable) {
54
+ for(let i = 0; i < attributes.length; i++){
55
+ if (initialAttributesRef.current[i] !== attributes[i]) {
56
+ isStable = false;
57
+ break;
58
+ }
59
+ }
42
60
  }
43
- return JSON.stringify({
44
- ...aParsed,
45
- ...bParsed
46
- });
47
- }
61
+ React.useEffect(()=>{
62
+ if (!isStable) {
63
+ const error = new Error();
64
+ // eslint-disable-next-line no-console
65
+ console.warn(/** #__DE-INDENT__ */ `
66
+ @fluentui/react-tabster [useMergedTabsterAttributes]:
67
+ The attributes passed to the hook changed at runtime.
68
+ This might lead to unexpected behavior, please ensure that the attributes are stable.
69
+ ${error.stack}
70
+ `);
71
+ }
72
+ }, [
73
+ isStable
74
+ ]);
75
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["useMergeTabsterAttributes.ts"],"sourcesContent":["import * as React from 'react';\nimport { Types, TABSTER_ATTRIBUTE_NAME } from 'tabster';\n\n/**\n * Merges a collection of tabster attributes.\n *\n * ⚠️The attributes passed as arguments to this hook cannot change at runtime.\n * @internal\n * @param attributes - collection of tabster attributes from other react-tabster hooks\n * @returns single merged tabster attribute\n */\nexport const useMergedTabsterAttributes_unstable: (\n ...attributes: Types.TabsterDOMAttribute[]\n) => Types.TabsterDOMAttribute = (...attributes) => {\n 'use no memo';\n\n const stringAttributes = attributes.map(attribute => attribute[TABSTER_ATTRIBUTE_NAME]).filter(Boolean) as string[];\n\n return React.useMemo(() => {\n let attribute = stringAttributes[0];\n attributes.shift();\n\n for (const attr of stringAttributes) {\n attribute = mergeAttributes(attribute, attr);\n }\n\n return { [TABSTER_ATTRIBUTE_NAME]: attribute };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, stringAttributes);\n};\n\nfunction mergeAttributes(a: string, b?: string): string {\n if (!b) {\n return a;\n }\n\n let aParsed = {};\n let bParsed = {};\n if (a) {\n try {\n aParsed = JSON.parse(a);\n // eslint-disable-next-line no-empty\n } catch {}\n }\n\n if (b) {\n try {\n bParsed = JSON.parse(b);\n // eslint-disable-next-line no-empty\n } catch {}\n }\n\n return JSON.stringify({ ...aParsed, ...bParsed });\n}\n"],"names":["React","TABSTER_ATTRIBUTE_NAME","useMergedTabsterAttributes_unstable","attributes","stringAttributes","map","attribute","filter","Boolean","useMemo","shift","attr","mergeAttributes","a","b","aParsed","bParsed","JSON","parse","stringify"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAAgBC,sBAAsB,QAAQ,UAAU;AAExD;;;;;;;CAOC,GACD,OAAO,MAAMC,sCAEoB,CAAC,GAAGC;IACnC;IAEA,MAAMC,mBAAmBD,WAAWE,GAAG,CAACC,CAAAA,YAAaA,SAAS,CAACL,uBAAuB,EAAEM,MAAM,CAACC;IAE/F,OAAOR,MAAMS,OAAO,CAAC;QACnB,IAAIH,YAAYF,gBAAgB,CAAC,EAAE;QACnCD,WAAWO,KAAK;QAEhB,KAAK,MAAMC,QAAQP,iBAAkB;YACnCE,YAAYM,gBAAgBN,WAAWK;QACzC;QAEA,OAAO;YAAE,CAACV,uBAAuB,EAAEK;QAAU;IAC7C,uDAAuD;IACzD,GAAGF;AACL,EAAE;AAEF,SAASQ,gBAAgBC,CAAS,EAAEC,CAAU;IAC5C,IAAI,CAACA,GAAG;QACN,OAAOD;IACT;IAEA,IAAIE,UAAU,CAAC;IACf,IAAIC,UAAU,CAAC;IACf,IAAIH,GAAG;QACL,IAAI;YACFE,UAAUE,KAAKC,KAAK,CAACL;QACrB,oCAAoC;QACtC,EAAE,OAAM,CAAC;IACX;IAEA,IAAIC,GAAG;QACL,IAAI;YACFE,UAAUC,KAAKC,KAAK,CAACJ;QACrB,oCAAoC;QACtC,EAAE,OAAM,CAAC;IACX;IAEA,OAAOG,KAAKE,SAAS,CAAC;QAAE,GAAGJ,OAAO;QAAE,GAAGC,OAAO;IAAC;AACjD"}
1
+ {"version":3,"sources":["useMergeTabsterAttributes.ts"],"sourcesContent":["import * as React from 'react';\nimport { Types, TABSTER_ATTRIBUTE_NAME } from 'tabster';\n\n/**\n * Merges a collection of tabster attributes.\n *\n * ⚠️The attributes passed as arguments to this hook cannot change at runtime.\n * @internal\n * @param attributes - collection of tabster attributes from other react-tabster hooks\n * @returns single merged tabster attribute\n */\nexport const useMergedTabsterAttributes_unstable = (\n ...attributes: Partial<Types.TabsterDOMAttribute>[]\n): Types.TabsterDOMAttribute => {\n 'use no memo';\n\n const stringAttributes = attributes.reduce<string[]>((acc, curr) => {\n if (curr[TABSTER_ATTRIBUTE_NAME]) {\n acc.push(curr[TABSTER_ATTRIBUTE_NAME]);\n }\n return acc;\n }, []);\n\n if (process.env.NODE_ENV !== 'production') {\n // ignoring rules of hooks because this is a condition based on the environment\n // it's safe to ignore the rule\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useWarnIfUnstableAttributes(stringAttributes);\n }\n\n return React.useMemo(\n () => ({\n [TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined,\n }),\n // disable exhaustive-deps because we want to memoize the result of the reduction\n // this is safe because the collection of attributes is not expected to change at runtime\n // eslint-disable-next-line react-hooks/exhaustive-deps\n stringAttributes,\n );\n};\n\n/**\n * Merges two JSON strings into one.\n */\nconst mergeJSONStrings = (a: string, b: string): string =>\n JSON.stringify(Object.assign(safelyParseJSON(a), safelyParseJSON(b)));\n\n/**\n * Tries to parse a JSON string and returns an object.\n * If the JSON string is invalid, an empty object is returned.\n */\nconst safelyParseJSON = (json: string): object => {\n try {\n return JSON.parse(json);\n } catch {\n return {};\n }\n};\n\n/**\n * Helper hook that ensures that the attributes passed to the hook are stable.\n * This is necessary because the attributes are expected to not change at runtime.\n *\n * This hook will console.warn if the attributes change at runtime.\n */\nconst useWarnIfUnstableAttributes = (attributes: string[]) => {\n 'use no memo';\n\n const initialAttributesRef = React.useRef(attributes);\n\n let isStable = initialAttributesRef.current.length === attributes.length;\n if (initialAttributesRef.current !== attributes && isStable) {\n for (let i = 0; i < attributes.length; i++) {\n if (initialAttributesRef.current[i] !== attributes[i]) {\n isStable = false;\n break;\n }\n }\n }\n React.useEffect(() => {\n if (!isStable) {\n const error = new Error();\n // eslint-disable-next-line no-console\n console.warn(/** #__DE-INDENT__ */ `\n @fluentui/react-tabster [useMergedTabsterAttributes]:\n The attributes passed to the hook changed at runtime.\n This might lead to unexpected behavior, please ensure that the attributes are stable.\n ${error.stack}\n `);\n }\n }, [isStable]);\n};\n"],"names":["React","TABSTER_ATTRIBUTE_NAME","useMergedTabsterAttributes_unstable","attributes","stringAttributes","reduce","acc","curr","push","process","env","NODE_ENV","useWarnIfUnstableAttributes","useMemo","length","mergeJSONStrings","undefined","a","b","JSON","stringify","Object","assign","safelyParseJSON","json","parse","initialAttributesRef","useRef","isStable","current","i","useEffect","error","Error","console","warn","stack"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAAgBC,sBAAsB,QAAQ,UAAU;AAExD;;;;;;;CAOC,GACD,OAAO,MAAMC,sCAAsC,CACjD,GAAGC;IAEH;IAEA,MAAMC,mBAAmBD,WAAWE,MAAM,CAAW,CAACC,KAAKC;QACzD,IAAIA,IAAI,CAACN,uBAAuB,EAAE;YAChCK,IAAIE,IAAI,CAACD,IAAI,CAACN,uBAAuB;QACvC;QACA,OAAOK;IACT,GAAG,EAAE;IAEL,IAAIG,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,+EAA+E;QAC/E,+BAA+B;QAC/B,sDAAsD;QACtDC,4BAA4BR;IAC9B;IAEA,OAAOJ,MAAMa,OAAO,CAClB,IAAO,CAAA;YACL,CAACZ,uBAAuB,EAAEG,iBAAiBU,MAAM,GAAG,IAAIV,iBAAiBC,MAAM,CAACU,oBAAoBC;QACtG,CAAA,GACA,iFAAiF;IACjF,yFAAyF;IACzF,uDAAuD;IACvDZ;AAEJ,EAAE;AAEF;;CAEC,GACD,MAAMW,mBAAmB,CAACE,GAAWC,IACnCC,KAAKC,SAAS,CAACC,OAAOC,MAAM,CAACC,gBAAgBN,IAAIM,gBAAgBL;AAEnE;;;CAGC,GACD,MAAMK,kBAAkB,CAACC;IACvB,IAAI;QACF,OAAOL,KAAKM,KAAK,CAACD;IACpB,EAAE,OAAM;QACN,OAAO,CAAC;IACV;AACF;AAEA;;;;;CAKC,GACD,MAAMZ,8BAA8B,CAACT;IACnC;IAEA,MAAMuB,uBAAuB1B,MAAM2B,MAAM,CAACxB;IAE1C,IAAIyB,WAAWF,qBAAqBG,OAAO,CAACf,MAAM,KAAKX,WAAWW,MAAM;IACxE,IAAIY,qBAAqBG,OAAO,KAAK1B,cAAcyB,UAAU;QAC3D,IAAK,IAAIE,IAAI,GAAGA,IAAI3B,WAAWW,MAAM,EAAEgB,IAAK;YAC1C,IAAIJ,qBAAqBG,OAAO,CAACC,EAAE,KAAK3B,UAAU,CAAC2B,EAAE,EAAE;gBACrDF,WAAW;gBACX;YACF;QACF;IACF;IACA5B,MAAM+B,SAAS,CAAC;QACd,IAAI,CAACH,UAAU;YACb,MAAMI,QAAQ,IAAIC;YAClB,sCAAsC;YACtCC,QAAQC,IAAI,CAAC,mBAAmB,GAAG,CAAC;;;;QAIlC,EAAEH,MAAMI,KAAK,CAAC;MAChB,CAAC;QACH;IACF,GAAG;QAACR;KAAS;AACf"}
package/lib/index.js CHANGED
@@ -5,6 +5,7 @@ import { dispatchGroupperMoveFocusEvent, dispatchMoverMoveFocusEvent, MoverMoveF
5
5
  export { KEYBORG_FOCUSIN } from 'keyborg';
6
6
  // WARNING! ATTENTION! Tabster.Types was exported from here by mistake. To avoid breaking changes,
7
7
  // we are putting a snapshot of Tabster.Types@6.0.1 and marking the entire export as deprecated.
8
+ // eslint-disable-next-line @typescript-eslint/naming-convention
8
9
  import * as TabsterTypes6_0_1_DoNotUse from './tabster-types-6.0.1-do-not-use';
9
10
  export { /** @deprecated (Do not use! Exposed by mistake and will be removed in the next major version.) */ TabsterTypes6_0_1_DoNotUse as TabsterTypes, /** @deprecated Use element.dispatchEvent(new GroupperMoveFocusEvent({ action: GroupperMoveFocusActions.Escape })) */ // eslint-disable-next-line deprecation/deprecation
10
11
  dispatchGroupperMoveFocusEvent, /** @deprecated Use element.dispatchEvent(new MoverMoveFocusEvent({ key: MoverKeys.ArrowDown })) */ // eslint-disable-next-line deprecation/deprecation
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n useArrowNavigationGroup,\n useFocusableGroup,\n useFocusFinders,\n useFocusVisible,\n useFocusWithin,\n useKeyboardNavAttribute,\n useModalAttributes,\n useTabsterAttributes,\n useObservedElement,\n useFocusObserved,\n useMergedTabsterAttributes_unstable,\n useRestoreFocusSource,\n useRestoreFocusTarget,\n useUncontrolledFocus,\n useOnKeyboardNavigationChange,\n useSetKeyboardNavigation,\n useFocusedElementChange,\n} from './hooks/index';\nexport type {\n UseArrowNavigationGroupOptions,\n UseFocusableGroupOptions,\n UseModalAttributesOptions,\n} from './hooks/index';\n\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\n\nexport type {\n CreateCustomFocusIndicatorStyleOptions,\n CreateFocusOutlineStyleOptions,\n FocusOutlineOffset,\n FocusOutlineStyleOptions,\n} from './focus/index';\n\nexport { applyFocusVisiblePolyfill } from './focus/index';\nimport {\n type Types,\n type EventsTypes,\n dispatchGroupperMoveFocusEvent,\n dispatchMoverMoveFocusEvent,\n MoverMoveFocusEventName,\n MoverMoveFocusEvent,\n MoverKeys,\n GroupperMoveFocusEventName,\n GroupperMoveFocusEvent,\n GroupperMoveFocusActions,\n MoverMemorizedElementEventName,\n MoverMemorizedElementEvent,\n TabsterMoveFocusEventName,\n TabsterMoveFocusEvent,\n} from 'tabster';\n\nexport type TabsterDOMAttribute = Types.TabsterDOMAttribute;\n\nexport type { KeyborgFocusInEvent } from 'keyborg';\nexport { KEYBORG_FOCUSIN } from 'keyborg';\n\n// WARNING! ATTENTION! Tabster.Types was exported from here by mistake. To avoid breaking changes,\n// we are putting a snapshot of Tabster.Types@6.0.1 and marking the entire export as deprecated.\nimport * as TabsterTypes6_0_1_DoNotUse from './tabster-types-6.0.1-do-not-use';\nexport {\n /** @deprecated (Do not use! Exposed by mistake and will be removed in the next major version.) */\n TabsterTypes6_0_1_DoNotUse as TabsterTypes,\n /** @deprecated Use element.dispatchEvent(new GroupperMoveFocusEvent({ action: GroupperMoveFocusActions.Escape })) */\n // eslint-disable-next-line deprecation/deprecation\n dispatchGroupperMoveFocusEvent,\n /** @deprecated Use element.dispatchEvent(new MoverMoveFocusEvent({ key: MoverKeys.ArrowDown })) */\n // eslint-disable-next-line deprecation/deprecation\n dispatchMoverMoveFocusEvent,\n};\n\n/**\n * For all exports below, we don't do wildcard exports to keep Tabster API flexible. We export only required\n * parts when they are needed.\n */\n\nexport { MoverMoveFocusEventName, MoverMoveFocusEvent, MoverKeys };\nexport type MoverMoveFocusEventDetail = EventsTypes.MoverMoveFocusEventDetail;\n\nexport { GroupperMoveFocusEventName, GroupperMoveFocusEvent, GroupperMoveFocusActions };\nexport type GroupperMoveFocusEventDetail = EventsTypes.GroupperMoveFocusEventDetail;\n\nexport { MoverMemorizedElementEventName, MoverMemorizedElementEvent };\nexport type MoverMemorizedElementEventDetail = EventsTypes.MoverMemorizedElementEventDetail;\n\nexport { TabsterMoveFocusEventName, TabsterMoveFocusEvent };\nexport type TabsterMoveFocusEventDetail = EventsTypes.TabsterMoveFocusEventDetail;\n"],"names":["useArrowNavigationGroup","useFocusableGroup","useFocusFinders","useFocusVisible","useFocusWithin","useKeyboardNavAttribute","useModalAttributes","useTabsterAttributes","useObservedElement","useFocusObserved","useMergedTabsterAttributes_unstable","useRestoreFocusSource","useRestoreFocusTarget","useUncontrolledFocus","useOnKeyboardNavigationChange","useSetKeyboardNavigation","useFocusedElementChange","createCustomFocusIndicatorStyle","createFocusOutlineStyle","applyFocusVisiblePolyfill","dispatchGroupperMoveFocusEvent","dispatchMoverMoveFocusEvent","MoverMoveFocusEventName","MoverMoveFocusEvent","MoverKeys","GroupperMoveFocusEventName","GroupperMoveFocusEvent","GroupperMoveFocusActions","MoverMemorizedElementEventName","MoverMemorizedElementEvent","TabsterMoveFocusEventName","TabsterMoveFocusEvent","KEYBORG_FOCUSIN","TabsterTypes6_0_1_DoNotUse","TabsterTypes"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAAA,SACEA,uBAAuB,EACvBC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,cAAc,EACdC,uBAAuB,EACvBC,kBAAkB,EAClBC,oBAAoB,EACpBC,kBAAkB,EAClBC,gBAAgB,EAChBC,mCAAmC,EACnCC,qBAAqB,EACrBC,qBAAqB,EACrBC,oBAAoB,EACpBC,6BAA6B,EAC7BC,wBAAwB,EACxBC,uBAAuB,QAClB,gBAAgB;AAOvB,SAASC,+BAA+B,EAAEC,uBAAuB,QAAQ,gBAAgB;AASzF,SAASC,yBAAyB,QAAQ,gBAAgB;AAC1D,SAGEC,8BAA8B,EAC9BC,2BAA2B,EAC3BC,uBAAuB,EACvBC,mBAAmB,EACnBC,SAAS,EACTC,0BAA0B,EAC1BC,sBAAsB,EACtBC,wBAAwB,EACxBC,8BAA8B,EAC9BC,0BAA0B,EAC1BC,yBAAyB,EACzBC,qBAAqB,QAChB,UAAU;AAKjB,SAASC,eAAe,QAAQ,UAAU;AAE1C,kGAAkG;AAClG,gGAAgG;AAChG,YAAYC,gCAAgC,mCAAmC;AAC/E,SACE,iGAAiG,GACjGA,8BAA8BC,YAAY,EAC1C,mHAAmH,GACnH,mDAAmD;AACnDd,8BAA8B,EAC9B,iGAAiG,GACjG,mDAAmD;AACnDC,2BAA2B,GAC3B;AAEF;;;CAGC,GAED,SAASC,uBAAuB,EAAEC,mBAAmB,EAAEC,SAAS,GAAG;AAGnE,SAASC,0BAA0B,EAAEC,sBAAsB,EAAEC,wBAAwB,GAAG;AAGxF,SAASC,8BAA8B,EAAEC,0BAA0B,GAAG;AAGtE,SAASC,yBAAyB,EAAEC,qBAAqB,GAAG"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n useArrowNavigationGroup,\n useFocusableGroup,\n useFocusFinders,\n useFocusVisible,\n useFocusWithin,\n useKeyboardNavAttribute,\n useModalAttributes,\n useTabsterAttributes,\n useObservedElement,\n useFocusObserved,\n useMergedTabsterAttributes_unstable,\n useRestoreFocusSource,\n useRestoreFocusTarget,\n useUncontrolledFocus,\n useOnKeyboardNavigationChange,\n useSetKeyboardNavigation,\n useFocusedElementChange,\n} from './hooks/index';\nexport type {\n UseArrowNavigationGroupOptions,\n UseFocusableGroupOptions,\n UseModalAttributesOptions,\n} from './hooks/index';\n\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\n\nexport type {\n CreateCustomFocusIndicatorStyleOptions,\n CreateFocusOutlineStyleOptions,\n FocusOutlineOffset,\n FocusOutlineStyleOptions,\n} from './focus/index';\n\nexport { applyFocusVisiblePolyfill } from './focus/index';\nimport {\n type Types,\n type EventsTypes,\n dispatchGroupperMoveFocusEvent,\n dispatchMoverMoveFocusEvent,\n MoverMoveFocusEventName,\n MoverMoveFocusEvent,\n MoverKeys,\n GroupperMoveFocusEventName,\n GroupperMoveFocusEvent,\n GroupperMoveFocusActions,\n MoverMemorizedElementEventName,\n MoverMemorizedElementEvent,\n TabsterMoveFocusEventName,\n TabsterMoveFocusEvent,\n} from 'tabster';\n\nexport type TabsterDOMAttribute = Types.TabsterDOMAttribute;\n\nexport type { KeyborgFocusInEvent } from 'keyborg';\nexport { KEYBORG_FOCUSIN } from 'keyborg';\n\n// WARNING! ATTENTION! Tabster.Types was exported from here by mistake. To avoid breaking changes,\n// we are putting a snapshot of Tabster.Types@6.0.1 and marking the entire export as deprecated.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as TabsterTypes6_0_1_DoNotUse from './tabster-types-6.0.1-do-not-use';\nexport {\n /** @deprecated (Do not use! Exposed by mistake and will be removed in the next major version.) */\n TabsterTypes6_0_1_DoNotUse as TabsterTypes,\n /** @deprecated Use element.dispatchEvent(new GroupperMoveFocusEvent({ action: GroupperMoveFocusActions.Escape })) */\n // eslint-disable-next-line deprecation/deprecation\n dispatchGroupperMoveFocusEvent,\n /** @deprecated Use element.dispatchEvent(new MoverMoveFocusEvent({ key: MoverKeys.ArrowDown })) */\n // eslint-disable-next-line deprecation/deprecation\n dispatchMoverMoveFocusEvent,\n};\n\n/**\n * For all exports below, we don't do wildcard exports to keep Tabster API flexible. We export only required\n * parts when they are needed.\n */\n\nexport { MoverMoveFocusEventName, MoverMoveFocusEvent, MoverKeys };\nexport type MoverMoveFocusEventDetail = EventsTypes.MoverMoveFocusEventDetail;\n\nexport { GroupperMoveFocusEventName, GroupperMoveFocusEvent, GroupperMoveFocusActions };\nexport type GroupperMoveFocusEventDetail = EventsTypes.GroupperMoveFocusEventDetail;\n\nexport { MoverMemorizedElementEventName, MoverMemorizedElementEvent };\nexport type MoverMemorizedElementEventDetail = EventsTypes.MoverMemorizedElementEventDetail;\n\nexport { TabsterMoveFocusEventName, TabsterMoveFocusEvent };\nexport type TabsterMoveFocusEventDetail = EventsTypes.TabsterMoveFocusEventDetail;\n"],"names":["useArrowNavigationGroup","useFocusableGroup","useFocusFinders","useFocusVisible","useFocusWithin","useKeyboardNavAttribute","useModalAttributes","useTabsterAttributes","useObservedElement","useFocusObserved","useMergedTabsterAttributes_unstable","useRestoreFocusSource","useRestoreFocusTarget","useUncontrolledFocus","useOnKeyboardNavigationChange","useSetKeyboardNavigation","useFocusedElementChange","createCustomFocusIndicatorStyle","createFocusOutlineStyle","applyFocusVisiblePolyfill","dispatchGroupperMoveFocusEvent","dispatchMoverMoveFocusEvent","MoverMoveFocusEventName","MoverMoveFocusEvent","MoverKeys","GroupperMoveFocusEventName","GroupperMoveFocusEvent","GroupperMoveFocusActions","MoverMemorizedElementEventName","MoverMemorizedElementEvent","TabsterMoveFocusEventName","TabsterMoveFocusEvent","KEYBORG_FOCUSIN","TabsterTypes6_0_1_DoNotUse","TabsterTypes"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAAA,SACEA,uBAAuB,EACvBC,iBAAiB,EACjBC,eAAe,EACfC,eAAe,EACfC,cAAc,EACdC,uBAAuB,EACvBC,kBAAkB,EAClBC,oBAAoB,EACpBC,kBAAkB,EAClBC,gBAAgB,EAChBC,mCAAmC,EACnCC,qBAAqB,EACrBC,qBAAqB,EACrBC,oBAAoB,EACpBC,6BAA6B,EAC7BC,wBAAwB,EACxBC,uBAAuB,QAClB,gBAAgB;AAOvB,SAASC,+BAA+B,EAAEC,uBAAuB,QAAQ,gBAAgB;AASzF,SAASC,yBAAyB,QAAQ,gBAAgB;AAC1D,SAGEC,8BAA8B,EAC9BC,2BAA2B,EAC3BC,uBAAuB,EACvBC,mBAAmB,EACnBC,SAAS,EACTC,0BAA0B,EAC1BC,sBAAsB,EACtBC,wBAAwB,EACxBC,8BAA8B,EAC9BC,0BAA0B,EAC1BC,yBAAyB,EACzBC,qBAAqB,QAChB,UAAU;AAKjB,SAASC,eAAe,QAAQ,UAAU;AAE1C,kGAAkG;AAClG,gGAAgG;AAChG,gEAAgE;AAChE,YAAYC,gCAAgC,mCAAmC;AAC/E,SACE,iGAAiG,GACjGA,8BAA8BC,YAAY,EAC1C,mHAAmH,GACnH,mDAAmD;AACnDd,8BAA8B,EAC9B,iGAAiG,GACjG,mDAAmD;AACnDC,2BAA2B,GAC3B;AAEF;;;CAGC,GAED,SAASC,uBAAuB,EAAEC,mBAAmB,EAAEC,SAAS,GAAG;AAGnE,SAASC,0BAA0B,EAAEC,sBAAsB,EAAEC,wBAAwB,GAAG;AAGxF,SAASC,8BAA8B,EAAEC,0BAA0B,GAAG;AAGtE,SAASC,yBAAyB,EAAEC,qBAAqB,GAAG"}
@@ -13,39 +13,66 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
13
13
  const _tabster = require("tabster");
14
14
  const useMergedTabsterAttributes_unstable = (...attributes)=>{
15
15
  'use no memo';
16
- const stringAttributes = attributes.map((attribute)=>attribute[_tabster.TABSTER_ATTRIBUTE_NAME]).filter(Boolean);
17
- return _react.useMemo(()=>{
18
- let attribute = stringAttributes[0];
19
- attributes.shift();
20
- for (const attr of stringAttributes){
21
- attribute = mergeAttributes(attribute, attr);
16
+ const stringAttributes = attributes.reduce((acc, curr)=>{
17
+ if (curr[_tabster.TABSTER_ATTRIBUTE_NAME]) {
18
+ acc.push(curr[_tabster.TABSTER_ATTRIBUTE_NAME]);
22
19
  }
23
- return {
24
- [_tabster.TABSTER_ATTRIBUTE_NAME]: attribute
25
- };
20
+ return acc;
21
+ }, []);
22
+ if (process.env.NODE_ENV !== 'production') {
23
+ // ignoring rules of hooks because this is a condition based on the environment
24
+ // it's safe to ignore the rule
25
+ // eslint-disable-next-line react-hooks/rules-of-hooks
26
+ useWarnIfUnstableAttributes(stringAttributes);
27
+ }
28
+ return _react.useMemo(()=>({
29
+ [_tabster.TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined
30
+ }), // this is safe because the collection of attributes is not expected to change at runtime
26
31
  // eslint-disable-next-line react-hooks/exhaustive-deps
27
- }, stringAttributes);
32
+ stringAttributes);
28
33
  };
29
- function mergeAttributes(a, b) {
30
- if (!b) {
31
- return a;
32
- }
33
- let aParsed = {};
34
- let bParsed = {};
35
- if (a) {
36
- try {
37
- aParsed = JSON.parse(a);
38
- // eslint-disable-next-line no-empty
39
- } catch {}
34
+ /**
35
+ * Merges two JSON strings into one.
36
+ */ const mergeJSONStrings = (a, b)=>JSON.stringify(Object.assign(safelyParseJSON(a), safelyParseJSON(b)));
37
+ /**
38
+ * Tries to parse a JSON string and returns an object.
39
+ * If the JSON string is invalid, an empty object is returned.
40
+ */ const safelyParseJSON = (json)=>{
41
+ try {
42
+ return JSON.parse(json);
43
+ } catch {
44
+ return {};
40
45
  }
41
- if (b) {
42
- try {
43
- bParsed = JSON.parse(b);
44
- // eslint-disable-next-line no-empty
45
- } catch {}
46
+ };
47
+ /**
48
+ * Helper hook that ensures that the attributes passed to the hook are stable.
49
+ * This is necessary because the attributes are expected to not change at runtime.
50
+ *
51
+ * This hook will console.warn if the attributes change at runtime.
52
+ */ const useWarnIfUnstableAttributes = (attributes)=>{
53
+ 'use no memo';
54
+ const initialAttributesRef = _react.useRef(attributes);
55
+ let isStable = initialAttributesRef.current.length === attributes.length;
56
+ if (initialAttributesRef.current !== attributes && isStable) {
57
+ for(let i = 0; i < attributes.length; i++){
58
+ if (initialAttributesRef.current[i] !== attributes[i]) {
59
+ isStable = false;
60
+ break;
61
+ }
62
+ }
46
63
  }
47
- return JSON.stringify({
48
- ...aParsed,
49
- ...bParsed
50
- });
51
- }
64
+ _react.useEffect(()=>{
65
+ if (!isStable) {
66
+ const error = new Error();
67
+ // eslint-disable-next-line no-console
68
+ console.warn(/** #__DE-INDENT__ */ `
69
+ @fluentui/react-tabster [useMergedTabsterAttributes]:
70
+ The attributes passed to the hook changed at runtime.
71
+ This might lead to unexpected behavior, please ensure that the attributes are stable.
72
+ ${error.stack}
73
+ `);
74
+ }
75
+ }, [
76
+ isStable
77
+ ]);
78
+ };
@@ -1 +1 @@
1
- {"version":3,"sources":["useMergeTabsterAttributes.ts"],"sourcesContent":["import * as React from 'react';\nimport { Types, TABSTER_ATTRIBUTE_NAME } from 'tabster';\n\n/**\n * Merges a collection of tabster attributes.\n *\n * ⚠️The attributes passed as arguments to this hook cannot change at runtime.\n * @internal\n * @param attributes - collection of tabster attributes from other react-tabster hooks\n * @returns single merged tabster attribute\n */\nexport const useMergedTabsterAttributes_unstable: (\n ...attributes: Types.TabsterDOMAttribute[]\n) => Types.TabsterDOMAttribute = (...attributes) => {\n 'use no memo';\n\n const stringAttributes = attributes.map(attribute => attribute[TABSTER_ATTRIBUTE_NAME]).filter(Boolean) as string[];\n\n return React.useMemo(() => {\n let attribute = stringAttributes[0];\n attributes.shift();\n\n for (const attr of stringAttributes) {\n attribute = mergeAttributes(attribute, attr);\n }\n\n return { [TABSTER_ATTRIBUTE_NAME]: attribute };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, stringAttributes);\n};\n\nfunction mergeAttributes(a: string, b?: string): string {\n if (!b) {\n return a;\n }\n\n let aParsed = {};\n let bParsed = {};\n if (a) {\n try {\n aParsed = JSON.parse(a);\n // eslint-disable-next-line no-empty\n } catch {}\n }\n\n if (b) {\n try {\n bParsed = JSON.parse(b);\n // eslint-disable-next-line no-empty\n } catch {}\n }\n\n return JSON.stringify({ ...aParsed, ...bParsed });\n}\n"],"names":["useMergedTabsterAttributes_unstable","attributes","stringAttributes","map","attribute","TABSTER_ATTRIBUTE_NAME","filter","Boolean","React","useMemo","shift","attr","mergeAttributes","a","b","aParsed","bParsed","JSON","parse","stringify"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;yBACuB;AAUvC,MAAMA,sCAEoB,CAAC,GAAGC;IACnC;IAEA,MAAMC,mBAAmBD,WAAWE,GAAG,CAACC,CAAAA,YAAaA,SAAS,CAACC,+BAAAA,CAAuB,EAAEC,MAAM,CAACC;IAE/F,OAAOC,OAAMC,OAAO,CAAC;QACnB,IAAIL,YAAYF,gBAAgB,CAAC,EAAE;QACnCD,WAAWS,KAAK;QAEhB,KAAK,MAAMC,QAAQT,iBAAkB;YACnCE,YAAYQ,gBAAgBR,WAAWO;QACzC;QAEA,OAAO;YAAE,CAACN,+BAAAA,CAAuB,EAAED;QAAU;IAC7C,uDAAuD;IACzD,GAAGF;AACL;AAEA,SAASU,gBAAgBC,CAAS,EAAEC,CAAU;IAC5C,IAAI,CAACA,GAAG;QACN,OAAOD;IACT;IAEA,IAAIE,UAAU,CAAC;IACf,IAAIC,UAAU,CAAC;IACf,IAAIH,GAAG;QACL,IAAI;YACFE,UAAUE,KAAKC,KAAK,CAACL;QACrB,oCAAoC;QACtC,EAAE,OAAM,CAAC;IACX;IAEA,IAAIC,GAAG;QACL,IAAI;YACFE,UAAUC,KAAKC,KAAK,CAACJ;QACrB,oCAAoC;QACtC,EAAE,OAAM,CAAC;IACX;IAEA,OAAOG,KAAKE,SAAS,CAAC;QAAE,GAAGJ,OAAO;QAAE,GAAGC,OAAO;IAAC;AACjD"}
1
+ {"version":3,"sources":["useMergeTabsterAttributes.ts"],"sourcesContent":["import * as React from 'react';\nimport { Types, TABSTER_ATTRIBUTE_NAME } from 'tabster';\n\n/**\n * Merges a collection of tabster attributes.\n *\n * ⚠️The attributes passed as arguments to this hook cannot change at runtime.\n * @internal\n * @param attributes - collection of tabster attributes from other react-tabster hooks\n * @returns single merged tabster attribute\n */\nexport const useMergedTabsterAttributes_unstable = (\n ...attributes: Partial<Types.TabsterDOMAttribute>[]\n): Types.TabsterDOMAttribute => {\n 'use no memo';\n\n const stringAttributes = attributes.reduce<string[]>((acc, curr) => {\n if (curr[TABSTER_ATTRIBUTE_NAME]) {\n acc.push(curr[TABSTER_ATTRIBUTE_NAME]);\n }\n return acc;\n }, []);\n\n if (process.env.NODE_ENV !== 'production') {\n // ignoring rules of hooks because this is a condition based on the environment\n // it's safe to ignore the rule\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useWarnIfUnstableAttributes(stringAttributes);\n }\n\n return React.useMemo(\n () => ({\n [TABSTER_ATTRIBUTE_NAME]: stringAttributes.length > 0 ? stringAttributes.reduce(mergeJSONStrings) : undefined,\n }),\n // disable exhaustive-deps because we want to memoize the result of the reduction\n // this is safe because the collection of attributes is not expected to change at runtime\n // eslint-disable-next-line react-hooks/exhaustive-deps\n stringAttributes,\n );\n};\n\n/**\n * Merges two JSON strings into one.\n */\nconst mergeJSONStrings = (a: string, b: string): string =>\n JSON.stringify(Object.assign(safelyParseJSON(a), safelyParseJSON(b)));\n\n/**\n * Tries to parse a JSON string and returns an object.\n * If the JSON string is invalid, an empty object is returned.\n */\nconst safelyParseJSON = (json: string): object => {\n try {\n return JSON.parse(json);\n } catch {\n return {};\n }\n};\n\n/**\n * Helper hook that ensures that the attributes passed to the hook are stable.\n * This is necessary because the attributes are expected to not change at runtime.\n *\n * This hook will console.warn if the attributes change at runtime.\n */\nconst useWarnIfUnstableAttributes = (attributes: string[]) => {\n 'use no memo';\n\n const initialAttributesRef = React.useRef(attributes);\n\n let isStable = initialAttributesRef.current.length === attributes.length;\n if (initialAttributesRef.current !== attributes && isStable) {\n for (let i = 0; i < attributes.length; i++) {\n if (initialAttributesRef.current[i] !== attributes[i]) {\n isStable = false;\n break;\n }\n }\n }\n React.useEffect(() => {\n if (!isStable) {\n const error = new Error();\n // eslint-disable-next-line no-console\n console.warn(/** #__DE-INDENT__ */ `\n @fluentui/react-tabster [useMergedTabsterAttributes]:\n The attributes passed to the hook changed at runtime.\n This might lead to unexpected behavior, please ensure that the attributes are stable.\n ${error.stack}\n `);\n }\n }, [isStable]);\n};\n"],"names":["useMergedTabsterAttributes_unstable","attributes","stringAttributes","reduce","acc","curr","TABSTER_ATTRIBUTE_NAME","push","process","env","NODE_ENV","useWarnIfUnstableAttributes","React","useMemo","length","mergeJSONStrings","undefined","a","b","JSON","stringify","Object","assign","safelyParseJSON","json","parse","initialAttributesRef","useRef","isStable","current","i","useEffect","error","Error","console","warn","stack"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAWaA;;;eAAAA;;;;iEAXU;yBACuB;AAUvC,MAAMA,sCAAsC,CACjD,GAAGC;IAEH;IAEA,MAAMC,mBAAmBD,WAAWE,MAAM,CAAW,CAACC,KAAKC;QACzD,IAAIA,IAAI,CAACC,+BAAAA,CAAuB,EAAE;YAChCF,IAAIG,IAAI,CAACF,IAAI,CAACC,+BAAAA,CAAuB;QACvC;QACA,OAAOF;IACT,GAAG,EAAE;IAEL,IAAII,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,+EAA+E;QAC/E,+BAA+B;QAC/B,sDAAsD;QACtDC,4BAA4BT;IAC9B;IAEA,OAAOU,OAAMC,OAAO,CAClB,IAAO,CAAA;YACL,CAACP,+BAAAA,CAAuB,EAAEJ,iBAAiBY,MAAM,GAAG,IAAIZ,iBAAiBC,MAAM,CAACY,oBAAoBC;QACtG,CAAA,GAEA,yFAAyF;IACzF,uDAAuD;IACvDd;AAEJ;AAEA;;CAEC,GACD,MAAMa,mBAAmB,CAACE,GAAWC,IACnCC,KAAKC,SAAS,CAACC,OAAOC,MAAM,CAACC,gBAAgBN,IAAIM,gBAAgBL;AAEnE;;;CAGC,GACD,MAAMK,kBAAkB,CAACC;IACvB,IAAI;QACF,OAAOL,KAAKM,KAAK,CAACD;IACpB,EAAE,OAAM;QACN,OAAO,CAAC;IACV;AACF;AAEA;;;;;CAKC,GACD,MAAMb,8BAA8B,CAACV;IACnC;IAEA,MAAMyB,uBAAuBd,OAAMe,MAAM,CAAC1B;IAE1C,IAAI2B,WAAWF,qBAAqBG,OAAO,CAACf,MAAM,KAAKb,WAAWa,MAAM;IACxE,IAAIY,qBAAqBG,OAAO,KAAK5B,cAAc2B,UAAU;QAC3D,IAAK,IAAIE,IAAI,GAAGA,IAAI7B,WAAWa,MAAM,EAAEgB,IAAK;YAC1C,IAAIJ,qBAAqBG,OAAO,CAACC,EAAE,KAAK7B,UAAU,CAAC6B,EAAE,EAAE;gBACrDF,WAAW;gBACX;YACF;QACF;IACF;IACAhB,OAAMmB,SAAS,CAAC;QACd,IAAI,CAACH,UAAU;YACb,MAAMI,QAAQ,IAAIC;YAClB,sCAAsC;YACtCC,QAAQC,IAAI,CAAC,mBAAmB,GAAG,CAAC;;;;QAIlC,EAAEH,MAAMI,KAAK,CAAC;MAChB,CAAC;QACH;IACF,GAAG;QAACR;KAAS;AACf"}
@@ -1 +1 @@
1
- {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n useArrowNavigationGroup,\n useFocusableGroup,\n useFocusFinders,\n useFocusVisible,\n useFocusWithin,\n useKeyboardNavAttribute,\n useModalAttributes,\n useTabsterAttributes,\n useObservedElement,\n useFocusObserved,\n useMergedTabsterAttributes_unstable,\n useRestoreFocusSource,\n useRestoreFocusTarget,\n useUncontrolledFocus,\n useOnKeyboardNavigationChange,\n useSetKeyboardNavigation,\n useFocusedElementChange,\n} from './hooks/index';\nexport type {\n UseArrowNavigationGroupOptions,\n UseFocusableGroupOptions,\n UseModalAttributesOptions,\n} from './hooks/index';\n\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\n\nexport type {\n CreateCustomFocusIndicatorStyleOptions,\n CreateFocusOutlineStyleOptions,\n FocusOutlineOffset,\n FocusOutlineStyleOptions,\n} from './focus/index';\n\nexport { applyFocusVisiblePolyfill } from './focus/index';\nimport {\n type Types,\n type EventsTypes,\n dispatchGroupperMoveFocusEvent,\n dispatchMoverMoveFocusEvent,\n MoverMoveFocusEventName,\n MoverMoveFocusEvent,\n MoverKeys,\n GroupperMoveFocusEventName,\n GroupperMoveFocusEvent,\n GroupperMoveFocusActions,\n MoverMemorizedElementEventName,\n MoverMemorizedElementEvent,\n TabsterMoveFocusEventName,\n TabsterMoveFocusEvent,\n} from 'tabster';\n\nexport type TabsterDOMAttribute = Types.TabsterDOMAttribute;\n\nexport type { KeyborgFocusInEvent } from 'keyborg';\nexport { KEYBORG_FOCUSIN } from 'keyborg';\n\n// WARNING! ATTENTION! Tabster.Types was exported from here by mistake. To avoid breaking changes,\n// we are putting a snapshot of Tabster.Types@6.0.1 and marking the entire export as deprecated.\nimport * as TabsterTypes6_0_1_DoNotUse from './tabster-types-6.0.1-do-not-use';\nexport {\n /** @deprecated (Do not use! Exposed by mistake and will be removed in the next major version.) */\n TabsterTypes6_0_1_DoNotUse as TabsterTypes,\n /** @deprecated Use element.dispatchEvent(new GroupperMoveFocusEvent({ action: GroupperMoveFocusActions.Escape })) */\n // eslint-disable-next-line deprecation/deprecation\n dispatchGroupperMoveFocusEvent,\n /** @deprecated Use element.dispatchEvent(new MoverMoveFocusEvent({ key: MoverKeys.ArrowDown })) */\n // eslint-disable-next-line deprecation/deprecation\n dispatchMoverMoveFocusEvent,\n};\n\n/**\n * For all exports below, we don't do wildcard exports to keep Tabster API flexible. We export only required\n * parts when they are needed.\n */\n\nexport { MoverMoveFocusEventName, MoverMoveFocusEvent, MoverKeys };\nexport type MoverMoveFocusEventDetail = EventsTypes.MoverMoveFocusEventDetail;\n\nexport { GroupperMoveFocusEventName, GroupperMoveFocusEvent, GroupperMoveFocusActions };\nexport type GroupperMoveFocusEventDetail = EventsTypes.GroupperMoveFocusEventDetail;\n\nexport { MoverMemorizedElementEventName, MoverMemorizedElementEvent };\nexport type MoverMemorizedElementEventDetail = EventsTypes.MoverMemorizedElementEventDetail;\n\nexport { TabsterMoveFocusEventName, TabsterMoveFocusEvent };\nexport type TabsterMoveFocusEventDetail = EventsTypes.TabsterMoveFocusEventDetail;\n"],"names":["GroupperMoveFocusActions","GroupperMoveFocusEvent","GroupperMoveFocusEventName","KEYBORG_FOCUSIN","MoverKeys","MoverMemorizedElementEvent","MoverMemorizedElementEventName","MoverMoveFocusEvent","MoverMoveFocusEventName","TabsterMoveFocusEvent","TabsterMoveFocusEventName","TabsterTypes","TabsterTypes6_0_1_DoNotUse","applyFocusVisiblePolyfill","createCustomFocusIndicatorStyle","createFocusOutlineStyle","dispatchGroupperMoveFocusEvent","dispatchMoverMoveFocusEvent","useArrowNavigationGroup","useFocusFinders","useFocusObserved","useFocusVisible","useFocusWithin","useFocusableGroup","useFocusedElementChange","useKeyboardNavAttribute","useMergedTabsterAttributes_unstable","useModalAttributes","useObservedElement","useOnKeyboardNavigationChange","useRestoreFocusSource","useRestoreFocusTarget","useSetKeyboardNavigation","useTabsterAttributes","useUncontrolledFocus"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IA+E6DA,wBAAwB;eAAxBA,iCAAwB;;IAAhDC,sBAAsB;eAAtBA,+BAAsB;;IAAlDC,0BAA0B;eAA1BA,mCAA0B;;IAxB1BC,eAAe;eAAfA,wBAAe;;IAqB+BC,SAAS;eAATA,kBAAS;;IAMvBC,0BAA0B;eAA1BA,mCAA0B;;IAA1DC,8BAA8B;eAA9BA,uCAA8B;;IANLC,mBAAmB;eAAnBA,4BAAmB;;IAA5CC,uBAAuB;eAAvBA,gCAAuB;;IASIC,qBAAqB;eAArBA,8BAAqB;;IAAhDC,yBAAyB;eAAzBA,kCAAyB;;IAvBFC,YAAY;eAA1CC;;IA5BOC,yBAAyB;eAAzBA,iCAAyB;;IATzBC,+BAA+B;eAA/BA,uCAA+B;;IAAEC,uBAAuB;eAAvBA,+BAAuB;;IAsC/D,mHAAmH,GAEnHC,8BAA8B;eAA9BA,uCAA8B;;IAC9B,iGAAiG,GAEjGC,2BAA2B;eAA3BA,oCAA2B;;IAnE3BC,uBAAuB;eAAvBA,8BAAuB;;IAEvBC,eAAe;eAAfA,sBAAe;;IAOfC,gBAAgB;eAAhBA,uBAAgB;;IANhBC,eAAe;eAAfA,sBAAe;;IACfC,cAAc;eAAdA,qBAAc;;IAHdC,iBAAiB;eAAjBA,wBAAiB;;IAejBC,uBAAuB;eAAvBA,8BAAuB;;IAXvBC,uBAAuB;eAAvBA,8BAAuB;;IAKvBC,mCAAmC;eAAnCA,0CAAmC;;IAJnCC,kBAAkB;eAAlBA,yBAAkB;;IAElBC,kBAAkB;eAAlBA,yBAAkB;;IAMlBC,6BAA6B;eAA7BA,oCAA6B;;IAH7BC,qBAAqB;eAArBA,4BAAqB;;IACrBC,qBAAqB;eAArBA,4BAAqB;;IAGrBC,wBAAwB;eAAxBA,+BAAwB;;IARxBC,oBAAoB;eAApBA,2BAAoB;;IAMpBC,oBAAoB;eAApBA,2BAAoB;;;;uBAIf;wBAOkE;yBAyBlE;yBAKyB;mFAIY"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export {\n useArrowNavigationGroup,\n useFocusableGroup,\n useFocusFinders,\n useFocusVisible,\n useFocusWithin,\n useKeyboardNavAttribute,\n useModalAttributes,\n useTabsterAttributes,\n useObservedElement,\n useFocusObserved,\n useMergedTabsterAttributes_unstable,\n useRestoreFocusSource,\n useRestoreFocusTarget,\n useUncontrolledFocus,\n useOnKeyboardNavigationChange,\n useSetKeyboardNavigation,\n useFocusedElementChange,\n} from './hooks/index';\nexport type {\n UseArrowNavigationGroupOptions,\n UseFocusableGroupOptions,\n UseModalAttributesOptions,\n} from './hooks/index';\n\nexport { createCustomFocusIndicatorStyle, createFocusOutlineStyle } from './focus/index';\n\nexport type {\n CreateCustomFocusIndicatorStyleOptions,\n CreateFocusOutlineStyleOptions,\n FocusOutlineOffset,\n FocusOutlineStyleOptions,\n} from './focus/index';\n\nexport { applyFocusVisiblePolyfill } from './focus/index';\nimport {\n type Types,\n type EventsTypes,\n dispatchGroupperMoveFocusEvent,\n dispatchMoverMoveFocusEvent,\n MoverMoveFocusEventName,\n MoverMoveFocusEvent,\n MoverKeys,\n GroupperMoveFocusEventName,\n GroupperMoveFocusEvent,\n GroupperMoveFocusActions,\n MoverMemorizedElementEventName,\n MoverMemorizedElementEvent,\n TabsterMoveFocusEventName,\n TabsterMoveFocusEvent,\n} from 'tabster';\n\nexport type TabsterDOMAttribute = Types.TabsterDOMAttribute;\n\nexport type { KeyborgFocusInEvent } from 'keyborg';\nexport { KEYBORG_FOCUSIN } from 'keyborg';\n\n// WARNING! ATTENTION! Tabster.Types was exported from here by mistake. To avoid breaking changes,\n// we are putting a snapshot of Tabster.Types@6.0.1 and marking the entire export as deprecated.\n// eslint-disable-next-line @typescript-eslint/naming-convention\nimport * as TabsterTypes6_0_1_DoNotUse from './tabster-types-6.0.1-do-not-use';\nexport {\n /** @deprecated (Do not use! Exposed by mistake and will be removed in the next major version.) */\n TabsterTypes6_0_1_DoNotUse as TabsterTypes,\n /** @deprecated Use element.dispatchEvent(new GroupperMoveFocusEvent({ action: GroupperMoveFocusActions.Escape })) */\n // eslint-disable-next-line deprecation/deprecation\n dispatchGroupperMoveFocusEvent,\n /** @deprecated Use element.dispatchEvent(new MoverMoveFocusEvent({ key: MoverKeys.ArrowDown })) */\n // eslint-disable-next-line deprecation/deprecation\n dispatchMoverMoveFocusEvent,\n};\n\n/**\n * For all exports below, we don't do wildcard exports to keep Tabster API flexible. We export only required\n * parts when they are needed.\n */\n\nexport { MoverMoveFocusEventName, MoverMoveFocusEvent, MoverKeys };\nexport type MoverMoveFocusEventDetail = EventsTypes.MoverMoveFocusEventDetail;\n\nexport { GroupperMoveFocusEventName, GroupperMoveFocusEvent, GroupperMoveFocusActions };\nexport type GroupperMoveFocusEventDetail = EventsTypes.GroupperMoveFocusEventDetail;\n\nexport { MoverMemorizedElementEventName, MoverMemorizedElementEvent };\nexport type MoverMemorizedElementEventDetail = EventsTypes.MoverMemorizedElementEventDetail;\n\nexport { TabsterMoveFocusEventName, TabsterMoveFocusEvent };\nexport type TabsterMoveFocusEventDetail = EventsTypes.TabsterMoveFocusEventDetail;\n"],"names":["GroupperMoveFocusActions","GroupperMoveFocusEvent","GroupperMoveFocusEventName","KEYBORG_FOCUSIN","MoverKeys","MoverMemorizedElementEvent","MoverMemorizedElementEventName","MoverMoveFocusEvent","MoverMoveFocusEventName","TabsterMoveFocusEvent","TabsterMoveFocusEventName","TabsterTypes","TabsterTypes6_0_1_DoNotUse","applyFocusVisiblePolyfill","createCustomFocusIndicatorStyle","createFocusOutlineStyle","dispatchGroupperMoveFocusEvent","dispatchMoverMoveFocusEvent","useArrowNavigationGroup","useFocusFinders","useFocusObserved","useFocusVisible","useFocusWithin","useFocusableGroup","useFocusedElementChange","useKeyboardNavAttribute","useMergedTabsterAttributes_unstable","useModalAttributes","useObservedElement","useOnKeyboardNavigationChange","useRestoreFocusSource","useRestoreFocusTarget","useSetKeyboardNavigation","useTabsterAttributes","useUncontrolledFocus"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAgF6DA,wBAAwB;eAAxBA,iCAAwB;;IAAhDC,sBAAsB;eAAtBA,+BAAsB;;IAAlDC,0BAA0B;eAA1BA,mCAA0B;;IAzB1BC,eAAe;eAAfA,wBAAe;;IAsB+BC,SAAS;eAATA,kBAAS;;IAMvBC,0BAA0B;eAA1BA,mCAA0B;;IAA1DC,8BAA8B;eAA9BA,uCAA8B;;IANLC,mBAAmB;eAAnBA,4BAAmB;;IAA5CC,uBAAuB;eAAvBA,gCAAuB;;IASIC,qBAAqB;eAArBA,8BAAqB;;IAAhDC,yBAAyB;eAAzBA,kCAAyB;;IAvBFC,YAAY;eAA1CC;;IA7BOC,yBAAyB;eAAzBA,iCAAyB;;IATzBC,+BAA+B;eAA/BA,uCAA+B;;IAAEC,uBAAuB;eAAvBA,+BAAuB;;IAuC/D,mHAAmH,GAEnHC,8BAA8B;eAA9BA,uCAA8B;;IAC9B,iGAAiG,GAEjGC,2BAA2B;eAA3BA,oCAA2B;;IApE3BC,uBAAuB;eAAvBA,8BAAuB;;IAEvBC,eAAe;eAAfA,sBAAe;;IAOfC,gBAAgB;eAAhBA,uBAAgB;;IANhBC,eAAe;eAAfA,sBAAe;;IACfC,cAAc;eAAdA,qBAAc;;IAHdC,iBAAiB;eAAjBA,wBAAiB;;IAejBC,uBAAuB;eAAvBA,8BAAuB;;IAXvBC,uBAAuB;eAAvBA,8BAAuB;;IAKvBC,mCAAmC;eAAnCA,0CAAmC;;IAJnCC,kBAAkB;eAAlBA,yBAAkB;;IAElBC,kBAAkB;eAAlBA,yBAAkB;;IAMlBC,6BAA6B;eAA7BA,oCAA6B;;IAH7BC,qBAAqB;eAArBA,4BAAqB;;IACrBC,qBAAqB;eAArBA,4BAAqB;;IAGrBC,wBAAwB;eAAxBA,+BAAwB;;IARxBC,oBAAoB;eAApBA,2BAAoB;;IAMpBC,oBAAoB;eAApBA,2BAAoB;;;;uBAIf;wBAOkE;yBAyBlE;yBAKyB;mFAKY"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-tabster",
3
- "version": "9.22.3",
3
+ "version": "9.22.5",
4
4
  "description": "Utilities for focus management and facade for tabster",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",