Files
NapCatQQ/.pnpm-store/v3/files/62/1529fb091f0b107c8f67d79bad07b8a194aa216affdcadd8e06c2111cd135e638daa630b3fb940741addf4f4b4d2c7f5112fcb3d99b7f7ed91976feedb5186
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

1 line
5.2 KiB
Plaintext

{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAkBM,SAAS,wCAAkC,KAA6B;QAIvD,2BAAA;IAHtB,IAAI,QAAQ,CAAA,GAAA,+BAAuB,EAAK;QACtC,GAAG,KAAK;QACR,0BAA0B;QAC1B,oBAAoB,CAAA,OAAA,CAAA,4BAAA,MAAM,kBAAkB,cAAxB,uCAAA,4BAA4B,6CAAuB,MAAM,UAAU,EAAE,MAAM,YAAY,GAAG,IAAI,IAAI,MAAM,YAAY,IAAI,IAAI,oBAA5H,kBAAA,OAAsI;IAC5J;IAEA,IAAI,oBACF,gBAAgB,cAChB,UAAU,EACV,aAAa,kBAAkB,EAChC,GAAG;IAEJ,IAAI,kBAAkB,CAAA,GAAA,aAAK,EAAE;IAC7B,CAAA,GAAA,gBAAQ,EAAE;QACR,0HAA0H;QAC1H,IAAI,cAAc;QAClB,IAAI,iBAAiB,OAAO,IAAI,eAAe,QAAQ,CAAC,WAAW,OAAO,CAAC,cAAc;YACvF,cAAc,6CAAuB,YAAY,MAAM,YAAY;YACnE,IAAI,eAAe,MACjB,uFAAuF;YACvF,iBAAiB,eAAe,CAAC;gBAAC;aAAY;QAElD;QAEA,2JAA2J;QAC3J,IAAI,eAAe,QAAQ,iBAAiB,UAAU,IAAI,QAAS,CAAC,iBAAiB,SAAS,IAAI,gBAAgB,gBAAgB,OAAO,EACvI,iBAAiB,aAAa,CAAC;QAEjC,gBAAgB,OAAO,GAAG;IAC5B;IAEA,OAAO;QACL,GAAG,KAAK;QACR,YAAY,MAAM,UAAU,IAAI;IAClC;AACF;AAEA,SAAS,6CAA0B,UAA2C,EAAE,YAAsB;IACpG,IAAI,cAA0B;IAC9B,IAAI,YAAY;YAGkD,2BAAA,qBAIH,4BAAA;QAN7D,cAAc,WAAW,WAAW;QACpC,uEAAuE;QACvE,MAAO,eAAe,QAAS,CAAA,aAAa,GAAG,CAAC,kBAAgB,sBAAA,WAAW,OAAO,CAAC,0BAAnB,2CAAA,4BAAA,oBAAiC,KAAK,cAAtC,gDAAA,0BAAwC,UAAU,CAAD,KAAM,gBAAgB,WAAW,UAAU,GAC1J,cAAc,WAAW,WAAW,CAAC;QAEvC,oHAAoH;QACpH,IAAI,eAAe,QAAS,CAAA,aAAa,GAAG,CAAC,kBAAgB,uBAAA,WAAW,OAAO,CAAC,0BAAnB,4CAAA,6BAAA,qBAAiC,KAAK,cAAtC,iDAAA,2BAAwC,UAAU,CAAD,KAAM,gBAAgB,WAAW,UAAU,IACvJ,cAAc,WAAW,WAAW;IAExC;IAEA,OAAO;AACT","sources":["packages/@react-stately/tabs/src/useTabListState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Collection, CollectionStateBase, Key, Node} from '@react-types/shared';\nimport {SingleSelectListState, useSingleSelectListState} from '@react-stately/list';\nimport {TabListProps} from '@react-types/tabs';\nimport {useEffect, useRef} from 'react';\n\nexport interface TabListStateOptions<T> extends Omit<TabListProps<T>, 'children'>, CollectionStateBase<T> {}\n\nexport interface TabListState<T> extends SingleSelectListState<T> {\n /** Whether the tab list is disabled. */\n isDisabled: boolean\n}\n\n/**\n * Provides state management for a Tabs component. Tabs include a TabList which tracks\n * which tab is currently selected and displays the content associated with that Tab in a TabPanel.\n */\nexport function useTabListState<T extends object>(props: TabListStateOptions<T>): TabListState<T> {\n let state = useSingleSelectListState<T>({\n ...props,\n suppressTextValueWarning: true,\n defaultSelectedKey: props.defaultSelectedKey ?? findDefaultSelectedKey(props.collection, props.disabledKeys ? new Set(props.disabledKeys) : new Set()) ?? undefined\n });\n\n let {\n selectionManager,\n collection,\n selectedKey: currentSelectedKey\n } = state;\n\n let lastSelectedKey = useRef(currentSelectedKey);\n useEffect(() => {\n // Ensure a tab is always selected (in case no selected key was specified or if selected item was deleted from collection)\n let selectedKey = currentSelectedKey;\n if (selectionManager.isEmpty || selectedKey == null || !collection.getItem(selectedKey)) {\n selectedKey = findDefaultSelectedKey(collection, state.disabledKeys);\n if (selectedKey != null) {\n // directly set selection because replace/toggle selection won't consider disabled keys\n selectionManager.setSelectedKeys([selectedKey]);\n }\n }\n\n // If the tablist doesn't have focus and the selected key changes or if there isn't a focused key yet, change focused key to the selected key if it exists.\n if (selectedKey != null && selectionManager.focusedKey == null || (!selectionManager.isFocused && selectedKey !== lastSelectedKey.current)) {\n selectionManager.setFocusedKey(selectedKey);\n }\n lastSelectedKey.current = selectedKey;\n });\n\n return {\n ...state,\n isDisabled: props.isDisabled || false\n };\n}\n\nfunction findDefaultSelectedKey<T>(collection: Collection<Node<T>> | undefined, disabledKeys: Set<Key>) {\n let selectedKey: Key | null = null;\n if (collection) {\n selectedKey = collection.getFirstKey();\n // loop over tabs until we find one that isn't disabled and select that\n while (selectedKey != null && (disabledKeys.has(selectedKey) || collection.getItem(selectedKey)?.props?.isDisabled) && selectedKey !== collection.getLastKey()) {\n selectedKey = collection.getKeyAfter(selectedKey);\n }\n // if this check is true, then every item is disabled, it makes more sense to default to the first key than the last\n if (selectedKey != null && (disabledKeys.has(selectedKey) || collection.getItem(selectedKey)?.props?.isDisabled) && selectedKey === collection.getLastKey()) {\n selectedKey = collection.getFirstKey();\n }\n }\n\n return selectedKey;\n}\n"],"names":[],"version":3,"file":"useTabListState.module.js.map"}