diff --git a/website/docs/library/access/Owner/Data/OwnerDataFacet.mdx b/website/docs/library/access/Owner/Data/OwnerDataFacet.mdx new file mode 100644 index 00000000..22553f72 --- /dev/null +++ b/website/docs/library/access/Owner/Data/OwnerDataFacet.mdx @@ -0,0 +1,94 @@ +--- +sidebar_position: 100 +title: "Owner Data Facet" +description: "ERC-173 read-only owner data access for diamonds" +sidebar_label: "Facet" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/Data/OwnerDataFacet.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Badge from '@site/src/components/ui/Badge'; +import Callout from '@site/src/components/ui/Callout'; +import CalloutBox from '@site/src/components/ui/CalloutBox'; +import Accordion, { AccordionGroup } from '@site/src/components/ui/Accordion'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import CodeShowcase from '@site/src/components/code/CodeShowcase'; +import RelatedDocs from '@site/src/components/docs/RelatedDocs'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import ReadingTime from '@site/src/components/docs/ReadingTime'; +import GradientText from '@site/src/components/ui/GradientText'; +import GradientButton from '@site/src/components/ui/GradientButton'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Read-only Owner data access for diamonds + + + +- Exposes the contract owner via external `owner()`. +- Shares `OwnerStorage` at `erc8042:erc173.owner` with `OwnerDataMod` and other Ownership facets. +- Read-Only facet + + +## Storage + +### State Variables + + + +### OwnerStorage + + + +{`/** storage-location: erc8042:erc173.owner */ +struct OwnerStorage { + address owner; +}`} + + +## Functions + +### owner + +Returns the address of the diamond owner + + +{`function owner() external view returns (address);`} + + +**Returns:** + + + + + +## Best Practices + +- Transfer ownership with a facet that uses `OwnerDataMod` (for example `OwnerTransferFacet`) so `owner()` always reflects the real owner. +- Avoid defining a second facet that writes to a different owner slot; keep all -owner state at `erc173.owner` +- Use [`setContractOwner()`](/docs/library/access/Owner/Data/OwnerDataMod#setcontractowner) in `OwnerDataMod` to initialize the owner when constructing your diamond. + + + diff --git a/website/docs/library/access/Owner/Data/OwnerDataMod.mdx b/website/docs/library/access/Owner/Data/OwnerDataMod.mdx new file mode 100644 index 00000000..d5b67935 --- /dev/null +++ b/website/docs/library/access/Owner/Data/OwnerDataMod.mdx @@ -0,0 +1,215 @@ +--- +sidebar_position: 110 +title: "Owner Data Module" +description: "ERC-173 diamond storage, owner reads, guards, and initial owner setup" +sidebar_label: "Module" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/Data/OwnerDataMod.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Badge from '@site/src/components/ui/Badge'; +import Callout from '@site/src/components/ui/Callout'; +import CalloutBox from '@site/src/components/ui/CalloutBox'; +import Accordion, { AccordionGroup } from '@site/src/components/ui/Accordion'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import CodeShowcase from '@site/src/components/code/CodeShowcase'; +import RelatedDocs from '@site/src/components/docs/RelatedDocs'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import ReadingTime from '@site/src/components/docs/ReadingTime'; +import GradientText from '@site/src/components/ui/GradientText'; +import GradientButton from '@site/src/components/ui/GradientButton'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Helper functions for owner storage, reads, and owner check based on ERC-173 + + + +- `requireOwner()` guards by requiring `msg.sender` is the stored owner. +- `setContractOwner` has no access control validation (Trusted initialization only). +- Emits `OwnershipTransferred` from `setContractOwner` with `previousOwner == address(0)`. + + + +You can use modules to wrap around you own project logic while using the default Compose building blocks. Modules provides all the necessary internal helpers for maximum integration. + +See Facets & Modules for more information. + + + +## Storage + +### State Variables + + + +### OwnerStorage + + +{`/** storage-location: erc8042:erc173.owner */ +struct OwnerStorage { + address owner; +}`} + + +## Functions + +### getStorage + +Returns a pointer to the `OwnerStorage` struct. + + +{`function getStorage() pure returns (OwnerStorage storage s);`} + + +**Returns:** + + + +--- +### owner + +Get the address of the owner + + +{`function owner() view returns (address);`} + + +**Returns:** + + + +--- +### requireOwner + +Verify if the message sender is the current diamond owner. Useful for gating specify logic inside your own facets. + + +{`function requireOwner() view;`} + + +**Reverts:** + + + +--- +### setContractOwner + +Writes the inital owner address to storage and emits `OwnershipTransferred(address(0), _initialOwner)`. + +There is **no** `msg.sender` or role check performed. Use only from trusted initialization code, or wrap with your own checks in a facet. + + +{`function setContractOwner(address _initialOwner);`} + + +**Parameters:** + + + +## Events + + + +
+ Emitted when the ownership changes. `setContractOwner` always uses `previousOwner == address(0)`. Transfer facets typically emit with the real previous owner. +
+ +
+ Signature: + +{`event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);`} + +
+ +
+
+ +## Errors + + + +
+ Thrown by `requireOwner` when `msg.sender` is not the curent owner. Other owner facets may also revert with this error. +
+
+ Signature: + +error OwnerUnauthorizedAccount(); + +
+
+ +
+ Declared here for shared use (for example renounce flows). This module does not reference it; companion facets may revert with it when ownership was already renounced. +
+
+ Signature: + +error OwnerAlreadyRenounced(); + +
+
+
+ +## Best Practices + +- Call `setContractOwner` only from trusted init paths (constructor, one-off setup). For transfers, use `OwnerTransferMod.transferOwnership` or an equivalent facet so events record the real previous owner. +- Guard external entrypoints with `requireOwner()` or equivalent before state changes restricted to the owner. + +## Integration Notes + +`OwnerStorage` is located at `keccak256("erc173.owner")` inside the diamond. + +All Compose Owner contracts use that slot, so `owner()` and transfer logic observe the same address. + + diff --git a/website/docs/library/access/Owner/Data/_category_.json b/website/docs/library/access/Owner/Data/_category_.json new file mode 100644 index 00000000..162c765c --- /dev/null +++ b/website/docs/library/access/Owner/Data/_category_.json @@ -0,0 +1,6 @@ +{ + "label": "Data", + "position": 99, + "collapsible": true, + "collapsed": true +} diff --git a/website/docs/library/access/Owner/Renounce/OwnerRenounceFacet.mdx b/website/docs/library/access/Owner/Renounce/OwnerRenounceFacet.mdx new file mode 100644 index 00000000..574372ae --- /dev/null +++ b/website/docs/library/access/Owner/Renounce/OwnerRenounceFacet.mdx @@ -0,0 +1,131 @@ +--- +sidebar_position: 100 +title: "Owner Renounce Facet" +description: "ERC-173 renounce ownership for Compose diamonds" +sidebar_label: "Facet" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/Renounce/OwnerRenounceFacet.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Badge from '@site/src/components/ui/Badge'; +import Callout from '@site/src/components/ui/Callout'; +import CalloutBox from '@site/src/components/ui/CalloutBox'; +import Accordion, { AccordionGroup } from '@site/src/components/ui/Accordion'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import CodeShowcase from '@site/src/components/code/CodeShowcase'; +import RelatedDocs from '@site/src/components/docs/RelatedDocs'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import ReadingTime from '@site/src/components/docs/ReadingTime'; +import GradientText from '@site/src/components/ui/GradientText'; +import GradientButton from '@site/src/components/ui/GradientButton'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Renounce the ownership of your diamonds + + +## Storage + +### State Variables + + + +### OwnerStorage + + +{`/** storage-location erc8042:erc173.owner */ +struct OwnerStorage { + address owner; +}`} + + +## Functions + +### renounceOwnership + +Sets the Owner to `address(0)` if call by the current owner; otherwise reverts `OwnerUnauthorizedAccount`. + +After this call succeeds, owner-only operations that rely on the owner should no longer work. This action is irreversible. + + +{`function renounceOwnership() external;`} + + + + +## Events + + + + +
+ Emitted after a successful renounce with `newOwner == address(0)`. +
+ +
+ Signature: + +{`event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);`} + +
+ +
+
+ +## Errors + + + + +
+ Signature: + +{`error OwnerUnauthorizedAccount();`} + +
+
+
+ + + + + +## Security Considerations + +Renouncement is irreversible in storage: once `owner` is zeroed, there is no way to rollback this action. This is useful when you are done modifing your diamond and want to make it immutable. + +If you need extra security, you can use the [`TwoSteps` Ownership](../TwoSteps) module, which permit the owner to set a pending owner address before renouncing. + + diff --git a/website/docs/library/access/Owner/Renounce/OwnerRenounceMod.mdx b/website/docs/library/access/Owner/Renounce/OwnerRenounceMod.mdx new file mode 100644 index 00000000..8f983c26 --- /dev/null +++ b/website/docs/library/access/Owner/Renounce/OwnerRenounceMod.mdx @@ -0,0 +1,159 @@ +--- +sidebar_position: 110 +title: "Owner Renounce Module" +description: "ERC-173 renounce ownership helpers for diamond facets" +sidebar_label: "Module" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/Renounce/OwnerRenounceMod.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Badge from '@site/src/components/ui/Badge'; +import Callout from '@site/src/components/ui/Callout'; +import CalloutBox from '@site/src/components/ui/CalloutBox'; +import Accordion, { AccordionGroup } from '@site/src/components/ui/Accordion'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import CodeShowcase from '@site/src/components/code/CodeShowcase'; +import RelatedDocs from '@site/src/components/docs/RelatedDocs'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import ReadingTime from '@site/src/components/docs/ReadingTime'; +import GradientText from '@site/src/components/ui/GradientText'; +import GradientButton from '@site/src/components/ui/GradientButton'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Helper functions for renouncing ownership and storage access. + + + +- `renounceOwnership` guards by requiring `msg.sender` is the current owner. +- Emits `OwnershipTransferred` with `newOwner == address(0)`. + + + +Import this module into facets or shared setup code. See Facets & Modules for more information. + + +## Storage + +### State Variables + + + +### OwnerStorage + + +{`/** @custom:storage-location erc8042:erc173.owner */ +struct OwnerStorage { + address owner; +}`} + + +## Functions + +### getStorage + +Returns a pointer to the `OwnerStorage` struct. + + +{`function getStorage() pure returns (OwnerStorage storage s);`} + + +**Returns:** + + + +--- + +### renounceOwnership + +Internal renounce path: requires `msg.sender` to be the current owner before setting the owner to `address(0)` + + +{`function renounceOwnership();`} + + +## Events + + + +
+ Emitted when the stored owner changes. After `renounceOwnership`, `newOwner` is `address(0)`. +
+ +
+ Signature: + +{`event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);`} + +
+ +
+
+ +## Errors + + + +
+ Thrown when `msg.sender` is not the stored owner during `renounceOwnership`. +
+
+ Signature: + +{`error OwnerUnauthorizedAccount();`} + +
+
+
+ + + + +## Best Practices + +- Call `renounceOwnership` only from a trusted `external` wrapper after you intend to give up owner control permanently. +- Keep the same `STORAGE_POSITION` and `OwnerStorage` layout as other owner modules; do not fork a second owner slot. + +## Integration Notes + +`OwnerStorage` lives at `keccak256("erc173.owner")` inside the diamond. The same slot as `OwnerDataMod`, `OwnerDataFacet`, and `OwnerRenounceFacet`. Renouncing here updates what `owner()` reads elsewhere. + + diff --git a/website/docs/library/access/Owner/Renounce/_category_.json b/website/docs/library/access/Owner/Renounce/_category_.json new file mode 100644 index 00000000..deaf11e2 --- /dev/null +++ b/website/docs/library/access/Owner/Renounce/_category_.json @@ -0,0 +1,6 @@ +{ + "label": "Renounce", + "position": 99, + "collapsible": true, + "collapsed": true +} diff --git a/website/docs/library/access/Owner/Transfer/OwnerTransferFacet.mdx b/website/docs/library/access/Owner/Transfer/OwnerTransferFacet.mdx new file mode 100644 index 00000000..525a8938 --- /dev/null +++ b/website/docs/library/access/Owner/Transfer/OwnerTransferFacet.mdx @@ -0,0 +1,130 @@ +--- +sidebar_position: 100 +title: "Owner Transfer Facet" +description: "ERC-173 ownership transfer for Compose diamonds" +sidebar_label: "Facet" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/Transfer/OwnerTransferFacet.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Callout from '@site/src/components/ui/Callout'; +import Accordion, { AccordionGroup } from '@site/src/components/ui/Accordion'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Transfer your diamonds ownership + + + +- `transferOwnership` writes into the `OwnerStorage` at `erc8042:erc173.owner`. +- `_newOwner` may be `address(0)` to clear ownership. (Similar to `renounceOwnership`) +- Transfers require the caller to be the curent owner + + +## Storage + +### State Variables + + + +### OwnerStorage + + +{`/** @custom:storage-location erc8042:erc173.owner */ +struct OwnerStorage { + address owner; +}`} + + +## Functions + +### transferOwnership + +Change the contract ownership to the `_newOwner` address. + +You can replicate the renouncement by setting the new owner to `address(0)`. This action is irreversible. + + +{`function transferOwnership(address _newOwner) external;`} + + +**Parameters:** + + + +## Events + + + + +
+ Emitted after a successful transfer, including when `_newOwner` is `address(0)`. +
+ +
+ Signature: + +{`event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);`} + +
+ +
+
+ +## Errors + + + + +
+ Ownership transfers require that the `msg.sender` is the current owner +
+ +
+ Signature: + +{`error OwnerUnauthorizedAccount();`} + +
+
+
+ + +## Best Practices + +- Initialize `OwnerStorage.owner` during deployment (or via a one-time setup) before relying on owner-only features elsewhere. +- Confirm `_newOwner` is the intended address; transfers are immediate and cannot be reverse. +- Keep owner state in a single slot: do not add another facet that writes a second “owner” elsewhere. Except id dual ownership is intend. +- If you need two-step acceptance or pending-owner flows, consider the Two Steps ownership utilities in addition to this facet. + +## Security Considerations + +`transferOwnership` is restricted to the address currently stored as owner (`msg.sender == s.owner`). The facet does not implement any additional role system. + +The main risks are **social** and **operational**: transferring to the wrong address, or setting `_newOwner` to `address(0)` when you did not intend to remove all owner control. + + diff --git a/website/docs/library/access/Owner/Transfer/OwnerTransferMod.mdx b/website/docs/library/access/Owner/Transfer/OwnerTransferMod.mdx new file mode 100644 index 00000000..f10aa56a --- /dev/null +++ b/website/docs/library/access/Owner/Transfer/OwnerTransferMod.mdx @@ -0,0 +1,166 @@ +--- +sidebar_position: 110 +title: "Owner Transfer Module" +description: "ERC-173 ownership transfer helpers for diamond facets" +sidebar_label: "Module" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/Transfer/OwnerTransferMod.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Callout from '@site/src/components/ui/Callout'; +import Accordion, { AccordionGroup } from '@site/src/components/ui/Accordion'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Helper functions for ownership transfer and storage access. + + + +- `transferOwnership` guards by requiring `msg.sender` is the current owner. +- Emits `OwnershipTransferred` on successful transfers. + + + +Use helper functions from Compose using your own custom facets. See Facets & Modules for more information. + + +## Storage + +### State Variables + + + +### OwnerStorage + + +{`/** @custom:storage-location erc8042:erc173.owner */ +struct OwnerStorage { + address owner; +}`} + + +## Functions + +### getStorage + +Returns a pointer to the `OwnerStorage` struct. + + +{`function getStorage() pure returns (OwnerStorage storage s);`} + + +**Returns:** + + + +--- + +### transferOwnership + +Transfer the diamond ownership from the current owner to the next one. Caller must be the current owner. + +`_newOwner` may be `address(0)` to clear ownership (same storage effect as `renounceOwnership()` in [`OwnerRenounceMod`](/docs/library/access/Owner/Renounce/OwnerRenounceMod)). + + +{`function transferOwnership(address _newOwner);`} + + +**Parameters:** + + + +## Events + + + +
+ Emitted when the stored owner changes (including when `_newOwner` is `address(0)`). +
+ +
+ Signature: + +{`event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);`} + +
+ +
+
+ +## Errors + + + +
+ Thrown when `msg.sender` is not the stored owner during `transferOwnership`. +
+
+ Signature: + +{`error OwnerUnauthorizedAccount();`} + +
+
+
+ + + + +## Best Practices + +- Call `transferOwnership` only from trusted `external` wrappers; confirm `_newOwner` before sending a transaction. +- Keep the same `STORAGE_POSITION` and `OwnerStorage` layout as other owner modules; do not introduce a second owner slot. +- If you want a dedicated renounce entrypoint in Solidity, prefer [`OwnerRenounceMod`](/docs/library/access/Owner/Renounce/OwnerRenounceMod) or pass `address(0)` here. Both target the same storage field. + +## Integration Notes + +`OwnerStorage` lives at `keccak256("erc173.owner")` inside the diamond. The same slot as [`OwnerDataMod`](/docs/library/access/Owner/Data/OwnerDataMod), [`OwnerTransferFacet`](/docs/library/access/Owner/Transfer/OwnerTransferFacet), and related owner code. Transferring here updates what `owner()` reads on [`OwnerDataFacet`](/docs/library/access/Owner/Data/OwnerDataFacet). + + diff --git a/website/docs/library/access/Owner/Transfer/_category_.json b/website/docs/library/access/Owner/Transfer/_category_.json new file mode 100644 index 00000000..bb4cf0df --- /dev/null +++ b/website/docs/library/access/Owner/Transfer/_category_.json @@ -0,0 +1,6 @@ +{ + "label": "Transfer", + "position": 99, + "collapsible": true, + "collapsed": true +} diff --git a/website/docs/library/access/Owner/TwoSteps/Data/OwnerTwoStepDataFacet.mdx b/website/docs/library/access/Owner/TwoSteps/Data/OwnerTwoStepDataFacet.mdx new file mode 100644 index 00000000..37a0d37b --- /dev/null +++ b/website/docs/library/access/Owner/TwoSteps/Data/OwnerTwoStepDataFacet.mdx @@ -0,0 +1,88 @@ +--- +sidebar_position: 100 +title: "Owner Two Step Data Facet" +description: "Read-only pending-owner data for ERC-173 two-step transfers in diamonds" +sidebar_label: "Facet" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/TwoSteps/Data/OwnerTwoStepDataFacet.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Badge from '@site/src/components/ui/Badge'; +import Callout from '@site/src/components/ui/Callout'; +import CalloutBox from '@site/src/components/ui/CalloutBox'; +import Accordion, { AccordionGroup } from '@site/src/components/ui/Accordion'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import CodeShowcase from '@site/src/components/code/CodeShowcase'; +import RelatedDocs from '@site/src/components/docs/RelatedDocs'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import ReadingTime from '@site/src/components/docs/ReadingTime'; +import GradientText from '@site/src/components/ui/GradientText'; +import GradientButton from '@site/src/components/ui/GradientButton'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Read-only pending-owner data extension for the Owner facets. + + + +- Exposes the pending owner via external `pendingOwner()` (read-only). +- Shares `PendingOwnerStorage` at `erc8042:erc173.owner.pending` with `OwnerTwoStepTransferFacet` and other contracts. + + +## Storage + +### State Variables + + + +### PendingOwnerStorage + + +{`/** storage-location: erc8042:erc173.owner.pending */ +struct PendingOwnerStorage { + address pendingOwner; +}`} + + +## Functions + +### pendingOwner + +Returns the pedding owner address registered`. + + +{`function pendingOwner() external view returns (address);`} + + +**Returns:** + + + +## Best Practices + +- Avoid defining another facet that reads or writes a different slot for pending owner; keep pending-owner state at `erc173.owner.pending`. +- The current owner in the Two-Step Ownership is stored in the same `OwnerStorage` as the single-step ownership. Reuse the storage struct to ensure full composability. + + diff --git a/website/docs/library/access/Owner/TwoSteps/Data/OwnerTwoStepDataMod.mdx b/website/docs/library/access/Owner/TwoSteps/Data/OwnerTwoStepDataMod.mdx new file mode 100644 index 00000000..ac237dd7 --- /dev/null +++ b/website/docs/library/access/Owner/TwoSteps/Data/OwnerTwoStepDataMod.mdx @@ -0,0 +1,121 @@ +--- +sidebar_position: 110 +title: "Owner Two Step Data Module" +description: "Diamond storage and read helpers for ERC-173 pending owner (two-step)" +sidebar_label: "Module" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/TwoSteps/Data/OwnerTwoStepDataMod.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Callout from '@site/src/components/ui/Callout'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Heper functions for two step ownership access + + + +- Single slot `erc8042:erc173.owner.pending` (`keccak256("erc173.owner.pending")`), shared with [Owner Two Step Transfer Module](/docs/library/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferMod), renounce/two-step flows, and [Owner Two Step Data Facet](/docs/library/access/Owner/TwoSteps/Data/OwnerTwoStepDataFacet). +- File-level `getStorage()` returns a `PendingOwnerStorage` pointer; `pendingOwner()` reads `pendingOwner` (or `address(0)` when unset). +- Read-only from this module `. + + + +Import this module into facets or shared setup code. Its helpers are file-level (effectively internal to your compilation unit). Use them from your facet’s external entrypoints or other modules. + +Storage follows the diamond slot in this file; any code using the same `STORAGE_POSITION` shares state. + +See Facets & Modules for more information. + + +## Storage + +### State Variables + + + +### PendingOwnerStorage + + +{`/** @custom:storage-location erc8042:erc173.owner.pending */ +struct PendingOwnerStorage { + address pendingOwner; +}`} + + +## Functions + +### getStorage + +Returns a storage pointer to `PendingOwnerStorage` at `STORAGE_POSITION` using inline assembly. + + +{`function getStorage() pure returns (PendingOwnerStorage storage s);`} + + +**Returns:** + + + +--- + +### pendingOwner + +Returns `getStorage().pendingOwner`. + + +{`function pendingOwner() view returns (address);`} + + +**Returns:** + + + +## Best Practices + +- Import this module (or match the same slot and struct) when adding facets so pending-owner reads stay aligned with [Owner Two Step Data Facet](/docs/library/access/Owner/TwoSteps/Data/OwnerTwoStepDataFacet) and two-step transfer/renounce code. +- Coordinate writes with two-step transfer or renounce modules (or facets built on them); this module does not assign `pendingOwner` itself. +- For read-only access through the diamond proxy, register [Owner Two Step Data Facet](/docs/library/access/Owner/TwoSteps/Data/OwnerTwoStepDataFacet) and expose `pendingOwner()` externally. + +## Integration Notes + +`PendingOwnerStorage` lives at `keccak256("erc173.owner.pending")`. Any code using that slot—including modules that define their own accessor with the same hash—shares the same `pendingOwner` field. + +
+ +
+ + diff --git a/website/docs/library/access/Owner/TwoSteps/Data/_category_.json b/website/docs/library/access/Owner/TwoSteps/Data/_category_.json new file mode 100644 index 00000000..162c765c --- /dev/null +++ b/website/docs/library/access/Owner/TwoSteps/Data/_category_.json @@ -0,0 +1,6 @@ +{ + "label": "Data", + "position": 99, + "collapsible": true, + "collapsed": true +} diff --git a/website/docs/library/access/Owner/TwoSteps/Renounce/OwnerTwoStepRenounceFacet.mdx b/website/docs/library/access/Owner/TwoSteps/Renounce/OwnerTwoStepRenounceFacet.mdx new file mode 100644 index 00000000..acd36f00 --- /dev/null +++ b/website/docs/library/access/Owner/TwoSteps/Renounce/OwnerTwoStepRenounceFacet.mdx @@ -0,0 +1,127 @@ +--- +sidebar_position: 100 +title: "Owner Two Step Renounce Facet" +description: "Renounce ERC-173 ownership and clear pending owner for two-step diamonds" +sidebar_label: "Facet" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/TwoSteps/Renounce/OwnerTwoStepRenounceFacet.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Badge from '@site/src/components/ui/Badge'; +import Callout from '@site/src/components/ui/Callout'; +import CalloutBox from '@site/src/components/ui/CalloutBox'; +import Accordion, { AccordionGroup } from '@site/src/components/ui/Accordion'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import CodeShowcase from '@site/src/components/code/CodeShowcase'; +import RelatedDocs from '@site/src/components/docs/RelatedDocs'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import ReadingTime from '@site/src/components/docs/ReadingTime'; +import GradientText from '@site/src/components/ui/GradientText'; +import GradientButton from '@site/src/components/ui/GradientButton'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Renounce the two step ownership of your diamonds + + + +- `renounceOwnership()` clears owner and pending owner in one call. +- Owner-only function; otherwise reverts `OwnerUnauthorizedAccount`. + + +## Storage +### State Variables + + + +### OwnerStorage + + +{`/** storage-location erc8042:erc173.owner */ +struct OwnerStorage { + address owner; +}`} + + +--- +### PendingOwnerStorage + + +{`/** storage-location erc8042:erc173.owner.pending */ +struct PendingOwnerStorage { + address pendingOwner; +}`} + + +## Functions + +### renounceOwnership + +Renounce the diamond ownership while clearing any pending owner. Requires `msg.sender` to equal the current owner; otherwise reverts `OwnerUnauthorizedAccount`. + + +{`function renounceOwnership() external;`} + + + + +## Events + + + + +
+ Emitted after a successful renounce with `_newOwner == address(0)`. +
+ +
+ Signature: + +{`event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner);`} + +
+ +
+
+ +## Errors + + + + +
+ Signature: + +{`error OwnerUnauthorizedAccount();`} + +
+
+
+ +## Best Practices + +- Only the current owner can renounce; there is no pending step for renounce itself, but clearing `pendingOwner` avoids leaving a nominated successor after you renounce + +## Security Considerations + +Renouncing is an **immediate** and **irreversible** on-chain action: you will lose access to all owner gated functionality inside your diamond. + + diff --git a/website/docs/library/access/Owner/TwoSteps/Renounce/OwnerTwoStepRenounceMod.mdx b/website/docs/library/access/Owner/TwoSteps/Renounce/OwnerTwoStepRenounceMod.mdx new file mode 100644 index 00000000..d7570406 --- /dev/null +++ b/website/docs/library/access/Owner/TwoSteps/Renounce/OwnerTwoStepRenounceMod.mdx @@ -0,0 +1,175 @@ +--- +sidebar_position: 110 +title: "Owner Two Step Renounce Module" +description: "Two-step ownership renouncement with ERC-173 logic" +sidebar_label: "Module" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/TwoSteps/Renounce/OwnerTwoStepRenounceMod.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Badge from '@site/src/components/ui/Badge'; +import Callout from '@site/src/components/ui/Callout'; +import CalloutBox from '@site/src/components/ui/CalloutBox'; +import Accordion, { AccordionGroup } from '@site/src/components/ui/Accordion'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import CodeShowcase from '@site/src/components/code/CodeShowcase'; +import RelatedDocs from '@site/src/components/docs/RelatedDocs'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import ReadingTime from '@site/src/components/docs/ReadingTime'; +import GradientText from '@site/src/components/ui/GradientText'; +import GradientButton from '@site/src/components/ui/GradientButton'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Helper functions for renouncing ownership and clearing pending-owner state. + + + +- `renounceOwnership` guards by requiring `msg.sender` is the current owner. +- Emits `OwnershipTransferred` with `newOwner == address(0)`. + + + +Use modules through your facet’s to extend Compose base logic. See Facets & Modules for more information. + + +## Storage + +### State Variables + + + +### OwnerStorage + + +{`/** storage-location erc8042:erc173.owner */ +struct OwnerStorage { + address owner; +}`} + + +--- +### PendingOwnerStorage + + +{`/** storage-location erc8042:erc173.owner.pending */ +struct PendingOwnerStorage { + address pendingOwner; +}`} + + +## Functions + +### getOwnerStorage + +Returns a pointer to the `OwnerStorage` struct. + + +{`function getOwnerStorage() pure returns (OwnerStorage storage s);`} + + +**Returns:** + + + +--- +### getPendingOwnerStorage + +Returns a pointer to the `PendingOwnerStorage` struct. + + +{`function getPendingOwnerStorage() pure returns (PendingOwnerStorage storage s);`} + + +**Returns:** + + + +--- +### renounceOwnership + +Renounce ownership of the contract. Sets the owner to address(0) and clears any pending owner, disabling all functions restricted to the owner. + + +{`function renounceOwnership() ;`} + + +## Events + + + +
+ This emits when ownership of a contract changes. +
+ +
+ Signature: + +{`event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);`} + +
+ +
+
+ +## Errors + + + + +
+ Signature: + +error OwnerUnauthorizedAccount(); + +
+
+
+ +## Best Practices + +- Ensure the caller is the owner before invoking state-changing functions. + +## Integration Notes + +This module interacts with diamond storage at the slots defined by `OWNER_STORAGE_POSITION` and `PENDING_OWNER_STORAGE_POSITION`. + +The `renounceOwnership` function directly modifies the `owner` & `pendingOwner` fields within the storage structs, setting it to `address(0)`. These changes are immediately visible to all facets that access the same storage slots. + + diff --git a/website/docs/library/access/Owner/TwoSteps/Renounce/_category_.json b/website/docs/library/access/Owner/TwoSteps/Renounce/_category_.json new file mode 100644 index 00000000..deaf11e2 --- /dev/null +++ b/website/docs/library/access/Owner/TwoSteps/Renounce/_category_.json @@ -0,0 +1,6 @@ +{ + "label": "Renounce", + "position": 99, + "collapsible": true, + "collapsed": true +} diff --git a/website/docs/library/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferFacet.mdx b/website/docs/library/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferFacet.mdx new file mode 100644 index 00000000..a29db9c7 --- /dev/null +++ b/website/docs/library/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferFacet.mdx @@ -0,0 +1,156 @@ +--- +sidebar_position: 100 +title: "Owner Two Step Transfer Facet" +description: "Two-step ERC-173 ownership transfer for Compose diamonds" +sidebar_label: "Facet" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferFacet.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Callout from '@site/src/components/ui/Callout'; +import Accordion, { AccordionGroup } from '@site/src/components/ui/Accordion'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Two-step ownership transfer for your diamond + + + +- Two-step handoff: the owner calls `transferOwnership`; the nominated address calls `acceptOwnership` to become owner. +- Storage uses `erc8042:erc173.owner` and `erc8042:erc173.owner.pending`, shared with the [two-step transfer module](/docs/library/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferMod). + + +## Storage + +### State Variables + + + +### OwnerStorage + + +{`/** storage-location: erc8042:erc173.owner */ +struct OwnerStorage { + address owner; +}`} + + +### PendingOwnerStorage + + +{`/** storage-location: erc8042:erc173.owner.pending */ +struct PendingOwnerStorage { + address pendingOwner; +}`} + + +## Functions + +### transferOwnership + +Callable only when `msg.sender` is the current owner. Sets `pendingOwner` to `_newOwner` and emits `OwnershipTransferStarted(owner, _newOwner)`. The on-chain owner does not change until `acceptOwnership` is call. + + +{`function transferOwnership(address _newOwner) external;`} + + +**Parameters:** + + + +--- + +### acceptOwnership + +Callable only when `msg.sender` is the pending owner. Assigns `owner` to the pending address, sets `pendingOwner` to `address(0)`, and emits `OwnershipTransferred(previousOwner, newOwner)`. + + +{`function acceptOwnership() external;`} + + +## Events + + + + +
+ Emitted when the current owner calls `transferOwnership`, before the pending address accepts. +
+ +
+ Signature: + +{`event OwnershipTransferStarted(address indexed _previousOwner, address indexed _newOwner);`} + +
+ +
+ + +
+ Emitted when the pending owner calls `acceptOwnership` and ownership is updated. +
+ +
+ Signature: + +{`event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner);`} + +
+ +
+
+ +## Errors + + + + +
+ Thrown when `transferOwnership` is called by anyone other than the current owner or the pending owner. +
+ +
+ Signature: + +{`error OwnerUnauthorizedAccount();`} + +
+
+
+ +## Best Practices + +- Initialize `OwnerStorage.owner` during deployment before relying on owner behavior elsewhere. +- After `transferOwnership`, ensure the nominated `_newOwner` can and will call `acceptOwnership`; until then, the previous owner remains owner. + + diff --git a/website/docs/library/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferMod.mdx b/website/docs/library/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferMod.mdx new file mode 100644 index 00000000..b2ed84d4 --- /dev/null +++ b/website/docs/library/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferMod.mdx @@ -0,0 +1,203 @@ +--- +sidebar_position: 110 +title: "Owner Two Step Transfer Module" +description: "Two-step ERC-173 ownership transfer logic" +sidebar_label: "Module" +gitSource: "https://github.com/Perfect-Abstractions/Compose/tree/main/src/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferMod.sol" +--- + +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Callout from '@site/src/components/ui/Callout'; +import Accordion, { AccordionGroup } from '@site/src/components/ui/Accordion'; +import PropertyTable from '@site/src/components/api/PropertyTable'; +import ExpandableCode from '@site/src/components/code/ExpandableCode'; +import WasThisHelpful from '@site/src/components/docs/WasThisHelpful'; +import LastUpdated from '@site/src/components/docs/LastUpdated'; +import PackageImport from '@site/src/components/docs/PackageImport'; + + + + +Helpers for the two step handoff ownership for your diamonds + + + +- Two-step handoff: current owner calls `transferOwnership`; the nominated address calls `acceptOwnership` to finalize (unlike single-step [`OwnerTransferMod`](/docs/library/access/Owner/Transfer/OwnerTransferMod)). +- Uses same layout as [Owner Two Step Transfer Facet](/docs/library/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferFacet). + + + +Helpers modules for composing the library logic into your own facets. See Facets & Modules for more information. + + +## Storage + +### State Variables + + + +### OwnerStorage + + +{`/** @custom:storage-location erc8042:erc173.owner */ +struct OwnerStorage { + address owner; +}`} + + +### PendingOwnerStorage + + +{`/** @custom:storage-location erc8042:erc173.owner.pending */ +struct PendingOwnerStorage { + address pendingOwner; +}`} + + +## Functions + +### getOwnerStorage + +Returns a storage pointer to `OwnerStorage`. + + +{`function getOwnerStorage() pure returns (OwnerStorage storage s);`} + + +**Returns:** + + + +--- + +### getPendingOwnerStorage + +Returns a storage pointer to `PendingOwnerStorage`. + + +{`function getPendingOwnerStorage() pure returns (PendingOwnerStorage storage s);`} + + +**Returns:** + + + +--- + +### transferOwnership + +Requires `msg.sender == owner`; otherwise reverts `OwnerUnauthorizedAccount`. Sets `pendingOwner` to `_newOwner` and emits `OwnershipTransferStarted(owner, _newOwner)`. Does not change `owner` until `acceptOwnership`. + + +{`function transferOwnership(address _newOwner);`} + + +**Parameters:** + + + +--- + +### acceptOwnership + +Requires `msg.sender == pendingOwner`; otherwise reverts `OwnerUnauthorizedAccount`. Assigns `owner` to the pending address, clears `pendingOwner`, and emits `OwnershipTransferred(previousOwner, newOwner)`. + + +{`function acceptOwnership();`} + + +## Events + + + +
+ Emitted when the current owner calls `transferOwnership` (pending owner set). +
+ +
+ Signature: + +{`event OwnershipTransferStarted(address indexed _previousOwner, address indexed _newOwner);`} + +
+ +
+ +
+ Emitted when the pending owner calls `acceptOwnership` and ownership is updated. +
+ +
+ Signature: + +{`event OwnershipTransferred(address indexed _previousOwner, address indexed _newOwner);`} + +
+ +
+
+ +## Errors + + + +
+ Thrown when `transferOwnership` is called by anyone other than the current owner, or when `acceptOwnership` is called by anyone other than the pending owner. +
+
+ Signature: + +{`error OwnerUnauthorizedAccount();`} + +
+
+
+ +## Best Practices + +- Expose `transferOwnership` and `acceptOwnership` only through trusted `external` facet entrypoints; confirm `_newOwner` before initiating. +- Keep the same `OwnerStorage` / `PendingOwnerStorage` layout as [Owner Two Step Transfer Facet](/docs/library/access/Owner/TwoSteps/Transfer/OwnerTwoStepTransferFacet) and [Owner Two Step Data Module](/docs/library/access/Owner/TwoSteps/Data/OwnerTwoStepDataMod) +- `owner` is shared with [`OwnerDataMod`](/docs/library/access/Owner/Data/OwnerDataMod) and single-step owner code at `keccak256("erc173.owner")`. + + diff --git a/website/docs/library/access/Owner/TwoSteps/Transfer/_category_.json b/website/docs/library/access/Owner/TwoSteps/Transfer/_category_.json new file mode 100644 index 00000000..bb4cf0df --- /dev/null +++ b/website/docs/library/access/Owner/TwoSteps/Transfer/_category_.json @@ -0,0 +1,6 @@ +{ + "label": "Transfer", + "position": 99, + "collapsible": true, + "collapsed": true +} diff --git a/website/docs/library/access/Owner/TwoSteps/_category_.json b/website/docs/library/access/Owner/TwoSteps/_category_.json new file mode 100644 index 00000000..e26b43cf --- /dev/null +++ b/website/docs/library/access/Owner/TwoSteps/_category_.json @@ -0,0 +1,10 @@ +{ + "label": "Two Steps", + "position": 99, + "collapsible": true, + "collapsed": true, + "link": { + "type": "doc", + "id": "library/access/Owner/TwoSteps/index" + } +} diff --git a/website/docs/library/access/Owner/TwoSteps/index.mdx b/website/docs/library/access/Owner/TwoSteps/index.mdx new file mode 100644 index 00000000..78745ef6 --- /dev/null +++ b/website/docs/library/access/Owner/TwoSteps/index.mdx @@ -0,0 +1,57 @@ +--- +title: "Two Steps" +description: "Two Steps components for Compose diamonds." +--- + +import DocCard, { DocCardGrid } from '@site/src/components/docs/DocCard'; +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Icon from '@site/src/components/ui/Icon'; + + + Two Steps components for Compose diamonds. + + + + } + size="medium" + /> + } + size="medium" + /> + } + size="medium" + /> + } + size="medium" + /> + } + size="medium" + /> + } + size="medium" + /> + diff --git a/website/docs/library/access/Owner/_category_.json b/website/docs/library/access/Owner/_category_.json new file mode 100644 index 00000000..2ddf56c9 --- /dev/null +++ b/website/docs/library/access/Owner/_category_.json @@ -0,0 +1,10 @@ +{ + "label": "Owner", + "position": 1, + "collapsible": true, + "collapsed": true, + "link": { + "type": "doc", + "id": "library/access/Owner/index" + } +} diff --git a/website/docs/library/access/Owner/index.mdx b/website/docs/library/access/Owner/index.mdx new file mode 100644 index 00000000..838542c3 --- /dev/null +++ b/website/docs/library/access/Owner/index.mdx @@ -0,0 +1,64 @@ +--- +title: "Owner" +description: "Single-owner access control pattern." +--- + +import DocCard, { DocCardGrid } from '@site/src/components/docs/DocCard'; +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Icon from '@site/src/components/ui/Icon'; + + + Single-owner access control pattern based on [ERC-173](https://eips.ethereum.org/EIPS/eip-173) + + + + } + size="medium" + /> + } + size="medium" + /> + } + size="medium" + /> + } + size="medium" + /> + } + size="medium" + /> + } + size="medium" + /> + } + size="medium" + /> + diff --git a/website/docs/library/access/_category_.json b/website/docs/library/access/_category_.json new file mode 100644 index 00000000..cbc9d5ba --- /dev/null +++ b/website/docs/library/access/_category_.json @@ -0,0 +1,10 @@ +{ + "label": "Access Control", + "position": 2, + "collapsible": true, + "collapsed": true, + "link": { + "type": "doc", + "id": "library/access/index" + } +} diff --git a/website/docs/library/access/index.mdx b/website/docs/library/access/index.mdx new file mode 100644 index 00000000..bc27733a --- /dev/null +++ b/website/docs/library/access/index.mdx @@ -0,0 +1,21 @@ +--- +title: "Access Control" +description: "Access control patterns for permission management in Compose diamonds." +--- + +import DocCard, { DocCardGrid } from '@site/src/components/docs/DocCard'; +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; +import Icon from '@site/src/components/ui/Icon'; + + + Access control for Compose diamonds. + + + + } + size="medium" + /> + diff --git a/website/docs/library/diamond/DiamondInspectFacet.mdx b/website/docs/library/diamond/DiamondInspectFacet.mdx index 2a6a0b96..3525ea9d 100644 --- a/website/docs/library/diamond/DiamondInspectFacet.mdx +++ b/website/docs/library/diamond/DiamondInspectFacet.mdx @@ -13,7 +13,7 @@ import ExpandableCode from '@site/src/components/code/ExpandableCode'; import LastUpdated from '@site/src/components/docs/LastUpdated'; import PackageImport from '@site/src/components/docs/PackageImport'; - + It lets you inspect the diamond’s routing table and retrieve the registered facet list. diff --git a/website/docs/library/diamond/DiamondMod.mdx b/website/docs/library/diamond/DiamondMod.mdx index 6ec977d2..3ecfbb59 100644 --- a/website/docs/library/diamond/DiamondMod.mdx +++ b/website/docs/library/diamond/DiamondMod.mdx @@ -19,7 +19,7 @@ import LastUpdated from '@site/src/components/docs/LastUpdated'; import ReadingTime from '@site/src/components/docs/ReadingTime'; import PackageImport from '@site/src/components/docs/PackageImport'; - + This module provides core internal functions and storage management for diamond proxies. diff --git a/website/docs/library/diamond/DiamondUpgradeFacet.mdx b/website/docs/library/diamond/DiamondUpgradeFacet.mdx index f41d5f5b..09cecf23 100644 --- a/website/docs/library/diamond/DiamondUpgradeFacet.mdx +++ b/website/docs/library/diamond/DiamondUpgradeFacet.mdx @@ -15,7 +15,7 @@ import LastUpdated from '@site/src/components/docs/LastUpdated'; import StepIndicator from '@site/src/components/docs/StepIndicator'; import PackageImport from '@site/src/components/docs/PackageImport'; - + Orchestrates upgrade functionality, enabling the addition, replacement, and removal of facets. diff --git a/website/docs/library/diamond/DiamondUpgradeMod.mdx b/website/docs/library/diamond/DiamondUpgradeMod.mdx index 2f32fcbf..471ef077 100644 --- a/website/docs/library/diamond/DiamondUpgradeMod.mdx +++ b/website/docs/library/diamond/DiamondUpgradeMod.mdx @@ -17,7 +17,7 @@ import LastUpdated from '@site/src/components/docs/LastUpdated'; import StepIndicator from '@site/src/components/docs/StepIndicator'; import PackageImport from '@site/src/components/docs/PackageImport'; - + Module providing the internal functions to extend the diamond's upgrade functionality by adding, replacing, or removing facets. diff --git a/website/docs/library/index.mdx b/website/docs/library/index.mdx index 221a4441..106b7077 100644 --- a/website/docs/library/index.mdx +++ b/website/docs/library/index.mdx @@ -21,6 +21,13 @@ import Callout from '@site/src/components/ui/Callout'; icon={} size="medium" /> + } + size="medium" + /> diff --git a/website/src/components/docs/PackageImport/index.js b/website/src/components/docs/PackageImport/index.js index b1eca8e0..d5d4b91d 100644 --- a/website/src/components/docs/PackageImport/index.js +++ b/website/src/components/docs/PackageImport/index.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; +import {useDoc} from '@docusaurus/plugin-content-docs/client'; import styles from './styles.module.css'; function getRelativePath(gitSource) { @@ -9,7 +10,9 @@ function getRelativePath(gitSource) { return after; } -export default function PackageImport({ gitSource }) { +export default function PackageImport() { + const {frontMatter} = useDoc(); + const gitSource = frontMatter?.gitSource; const [copied, setCopied] = useState(false); if (!gitSource) return null; diff --git a/website/src/css/sidebar.css b/website/src/css/sidebar.css index 48b2f521..fd674079 100644 --- a/website/src/css/sidebar.css +++ b/website/src/css/sidebar.css @@ -37,9 +37,22 @@ .menu__link { color: #475569; border-radius: 0.375rem; + font-size: 0.8125rem; + padding: 0.3rem 0.5rem; transition: all 0.2s ease; } +/* Top-level non-collapsible items (e.g. Introduction) */ +.menu__list-item > .menu__link { + font-size: 0.875rem; +} + +.menu__list-item-collapsible > .menu__caret, +.menu__list-item-collapsible > .menu__link { + font-size: 0.875rem; + padding: 0.3rem 0.5rem; +} + .menu__link:hover { background: #f1f5f9; color: #0f172a;