@ankhorage/zora 27.2.3 → 27.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +1 -1
  3. package/package.json +4 -3
  4. package/web-dist/authoring/index.js +1 -1
  5. package/web-dist/chunks/{Accordion-2ga81fwp.js → Accordion-0c585c6b.js} +2 -2
  6. package/web-dist/chunks/{Accordion-ecknv9v4.js → Accordion-276zkmsp.js} +6 -6
  7. package/web-dist/chunks/{Accordion-yq16wwh5.js → Accordion-2bwvswbf.js} +100 -2
  8. package/web-dist/chunks/{Accordion-pwpjet1r.js → Accordion-3c33rhns.js} +2 -2
  9. package/web-dist/chunks/{Accordion-6wrr910w.js → Accordion-4d4xahgg.js} +1 -1
  10. package/web-dist/chunks/{Accordion-fvv1jb72.js → Accordion-58rjgzd8.js} +4 -4
  11. package/web-dist/chunks/{Accordion-awarqvqt.js → Accordion-5xjm3haw.js} +3 -3
  12. package/web-dist/chunks/{Accordion-r2g18vxa.js → Accordion-67hswqw7.js} +1 -1
  13. package/web-dist/chunks/{Accordion-bfszt9f0.js → Accordion-6fe2cg8x.js} +3 -2
  14. package/web-dist/chunks/{Accordion-xstk85jq.js → Accordion-6pyhxpvj.js} +53 -18
  15. package/web-dist/chunks/{Accordion-ng4f4k3b.js → Accordion-7hcnqvw9.js} +3 -3
  16. package/web-dist/chunks/{Accordion-vg337250.js → Accordion-7j1ams3h.js} +2 -2
  17. package/web-dist/chunks/{Accordion-rkg1y7x3.js → Accordion-a0rf46ya.js} +9 -9
  18. package/web-dist/chunks/{Accordion-vmbaw3e9.js → Accordion-av34pgmt.js} +6 -6
  19. package/web-dist/chunks/{Accordion-srjya6dz.js → Accordion-b36h9a7g.js} +1 -1
  20. package/web-dist/chunks/{Accordion-37fyjrmm.js → Accordion-bjagk749.js} +3 -3
  21. package/web-dist/chunks/{Accordion-apchszqk.js → Accordion-c1hhwvme.js} +2 -2
  22. package/web-dist/chunks/{Accordion-vyr0pdcg.js → Accordion-cqw8wx8b.js} +4 -4
  23. package/web-dist/chunks/{Accordion-hywab9gp.js → Accordion-czjn2qsj.js} +12 -12
  24. package/web-dist/chunks/{Accordion-yen1cn5b.js → Accordion-dvydrq9k.js} +2 -2
  25. package/web-dist/chunks/{Accordion-k3mcnzzz.js → Accordion-e027hq2m.js} +9 -9
  26. package/web-dist/chunks/{Accordion-109vh7aq.js → Accordion-e5cv8nsg.js} +8 -8
  27. package/web-dist/chunks/{Accordion-xwg44t8y.js → Accordion-ekynbcva.js} +5 -5
  28. package/web-dist/chunks/{Accordion-9j3x1ccv.js → Accordion-fz2eb6nq.js} +7 -7
  29. package/web-dist/chunks/{Accordion-z11jhrng.js → Accordion-gs2sm01j.js} +8 -8
  30. package/web-dist/chunks/{Accordion-mfyhqbk5.js → Accordion-h0g07rpv.js} +6 -6
  31. package/web-dist/chunks/{Accordion-rwk4marz.js → Accordion-hcybq8sv.js} +5 -5
  32. package/web-dist/chunks/{Accordion-8pwsx854.js → Accordion-hh7rrtvm.js} +7 -7
  33. package/web-dist/chunks/{Accordion-55axaf49.js → Accordion-hvxmng6p.js} +4 -4
  34. package/web-dist/chunks/{Accordion-972z2w82.js → Accordion-k90e8xbz.js} +4 -4
  35. package/web-dist/chunks/{Accordion-dska91jj.js → Accordion-kgsyp87f.js} +13 -13
  36. package/web-dist/chunks/{Accordion-jz4j00nh.js → Accordion-kw82sjaq.js} +4 -4
  37. package/web-dist/chunks/{Accordion-f2ce5m3x.js → Accordion-m0h44b2f.js} +4 -4
  38. package/web-dist/chunks/{Accordion-j1chy29e.js → Accordion-m9ph4kvs.js} +3 -3
  39. package/web-dist/chunks/{Accordion-2d49mqp7.js → Accordion-mqb226ws.js} +2 -2
  40. package/web-dist/chunks/Accordion-n6r6pees.js +9568 -0
  41. package/web-dist/chunks/Accordion-n8272tj8.js +1296 -0
  42. package/web-dist/chunks/{Accordion-dev40gg3.js → Accordion-n893wynv.js} +2 -2
  43. package/web-dist/chunks/{Accordion-aqqx878d.js → Accordion-p10zbjj2.js} +7 -7
  44. package/web-dist/chunks/{Accordion-2gx0rh1s.js → Accordion-pc1amd3f.js} +9 -9
  45. package/web-dist/chunks/{Accordion-qr5qn652.js → Accordion-pc21382h.js} +1 -1
  46. package/web-dist/chunks/{Accordion-bn0e6xt0.js → Accordion-pjp156pj.js} +7 -7
  47. package/web-dist/chunks/{Accordion-3p43xhk7.js → Accordion-qdpdvt4d.js} +29 -17
  48. package/web-dist/chunks/{Accordion-vj2yj9fa.js → Accordion-qe96qhwd.js} +2 -2
  49. package/web-dist/chunks/{Accordion-y0kg8p9s.js → Accordion-qntvm6fr.js} +5 -5
  50. package/web-dist/chunks/{Accordion-bff0p3x4.js → Accordion-qqv9mak2.js} +17 -5
  51. package/web-dist/chunks/{Accordion-0x8jncra.js → Accordion-tz5kyeym.js} +5 -7
  52. package/web-dist/chunks/{Accordion-vj1m2wck.js → Accordion-w42y21pt.js} +1 -1
  53. package/web-dist/chunks/{Accordion-xyx98xnk.js → Accordion-yttxjn1e.js} +5 -5
  54. package/web-dist/chunks/{Accordion-rmnw8z4x.js → Accordion-zvd2t0ey.js} +4 -4
  55. package/web-dist/components/accordion/Accordion.js +10 -12
  56. package/web-dist/components/accordion-item/AccordionItem.js +10 -12
  57. package/web-dist/components/activity-indicator/ActivityIndicator.js +3 -3
  58. package/web-dist/components/app-bar/AppBar.js +15 -17
  59. package/web-dist/components/app-header/AppHeader.js +15 -17
  60. package/web-dist/components/app-shell/AppShell.js +4 -5
  61. package/web-dist/components/auth-screen/AuthScreen.js +19 -21
  62. package/web-dist/components/avatar/Avatar.js +10 -12
  63. package/web-dist/components/avatar-group/AvatarGroup.js +10 -12
  64. package/web-dist/components/badge/Badge.js +5 -6
  65. package/web-dist/components/barcode-scanner-view/BarcodeScannerView.js +18 -20
  66. package/web-dist/components/bottom-sheet/BottomSheet.js +6 -7
  67. package/web-dist/components/bottom-sheet-flat-list/BottomSheetFlatList.js +6 -7
  68. package/web-dist/components/bottom-sheet-scroll-view/BottomSheetScrollView.js +6 -7
  69. package/web-dist/components/bottom-sheet-section-list/BottomSheetSectionList.js +6 -7
  70. package/web-dist/components/bottom-sheet-view/BottomSheetView.js +6 -7
  71. package/web-dist/components/bottom-sheet-virtualized-list/BottomSheetVirtualizedList.js +6 -7
  72. package/web-dist/components/breadcrumbs/Breadcrumbs.js +12 -14
  73. package/web-dist/components/button/Button.js +10 -12
  74. package/web-dist/components/button-group/ButtonGroup.js +10 -12
  75. package/web-dist/components/camera-permission-view/CameraPermissionView.js +18 -20
  76. package/web-dist/components/card/Card.js +17 -19
  77. package/web-dist/components/card-back/CardBack.js +4 -4
  78. package/web-dist/components/card-hand/CardHand.js +4 -4
  79. package/web-dist/components/chat-list-item/ChatListItem.js +14 -16
  80. package/web-dist/components/checkbox/Checkbox.js +10 -12
  81. package/web-dist/components/checkbox-group/CheckboxGroup.js +10 -12
  82. package/web-dist/components/chess-board/ChessBoard.js +4 -4
  83. package/web-dist/components/chip/Chip.js +11 -13
  84. package/web-dist/components/chip-group/ChipGroup.js +11 -13
  85. package/web-dist/components/collection-editor/CollectionEditor.js +17 -19
  86. package/web-dist/components/content-rail/ContentRail.js +11 -13
  87. package/web-dist/components/data-table/DataTable.js +22 -24
  88. package/web-dist/components/date-picker/DatePicker.js +15 -17
  89. package/web-dist/components/dialog/Dialog.js +9 -11
  90. package/web-dist/components/divider/Divider.js +4 -5
  91. package/web-dist/components/empty-state/EmptyState.js +18 -20
  92. package/web-dist/components/explorer/Explorer.js +11 -13
  93. package/web-dist/components/field/Field.js +10 -12
  94. package/web-dist/components/file-explorer/FileExplorer.js +11 -13
  95. package/web-dist/components/flat-list/FlatList.js +11 -13
  96. package/web-dist/components/forgot-password-form/ForgotPasswordForm.js +19 -21
  97. package/web-dist/components/form/Form.js +14 -16
  98. package/web-dist/components/form-actions/FormActions.js +14 -16
  99. package/web-dist/components/form-error/FormError.js +14 -16
  100. package/web-dist/components/game/Game.js +5 -6
  101. package/web-dist/components/game-entity/GameEntity.js +5 -6
  102. package/web-dist/components/game-field/GameField.js +5 -6
  103. package/web-dist/components/game-input-zone/GameInputZone.js +5 -6
  104. package/web-dist/components/game-measurement-probe/GameMeasurementProbe.js +5 -6
  105. package/web-dist/components/game-overlay/GameOverlay.js +5 -6
  106. package/web-dist/components/gradient/Gradient.js +5 -6
  107. package/web-dist/components/gradient-renderer-provider/GradientRendererProvider.js +5 -6
  108. package/web-dist/components/grid/Grid.js +4 -5
  109. package/web-dist/components/grid-line-overlay/GridLineOverlay.js +4 -4
  110. package/web-dist/components/grid-ruler/GridRuler.js +4 -4
  111. package/web-dist/components/heading/Heading.js +5 -6
  112. package/web-dist/components/hero/Hero.js +17 -19
  113. package/web-dist/components/icon/Icon.js +4 -5
  114. package/web-dist/components/icon-button/IconButton.js +10 -12
  115. package/web-dist/components/image/Image.js +8 -10
  116. package/web-dist/components/keyboard-avoiding-view/KeyboardAvoidingView.js +3 -3
  117. package/web-dist/components/list/List.js +11 -13
  118. package/web-dist/components/list-item/ListItem.js +11 -13
  119. package/web-dist/components/list-section/ListSection.js +11 -13
  120. package/web-dist/components/matrix-grid/MatrixGrid.js +4 -9
  121. package/web-dist/components/media-card/MediaCard.js +17 -19
  122. package/web-dist/components/media-explorer/MediaExplorer.js +11 -13
  123. package/web-dist/components/message-bubble/MessageBubble.js +14 -16
  124. package/web-dist/components/metric-card/MetricCard.js +17 -19
  125. package/web-dist/components/missing-element/MissingElement.js +9 -11
  126. package/web-dist/components/o-auth-provider-button/OAuthProviderButton.js +19 -21
  127. package/web-dist/components/o-auth-provider-list/OAuthProviderList.js +19 -21
  128. package/web-dist/components/opening-book/OpeningBook.js +4 -4
  129. package/web-dist/components/otp-form/OtpForm.js +19 -21
  130. package/web-dist/components/pagination/Pagination.js +11 -13
  131. package/web-dist/components/palette-item/PaletteItem.js +17 -19
  132. package/web-dist/components/playing-card/PlayingCard.js +4 -4
  133. package/web-dist/components/poker-training-table/PokerTrainingTable.js +4 -4
  134. package/web-dist/components/popover-menu/PopoverMenu.js +10 -12
  135. package/web-dist/components/post-card/PostCard.js +17 -19
  136. package/web-dist/components/product-card/ProductCard.js +17 -19
  137. package/web-dist/components/progress/Progress.js +8 -10
  138. package/web-dist/components/progress-ring/ProgressRing.js +8 -10
  139. package/web-dist/components/radio/Radio.js +12 -14
  140. package/web-dist/components/radio-group/RadioGroup.js +12 -14
  141. package/web-dist/components/rating/Rating.js +7 -9
  142. package/web-dist/components/reader/Reader.js +18 -20
  143. package/web-dist/components/scan-overlay/ScanOverlay.js +18 -20
  144. package/web-dist/components/screen/Screen.js +4 -5
  145. package/web-dist/components/screen-section/ScreenSection.js +8 -10
  146. package/web-dist/components/scroll-view/ScrollView.js +4 -5
  147. package/web-dist/components/search-input/SearchInput.js +11 -13
  148. package/web-dist/components/section-header/SectionHeader.js +8 -10
  149. package/web-dist/components/section-list/SectionList.js +11 -13
  150. package/web-dist/components/select/Select.js +13 -15
  151. package/web-dist/components/selectable-item/SelectableItem.js +3 -8
  152. package/web-dist/components/selection-provider/SelectionProvider.js +3 -8
  153. package/web-dist/components/sign-in-form/SignInForm.js +19 -21
  154. package/web-dist/components/sign-up-form/SignUpForm.js +19 -21
  155. package/web-dist/components/skeleton/Skeleton.js +20 -22
  156. package/web-dist/components/skeleton-card/SkeletonCard.js +20 -22
  157. package/web-dist/components/skeleton-list/SkeletonList.js +20 -22
  158. package/web-dist/components/skeleton-text/SkeletonText.js +20 -22
  159. package/web-dist/components/surface/Surface.js +5 -6
  160. package/web-dist/components/switch/Switch.js +5 -6
  161. package/web-dist/components/tab/Tab.js +5 -6
  162. package/web-dist/components/tab-list/TabList.js +5 -6
  163. package/web-dist/components/tab-panel/TabPanel.js +5 -6
  164. package/web-dist/components/tabletop-table/TabletopTable.js +4 -4
  165. package/web-dist/components/tabs/Tabs.js +5 -6
  166. package/web-dist/components/text/Text.js +5 -6
  167. package/web-dist/components/text-input/TextInput.js +11 -13
  168. package/web-dist/components/theme-mode-toggle/ThemeModeToggle.js +10 -12
  169. package/web-dist/components/time-picker/TimePicker.js +15 -17
  170. package/web-dist/components/timeline/Timeline.js +9 -11
  171. package/web-dist/components/toast/Toast.js +7 -8
  172. package/web-dist/components/toast-provider/ToastProvider.js +7 -8
  173. package/web-dist/components/toolbar/Toolbar.js +17 -19
  174. package/web-dist/components/tree-item/TreeItem.js +15 -17
  175. package/web-dist/components/uploader/Uploader.js +20 -22
  176. package/web-dist/components/view/View.js +4 -5
  177. package/web-dist/manifest.json +1271 -1477
  178. package/web-dist/runtime/ZoraProvider.js +6 -7
  179. package/web-dist/chunks/Accordion-58yzdsab.js +0 -106
  180. package/web-dist/chunks/Accordion-bfzeab9x.js +0 -18
  181. package/web-dist/chunks/Accordion-ebcg2kyw.js +0 -218
  182. package/web-dist/chunks/Accordion-pv1432kr.js +0 -413
@@ -0,0 +1,1296 @@
1
+ 'use client';
2
+ import {
3
+ parseHexColorOrThrow,
4
+ getContrastRatio,
5
+ getReadableForeground,
6
+ selectColorSwatchStep,
7
+ createDefaultSemanticStatusSwatches,
8
+ LIGHT_SEMANTIC_COLOR_REFERENCES,
9
+ DARK_SEMANTIC_COLOR_REFERENCES,
10
+ generateThemeModeColors
11
+ } from "./Accordion-4d4xahgg.js";
12
+ import {
13
+ withZoraThemeScope
14
+ } from "./Accordion-w42y21pt.js";
15
+ import {
16
+ resolveSelectionEventIntent
17
+ } from "./Accordion-md1g54wg.js";
18
+ import {
19
+ applySelectionIntent
20
+ } from "./Accordion-n4et7etk.js";
21
+ import {
22
+ require_cjs
23
+ } from "./Accordion-xgpzh4wq.js";
24
+ import {
25
+ __toESM
26
+ } from "./Accordion-nh0cs9hq.js";
27
+
28
+ // src/features/selection/adapters/inbound/SelectionProvider.tsx
29
+ import React from "react";
30
+
31
+ // src/features/selection/utils/resolveSelectionNextIds.ts
32
+ function normalizeIds(ids, mode) {
33
+ const uniqueIds = [];
34
+ const seen = new Set;
35
+ for (const id of ids ?? []) {
36
+ if (seen.has(id))
37
+ continue;
38
+ seen.add(id);
39
+ uniqueIds.push(id);
40
+ if (mode === "single")
41
+ break;
42
+ }
43
+ return uniqueIds;
44
+ }
45
+ function areIdsEqual(a, b) {
46
+ if (a.length !== b.length)
47
+ return false;
48
+ for (let index = 0;index < a.length; index += 1) {
49
+ if (a.at(index) !== b.at(index))
50
+ return false;
51
+ }
52
+ return true;
53
+ }
54
+ function clearIds() {
55
+ return [];
56
+ }
57
+ function selectId({
58
+ mode,
59
+ ids,
60
+ id
61
+ }) {
62
+ if (mode === "single")
63
+ return [id];
64
+ if (ids.includes(id))
65
+ return ids;
66
+ return [...ids, id];
67
+ }
68
+
69
+ // src/features/selection/adapters/inbound/SelectionProvider.tsx
70
+ import { jsx } from "react/jsx-runtime";
71
+ var MISSING_CONTEXT_MESSAGE = "ZORA selection context is missing. Wrap this tree in <SelectionProvider>.";
72
+ var SelectionContext = React.createContext(null);
73
+ function resolveMode(mode) {
74
+ return mode ?? "single";
75
+ }
76
+ function resolveDisabled(disabled) {
77
+ return disabled ?? false;
78
+ }
79
+ function useSelection() {
80
+ const value = React.use(SelectionContext);
81
+ if (!value)
82
+ throw new Error(MISSING_CONTEXT_MESSAGE);
83
+ return value;
84
+ }
85
+ function SelectionProvider2({
86
+ children,
87
+ selectedIds,
88
+ defaultSelectedIds,
89
+ mode,
90
+ disabled,
91
+ onSelectionChange,
92
+ interactionPolicy
93
+ }) {
94
+ const resolvedMode = resolveMode(mode);
95
+ const resolvedDisabled = resolveDisabled(disabled);
96
+ const isControlled = selectedIds !== undefined;
97
+ const [uncontrolledIds, setUncontrolledIds] = React.useState(defaultSelectedIds ?? []);
98
+ const rawIds = isControlled ? selectedIds : uncontrolledIds;
99
+ const currentNormalizedIds = normalizeIds(rawIds, resolvedMode);
100
+ const selectedIdSet = React.useMemo(() => new Set(currentNormalizedIds), [currentNormalizedIds]);
101
+ const commitSelectionChange = React.useCallback((nextNormalizedIds) => {
102
+ if (resolvedDisabled || interactionPolicy === "passive")
103
+ return;
104
+ if (areIdsEqual(nextNormalizedIds, currentNormalizedIds))
105
+ return;
106
+ onSelectionChange?.(nextNormalizedIds);
107
+ if (!isControlled)
108
+ setUncontrolledIds(nextNormalizedIds);
109
+ }, [currentNormalizedIds, interactionPolicy, isControlled, onSelectionChange, resolvedDisabled]);
110
+ const clear = React.useCallback(() => {
111
+ commitSelectionChange(normalizeIds(clearIds(), resolvedMode));
112
+ }, [commitSelectionChange, resolvedMode]);
113
+ const select = React.useCallback((id) => {
114
+ const nextIds = selectId({ mode: resolvedMode, ids: currentNormalizedIds, id });
115
+ commitSelectionChange(normalizeIds(nextIds, resolvedMode));
116
+ }, [commitSelectionChange, currentNormalizedIds, resolvedMode]);
117
+ const toggle = React.useCallback((id) => {
118
+ const nextIds = applySelectionIntent(currentNormalizedIds, id, "toggle");
119
+ commitSelectionChange(normalizeIds(nextIds, resolvedMode));
120
+ }, [commitSelectionChange, currentNormalizedIds, resolvedMode]);
121
+ const activate = React.useCallback((id, intent) => {
122
+ const effectiveIntent = resolvedMode === "single" ? "replace" : intent;
123
+ const nextIds = applySelectionIntent(currentNormalizedIds, id, effectiveIntent);
124
+ commitSelectionChange(normalizeIds(nextIds, resolvedMode));
125
+ }, [commitSelectionChange, currentNormalizedIds, resolvedMode]);
126
+ const value = React.useMemo(() => ({
127
+ mode: resolvedMode,
128
+ disabled: resolvedDisabled,
129
+ selectedIds: currentNormalizedIds,
130
+ selectedCount: currentNormalizedIds.length,
131
+ hasSelection: currentNormalizedIds.length > 0,
132
+ isSelected: (id) => selectedIdSet.has(id),
133
+ activate,
134
+ select,
135
+ toggle,
136
+ clear
137
+ }), [
138
+ activate,
139
+ clear,
140
+ currentNormalizedIds,
141
+ resolvedDisabled,
142
+ resolvedMode,
143
+ select,
144
+ selectedIdSet,
145
+ toggle
146
+ ]);
147
+ return /* @__PURE__ */ jsx(SelectionContext, {
148
+ value,
149
+ children
150
+ });
151
+ }
152
+ // node_modules/@ankhorage/surface/dist/features/pressable/adapters/inbound/Pressable.js
153
+ var import_react_native2 = __toESM(require_cjs(), 1);
154
+ import { jsx as _jsx2 } from "react/jsx-runtime";
155
+ import React3 from "react";
156
+ // node_modules/@ankhorage/surface/dist/core/responsive/ResponsiveProvider.js
157
+ import { jsx as _jsx } from "react/jsx-runtime";
158
+ import React2, { createContext, use, useMemo } from "react";
159
+
160
+ // node_modules/@ankhorage/surface/dist/core/responsive/breakpoints.js
161
+ var BREAKPOINT_ORDER = ["base", "sm", "md", "lg", "xl"];
162
+
163
+ // node_modules/@ankhorage/surface/dist/core/responsive/useResponsiveWidth.js
164
+ var import_react_native = __toESM(require_cjs(), 1);
165
+ import { useSyncExternalStore } from "react";
166
+
167
+ // node_modules/@ankhorage/surface/dist/core/responsive/ResponsiveProvider.js
168
+ var ResponsiveContext = createContext(null);
169
+ function useResponsiveRuntime() {
170
+ const runtime = use(ResponsiveContext);
171
+ if (!runtime) {
172
+ throw new Error("useResponsiveRuntime must be used within a ResponsiveProvider");
173
+ }
174
+ return runtime;
175
+ }
176
+ // node_modules/@ankhorage/surface/dist/internal/resolvers/resolveFocusRingStyles.js
177
+ function resolveFocusRingStyles(color, focused, isWeb) {
178
+ if (!focused || !isWeb) {
179
+ return {};
180
+ }
181
+ return {
182
+ shadowColor: color,
183
+ shadowOpacity: 0.22,
184
+ shadowRadius: 6,
185
+ shadowOffset: { width: 0, height: 0 }
186
+ };
187
+ }
188
+ // node_modules/@ankhorage/surface/dist/internal/resolvers/resolveInteractiveState.js
189
+ function resolveInteractiveState(input) {
190
+ return {
191
+ pressed: Boolean(input.pressed),
192
+ hovered: Boolean(input.hovered),
193
+ focused: Boolean(input.focused),
194
+ disabled: Boolean(input.disabled)
195
+ };
196
+ }
197
+ // node_modules/@ankhorage/surface/dist/core/responsive/resolve.js
198
+ function isResponsiveRecord(value) {
199
+ return typeof value === "object" && value !== null && !Array.isArray(value);
200
+ }
201
+ function resolveResponsive2(value, breakpoint) {
202
+ if (value === undefined)
203
+ return;
204
+ if (!isResponsiveRecord(value))
205
+ return value;
206
+ const activeIndex = BREAKPOINT_ORDER.indexOf(breakpoint);
207
+ for (let i = activeIndex;i >= 0; i -= 1) {
208
+ const key = BREAKPOINT_ORDER[i];
209
+ if (!key)
210
+ continue;
211
+ const candidate = value[key];
212
+ if (candidate !== undefined)
213
+ return candidate;
214
+ }
215
+ return;
216
+ }
217
+
218
+ // node_modules/@ankhorage/surface/dist/features/theme/utils/resolveToken.js
219
+ function resolveToken(map, value) {
220
+ if (value === undefined)
221
+ return;
222
+ if (Object.prototype.hasOwnProperty.call(map, value)) {
223
+ return map[value];
224
+ }
225
+ return value;
226
+ }
227
+
228
+ // node_modules/@ankhorage/surface/dist/utils/resolveSpacing.js
229
+ function resolveSpacing(theme, value) {
230
+ return resolveToken(theme.spacing, value);
231
+ }
232
+
233
+ // node_modules/@ankhorage/surface/dist/utils/resolveViewStyles.js
234
+ function resolveViewStyles(theme, breakpoint, props) {
235
+ return {
236
+ elevation: 0,
237
+ ...resolveSpacingStyles(theme, breakpoint, props),
238
+ ...resolveVisualStyles(theme, breakpoint, props),
239
+ ...resolveDimensionStyles(theme, breakpoint, props),
240
+ ...resolveLayoutStyles(theme, breakpoint, props)
241
+ };
242
+ }
243
+ function resolveSpacingStyles(theme, breakpoint, props) {
244
+ return {
245
+ padding: resolveSpacing(theme, resolveResponsive2(props.p, breakpoint)),
246
+ paddingHorizontal: resolveSpacing(theme, resolveResponsive2(props.px, breakpoint)),
247
+ paddingVertical: resolveSpacing(theme, resolveResponsive2(props.py, breakpoint)),
248
+ paddingTop: resolveSpacing(theme, resolveResponsive2(props.pt, breakpoint)),
249
+ paddingBottom: resolveSpacing(theme, resolveResponsive2(props.pb, breakpoint)),
250
+ paddingLeft: resolveSpacing(theme, resolveResponsive2(props.pl, breakpoint)),
251
+ paddingRight: resolveSpacing(theme, resolveResponsive2(props.pr, breakpoint)),
252
+ margin: resolveSpacing(theme, resolveResponsive2(props.m, breakpoint)),
253
+ marginHorizontal: resolveSpacing(theme, resolveResponsive2(props.mx, breakpoint)),
254
+ marginVertical: resolveSpacing(theme, resolveResponsive2(props.my, breakpoint)),
255
+ marginTop: resolveSpacing(theme, resolveResponsive2(props.mt, breakpoint)),
256
+ marginBottom: resolveSpacing(theme, resolveResponsive2(props.mb, breakpoint)),
257
+ marginLeft: resolveSpacing(theme, resolveResponsive2(props.ml, breakpoint)),
258
+ marginRight: resolveSpacing(theme, resolveResponsive2(props.mr, breakpoint)),
259
+ gap: resolveSpacing(theme, resolveResponsive2(props.gap, breakpoint)),
260
+ rowGap: resolveSpacing(theme, resolveResponsive2(props.rowGap, breakpoint)),
261
+ columnGap: resolveSpacing(theme, resolveResponsive2(props.columnGap, breakpoint))
262
+ };
263
+ }
264
+ function resolveVisualStyles(theme, breakpoint, props) {
265
+ return {
266
+ backgroundColor: resolveColor(theme, resolveResponsive2(props.bg, breakpoint)),
267
+ borderRadius: resolveRadius(theme, resolveResponsive2(props.radius, breakpoint)),
268
+ borderWidth: resolveResponsive2(props.borderWidth, breakpoint),
269
+ borderColor: resolveColor(theme, resolveResponsive2(props.borderColor, breakpoint))
270
+ };
271
+ }
272
+ function resolveDimensionStyles(theme, breakpoint, props) {
273
+ return {
274
+ width: resolveDimension(theme, resolveResponsive2(props.width, breakpoint)),
275
+ height: resolveDimension(theme, resolveResponsive2(props.height, breakpoint)),
276
+ minWidth: resolveDimension(theme, resolveResponsive2(props.minWidth, breakpoint)),
277
+ maxWidth: resolveDimension(theme, resolveResponsive2(props.maxWidth, breakpoint)),
278
+ minHeight: resolveDimension(theme, resolveResponsive2(props.minHeight, breakpoint)),
279
+ maxHeight: resolveDimension(theme, resolveResponsive2(props.maxHeight, breakpoint))
280
+ };
281
+ }
282
+ function resolveLayoutStyles(theme, breakpoint, props) {
283
+ return {
284
+ flex: resolveResponsive2(props.flex, breakpoint),
285
+ flexGrow: resolveResponsive2(props.flexGrow, breakpoint),
286
+ flexShrink: resolveResponsive2(props.flexShrink, breakpoint),
287
+ flexBasis: resolveDimension(theme, resolveResponsive2(props.flexBasis, breakpoint)),
288
+ flexDirection: resolveResponsive2(props.direction, breakpoint),
289
+ alignItems: resolveResponsive2(props.align, breakpoint),
290
+ justifyContent: resolveResponsive2(props.justify, breakpoint),
291
+ flexWrap: resolveResponsive2(props.wrap, breakpoint),
292
+ alignSelf: resolveResponsive2(props.alignSelf, breakpoint),
293
+ position: resolveResponsive2(props.position, breakpoint),
294
+ top: resolveResponsive2(props.top, breakpoint),
295
+ bottom: resolveResponsive2(props.bottom, breakpoint),
296
+ left: resolveResponsive2(props.left, breakpoint),
297
+ right: resolveResponsive2(props.right, breakpoint),
298
+ overflow: resolveResponsive2(props.overflow, breakpoint),
299
+ zIndex: resolveResponsive2(props.zIndex, breakpoint),
300
+ opacity: resolveResponsive2(props.opacity, breakpoint)
301
+ };
302
+ }
303
+ function resolveRadius(theme, value) {
304
+ return resolveToken(theme.radii, value);
305
+ }
306
+ function resolveColor(theme, value) {
307
+ return resolveToken(theme.colors, value);
308
+ }
309
+ function resolveDimension(theme, value) {
310
+ const resolved = resolveToken(theme.spacing, value);
311
+ if (resolved === undefined || typeof resolved === "number")
312
+ return resolved;
313
+ if (isPortableDimensionString(resolved))
314
+ return resolved;
315
+ throw new Error(`Unsupported Surface dimension: ${JSON.stringify(resolved)}.`);
316
+ }
317
+ function isPortableDimensionString(value) {
318
+ return value === "auto" || /^-?(?:\d+(?:\.\d+)?|\.\d+)%$/u.test(value);
319
+ }
320
+ // node_modules/@ankhorage/surface/dist/features/theme/adapters/inbound/useTheme.js
321
+ import { use as use2 } from "react";
322
+
323
+ // node_modules/@ankhorage/surface/dist/features/theme/adapters/inbound/ThemeRuntimeContext.js
324
+ import { createContext as createContext2 } from "react";
325
+
326
+ // node_modules/@ankhorage/surface/dist/features/theme/domain/resolveSemanticColors.js
327
+ function resolveSemanticColors(generated, references) {
328
+ return Object.fromEntries(Object.entries(references).map(([token, ref]) => {
329
+ const swatch = generated.swatches[ref.role];
330
+ if (!swatch) {
331
+ throw new Error(`Missing swatch for role '${ref.role}' (token: '${token}')`);
332
+ }
333
+ return [token, swatch[ref.step]];
334
+ }));
335
+ }
336
+
337
+ // node_modules/@ankhorage/surface/dist/features/theme/domain/createSurfaceColorDiagnosticCollector.js
338
+ function createSurfaceColorDiagnosticCollector() {
339
+ return new SurfaceColorDiagnosticCollector;
340
+ }
341
+
342
+ class SurfaceColorDiagnosticCollector {
343
+ selections = [];
344
+ contrasts = [];
345
+ measureForeground = (id, foreground, background, minimumContrast) => {
346
+ const contrast = getContrastRatio(foreground, background);
347
+ this.contrasts.push({
348
+ id,
349
+ foreground,
350
+ background,
351
+ contrast,
352
+ minimumContrast,
353
+ passes: contrast >= minimumContrast
354
+ });
355
+ return foreground;
356
+ };
357
+ measureSurface = (id, foreground, background, minimumContrast) => {
358
+ const contrast = getContrastRatio(foreground, background);
359
+ return {
360
+ id,
361
+ foreground,
362
+ background,
363
+ contrast,
364
+ minimumContrast,
365
+ passes: contrast >= minimumContrast
366
+ };
367
+ };
368
+ selectColor = (id, swatch, target, contexts, tiePolicy) => {
369
+ const result = selectColorSwatchStep(swatch, target, contexts, tiePolicy);
370
+ this.selections.push({ id, result });
371
+ if (!result.selected) {
372
+ throw new Error(`[surface] No '${id}' swatch step satisfies the required contrast.`);
373
+ }
374
+ return result.selected.hex;
375
+ };
376
+ selectForeground = (id, background, minimumContrast) => {
377
+ const selected = getReadableForeground(background);
378
+ this.contrasts.push({
379
+ id,
380
+ foreground: selected.foreground,
381
+ background,
382
+ contrast: selected.contrast,
383
+ minimumContrast,
384
+ passes: selected.contrast >= minimumContrast
385
+ });
386
+ return selected.foreground;
387
+ };
388
+ }
389
+
390
+ // node_modules/@ankhorage/surface/dist/features/theme/constants.js
391
+ var EMPTY_FONT_MAP = {
392
+ "100": undefined,
393
+ "200": undefined,
394
+ "300": undefined,
395
+ "400": undefined,
396
+ "500": undefined,
397
+ "600": undefined,
398
+ "700": undefined,
399
+ "800": undefined,
400
+ "900": undefined,
401
+ bold: undefined,
402
+ normal: undefined
403
+ };
404
+ var DEFAULT_TOKENS = {
405
+ spacing: { none: 0, xs: 4, s: 8, m: 16, l: 24, xl: 32, xxl: 48 },
406
+ radii: { none: 0, s: 4, m: 8, l: 16, full: 9999 },
407
+ typography: {
408
+ headings: {
409
+ 1: { size: 32, lineHeight: 40, weight: "bold" },
410
+ 2: { size: 24, lineHeight: 32, weight: "bold" },
411
+ 3: { size: 20, lineHeight: 28, weight: "bold" },
412
+ 4: { size: 18, lineHeight: 24, weight: "semiBold" },
413
+ 5: { size: 16, lineHeight: 22, weight: "semiBold" },
414
+ 6: { size: 14, lineHeight: 20, weight: "semiBold" }
415
+ },
416
+ sizes: {
417
+ xs: 12,
418
+ s: 14,
419
+ m: 16,
420
+ l: 18,
421
+ xl: 20,
422
+ xxl: 24,
423
+ "3xl": 30,
424
+ h1: 32,
425
+ h2: 24,
426
+ h3: 20,
427
+ h4: 18,
428
+ h5: 16,
429
+ h6: 14
430
+ },
431
+ weights: {
432
+ thin: "100",
433
+ extraLight: "200",
434
+ light: "300",
435
+ regular: "400",
436
+ medium: "500",
437
+ semiBold: "600",
438
+ bold: "700",
439
+ extraBold: "800",
440
+ black: "900"
441
+ },
442
+ fonts: { normal: { ...EMPTY_FONT_MAP }, italic: { ...EMPTY_FONT_MAP } }
443
+ },
444
+ shadows: { soft: 2, medium: 4, hard: 8 }
445
+ };
446
+ var SURFACE_COLOR_POLICY = {
447
+ disabledContrast: 3,
448
+ surfaceSeparation: 1.05,
449
+ textContrast: 4.5,
450
+ uiContrast: 3
451
+ };
452
+
453
+ // node_modules/@ankhorage/surface/dist/features/theme/domain/createSurfaceSemanticPolicy.js
454
+ function createSurfaceSemanticPolicy(resolved, isDark, measurements) {
455
+ return new SurfaceSemanticPolicy(resolved, isDark, measurements);
456
+ }
457
+
458
+ class SurfaceSemanticPolicy {
459
+ resolved;
460
+ isDark;
461
+ measurements;
462
+ adjacentSurfaceContexts;
463
+ textSurfaceContexts;
464
+ tiePolicy;
465
+ constructor(resolved, isDark, measurements) {
466
+ this.resolved = resolved;
467
+ this.isDark = isDark;
468
+ this.measurements = measurements;
469
+ this.adjacentSurfaceContexts = this.createSurfaceContexts(SURFACE_COLOR_POLICY.uiContrast);
470
+ this.textSurfaceContexts = this.createSurfaceContexts(SURFACE_COLOR_POLICY.textContrast);
471
+ this.tiePolicy = isDark ? "lower-step" : "higher-step";
472
+ }
473
+ buildNeutral(neutralSwatch) {
474
+ return {
475
+ bg: this.resolved.background,
476
+ bgSubtle: this.resolved.surface,
477
+ surface: this.resolved.surface,
478
+ surfaceHover: this.isDark ? neutralSwatch[800] : neutralSwatch[200],
479
+ surfaceActive: this.isDark ? neutralSwatch[700] : neutralSwatch[300],
480
+ border: this.resolved.border,
481
+ borderStrong: this.isDark ? neutralSwatch[600] : neutralSwatch[300],
482
+ divider: this.resolved.divider,
483
+ text: this.resolved.text,
484
+ textMuted: this.resolved.textMuted,
485
+ textSubtle: this.isDark ? neutralSwatch[300] : neutralSwatch[600],
486
+ disabledBg: this.resolved.disabledBg,
487
+ disabledText: this.resolved.disabledText
488
+ };
489
+ }
490
+ buildSurface(inverse) {
491
+ return {
492
+ default: this.resolved.surface,
493
+ subtle: this.resolved.background,
494
+ raised: this.resolved.surfaceRaised,
495
+ sunken: this.resolved.background,
496
+ overlay: this.resolved.surfaceRaised,
497
+ scrim: "#0000008f",
498
+ disabled: this.resolved.disabledBg,
499
+ inverse
500
+ };
501
+ }
502
+ measureContent(content, surface) {
503
+ const pairs = [
504
+ [
505
+ "content.default/background",
506
+ content.default,
507
+ surface.sunken,
508
+ SURFACE_COLOR_POLICY.textContrast
509
+ ],
510
+ [
511
+ "content.default/surface",
512
+ content.default,
513
+ surface.default,
514
+ SURFACE_COLOR_POLICY.textContrast
515
+ ],
516
+ ["content.muted/surface", content.muted, surface.default, SURFACE_COLOR_POLICY.textContrast],
517
+ [
518
+ "content.subtle/surface",
519
+ content.subtle,
520
+ surface.default,
521
+ SURFACE_COLOR_POLICY.textContrast
522
+ ],
523
+ [
524
+ "content.disabled/disabled",
525
+ content.disabled,
526
+ surface.disabled,
527
+ SURFACE_COLOR_POLICY.disabledContrast
528
+ ],
529
+ [
530
+ "content.inverse/inverse",
531
+ content.inverse,
532
+ surface.inverse,
533
+ SURFACE_COLOR_POLICY.textContrast
534
+ ]
535
+ ];
536
+ for (const [id, foreground, background, minimumContrast] of pairs) {
537
+ this.measurements.measureForeground(id, parseHexColorOrThrow(foreground), parseHexColorOrThrow(background), minimumContrast);
538
+ }
539
+ }
540
+ measureSurfaceSeparation(surface) {
541
+ return [
542
+ this.measureSurface("surface.default", surface.default),
543
+ this.measureSurface("surface.raised", surface.raised),
544
+ this.measureSurface("surface.disabled", surface.disabled)
545
+ ];
546
+ }
547
+ neutralTarget() {
548
+ return { lightness: this.isDark ? 0.65 : 0.55, chroma: 0.02 };
549
+ }
550
+ roleTarget() {
551
+ return { lightness: this.isDark ? 0.65 : 0.5, chroma: 0.15 };
552
+ }
553
+ strongNeutralTarget() {
554
+ return { lightness: this.isDark ? 0.8 : 0.4, chroma: 0.02 };
555
+ }
556
+ textTarget() {
557
+ return { lightness: this.isDark ? 0.75 : 0.45, chroma: 0.15 };
558
+ }
559
+ createSurfaceContexts(minimumContrast) {
560
+ return [
561
+ { id: "background", against: this.resolved.background, minimumContrast },
562
+ { id: "surface", against: this.resolved.surface, minimumContrast }
563
+ ];
564
+ }
565
+ measureSurface(id, foreground) {
566
+ return this.measurements.measureSurface(id, parseHexColorOrThrow(foreground), this.resolved.background, SURFACE_COLOR_POLICY.surfaceSeparation);
567
+ }
568
+ }
569
+
570
+ // node_modules/@ankhorage/surface/dist/features/theme/domain/resolveRoleSemantics.js
571
+ function resolveRoleSemantics({ base, disabledBg, disabledText, hover, id, isDark, measureForeground, onSurfaceText, outline, selectForeground, swatch }) {
572
+ const states = resolveRoleStateColors(swatch, isDark, base, hover);
573
+ return {
574
+ ...states,
575
+ outline,
576
+ onSurfaceText,
577
+ onSolidText: selectForeground(`${id}.base`, states.base, SURFACE_COLOR_POLICY.textContrast),
578
+ onHoverText: selectForeground(`${id}.hover`, states.hover, SURFACE_COLOR_POLICY.textContrast),
579
+ onStrongText: selectForeground(`${id}.strong`, states.strong, SURFACE_COLOR_POLICY.textContrast),
580
+ onSoftText: selectForeground(`${id}.soft`, states.softBg, SURFACE_COLOR_POLICY.textContrast),
581
+ onSoftHoverText: selectForeground(`${id}.softHover`, states.softHover, SURFACE_COLOR_POLICY.textContrast),
582
+ onSoftActiveText: selectForeground(`${id}.softActive`, states.softActive, SURFACE_COLOR_POLICY.textContrast),
583
+ disabledBg,
584
+ onDisabledText: measureForeground(`${id}.disabled`, disabledText, disabledBg, SURFACE_COLOR_POLICY.disabledContrast)
585
+ };
586
+ }
587
+ function resolveRoleStateColors(swatch, isDark, base, hover) {
588
+ return {
589
+ base: base ?? swatch[500],
590
+ hover: hover ?? (isDark ? swatch[400] : swatch[600]),
591
+ strong: isDark ? swatch[300] : swatch[700],
592
+ softBg: isDark ? swatch[900] : swatch[100],
593
+ softHover: isDark ? swatch[800] : swatch[200],
594
+ softActive: isDark ? swatch[700] : swatch[300]
595
+ };
596
+ }
597
+
598
+ // node_modules/@ankhorage/surface/dist/features/theme/domain/resolveSurfaceSemanticModel.js
599
+ function resolveSurfaceSemanticModel(input) {
600
+ const context = createResolutionContext(input);
601
+ const roles = resolveSemanticRoles(context);
602
+ const inverseSurface = context.isDark ? context.neutralSwatch[50] : context.neutralSwatch[900];
603
+ const inverseContent = context.isDark ? context.neutralSwatch[900] : context.neutralSwatch[50];
604
+ const neutral = context.policy.buildNeutral(context.neutralSwatch);
605
+ const surface = context.policy.buildSurface(inverseSurface);
606
+ const content = resolveContentSemantics(context, neutral.textSubtle, inverseContent);
607
+ const border = resolveBorderSemantics(context, roles.brand.outline);
608
+ context.policy.measureContent(content, surface);
609
+ return {
610
+ semantics: {
611
+ neutral,
612
+ brand: roles.brand,
613
+ secondary: roles.secondary,
614
+ accent: roles.accent,
615
+ highlight: roles.highlight,
616
+ danger: roles.danger,
617
+ success: roles.success,
618
+ warning: roles.warning,
619
+ error: roles.danger,
620
+ info: roles.info,
621
+ surface,
622
+ content,
623
+ border,
624
+ selection: {
625
+ background: roles.brand.softBg,
626
+ content: roles.brand.onSoftText,
627
+ border: border.focus
628
+ },
629
+ action: { primary: roles.brand, neutral: roles.neutralAction, danger: roles.danger }
630
+ },
631
+ colorDiagnostics: {
632
+ mode: context.mode,
633
+ generated: context.generated,
634
+ semanticReferences: context.references,
635
+ statusSwatches: context.statusSwatches.diagnostics,
636
+ selections: context.collector.selections,
637
+ contrasts: context.collector.contrasts,
638
+ surfaceSeparation: context.policy.measureSurfaceSeparation(surface)
639
+ }
640
+ };
641
+ }
642
+ function createResolutionContext(input) {
643
+ const { generated, mode, references, resolved } = input;
644
+ const { swatches } = generated;
645
+ const collector = createSurfaceColorDiagnosticCollector();
646
+ const isDark = mode === "dark";
647
+ return {
648
+ collector,
649
+ generated,
650
+ isDark,
651
+ mode,
652
+ neutralSwatch: swatches.neutral,
653
+ policy: createSurfaceSemanticPolicy(resolved, isDark, collector),
654
+ quaternarySwatch: swatches.quaternary ?? swatches.primary,
655
+ references,
656
+ resolved,
657
+ secondarySwatch: swatches.secondary ?? swatches.primary,
658
+ statusSwatches: createDefaultSemanticStatusSwatches(),
659
+ swatches,
660
+ tertiarySwatch: swatches.tertiary ?? swatches.primary
661
+ };
662
+ }
663
+ function resolveBorderSemantics(context, focus) {
664
+ const { collector, neutralSwatch, policy, resolved } = context;
665
+ return {
666
+ default: collector.selectColor("border.default", neutralSwatch, policy.neutralTarget(), policy.adjacentSurfaceContexts, policy.tiePolicy),
667
+ subtle: resolved.border,
668
+ strong: collector.selectColor("border.strong", neutralSwatch, policy.strongNeutralTarget(), policy.adjacentSurfaceContexts, policy.tiePolicy),
669
+ divider: resolved.divider,
670
+ focus
671
+ };
672
+ }
673
+ function resolveContentSemantics(context, subtle, inverse) {
674
+ const { collector, policy, resolved, secondarySwatch, swatches } = context;
675
+ return {
676
+ default: resolved.text,
677
+ muted: resolved.textMuted,
678
+ subtle,
679
+ disabled: resolved.disabledText,
680
+ icon: resolved.text,
681
+ link: collector.selectColor("content.link", swatches.primary, policy.textTarget(), policy.textSurfaceContexts, policy.tiePolicy),
682
+ visited: collector.selectColor("content.visited", secondarySwatch, policy.textTarget(), policy.textSurfaceContexts, policy.tiePolicy),
683
+ inverse
684
+ };
685
+ }
686
+ function resolveRole(context, id, swatch, options = {}) {
687
+ const { collector, isDark, policy, resolved } = context;
688
+ return resolveRoleSemantics({
689
+ base: options.base,
690
+ disabledBg: resolved.disabledBg,
691
+ disabledText: resolved.disabledText,
692
+ hover: options.hover,
693
+ id,
694
+ isDark,
695
+ measureForeground: collector.measureForeground,
696
+ onSurfaceText: collector.selectColor(`${id}.content`, swatch, policy.textTarget(), policy.textSurfaceContexts, policy.tiePolicy),
697
+ outline: collector.selectColor(`${id}.outline`, swatch, options.target ?? policy.roleTarget(), policy.adjacentSurfaceContexts, policy.tiePolicy),
698
+ selectForeground: collector.selectForeground,
699
+ swatch
700
+ });
701
+ }
702
+ function resolveSemanticRoles(context) {
703
+ const { neutralSwatch, resolved, secondarySwatch, statusSwatches, swatches } = context;
704
+ return {
705
+ brand: resolveRole(context, "brand", swatches.primary, {
706
+ base: resolved.action,
707
+ hover: resolved.actionEmphasis
708
+ }),
709
+ secondary: resolveRole(context, "secondary", secondarySwatch),
710
+ accent: resolveRole(context, "accent", context.tertiarySwatch),
711
+ highlight: resolveRole(context, "highlight", context.quaternarySwatch),
712
+ danger: resolveRole(context, "danger", statusSwatches.swatches.danger),
713
+ success: resolveRole(context, "success", statusSwatches.swatches.success),
714
+ warning: resolveRole(context, "warning", statusSwatches.swatches.warning),
715
+ info: resolveRole(context, "info", statusSwatches.swatches.info),
716
+ neutralAction: resolveRole(context, "neutral", neutralSwatch, {
717
+ target: context.policy.neutralTarget()
718
+ })
719
+ };
720
+ }
721
+
722
+ // node_modules/@ankhorage/surface/dist/features/theme/domain/generatePalette.js
723
+ function generatePalette(config, mode = "light") {
724
+ const modeConfig = mode === "dark" ? config.dark : config.light;
725
+ const isDark = mode === "dark";
726
+ parseHexColorOrThrow(modeConfig.primaryColor);
727
+ const generated = generateThemeModeColors(modeConfig);
728
+ const { swatches } = generated;
729
+ const references = isDark ? DARK_SEMANTIC_COLOR_REFERENCES : LIGHT_SEMANTIC_COLOR_REFERENCES;
730
+ const resolved = resolveSemanticColors(generated, references);
731
+ const { semantics, colorDiagnostics } = resolveSurfaceSemanticModel({
732
+ generated,
733
+ mode,
734
+ references,
735
+ resolved
736
+ });
737
+ const { border, content, error, info, neutral, success, surface, warning } = semantics;
738
+ const colors = {
739
+ primary: swatches.primary[500],
740
+ secondary: (swatches.secondary ?? swatches.primary)[500],
741
+ accent: (swatches.tertiary ?? swatches.primary)[500],
742
+ highlight: (swatches.quaternary ?? swatches.primary)[500],
743
+ tertiary: (swatches.tertiary ?? swatches.primary)[500],
744
+ quaternary: (swatches.quaternary ?? swatches.primary)[500],
745
+ background: neutral.bg,
746
+ surface: surface.default,
747
+ text: content.default,
748
+ textSecondary: content.muted,
749
+ border: border.default,
750
+ error: error.base,
751
+ success: success.base,
752
+ warning: warning.base,
753
+ info: info.base
754
+ };
755
+ return {
756
+ colors,
757
+ swatches,
758
+ semantics,
759
+ colorDiagnostics
760
+ };
761
+ }
762
+
763
+ // node_modules/@ankhorage/surface/dist/features/theme/domain/resolveInverseSurface.js
764
+ function resolveInverseSurface(theme, lightSurface, collector) {
765
+ const { neutral } = theme.swatches;
766
+ const base = theme.semantics.surface.inverse;
767
+ const adjacent = lightSurface ? neutral[100] : neutral[800];
768
+ const sunken = lightSurface ? neutral[200] : neutral[950];
769
+ const surface = {
770
+ ...theme.semantics.surface,
771
+ default: base,
772
+ subtle: adjacent,
773
+ raised: adjacent,
774
+ sunken,
775
+ overlay: adjacent,
776
+ disabled: adjacent,
777
+ inverse: theme.semantics.surface.default
778
+ };
779
+ return { surface, surfaceSeparation: measureInverseSurfaceSeparation(surface, collector) };
780
+ }
781
+ function measureInverseSurfaceSeparation(surface, collector) {
782
+ const background = parseHexColorOrThrow(surface.sunken);
783
+ const surfaces = [
784
+ ["surface.default", surface.default],
785
+ ["surface.raised", surface.raised],
786
+ ["surface.disabled", surface.disabled]
787
+ ];
788
+ return surfaces.map(([id, foreground]) => collector.measureSurface(id, parseHexColorOrThrow(foreground), background, SURFACE_COLOR_POLICY.surfaceSeparation));
789
+ }
790
+
791
+ // node_modules/@ankhorage/surface/dist/features/theme/domain/projectInvertedTheme.js
792
+ function projectInvertedTheme(theme) {
793
+ const collector = createSurfaceColorDiagnosticCollector();
794
+ const lightSurface = theme.colorDiagnostics.mode === "dark";
795
+ const { neutral } = theme.swatches;
796
+ const { surface, surfaceSeparation } = resolveInverseSurface(theme, lightSurface, collector);
797
+ const selection = createInverseSelection(collector, surface, neutral, lightSurface);
798
+ const content = resolveInverseContent(theme, selection);
799
+ const border = resolveInverseBorder(theme, selection);
800
+ const roles = resolveInverseRoles(theme, selection);
801
+ const { neutralAction, ...semanticRoles } = roles;
802
+ const semantics = {
803
+ ...theme.semantics,
804
+ neutral: resolveInverseNeutral(theme, surface, content, border, neutral, lightSurface),
805
+ surface,
806
+ content,
807
+ border,
808
+ ...semanticRoles,
809
+ error: roles.danger,
810
+ selection: {
811
+ background: roles.brand.softBg,
812
+ content: roles.brand.onSoftText,
813
+ border: border.focus
814
+ },
815
+ action: { primary: roles.brand, neutral: neutralAction, danger: roles.danger }
816
+ };
817
+ return {
818
+ ...theme,
819
+ inverted: true,
820
+ semantics,
821
+ colors: {
822
+ ...theme.colors,
823
+ background: surface.sunken,
824
+ surface: surface.default,
825
+ text: content.default,
826
+ textSecondary: content.muted,
827
+ border: border.default
828
+ },
829
+ colorDiagnostics: {
830
+ ...theme.colorDiagnostics,
831
+ selections: [...theme.colorDiagnostics.selections, ...collector.selections],
832
+ contrasts: [...theme.colorDiagnostics.contrasts, ...collector.contrasts],
833
+ surfaceSeparation
834
+ }
835
+ };
836
+ }
837
+ function createInverseSelection(collector, surface, neutral, lightSurface) {
838
+ return {
839
+ collector,
840
+ neutral,
841
+ contexts: [
842
+ {
843
+ id: "inverse-surface",
844
+ against: parseHexColorOrThrow(surface.default),
845
+ minimumContrast: SURFACE_COLOR_POLICY.textContrast
846
+ },
847
+ {
848
+ id: "inverse-subtle",
849
+ against: parseHexColorOrThrow(surface.subtle),
850
+ minimumContrast: SURFACE_COLOR_POLICY.textContrast
851
+ },
852
+ {
853
+ id: "inverse-sunken",
854
+ against: parseHexColorOrThrow(surface.sunken),
855
+ minimumContrast: SURFACE_COLOR_POLICY.textContrast
856
+ }
857
+ ],
858
+ tiePolicy: lightSurface ? "higher-step" : "lower-step",
859
+ textTarget: { lightness: lightSurface ? 0.2 : 0.9, chroma: 0.02 },
860
+ mutedTarget: { lightness: lightSurface ? 0.35 : 0.75, chroma: 0.02 },
861
+ subtleTarget: { lightness: lightSurface ? 0.4 : 0.7, chroma: 0.02 },
862
+ borderTarget: { lightness: lightSurface ? 0.45 : 0.65, chroma: 0.02 }
863
+ };
864
+ }
865
+ function resolveInverseContent(theme, selection) {
866
+ const { neutral, primary } = theme.swatches;
867
+ const secondary = theme.swatches.secondary ?? primary;
868
+ return {
869
+ default: selectText("content.default", neutral, selection.textTarget, selection),
870
+ muted: selectText("content.muted", neutral, selection.mutedTarget, selection),
871
+ subtle: selectText("content.subtle", neutral, selection.subtleTarget, selection),
872
+ disabled: selectText("content.disabled", neutral, selection.subtleTarget, selection, SURFACE_COLOR_POLICY.disabledContrast),
873
+ icon: selectText("content.icon", neutral, selection.textTarget, selection),
874
+ link: selectText("content.link", primary, selection.textTarget, selection),
875
+ visited: selectText("content.visited", secondary, selection.textTarget, selection),
876
+ inverse: theme.semantics.content.default
877
+ };
878
+ }
879
+ function resolveInverseBorder(theme, selection) {
880
+ const { neutral } = theme.swatches;
881
+ const outline = selection.borderTarget;
882
+ return {
883
+ default: selectOutline("border.default", neutral, outline, selection),
884
+ subtle: selectOutline("border.subtle", neutral, outline, selection),
885
+ strong: selectOutline("border.strong", neutral, outline, selection),
886
+ divider: selectOutline("border.divider", neutral, outline, selection),
887
+ focus: selectOutline("border.focus", theme.swatches.primary, selection.textTarget, selection)
888
+ };
889
+ }
890
+ function resolveInverseRoles(theme, selection) {
891
+ const status = createDefaultSemanticStatusSwatches().swatches;
892
+ const { semantics } = theme;
893
+ return {
894
+ brand: projectRole("brand", semantics.brand, theme.swatches.primary, selection),
895
+ secondary: projectRole("secondary", semantics.secondary, theme.swatches.secondary ?? theme.swatches.primary, selection),
896
+ accent: projectRole("accent", semantics.accent, theme.swatches.tertiary ?? theme.swatches.primary, selection),
897
+ highlight: projectRole("highlight", semantics.highlight, theme.swatches.quaternary ?? theme.swatches.primary, selection),
898
+ danger: projectRole("danger", semantics.danger, status.danger, selection),
899
+ success: projectRole("success", semantics.success, status.success, selection),
900
+ warning: projectRole("warning", semantics.warning, status.warning, selection),
901
+ info: projectRole("info", semantics.info, status.info, selection),
902
+ neutralAction: projectRole("neutral", semantics.action.neutral, theme.swatches.neutral, selection)
903
+ };
904
+ }
905
+ function projectRole(id, role, swatch, selection) {
906
+ return {
907
+ ...role,
908
+ onSurfaceText: selectText(`${id}.onSurfaceText`, swatch, selection.textTarget, selection),
909
+ outline: selectOutline(`${id}.outline`, swatch, selection.borderTarget, selection)
910
+ };
911
+ }
912
+ function resolveInverseNeutral(theme, surface, content, border, swatch, lightSurface) {
913
+ return {
914
+ ...theme.semantics.neutral,
915
+ bg: surface.sunken,
916
+ bgSubtle: surface.subtle,
917
+ surface: surface.default,
918
+ surfaceHover: lightSurface ? swatch[200] : swatch[700],
919
+ surfaceActive: lightSurface ? swatch[300] : swatch[600],
920
+ border: border.default,
921
+ borderStrong: border.strong,
922
+ divider: border.divider,
923
+ text: content.default,
924
+ textMuted: content.muted,
925
+ textSubtle: content.subtle,
926
+ disabledBg: surface.disabled,
927
+ disabledText: content.disabled
928
+ };
929
+ }
930
+ function selectText(id, swatch, target, selection, minimumContrast = SURFACE_COLOR_POLICY.textContrast) {
931
+ const contexts = selection.contexts.map((context) => ({ ...context, minimumContrast }));
932
+ const color = selectInverseColor(id, swatch, target, contexts, selection);
933
+ for (const context of contexts) {
934
+ selection.collector.measureForeground(`inverse.${id}/${context.id}`, color, context.against, minimumContrast);
935
+ }
936
+ return color;
937
+ }
938
+ function selectOutline(id, swatch, target, selection) {
939
+ const contexts = selection.contexts.map((context) => ({
940
+ ...context,
941
+ minimumContrast: SURFACE_COLOR_POLICY.uiContrast
942
+ }));
943
+ const color = selectInverseColor(id, swatch, target, contexts, selection);
944
+ for (const context of contexts) {
945
+ selection.collector.measureForeground(`inverse.${id}/${context.id}`, color, context.against, SURFACE_COLOR_POLICY.uiContrast);
946
+ }
947
+ return color;
948
+ }
949
+ function selectInverseColor(id, swatch, target, contexts, selection) {
950
+ const result = selectColorSwatchStep(swatch, target, contexts, selection.tiePolicy);
951
+ selection.collector.selections.push({ id: `inverse.${id}`, result });
952
+ return result.selected?.hex ?? selection.collector.selectColor(`inverse.${id}.neutralFallback`, selection.neutral, target, contexts, selection.tiePolicy);
953
+ }
954
+
955
+ // node_modules/@ankhorage/surface/dist/features/theme/utils/resolveHeadingTokenOverrides.js
956
+ var HEADING_KEYS = new Set(["1", "2", "3", "4", "5", "6"]);
957
+ var HEADING_WEIGHTS = new Set(["regular", "medium", "semiBold", "bold"]);
958
+ function resolveHeadingTokenOverrides(defaults, overrides) {
959
+ validateHeadingKeys(overrides);
960
+ return {
961
+ 1: resolveHeading("1", defaults[1], overrides?.["1"]),
962
+ 2: resolveHeading("2", defaults[2], overrides?.["2"]),
963
+ 3: resolveHeading("3", defaults[3], overrides?.["3"]),
964
+ 4: resolveHeading("4", defaults[4], overrides?.["4"]),
965
+ 5: resolveHeading("5", defaults[5], overrides?.["5"]),
966
+ 6: resolveHeading("6", defaults[6], overrides?.["6"])
967
+ };
968
+ }
969
+ function validateHeadingKeys(overrides) {
970
+ for (const key of Object.keys(overrides ?? {})) {
971
+ if (!HEADING_KEYS.has(key))
972
+ throw new RangeError(`Unknown typography heading token: ${key}.`);
973
+ }
974
+ }
975
+ function resolveHeading(key, fallback, override) {
976
+ const size = override?.size ?? fallback.size;
977
+ const lineHeight = override?.lineHeight ?? fallback.lineHeight;
978
+ const weight = override?.weight ?? fallback.weight;
979
+ if (!Number.isFinite(size) || size <= 0) {
980
+ throw new RangeError(`Theme token typography.headings.${key}.size must be a finite positive number.`);
981
+ }
982
+ if (!Number.isFinite(lineHeight) || lineHeight <= 0) {
983
+ throw new RangeError(`Theme token typography.headings.${key}.lineHeight must be a finite positive number.`);
984
+ }
985
+ if (!isHeadingWeight(weight)) {
986
+ throw new RangeError(`Invalid heading weight for typography.headings.${key}: ${weight}.`);
987
+ }
988
+ return { size, lineHeight, weight };
989
+ }
990
+ function isHeadingWeight(value) {
991
+ return HEADING_WEIGHTS.has(value);
992
+ }
993
+
994
+ // node_modules/@ankhorage/surface/dist/features/theme/utils/resolveNumericTokenOverrides.js
995
+ function resolveNumericTokenOverrides(family, overrides, requirePositive = false) {
996
+ if (overrides === undefined)
997
+ return {};
998
+ for (const [token, value] of Object.entries(overrides)) {
999
+ const invalid = !Number.isFinite(value) || (requirePositive ? value <= 0 : value < 0);
1000
+ if (invalid) {
1001
+ const expectation = requirePositive ? "a finite positive number" : "a finite non-negative number";
1002
+ throw new RangeError(`Theme token ${family}.${token} must be ${expectation}.`);
1003
+ }
1004
+ }
1005
+ return { ...overrides };
1006
+ }
1007
+
1008
+ // node_modules/@ankhorage/surface/dist/features/theme/utils/resolveWeightTokenOverrides.js
1009
+ var WEIGHT_TOKEN_KEYS = new Set([
1010
+ "thin",
1011
+ "extraLight",
1012
+ "light",
1013
+ "regular",
1014
+ "medium",
1015
+ "semiBold",
1016
+ "bold",
1017
+ "extraBold",
1018
+ "black"
1019
+ ]);
1020
+ var FONT_WEIGHT_VALUES = new Set([
1021
+ "100",
1022
+ "200",
1023
+ "300",
1024
+ "400",
1025
+ "500",
1026
+ "600",
1027
+ "700",
1028
+ "800",
1029
+ "900",
1030
+ "bold",
1031
+ "normal"
1032
+ ]);
1033
+ function resolveWeightTokenOverrides(overrides) {
1034
+ if (overrides === undefined)
1035
+ return {};
1036
+ return Object.fromEntries(Object.entries(overrides).map(([token, value]) => {
1037
+ if (!WEIGHT_TOKEN_KEYS.has(token)) {
1038
+ throw new RangeError(`Unknown typography weight token: ${token}.`);
1039
+ }
1040
+ if (!isFontWeight(value)) {
1041
+ throw new RangeError(`Invalid font weight for typography.weights.${token}: ${value}.`);
1042
+ }
1043
+ return [token, value];
1044
+ }));
1045
+ }
1046
+ function isFontWeight(value) {
1047
+ return FONT_WEIGHT_VALUES.has(value);
1048
+ }
1049
+
1050
+ // node_modules/@ankhorage/surface/dist/features/theme/utils/resolveGlobalTokens.js
1051
+ function resolveGlobalTokens(overrides) {
1052
+ validateZeroTokens(overrides);
1053
+ const typography = overrides?.typography;
1054
+ return {
1055
+ spacing: {
1056
+ ...DEFAULT_TOKENS.spacing,
1057
+ ...resolveNumericTokenOverrides("spacing", overrides?.spacing)
1058
+ },
1059
+ radii: {
1060
+ ...DEFAULT_TOKENS.radii,
1061
+ ...resolveNumericTokenOverrides("radii", overrides?.radii)
1062
+ },
1063
+ typography: {
1064
+ headings: resolveHeadingTokenOverrides(DEFAULT_TOKENS.typography.headings, typography?.headings),
1065
+ sizes: {
1066
+ ...DEFAULT_TOKENS.typography.sizes,
1067
+ ...resolveNumericTokenOverrides("typography.sizes", typography?.sizes, true)
1068
+ },
1069
+ weights: {
1070
+ ...DEFAULT_TOKENS.typography.weights,
1071
+ ...resolveWeightTokenOverrides(typography?.weights)
1072
+ },
1073
+ fonts: {
1074
+ normal: { ...DEFAULT_TOKENS.typography.fonts.normal },
1075
+ italic: { ...DEFAULT_TOKENS.typography.fonts.italic }
1076
+ }
1077
+ },
1078
+ shadows: {
1079
+ ...DEFAULT_TOKENS.shadows,
1080
+ ...resolveNumericTokenOverrides("shadows", overrides?.shadows)
1081
+ }
1082
+ };
1083
+ }
1084
+ function validateZeroTokens(overrides) {
1085
+ if (overrides?.spacing?.none !== undefined && overrides.spacing.none !== 0) {
1086
+ throw new RangeError("Theme token spacing.none must remain 0.");
1087
+ }
1088
+ if (overrides?.radii?.none !== undefined && overrides.radii.none !== 0) {
1089
+ throw new RangeError("Theme token radii.none must remain 0.");
1090
+ }
1091
+ }
1092
+
1093
+ // node_modules/@ankhorage/surface/dist/features/theme/application/use-cases/createTheme.js
1094
+ var DEFAULT_CONFIG = {
1095
+ id: "default",
1096
+ name: "Default",
1097
+ light: { primaryColor: "#3B82F6", harmony: "monochromatic" },
1098
+ dark: { primaryColor: "#3B82F6", harmony: "monochromatic" }
1099
+ };
1100
+ function createTheme(config = DEFAULT_CONFIG, mode = "light", activeFontId, inverted = false) {
1101
+ const { colors, swatches, semantics, colorDiagnostics } = generatePalette(config, mode);
1102
+ const baseTheme = {
1103
+ ...resolveGlobalTokens(config.tokens),
1104
+ colors,
1105
+ swatches,
1106
+ semantics,
1107
+ colorDiagnostics,
1108
+ config,
1109
+ inverted: false
1110
+ };
1111
+ const themed = activeFontId ? withActiveFont(baseTheme, activeFontId) : baseTheme;
1112
+ return inverted ? projectInvertedTheme(themed) : themed;
1113
+ }
1114
+ function withActiveFont(theme, activeFontId) {
1115
+ const familyName = toPascalCase(activeFontId);
1116
+ return {
1117
+ ...theme,
1118
+ typography: {
1119
+ ...theme.typography,
1120
+ fonts: {
1121
+ normal: createFontMap(theme.typography.fonts.normal, familyName, "Regular"),
1122
+ italic: createFontMap(theme.typography.fonts.italic, familyName, "Italic")
1123
+ }
1124
+ }
1125
+ };
1126
+ }
1127
+ function createFontMap(fallback, familyName, style) {
1128
+ return {
1129
+ ...fallback,
1130
+ "100": `${familyName}_100${style}`,
1131
+ "200": `${familyName}_200${style}`,
1132
+ "300": `${familyName}_300${style}`,
1133
+ "400": `${familyName}_400${style}`,
1134
+ "500": `${familyName}_500${style}`,
1135
+ "600": `${familyName}_600${style}`,
1136
+ "700": `${familyName}_700${style}`,
1137
+ "800": `${familyName}_800${style}`,
1138
+ "900": `${familyName}_900${style}`
1139
+ };
1140
+ }
1141
+ function toPascalCase(value) {
1142
+ return value.split(/[- ]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
1143
+ }
1144
+
1145
+ // node_modules/@ankhorage/surface/dist/features/theme/adapters/inbound/ThemeRuntimeContext.js
1146
+ var defaultTheme = createTheme();
1147
+ var ThemeRuntimeContext = createContext2({
1148
+ theme: defaultTheme,
1149
+ mode: "light",
1150
+ inverted: false,
1151
+ setThemeConfig: () => {
1152
+ return;
1153
+ },
1154
+ setMode: () => {
1155
+ return;
1156
+ }
1157
+ });
1158
+
1159
+ // node_modules/@ankhorage/surface/dist/features/theme/adapters/inbound/useTheme.js
1160
+ function useTheme() {
1161
+ return use2(ThemeRuntimeContext);
1162
+ }
1163
+ // node_modules/@ankhorage/surface/dist/features/pressable/adapters/inbound/Pressable.js
1164
+ function Pressable({ children, disabled = false, interactionPolicy = "enabled", onPress, onLongPress, accessibilityLabel, accessibilityRole = "button", accessibilityState, style, testID, ...props }) {
1165
+ const { theme } = useTheme();
1166
+ const { breakpoint } = useResponsiveRuntime();
1167
+ const [hovered, setHovered] = React3.useState(false);
1168
+ const [focused, setFocused] = React3.useState(false);
1169
+ const isWeb = import_react_native2.Platform.OS === "web";
1170
+ const resolvedViewStyles = resolveViewStyles(theme, breakpoint, props);
1171
+ const pressHandlers = resolvePressHandlers(interactionPolicy, onPress, onLongPress);
1172
+ const pressableStyle = resolvePressableStyle({
1173
+ disabled,
1174
+ focusColor: theme.semantics.border.focus,
1175
+ focused,
1176
+ hovered,
1177
+ isWeb,
1178
+ resolvedViewStyles,
1179
+ style
1180
+ });
1181
+ return _jsx2(import_react_native2.Pressable, { ...pressHandlers, accessibilityLabel, accessibilityRole, accessibilityState: { ...accessibilityState, disabled }, "aria-checked": accessibilityState?.checked, disabled, onBlur: () => setFocused(false), onFocus: resolveFocusHandler(isWeb, setFocused), onHoverIn: isWeb ? () => setHovered(true) : undefined, onHoverOut: isWeb ? () => setHovered(false) : undefined, onKeyDown: resolveCheckboxSpaceKeyHandler(accessibilityRole, isWeb, pressHandlers.onPress), style: pressableStyle, testID, children: resolvePressableChildren(children, hovered, focused, disabled) });
1182
+ }
1183
+ function resolvePressHandlers(interactionPolicy, onPress, onLongPress) {
1184
+ return interactionPolicy === "passive" ? { onLongPress: undefined, onPress: undefined } : { onLongPress, onPress };
1185
+ }
1186
+ function resolveCheckboxSpaceKeyHandler(accessibilityRole, isWeb, onPress) {
1187
+ if (!isWeb || accessibilityRole !== "checkbox" || onPress === undefined)
1188
+ return;
1189
+ const onKeyDown = (event) => {
1190
+ if (event.nativeEvent.key !== " " && event.nativeEvent.key !== "Spacebar")
1191
+ return;
1192
+ event.preventDefault();
1193
+ document.activeElement?.dispatchEvent(new MouseEvent("click", { bubbles: true }));
1194
+ };
1195
+ return onKeyDown;
1196
+ }
1197
+ function resolvePressableChildren(children, hovered, focused, disabled) {
1198
+ return (pressableState) => {
1199
+ const state = resolveInteractionState(pressableState, hovered, focused, disabled);
1200
+ return typeof children === "function" ? children(state) : children;
1201
+ };
1202
+ }
1203
+ function resolveFocusHandler(isWeb, setFocused) {
1204
+ return () => {
1205
+ if (isWeb)
1206
+ setFocused(true);
1207
+ };
1208
+ }
1209
+ function resolvePressableStyle({ disabled, focusColor, focused, hovered, isWeb, resolvedViewStyles, style }) {
1210
+ return (pressableState) => {
1211
+ const state = resolveInteractionState(pressableState, hovered, focused, disabled);
1212
+ return [resolvedViewStyles, resolveFocusRingStyles(focusColor, state.focused, isWeb), style];
1213
+ };
1214
+ }
1215
+ function resolveInteractionState(pressableState, hovered, focused, disabled) {
1216
+ return resolveInteractiveState({
1217
+ pressed: pressableState.pressed,
1218
+ hovered,
1219
+ focused,
1220
+ disabled
1221
+ });
1222
+ }
1223
+ // src/features/selection/adapters/inbound/SelectableItem.tsx
1224
+ var import_react_native3 = __toESM(require_cjs(), 1);
1225
+ import React4 from "react";
1226
+ import { jsx as jsx2, Fragment } from "react/jsx-runtime";
1227
+ function resolveTrigger(trigger) {
1228
+ return trigger ?? "manual";
1229
+ }
1230
+ function isRenderProp(children) {
1231
+ return typeof children === "function";
1232
+ }
1233
+ var SelectableItem2 = withZoraThemeScope(SelectableItemInner);
1234
+ function SelectableItemInner({
1235
+ id,
1236
+ trigger,
1237
+ disabled = false,
1238
+ interactionPolicy,
1239
+ children
1240
+ }) {
1241
+ const selection = useSelection();
1242
+ const resolvedTrigger = resolveTrigger(trigger);
1243
+ const resolvedDisabled = selection.disabled || disabled;
1244
+ const selected = selection.isSelected(id);
1245
+ const activate = React4.useCallback((intent) => {
1246
+ if (resolvedDisabled || interactionPolicy === "passive")
1247
+ return;
1248
+ selection.activate(id, intent);
1249
+ }, [id, interactionPolicy, resolvedDisabled, selection]);
1250
+ const select = React4.useCallback(() => {
1251
+ if (resolvedDisabled || interactionPolicy === "passive")
1252
+ return;
1253
+ selection.select(id);
1254
+ }, [id, interactionPolicy, resolvedDisabled, selection]);
1255
+ const toggle = React4.useCallback(() => {
1256
+ if (resolvedDisabled || interactionPolicy === "passive")
1257
+ return;
1258
+ selection.toggle(id);
1259
+ }, [id, interactionPolicy, resolvedDisabled, selection]);
1260
+ const clear = React4.useCallback(() => {
1261
+ if (selection.disabled || interactionPolicy === "passive")
1262
+ return;
1263
+ selection.clear();
1264
+ }, [interactionPolicy, selection]);
1265
+ const itemState = React4.useMemo(() => ({
1266
+ id,
1267
+ selected,
1268
+ disabled: resolvedDisabled,
1269
+ mode: selection.mode,
1270
+ activate,
1271
+ select,
1272
+ toggle,
1273
+ clear
1274
+ }), [activate, clear, id, resolvedDisabled, select, selected, selection.mode, toggle]);
1275
+ const content = isRenderProp(children) ? children(itemState) : children;
1276
+ if (resolvedTrigger === "manual")
1277
+ return /* @__PURE__ */ jsx2(Fragment, {
1278
+ children: content
1279
+ });
1280
+ const handleActivation = (event) => {
1281
+ event.stopPropagation();
1282
+ if (resolvedDisabled || interactionPolicy === "passive")
1283
+ return;
1284
+ selection.activate(id, resolveSelectionEventIntent(event, import_react_native3.Platform.OS === "web" ? "pointer" : "touch"));
1285
+ };
1286
+ return /* @__PURE__ */ jsx2(Pressable, {
1287
+ interactionPolicy,
1288
+ accessibilityRole: "button",
1289
+ accessibilityState: { disabled: resolvedDisabled, selected },
1290
+ disabled: resolvedDisabled,
1291
+ onLongPress: resolvedTrigger === "longPress" ? handleActivation : undefined,
1292
+ onPress: resolvedTrigger === "press" ? handleActivation : undefined,
1293
+ children: content
1294
+ });
1295
+ }
1296
+ export { SelectionProvider2, SelectableItem2 };