@bloxwap/hig 0.2.0 → 0.5.1

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.
Files changed (119) hide show
  1. package/README.md +1 -1
  2. package/chart/README.md +3 -3
  3. package/contracts/README.md +1 -1
  4. package/contracts/dist/messages.d.ts +138 -0
  5. package/contracts/dist/messages.js +48 -2
  6. package/css.d.ts +2 -0
  7. package/feedback/README.md +1 -1
  8. package/feedback/assets/error.wav +0 -0
  9. package/feedback/assets/manifest.json +29 -19
  10. package/feedback/assets/tick.wav +0 -0
  11. package/feedback/assets/toggle.wav +0 -0
  12. package/feedback/dist/contract.d.ts +1 -57
  13. package/feedback/dist/contract.js +2 -1
  14. package/feedback/dist/native.d.ts +2 -1
  15. package/feedback/dist/presets.d.ts +57 -0
  16. package/feedback/dist/presets.js +1 -0
  17. package/native/README.md +6 -1
  18. package/native/dist/animated-number.js +11 -7
  19. package/native/dist/brand.d.ts +1 -1
  20. package/native/dist/brand.js +4 -3
  21. package/native/dist/button.d.ts +3 -2
  22. package/native/dist/button.js +8 -6
  23. package/native/dist/data.d.ts +18 -1
  24. package/native/dist/data.js +22 -2
  25. package/native/dist/field.d.ts +1 -0
  26. package/native/dist/field.js +18 -5
  27. package/native/dist/gesture-sheet.js +5 -3
  28. package/native/dist/icons.d.ts +21 -0
  29. package/native/dist/icons.js +20 -0
  30. package/native/dist/navigation.d.ts +1 -0
  31. package/native/dist/navigation.js +49 -7
  32. package/native/dist/overlay.js +3 -3
  33. package/native/dist/pickers.d.ts +54 -0
  34. package/native/dist/pickers.js +60 -0
  35. package/native/dist/provider.d.ts +25 -6
  36. package/native/dist/provider.js +19 -4
  37. package/native/dist/radio-group.d.ts +17 -1
  38. package/native/dist/radio-group.js +45 -7
  39. package/native/dist/recipes.d.ts +3 -0
  40. package/native/dist/recipes.js +15 -2
  41. package/native/dist/selection.d.ts +1 -0
  42. package/native/dist/selection.js +1 -0
  43. package/native/dist/slider.js +3 -2
  44. package/native/dist/status.d.ts +16 -5
  45. package/native/dist/status.js +55 -15
  46. package/native/dist/surface.d.ts +2 -1
  47. package/native/dist/surface.js +4 -3
  48. package/native/dist/swap-panel.d.ts +125 -0
  49. package/native/dist/swap-panel.js +177 -0
  50. package/native/dist/swap-parts.d.ts +86 -0
  51. package/native/dist/swap-parts.js +66 -0
  52. package/native/dist/swap-shared.d.ts +65 -0
  53. package/native/dist/swap-shared.js +76 -0
  54. package/native/dist/swap-sheet.d.ts +14 -0
  55. package/native/dist/swap-sheet.js +26 -0
  56. package/native/dist/swap-views.d.ts +41 -0
  57. package/native/dist/swap-views.js +37 -0
  58. package/native/dist/switch.d.ts +1 -1
  59. package/native/dist/switch.js +20 -13
  60. package/native/dist/wallet-address.d.ts +37 -0
  61. package/native/dist/wallet-address.js +50 -0
  62. package/native-fonts/README.md +1 -1
  63. package/native-fonts/dist/index.d.ts +1 -1
  64. package/native-fonts/dist/index.js +1 -1
  65. package/native-fonts/fonts/manifest.json +1 -1
  66. package/og-fonts/README.md +2 -2
  67. package/og-fonts/dist/index.d.ts +1 -1
  68. package/og-fonts/dist/index.js +1 -1
  69. package/og-fonts/fonts/manifest.json +1 -1
  70. package/package.json +181 -63
  71. package/react/README.md +22 -1
  72. package/react/dist/animated-number.js +2 -1
  73. package/react/dist/brand.d.ts +1 -1
  74. package/react/dist/brand.js +3 -2
  75. package/react/dist/button.d.ts +2 -2
  76. package/react/dist/button.js +1 -1
  77. package/react/dist/data.d.ts +15 -0
  78. package/react/dist/data.js +13 -0
  79. package/react/dist/field.d.ts +1 -0
  80. package/react/dist/field.js +2 -1
  81. package/react/dist/navigation.js +1 -1
  82. package/react/dist/notify.d.ts +14 -0
  83. package/react/dist/notify.js +6 -0
  84. package/react/dist/recipes/install-command.d.ts +1 -0
  85. package/react/dist/recipes/install-command.js +8 -1
  86. package/react/dist/recipes/pickers.d.ts +57 -0
  87. package/react/dist/recipes/pickers.js +78 -0
  88. package/react/dist/recipes/swap/amount-card.d.ts +40 -0
  89. package/react/dist/recipes/swap/amount-card.js +7 -0
  90. package/react/dist/recipes/swap/picker.d.ts +26 -0
  91. package/react/dist/recipes/swap/picker.js +20 -0
  92. package/react/dist/recipes/swap/settings.d.ts +24 -0
  93. package/react/dist/recipes/swap/settings.js +25 -0
  94. package/react/dist/recipes/swap/shared.d.ts +98 -0
  95. package/react/dist/recipes/swap/shared.js +106 -0
  96. package/react/dist/recipes/swap-panel.d.ts +127 -0
  97. package/react/dist/recipes/swap-panel.js +170 -0
  98. package/react/dist/recipes/swap-sheet.d.ts +16 -0
  99. package/react/dist/recipes/swap-sheet.js +22 -0
  100. package/react/dist/recipes/trade-entry.js +1 -1
  101. package/react/dist/recipes.d.ts +3 -1
  102. package/react/dist/recipes.js +3 -1
  103. package/react/dist/select.js +2 -0
  104. package/react/dist/selection.d.ts +13 -0
  105. package/react/dist/selection.js +7 -0
  106. package/react/dist/status.d.ts +15 -5
  107. package/react/dist/status.js +8 -4
  108. package/react/dist/styles.css +406 -92
  109. package/react/dist/toast.d.ts +17 -0
  110. package/react/dist/toast.js +21 -0
  111. package/react/dist/wallet-address.d.ts +23 -0
  112. package/react/dist/wallet-address.js +24 -0
  113. package/tokens/README.md +9 -1
  114. package/tokens/dist/brand.d.ts +19 -0
  115. package/tokens/dist/brand.js +24 -0
  116. package/tokens/dist/index.d.ts +9 -1
  117. package/tokens/dist/index.js +8 -1
  118. package/tokens/dist/manifest.json +4 -1
  119. package/tokens/dist/tokens.css +1 -0
package/README.md CHANGED
@@ -32,7 +32,7 @@ import {Button} from '@bloxwap/hig/react/button';
32
32
 
33
33
  Every renderer, device and overlay peer is optional: install React DOM and Radix for web overlays, React Native
34
34
  and its community modules for native, `vaul` for the web gesture sheet, and the Expo or Bloxwap audio/haptic
35
- packages for feedback, only when you import those entries. `@bloxwap/chart` `^0.3.0` is the one required peer;
35
+ packages for feedback, only when you import those entries. `@bloxwap/chart` `^0.3.0 || ^0.4.0` is the one required peer;
36
36
  an optional peer on it makes npm 11 drop a host's workspace `@bloxwap/chart` (bloxwap/hig#96).
37
37
 
38
38
  ## Moving from 0.1
package/chart/README.md CHANGED
@@ -1,19 +1,19 @@
1
1
  # @bloxwap/hig/chart
2
2
 
3
- Version 0.2.0, an entry of `@bloxwap/hig`. The HIG adapter for [`@bloxwap/chart`](https://github.com/bloxwap/chart): `PriceChart` (a
3
+ Version 0.5.1, an entry of `@bloxwap/hig`. The HIG adapter for [`@bloxwap/chart`](https://github.com/bloxwap/chart): `PriceChart` (a
4
4
  `<figure>` with a required text `summary`, lazy-loading `@bloxwap/chart/react` inside `Suspense`) and
5
5
  `chartTheme` (HIG token colors in sRGB for the canvas). Web only; React Native uses labeled readouts and lists
6
6
  from `@bloxwap/hig/native/data`.
7
7
 
8
8
  ```sh
9
- npm install @bloxwap/hig @bloxwap/chart@^0.3.0
9
+ npm install @bloxwap/hig @bloxwap/chart@^0.5.0
10
10
  ```
11
11
 
12
12
  ```tsx
13
13
  import {PriceChart, chartTheme} from '@bloxwap/hig/chart';
14
14
  ```
15
15
 
16
- Needs `react` and `@bloxwap/chart` `^0.3.0`; `HIGProvider` from `@bloxwap/hig/react/provider` supplies the
16
+ Needs `react` and `@bloxwap/chart` `^0.3.0 || ^0.4.0 || ^0.5.0` (0.5.0 is the tested baseline); `HIGProvider` from `@bloxwap/hig/react/provider` supplies the
17
17
  loading messages. `@bloxwap/chart` is the one required peer of `@bloxwap/hig`, and deliberately not optional: npm 11 drops a workspace copy of
18
18
  `@bloxwap/chart` from a lockfile regenerated from scratch when an installed package declares it as an optional
19
19
  peer (bloxwap/hig#96).
@@ -1,3 +1,3 @@
1
1
  # @bloxwap/hig/contracts
2
2
 
3
- Version 0.2.0, an entry of `@bloxwap/hig`. See the HIG architecture and platform limitations before adoption.
3
+ Version 0.5.1, an entry of `@bloxwap/hig`. See the HIG architecture and platform limitations before adoption.
@@ -102,6 +102,98 @@ export interface HIGMessages {
102
102
  increase: string;
103
103
  /** Native Slider decrement accessibility action label. */
104
104
  decrease: string;
105
+ /** Swap panel source side: card placeholder (with an ellipsis) and picker title. */
106
+ swapFrom: string;
107
+ /** Swap panel destination side: card placeholder (with an ellipsis) and picker title. */
108
+ swapTo: string;
109
+ /** Accessible name of a swap card's token slot; receives `swapFrom` or `swapTo`. */
110
+ swapSelectToken: (side: string) => string;
111
+ /** Accessible name of a swap card's amount; receives `swapFrom` or `swapTo`. */
112
+ swapAmount: (side: string) => string;
113
+ /** Accessible name of the conversion capsule that switches an amount between dollars and token units. */
114
+ swapSwitchDenomination: string;
115
+ /** Accessible name of the button that exchanges the two tokens. */
116
+ swapFlip: string;
117
+ /** Swap panel action when both sides are the same asset. */
118
+ swapActionSend: string;
119
+ /** Swap panel action for different assets on one chain. */
120
+ swapActionSwap: string;
121
+ /** Swap panel action for different assets across chains. */
122
+ swapActionBridge: string;
123
+ /** Swap panel action text while a side has no token. */
124
+ swapChooseToken: string;
125
+ /** Swap panel action text while its destination is still to be chosen. */
126
+ swapChooseDestination: string;
127
+ /** Swap panel action text while the amount is zero. */
128
+ swapEnterAmount: string;
129
+ /** Swap panel action text when the amount exceeds the known balance. */
130
+ swapInsufficient: (symbol: string) => string;
131
+ /** Swap panel action text in the receive view. */
132
+ swapSendFromWallet: string;
133
+ /** Accessible name of the swap panel reset button. */
134
+ swapReset: string;
135
+ /** Swap panel settings button and sheet title. */
136
+ swapSettings: string;
137
+ /** Capsule that enters the whole balance. */
138
+ swapMax: string;
139
+ /** Capsule that enters a small trial amount. */
140
+ swapTest: string;
141
+ /** Slippage capsule on the destination card; receives a percent such as `0.5%`. */
142
+ swapSlippage: (percent: string) => string;
143
+ /** Slippage setting row, view title and preset group. */
144
+ swapSlippageTitle: string;
145
+ /** Label of the custom slippage field. */
146
+ swapSlippageCustom: string;
147
+ /** Fee line on the destination card; receives a formatted amount, an ellipsis while loading, or a dash. */
148
+ swapFee: (amount: string) => string;
149
+ /** Fee breakdown setting row and view title. */
150
+ swapFees: string;
151
+ /** Total row of the fee breakdown. */
152
+ swapFeeTotal: string;
153
+ /** Label of the default amount denomination setting. */
154
+ swapDenomination: string;
155
+ /** Dollar denomination option. */
156
+ swapDollars: string;
157
+ /** Token unit denomination option. */
158
+ swapUnits: string;
159
+ /** Token picker search placeholder and accessible name. */
160
+ swapSearchTokens: string;
161
+ /** Accessible name of the token picker chain filter. */
162
+ swapChains: string;
163
+ /** Chain filter option that clears the filter. */
164
+ swapAllChains: string;
165
+ /** Token picker section of host-ranked tokens. */
166
+ swapHot: string;
167
+ /** Token picker section after the hot tokens. */
168
+ swapAllTokens: string;
169
+ /** Token picker empty state. */
170
+ swapNoTokens: string;
171
+ /** Marks the token picker row that is already selected. */
172
+ swapSelected: string;
173
+ /** Token picker button that asks the host to connect a wallet. */
174
+ swapConnectWallet: string;
175
+ /** Accessible name of the token picker disconnect button. */
176
+ swapDisconnect: string;
177
+ /** Switch in the From picker that asks for a deposit address in place of a connected wallet. */
178
+ swapGenerateAddress: string;
179
+ /** Recipient address field placeholder and accessible name. */
180
+ swapRecipient: string;
181
+ /** Accessible name of the recipient QR scan button. */
182
+ swapScan: string;
183
+ /** Accessible name of a wallet address that copies on press (WalletAddress, the SwapPanel receive view); the address follows it. */
184
+ copyAddress: string;
185
+ /** Notice after a wallet address is copied. */
186
+ addressCopied: string;
187
+ /** Visible hint under a wallet address that copies on press. */
188
+ tapToCopy: string;
189
+ /** Accessible name of a wallet address QR code. */
190
+ qrCode: string;
191
+ /** Control key legend in the swap panel's shortcut hint on non-Apple keyboards (`Ctrl K`). Apple keyboards show ⌘. */
192
+ swapControlKey: string;
193
+ /** Accessible name of the swap panel keypad. */
194
+ swapKeypad: string;
195
+ /** Accessible name of the keypad delete key. */
196
+ swapDelete: string;
105
197
  }
106
198
  export declare const close = "Close";
107
199
  export declare const cancel = "Cancel";
@@ -150,6 +242,52 @@ export declare const statusOffline = "offline";
150
242
  export declare const statusStale = "stale";
151
243
  export declare const increase = "Increase";
152
244
  export declare const decrease = "Decrease";
245
+ export declare const swapFrom = "From";
246
+ export declare const swapTo = "To";
247
+ export declare const swapSelectToken: (side: string) => string;
248
+ export declare const swapAmount: (side: string) => string;
249
+ export declare const swapSwitchDenomination = "Switch between dollars and token units";
250
+ export declare const swapFlip = "Swap direction";
251
+ export declare const swapActionSend = "Send";
252
+ export declare const swapActionSwap = "Swap";
253
+ export declare const swapActionBridge = "Bridge";
254
+ export declare const swapChooseToken = "Select a token";
255
+ export declare const swapChooseDestination = "Pick a destination";
256
+ export declare const swapEnterAmount = "Enter an amount";
257
+ export declare const swapInsufficient: (symbol: string) => string;
258
+ export declare const swapSendFromWallet = "Send from your wallet";
259
+ export declare const swapReset = "Reset";
260
+ export declare const swapSettings = "Settings";
261
+ export declare const swapMax = "Max";
262
+ export declare const swapTest = "Test";
263
+ export declare const swapSlippage: (percent: string) => string;
264
+ export declare const swapSlippageTitle = "Slippage";
265
+ export declare const swapSlippageCustom = "Custom slippage (%)";
266
+ export declare const swapFee: (amount: string) => string;
267
+ export declare const swapFees = "Fees";
268
+ export declare const swapFeeTotal = "Total";
269
+ export declare const swapDenomination = "Show amounts in";
270
+ export declare const swapDollars = "Dollars";
271
+ export declare const swapUnits = "Units";
272
+ export declare const swapSearchTokens = "Search name or paste address";
273
+ export declare const swapChains = "Chains";
274
+ export declare const swapAllChains = "All";
275
+ export declare const swapHot = "Hot";
276
+ export declare const swapAllTokens = "All tokens";
277
+ export declare const swapNoTokens = "No tokens found";
278
+ export declare const swapSelected = "Selected";
279
+ export declare const swapConnectWallet = "Connect wallet";
280
+ export declare const swapDisconnect = "Disconnect wallet";
281
+ export declare const swapGenerateAddress = "Generate address";
282
+ export declare const swapRecipient = "Recipient address";
283
+ export declare const swapScan = "Scan QR code";
284
+ export declare const copyAddress = "Copy address";
285
+ export declare const addressCopied = "Address copied";
286
+ export declare const tapToCopy = "Tap to copy";
287
+ export declare const qrCode = "QR code";
288
+ export declare const swapControlKey = "Ctrl";
289
+ export declare const swapKeypad = "Keypad";
290
+ export declare const swapDelete = "Delete";
153
291
  /** The complete English catalog. */
154
292
  export declare const defaultMessages: Readonly<HIGMessages>;
155
293
  /** Every message key, in documentation order. */
@@ -46,8 +46,54 @@ export const statusOffline = 'offline';
46
46
  export const statusStale = 'stale';
47
47
  export const increase = 'Increase';
48
48
  export const decrease = 'Decrease';
49
+ export const swapFrom = 'From';
50
+ export const swapTo = 'To';
51
+ export const swapSelectToken = (side) => `Select ${side} token`;
52
+ export const swapAmount = (side) => `${side} amount`;
53
+ export const swapSwitchDenomination = 'Switch between dollars and token units';
54
+ export const swapFlip = 'Swap direction';
55
+ export const swapActionSend = 'Send';
56
+ export const swapActionSwap = 'Swap';
57
+ export const swapActionBridge = 'Bridge';
58
+ export const swapChooseToken = 'Select a token';
59
+ export const swapChooseDestination = 'Pick a destination';
60
+ export const swapEnterAmount = 'Enter an amount';
61
+ export const swapInsufficient = (symbol) => `Insufficient ${symbol}`;
62
+ export const swapSendFromWallet = 'Send from your wallet';
63
+ export const swapReset = 'Reset';
64
+ export const swapSettings = 'Settings';
65
+ export const swapMax = 'Max';
66
+ export const swapTest = 'Test';
67
+ export const swapSlippage = (percent) => `Slippage ${percent}`;
68
+ export const swapSlippageTitle = 'Slippage';
69
+ export const swapSlippageCustom = 'Custom slippage (%)';
70
+ export const swapFee = (amount) => `Fee ${amount}`;
71
+ export const swapFees = 'Fees';
72
+ export const swapFeeTotal = 'Total';
73
+ export const swapDenomination = 'Show amounts in';
74
+ export const swapDollars = 'Dollars';
75
+ export const swapUnits = 'Units';
76
+ export const swapSearchTokens = 'Search name or paste address';
77
+ export const swapChains = 'Chains';
78
+ export const swapAllChains = 'All';
79
+ export const swapHot = 'Hot';
80
+ export const swapAllTokens = 'All tokens';
81
+ export const swapNoTokens = 'No tokens found';
82
+ export const swapSelected = 'Selected';
83
+ export const swapConnectWallet = 'Connect wallet';
84
+ export const swapDisconnect = 'Disconnect wallet';
85
+ export const swapGenerateAddress = 'Generate address';
86
+ export const swapRecipient = 'Recipient address';
87
+ export const swapScan = 'Scan QR code';
88
+ export const copyAddress = 'Copy address';
89
+ export const addressCopied = 'Address copied';
90
+ export const tapToCopy = 'Tap to copy';
91
+ export const qrCode = 'QR code';
92
+ export const swapControlKey = 'Ctrl';
93
+ export const swapKeypad = 'Keypad';
94
+ export const swapDelete = 'Delete';
49
95
  /** The complete English catalog. */
50
- export const defaultMessages = { close, cancel, dismiss, dismissNotice, busy, notifications, loading, loadingContent, loadingItems, loadingChart, noItems, noRows, retry, loadMore, stale, required, breadcrumb, pagination, previous, next, pageOf, search, searching, noResults, resultCount, back, menuDescription, choose, chooseOne, inProgress, progressValue, copied, copyFailed, copyInstallCommand, reviewAssetOrder, amountInAsset, availableAmount, reviewOrder, confirmOrder, confirmOrderDescription, orderUnavailable, noActivity, statusOnline, statusOffline, statusStale, increase, decrease };
96
+ export const defaultMessages = { close, cancel, dismiss, dismissNotice, busy, notifications, loading, loadingContent, loadingItems, loadingChart, noItems, noRows, retry, loadMore, stale, required, breadcrumb, pagination, previous, next, pageOf, search, searching, noResults, resultCount, back, menuDescription, choose, chooseOne, inProgress, progressValue, copied, copyFailed, copyInstallCommand, reviewAssetOrder, amountInAsset, availableAmount, reviewOrder, confirmOrder, confirmOrderDescription, orderUnavailable, noActivity, statusOnline, statusOffline, statusStale, increase, decrease, swapFrom, swapTo, swapSelectToken, swapAmount, swapSwitchDenomination, swapFlip, swapActionSend, swapActionSwap, swapActionBridge, swapChooseToken, swapChooseDestination, swapEnterAmount, swapInsufficient, swapSendFromWallet, swapReset, swapSettings, swapMax, swapTest, swapSlippage, swapSlippageTitle, swapSlippageCustom, swapFee, swapFees, swapFeeTotal, swapDenomination, swapDollars, swapUnits, swapSearchTokens, swapChains, swapAllChains, swapHot, swapAllTokens, swapNoTokens, swapSelected, swapConnectWallet, swapDisconnect, swapGenerateAddress, swapRecipient, swapScan, copyAddress, addressCopied, tapToCopy, qrCode, swapControlKey, swapKeypad, swapDelete };
51
97
  /** Every message key, in documentation order. */
52
98
  export const messageKeys = /* @__PURE__ */ Object.keys(defaultMessages);
53
99
  /**
@@ -58,7 +104,7 @@ export const messageKeys = /* @__PURE__ */ Object.keys(defaultMessages);
58
104
  export function resolveMessages(base, overrides) {
59
105
  if (!overrides)
60
106
  return base;
61
- const formatters = ['dismissNotice', 'pageOf', 'resultCount', 'progressValue', 'reviewAssetOrder', 'amountInAsset', 'availableAmount', 'confirmOrderDescription'];
107
+ const formatters = ['dismissNotice', 'pageOf', 'resultCount', 'progressValue', 'reviewAssetOrder', 'amountInAsset', 'availableAmount', 'confirmOrderDescription', 'swapSelectToken', 'swapAmount', 'swapInsufficient', 'swapSlippage', 'swapFee'];
62
108
  const resolved = { ...base };
63
109
  for (const [key, value] of Object.entries(overrides)) {
64
110
  if (value !== undefined && typeof value === (formatters.includes(key) ? 'function' : 'string'))
package/css.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ // Stylesheet imports have no JavaScript exports. Bundlers load the default CSS target.
2
+ export {};
@@ -1,6 +1,6 @@
1
1
  # @bloxwap/hig/feedback
2
2
 
3
- Version 0.2.0, an entry of `@bloxwap/hig`. Root contract imports no React, DOM, RN, audio or device API. Use independent web/native entries and opt in to each channel. Successful API invocation never certifies physical output. See docs/feedback for timing, storage, capability and device verification.
3
+ Version 0.5.1, an entry of `@bloxwap/hig`. Root contract imports no React, DOM, RN, audio or device API. Use independent web/native entries and opt in to each channel. Successful API invocation never certifies physical output. See docs/feedback for timing, storage, capability and device verification.
4
4
 
5
5
  `createWebSoundAdapter` passes a per-adapter abort signal to SFX. The signal-aware engine cancels that root's active voices while other roots and host-owned playback continue. The shared default engine remains reference-counted.
6
6
 
Binary file
@@ -1,7 +1,17 @@
1
1
  {
2
2
  "version": "0.1.0",
3
- "exporter": "@bloxwap/sfx 0.1.0 / node-web-audio-api 2.2.0",
4
- "command": "sfx-wav --out packages/hig/feedback/assets --sounds tick,toggle,success,error --sample-rate 48000 --bit-depth 16 --channels 1 --trim",
3
+ "exporter": "@bloxwap/sfx 0.3.0 / node-web-audio-api 2.2.0",
4
+ "command": "node --import ./scripts/cue-random.mjs node_modules/@bloxwap/sfx/dist/cli/sfx-wav.js --out packages/hig/feedback/assets --sounds tick,toggle,success,error --sample-rate 48000 --bit-depth 16 --channels 1 --trim",
5
+ "flags": [
6
+ "--sample-rate",
7
+ "48000",
8
+ "--bit-depth",
9
+ "16",
10
+ "--channels",
11
+ "1",
12
+ "--trim"
13
+ ],
14
+ "noiseSeed": "mulberry32:0x183",
5
15
  "noise": "Noise recipes can vary; compare duration/envelope/levels, not regenerated bytes. Hashes identify the reviewed committed artifact.",
6
16
  "cues": [
7
17
  {
@@ -9,37 +19,37 @@
9
19
  "file": "tick.wav",
10
20
  "recipe": "tick",
11
21
  "package": "@bloxwap/sfx",
12
- "packageVersion": "0.1.0",
22
+ "packageVersion": "0.3.0",
13
23
  "channels": 1,
14
24
  "sampleRate": 48000,
15
25
  "bitDepth": 16,
16
- "durationMs": 83.02,
17
- "peakDbFS": -15.19,
18
- "rmsDbFS": -40.13,
19
- "bytes": 8014,
20
- "sha256": "2a4a100e1bb38a86e4f314bbf6f5254f34d3293d760a051c96fde09f996401c1"
26
+ "durationMs": 83.06,
27
+ "peakDbFS": -17.11,
28
+ "rmsDbFS": -40.59,
29
+ "bytes": 8018,
30
+ "sha256": "942150b5f9001cc9a9579225aff79ae3a52223dac636301c028b4be4d188befc"
21
31
  },
22
32
  {
23
33
  "name": "toggle",
24
34
  "file": "toggle.wav",
25
35
  "recipe": "toggle",
26
36
  "package": "@bloxwap/sfx",
27
- "packageVersion": "0.1.0",
37
+ "packageVersion": "0.3.0",
28
38
  "channels": 1,
29
39
  "sampleRate": 48000,
30
40
  "bitDepth": 16,
31
- "durationMs": 113.58,
32
- "peakDbFS": -18.17,
33
- "rmsDbFS": -39.27,
34
- "bytes": 10948,
35
- "sha256": "6b8c2c0eccd1f3b5ac20adcfd34b6360ecbf59b786cdb02e60c81e7b363a147c"
41
+ "durationMs": 114.6,
42
+ "peakDbFS": -17.01,
43
+ "rmsDbFS": -39.84,
44
+ "bytes": 11046,
45
+ "sha256": "00ba23f1bffebf72340c08aece8caa9a9f8966fbb108b5dd8189aec047c8197d"
36
46
  },
37
47
  {
38
48
  "name": "success",
39
49
  "file": "success.wav",
40
50
  "recipe": "success",
41
51
  "package": "@bloxwap/sfx",
42
- "packageVersion": "0.1.0",
52
+ "packageVersion": "0.3.0",
43
53
  "channels": 1,
44
54
  "sampleRate": 48000,
45
55
  "bitDepth": 16,
@@ -54,15 +64,15 @@
54
64
  "file": "error.wav",
55
65
  "recipe": "error",
56
66
  "package": "@bloxwap/sfx",
57
- "packageVersion": "0.1.0",
67
+ "packageVersion": "0.3.0",
58
68
  "channels": 1,
59
69
  "sampleRate": 48000,
60
70
  "bitDepth": 16,
61
71
  "durationMs": 314,
62
- "peakDbFS": -14.98,
63
- "rmsDbFS": -31.9,
72
+ "peakDbFS": -14.99,
73
+ "rmsDbFS": -31.89,
64
74
  "bytes": 30188,
65
- "sha256": "e0b541e34955dbfa32b0146682f1dc1aa6f5cd251318476aabccc25039856ac0"
75
+ "sha256": "c3a4b4d82447326ae656e0828a7648b59f6979437dc2ea4d7821e6dc2ce3b3c3"
66
76
  }
67
77
  ]
68
78
  }
Binary file
Binary file
@@ -1,63 +1,7 @@
1
1
  import type { FeedbackAdapter, FeedbackEvent, FeedbackPreferences, FeedbackSink } from '@bloxwap/hig/contracts/feedback';
2
2
  export type { FeedbackAdapter, FeedbackEvent, FeedbackPreferences, FeedbackSink, FeedbackCapability, PreferenceStorage, FeedbackIntent } from '@bloxwap/hig/contracts/feedback';
3
3
  export declare const defaultPreferences: FeedbackPreferences;
4
- export declare const presets: {
5
- readonly press: {
6
- readonly sound: null;
7
- readonly haptic: null;
8
- readonly cooldown: 0;
9
- };
10
- readonly activate: {
11
- readonly sound: 'tick';
12
- readonly haptic: 'selection';
13
- readonly cooldown: 80;
14
- };
15
- readonly release: {
16
- readonly sound: null;
17
- readonly haptic: null;
18
- readonly cooldown: 0;
19
- };
20
- readonly cancel: {
21
- readonly sound: null;
22
- readonly haptic: null;
23
- readonly cooldown: 0;
24
- };
25
- readonly selection: {
26
- readonly sound: 'tick';
27
- readonly haptic: 'selection';
28
- readonly cooldown: 80;
29
- };
30
- readonly toggle: {
31
- readonly sound: 'toggle';
32
- readonly haptic: 'selection';
33
- readonly cooldown: 80;
34
- };
35
- readonly disclosure: {
36
- readonly sound: null;
37
- readonly haptic: null;
38
- readonly cooldown: 120;
39
- };
40
- readonly success: {
41
- readonly sound: 'success';
42
- readonly haptic: 'success';
43
- readonly cooldown: 400;
44
- };
45
- readonly warning: {
46
- readonly sound: null;
47
- readonly haptic: 'warning';
48
- readonly cooldown: 400;
49
- };
50
- readonly error: {
51
- readonly sound: 'error';
52
- readonly haptic: 'error';
53
- readonly cooldown: 400;
54
- };
55
- readonly notification: {
56
- readonly sound: null;
57
- readonly haptic: null;
58
- readonly cooldown: 800;
59
- };
60
- };
4
+ export { presets } from './presets.js';
61
5
  export interface ControllerOptions {
62
6
  sound?: FeedbackAdapter;
63
7
  haptics?: FeedbackAdapter;
@@ -1,5 +1,6 @@
1
1
  export const defaultPreferences = { version: 1, sound: false, haptics: false, volume: 0.3, motion: true };
2
- export const presets = { press: { sound: null, haptic: null, cooldown: 0 }, activate: { sound: 'tick', haptic: 'selection', cooldown: 80 }, release: { sound: null, haptic: null, cooldown: 0 }, cancel: { sound: null, haptic: null, cooldown: 0 }, selection: { sound: 'tick', haptic: 'selection', cooldown: 80 }, toggle: { sound: 'toggle', haptic: 'selection', cooldown: 80 }, disclosure: { sound: null, haptic: null, cooldown: 120 }, success: { sound: 'success', haptic: 'success', cooldown: 400 }, warning: { sound: null, haptic: 'warning', cooldown: 400 }, error: { sound: 'error', haptic: 'error', cooldown: 400 }, notification: { sound: null, haptic: null, cooldown: 800 } };
2
+ import { presets } from './presets.js';
3
+ export { presets } from './presets.js';
3
4
  function attempt(fn) { if (!fn)
4
5
  return; try {
5
6
  Promise.resolve(fn()).catch(() => { });
@@ -1,4 +1,5 @@
1
1
  import type { FeedbackAdapter } from '@bloxwap/hig/contracts/feedback';
2
+ import { presets } from './contract.js';
2
3
  export interface NativePlayer {
3
4
  play: () => void;
4
5
  pause: () => void;
@@ -10,7 +11,7 @@ export interface NativeAudioBackend {
10
11
  create: (asset: unknown) => NativePlayer;
11
12
  configure?: () => Promise<void>;
12
13
  }
13
- export type CueAssets = Readonly<Partial<Record<'tick' | 'toggle' | 'success' | 'error', unknown>>>;
14
+ export type CueAssets = Readonly<Partial<Record<NonNullable<(typeof presets)[keyof typeof presets]['sound']>, unknown>>>;
14
15
  /** Host provides packaged Metro asset ids and lifecycle hooks; no browser audio at module load.
15
16
  * After preload() settles, play() dispatches synchronously: no bridge round trip (configure, seek) precedes player.play(). */
16
17
  export declare function createNativeSoundAdapter(backend: NativeAudioBackend, assets: CueAssets): FeedbackAdapter & {
@@ -0,0 +1,57 @@
1
+ export declare const presets: {
2
+ readonly press: {
3
+ readonly sound: null;
4
+ readonly haptic: null;
5
+ readonly cooldown: 0;
6
+ };
7
+ readonly activate: {
8
+ readonly sound: 'tick';
9
+ readonly haptic: 'selection';
10
+ readonly cooldown: 80;
11
+ };
12
+ readonly release: {
13
+ readonly sound: null;
14
+ readonly haptic: null;
15
+ readonly cooldown: 0;
16
+ };
17
+ readonly cancel: {
18
+ readonly sound: null;
19
+ readonly haptic: null;
20
+ readonly cooldown: 0;
21
+ };
22
+ readonly selection: {
23
+ readonly sound: 'tick';
24
+ readonly haptic: 'selection';
25
+ readonly cooldown: 80;
26
+ };
27
+ readonly toggle: {
28
+ readonly sound: 'toggle';
29
+ readonly haptic: 'selection';
30
+ readonly cooldown: 80;
31
+ };
32
+ readonly disclosure: {
33
+ readonly sound: null;
34
+ readonly haptic: null;
35
+ readonly cooldown: 120;
36
+ };
37
+ readonly success: {
38
+ readonly sound: 'success';
39
+ readonly haptic: 'success';
40
+ readonly cooldown: 400;
41
+ };
42
+ readonly warning: {
43
+ readonly sound: null;
44
+ readonly haptic: 'warning';
45
+ readonly cooldown: 400;
46
+ };
47
+ readonly error: {
48
+ readonly sound: 'error';
49
+ readonly haptic: 'error';
50
+ readonly cooldown: 400;
51
+ };
52
+ readonly notification: {
53
+ readonly sound: null;
54
+ readonly haptic: null;
55
+ readonly cooldown: 800;
56
+ };
57
+ };
@@ -0,0 +1 @@
1
+ export const presets = { press: { sound: null, haptic: null, cooldown: 0 }, activate: { sound: 'tick', haptic: 'selection', cooldown: 80 }, release: { sound: null, haptic: null, cooldown: 0 }, cancel: { sound: null, haptic: null, cooldown: 0 }, selection: { sound: 'tick', haptic: 'selection', cooldown: 80 }, toggle: { sound: 'toggle', haptic: 'selection', cooldown: 80 }, disclosure: { sound: null, haptic: null, cooldown: 120 }, success: { sound: 'success', haptic: 'success', cooldown: 400 }, warning: { sound: null, haptic: 'warning', cooldown: 400 }, error: { sound: 'error', haptic: 'error', cooldown: 400 }, notification: { sound: null, haptic: null, cooldown: 800 } };
package/native/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @bloxwap/hig/native
2
2
 
3
- Version 0.2.0, an entry of `@bloxwap/hig`. Import individual entries; see docs/components for platform and accessibility contracts.
3
+ Version 0.5.1, an entry of `@bloxwap/hig`. Import individual entries; see docs/components for platform and accessibility contracts.
4
4
 
5
5
  Set a brand accent with `<HIGProvider primaryColor='#ff0000'>` from
6
6
  `@bloxwap/hig/native/provider`. It accepts opaque sRGB hex (`#RGB` or `#RRGGBB`),
@@ -9,3 +9,8 @@ Omit it to keep Bloxwap green. Nested providers inherit the accent, and `useColo
9
9
  returns the resolved roles. With `colorSpace='display-p3'` on iOS, HIG converts
10
10
  the sRGB input to P3 channels. Status, buy/sell colours, and the Bloxwap mark retain
11
11
  their defaults. See [the colour guide](../../../docs/foundations/platform.md#primary-brand-colour).
12
+
13
+ Market direction has its own roles. `useColors().up` and `.down` default to `buy` and
14
+ `sell`. `<HIGProvider marketColors={{up,down}}>` overrides either one for hosts whose
15
+ convention differs, and readouts paint them with `tone="up"` / `tone="down"`. See
16
+ [market direction colours](../../../docs/foundations/platform.md#market-direction-colours).
@@ -4,14 +4,18 @@ import { useEffect, useRef, useState } from 'react';
4
4
  import { PixelRatio, StyleSheet, View } from 'react-native';
5
5
  import Reanimated, { cancelAnimation, Easing, ReduceMotion, useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
6
6
  import * as en from '@bloxwap/hig/contracts/messages';
7
+ import { tokens } from '@bloxwap/hig/tokens';
7
8
  import { createNumberReelModel, formatNumberReadout, numberTrendDirection, safeNumberLayout } from './animated-number-model.js';
8
9
  import { useColors, useHIG } from './provider.js';
9
10
  import { detectScript, Text } from './surface.js';
10
11
  const numberTypographyKeys = new Set(['fontFamily', 'fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'textAlign']);
12
+ // Android Fabric reads colour 0 as "unset", so 'transparent' (0x00000000) drew the hidden reading in the default
13
+ // black under the reels. Clear white is non-zero there and still invisible.
14
+ const hiddenReading = { color: '#ffffff00' };
11
15
  const clampedDuration = (duration) => Number.isFinite(duration) && duration > 0 ? Math.min(duration, 600) : 0;
12
16
  function DigitReel({ digits, digit, trend, duration, reducedMotion, width, height, style, script, maxFontSizeMultiplier }) {
13
17
  const position = useSharedValue(digit), previousDigit = useRef(digit);
14
- const animatedStyle = useAnimatedStyle(() => ({ transform: [{ translateY: -(position.value + 10) * height }] }), [height]);
18
+ const animatedStyle = useAnimatedStyle(() => ({ transform: [{ translateY: -position.value * height }] }), [height]);
15
19
  useEffect(() => {
16
20
  const motionDuration = clampedDuration(duration);
17
21
  if (previousDigit.current === digit) {
@@ -32,10 +36,10 @@ function DigitReel({ digits, digit, trend, duration, reducedMotion, width, heigh
32
36
  position.value = digit;
33
37
  return;
34
38
  }
35
- const normalized = current >= 0 && current < 10 ? current : ((current % 10) + 10) % 10;
39
+ const cycle = trend < 0 ? 10 : 0, normalized = current >= cycle && current < cycle + 10 ? current : ((current % 10) + 10) % 10 + cycle;
36
40
  if (normalized !== current)
37
41
  position.value = normalized;
38
- let destination = digit;
42
+ let destination = trend < 0 ? digit + 10 : digit;
39
43
  if (trend > 0)
40
44
  while (destination <= normalized)
41
45
  destination += 10;
@@ -46,10 +50,10 @@ function DigitReel({ digits, digit, trend, duration, reducedMotion, width, heigh
46
50
  position.value = digit;
47
51
  return;
48
52
  }
49
- position.value = withTiming(destination, { duration: motionDuration, easing: Easing.out(Easing.cubic), reduceMotion: ReduceMotion.Never });
53
+ position.value = withTiming(destination, { duration: motionDuration, easing: Easing.bezier(...tokens.easing.standard), reduceMotion: ReduceMotion.Never });
50
54
  }, [digit, trend, duration, reducedMotion, position]);
51
55
  useEffect(() => () => cancelAnimation(position), [position]);
52
- const rows = Array.from({ length: 30 }, (_, index) => digits[index % 10]);
56
+ const rows = Array.from({ length: 20 }, (_, index) => digits[index % 10]);
53
57
  return _jsx(View, { collapsable: false, style: { width, height, overflow: 'hidden' }, children: _jsx(Reanimated.View, { style: animatedStyle, children: rows.map((glyph, index) => _jsx(Text, { accessible: false, script: script, maxFontSizeMultiplier: maxFontSizeMultiplier, style: [style, { width, height, textAlign: 'center' }], children: glyph }, `${index}:${glyph}`)) }) });
54
58
  }
55
59
  function recordGlyph(measurements, key, index, event, setMetrics) {
@@ -70,7 +74,7 @@ export function AnimatedNumberReadout({ value, options, formattedValue, stale, l
70
74
  const previousValue = useRef(value), directionTrend = numberTrendDirection(trend, previousValue.current, value);
71
75
  useEffect(() => { previousValue.current = value; }, [value]);
72
76
  const typography = Object.fromEntries(Object.entries(StyleSheet.flatten(style) ?? {}).filter(([key]) => numberTypographyKeys.has(key)));
73
- const color = colors[tone === 'positive' || tone === 'negative' || tone === 'muted' ? tone : 'text'];
77
+ const color = colors[tone === 'positive' || tone === 'negative' || tone === 'muted' || tone === 'up' || tone === 'down' ? tone : 'text'];
74
78
  const textStyle = [typography, { color, fontVariant: ['tabular-nums'] }];
75
79
  const script = detectScript(`${reading.text}${staleSuffix}`, locale);
76
80
  const model = createNumberReelModel(value, locale, options, formattedValue, direction);
@@ -89,5 +93,5 @@ export function AnimatedNumberReadout({ value, options, formattedValue, stale, l
89
93
  const activeMetrics = activeModel ? metrics : null;
90
94
  const justifyContent = typography.textAlign === 'right' ? 'flex-end' : typography.textAlign === 'center' ? 'center' : 'flex-start';
91
95
  const visualProps = { accessible: false, script, maxFontSizeMultiplier };
92
- return _jsxs(View, { collapsable: false, style: { position: 'relative' }, children: [_jsxs(Text, { accessibilityLabel: label ? `${label}: ${reading.text}${staleSuffix}` : undefined, testID: testID, maxFontSizeMultiplier: maxFontSizeMultiplier, style: [textStyle, activeModel ? { color: 'transparent' } : undefined], children: [reading.text, staleSuffix] }), safeModel && _jsx(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', pointerEvents: 'none', style: { position: 'absolute', opacity: 0, flexDirection: 'row' }, children: safeModel.digits.map((glyph, index) => _createElement(Text, { ...visualProps, key: `${measurementKey}:${index}`, onLayout: event => recordGlyph(measurements, measurementKey, index, event, setMetrics), style: textStyle }, glyph)) }), activeModel && activeMetrics && _jsxs(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', pointerEvents: 'none', style: [StyleSheet.absoluteFill, { overflow: 'hidden', flexDirection: 'row', direction: 'ltr', alignItems: 'center', justifyContent }], children: [prefix && _jsx(Text, { ...visualProps, style: textStyle, children: prefix }), activeModel.tokens.map(token => token.kind === 'static' ? _createElement(Text, { ...visualProps, key: token.key, style: textStyle }, token.value) : _jsx(DigitReel, { digits: activeModel.digits, digit: token.digit ?? 0, trend: directionTrend, duration: duration, reducedMotion: reducedMotion, width: activeMetrics.width, height: activeMetrics.height, style: textStyle, script: script, maxFontSizeMultiplier: maxFontSizeMultiplier }, token.key)), (suffix || staleSuffix) && _jsx(Text, { ...visualProps, style: textStyle, children: `${suffix ?? ''}${staleSuffix}` })] })] });
96
+ return _jsxs(View, { collapsable: false, style: { position: 'relative' }, children: [_jsxs(Text, { accessibilityLabel: label ? `${label}: ${reading.text}${staleSuffix}` : undefined, testID: testID, maxFontSizeMultiplier: maxFontSizeMultiplier, style: [textStyle, activeModel ? hiddenReading : undefined], children: [reading.text, staleSuffix] }), safeModel && _jsx(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', pointerEvents: 'none', style: { position: 'absolute', opacity: 0, flexDirection: 'row' }, children: safeModel.digits.map((glyph, index) => _createElement(Text, { ...visualProps, key: `${measurementKey}:${index}`, onLayout: event => recordGlyph(measurements, measurementKey, index, event, setMetrics), style: textStyle }, glyph)) }), activeModel && activeMetrics && _jsxs(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', pointerEvents: 'none', style: [StyleSheet.absoluteFill, { overflow: 'hidden', flexDirection: 'row', direction: 'ltr', alignItems: 'center', justifyContent }], children: [prefix && _jsx(Text, { ...visualProps, style: textStyle, children: prefix }), activeModel.tokens.map(token => token.kind === 'static' ? _createElement(Text, { ...visualProps, key: token.key, style: textStyle }, token.value) : _jsx(DigitReel, { digits: activeModel.digits, digit: token.digit ?? 0, trend: directionTrend, duration: duration, reducedMotion: reducedMotion, width: activeMetrics.width, height: activeMetrics.height, style: textStyle, script: script, maxFontSizeMultiplier: maxFontSizeMultiplier }, token.key)), (suffix || staleSuffix) && _jsx(Text, { ...visualProps, style: textStyle, children: `${suffix ?? ''}${staleSuffix}` })] })] });
93
97
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- /** The approved mark's #00ff3f fill and #0a0a0a strokes are the action and background tokens, painted in the provider's colour space independently of its primary colour. */
2
+ /** The approved mark. Geometry and fills come from the pinned SVG through `@bloxwap/hig/tokens/brand`, painted in the provider's colour space and independent of its primary colour. */
3
3
  export declare function BrandMark({ size, label }: {
4
4
  size?: number;
5
5
  label?: string;
@@ -1,6 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Svg, { Rect, G, Path } from 'react-native-svg';
3
- import { useColors, useBrandColors } from './provider.js';
4
- /** The approved mark's #00ff3f fill and #0a0a0a strokes are the action and background tokens, painted in the provider's colour space independently of its primary colour. */
5
- export function BrandMark({ size = 32, label }) { const colors = useBrandColors(); return _jsxs(Svg, { width: size, height: size, viewBox: '0 0 100 100', accessible: !!label, accessibilityLabel: label, children: [_jsx(Rect, { width: '100', height: '100', rx: '22.37', fill: colors.action }), _jsxs(G, { fill: 'none', stroke: colors.background, strokeWidth: '16', strokeLinecap: 'round', children: [_jsx(Path, { d: 'M25 75L75 25' }), _jsx(Path, { d: 'M24 24L35 35' }), _jsx(Path, { d: 'M65 65L76 76' })] })] }); }
3
+ import { brandMark as mark } from '@bloxwap/hig/tokens/brand';
4
+ import { useColors, useColorSpace } from './provider.js';
5
+ /** The approved mark. Geometry and fills come from the pinned SVG through `@bloxwap/hig/tokens/brand`, painted in the provider's colour space and independent of its primary colour. */
6
+ export function BrandMark({ size = 32, label }) { const space = useColorSpace() === 'display-p3' ? 'displayP3' : 'srgb'; return _jsxs(Svg, { width: size, height: size, viewBox: mark.viewBox, accessible: !!label, accessibilityLabel: label, children: [_jsx(Rect, { width: String(mark.size), height: String(mark.size), rx: String(mark.radius), fill: mark.fill[space] }), _jsx(G, { fill: 'none', stroke: mark.stroke[space], strokeWidth: String(mark.strokeWidth), strokeLinecap: mark.strokeLinecap, children: mark.paths.map(d => _jsx(Path, { d: d }, d)) })] }); }
6
7
  export function CheckIcon() { const colors = useColors(); return _jsx(Svg, { width: '20', height: '20', viewBox: '0 0 24 24', accessible: false, children: _jsx(Path, { d: 'm5 12 4 4 10-10', fill: 'none', stroke: colors.text, strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }) }); }