@net-protocol/profiles 0.1.6 → 0.1.7
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/README.md +15 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -12,8 +12,9 @@ yarn add @net-protocol/profiles
|
|
|
12
12
|
|
|
13
13
|
## Features
|
|
14
14
|
|
|
15
|
-
- **Read profile data**: Profile picture, X username, bio, canvas content
|
|
15
|
+
- **Read profile data**: Profile picture, X username, bio, canvas content, custom CSS themes
|
|
16
16
|
- **Write profile data**: Utilities to prepare Storage.put() transactions
|
|
17
|
+
- **CSS theming**: Demo themes, AI prompt generation, CSS sanitization, and theme selector definitions
|
|
17
18
|
- **Efficient batch reads**: `useBasicUserProfileMetadata` batches multiple reads
|
|
18
19
|
- **Built on net-storage**: Uses the Net Storage SDK for underlying storage operations
|
|
19
20
|
|
|
@@ -106,6 +107,7 @@ function UpdateProfile() {
|
|
|
106
107
|
| Display Name | User-chosen display name | Max 25 characters |
|
|
107
108
|
| Token Address | ERC-20 token that represents you | Valid EVM address (0x-prefixed) |
|
|
108
109
|
| Canvas | Custom HTML profile page | For advanced customization |
|
|
110
|
+
| CSS Theme | Custom CSS for profile styling | Max 10KB, scoped under `.profile-themed` |
|
|
109
111
|
|
|
110
112
|
## Storage Keys
|
|
111
113
|
|
|
@@ -115,6 +117,7 @@ function UpdateProfile() {
|
|
|
115
117
|
| `PROFILE_X_USERNAME_STORAGE_KEY` | X username (legacy, prefer metadata) | Plain string |
|
|
116
118
|
| `PROFILE_METADATA_STORAGE_KEY` | Profile metadata JSON | `{ x_username: "handle", bio: "...", display_name: "...", token_address: "0x..." }` |
|
|
117
119
|
| `PROFILE_CANVAS_STORAGE_KEY` | Custom HTML canvas | HTML string |
|
|
120
|
+
| `PROFILE_CSS_STORAGE_KEY` | Custom CSS theme | CSS string (max 10KB) |
|
|
118
121
|
|
|
119
122
|
## API Reference
|
|
120
123
|
|
|
@@ -123,6 +126,7 @@ function UpdateProfile() {
|
|
|
123
126
|
- `useProfilePicture({ chainId, userAddress })` - Fetch profile picture URL
|
|
124
127
|
- `useProfileXUsername({ chainId, userAddress })` - Fetch X username
|
|
125
128
|
- `useProfileCanvas({ chainId, userAddress })` - Fetch canvas HTML
|
|
129
|
+
- `useProfileCSS({ chainId, userAddress })` - Fetch custom CSS theme
|
|
126
130
|
- `useBasicUserProfileMetadata({ chainId, userAddress })` - Batch fetch picture, username, bio, display name, and token address
|
|
127
131
|
|
|
128
132
|
### Utilities (from `@net-protocol/profiles`)
|
|
@@ -140,6 +144,16 @@ function UpdateProfile() {
|
|
|
140
144
|
- `isValidDisplayName(displayName)` - Validate display name format (max 25 chars, no control chars)
|
|
141
145
|
- `getTokenAddressStorageArgs(tokenAddress)` - Prepare token address update args
|
|
142
146
|
- `isValidTokenAddress(address)` - Validate EVM token address format
|
|
147
|
+
- `getProfileCSSStorageArgs(css)` - Prepare CSS theme update args
|
|
148
|
+
- `isValidCSS(css)` - Validate CSS (size limit, no script injection)
|
|
149
|
+
- `sanitizeCSS(css)` - Strip dangerous patterns (`<script>`, `javascript:`, `expression()`, `behavior:`, `@import`, `</style>`)
|
|
150
|
+
|
|
151
|
+
### Theme Utilities (from `@net-protocol/profiles`)
|
|
152
|
+
|
|
153
|
+
- `THEME_SELECTORS` - Array of all themeable CSS selectors/variables with descriptions
|
|
154
|
+
- `DEMO_THEMES` - Built-in demo themes (use `buildCSSPrompt()` or CLI `--list-themes` to discover names)
|
|
155
|
+
- `buildCSSPrompt()` - Generate an AI prompt describing the full theming surface
|
|
156
|
+
- `MAX_CSS_SIZE` - Maximum CSS size in bytes (10KB)
|
|
143
157
|
|
|
144
158
|
## Dependencies
|
|
145
159
|
|
package/package.json
CHANGED