@oxy.so/bloom-lens 0.0.0-stage → 1.0.0

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 (108) hide show
  1. package/LICENSE +673 -0
  2. package/NOTICE +26 -0
  3. package/android/build.gradle +19 -0
  4. package/android/src/main/AndroidManifest.xml +1 -0
  5. package/android/src/main/assets/fonts/Inter-OFL.txt +93 -0
  6. package/android/src/main/assets/fonts/Inter-Regular.ttf +0 -0
  7. package/android/src/main/java/so/oxy/bloom/glassmenu/220 +0 -0
  8. package/android/src/main/java/so/oxy/bloom/glassmenu/GlassMenuAndroidModule.kt +71 -0
  9. package/android/src/main/java/so/oxy/bloom/glassmenu/GlassMenuAndroidView.kt +548 -0
  10. package/android/src/main/java/so/oxy/bloom/glassmenu/backdrop/GlassBackdrop.kt +215 -0
  11. package/android/src/main/java/so/oxy/bloom/glassmenu/backdrop/GlassLens.kt +103 -0
  12. package/android/src/main/java/so/oxy/bloom/glassmenu/chrome/ChromeGeometry.kt +73 -0
  13. package/android/src/main/java/so/oxy/bloom/glassmenu/chrome/ChromeIcons.kt +74 -0
  14. package/android/src/main/java/so/oxy/bloom/glassmenu/chrome/ChromeMaterial.kt +74 -0
  15. package/android/src/main/java/so/oxy/bloom/glassmenu/chrome/GlassChromeHost.kt +73 -0
  16. package/android/src/main/java/so/oxy/bloom/glassmenu/chrome/GlassChromeModule.kt +31 -0
  17. package/android/src/main/java/so/oxy/bloom/glassmenu/chrome/GlassChromeView.kt +609 -0
  18. package/android/src/main/java/so/oxy/bloom/glassmenu/chrome/StaticGlassCache.kt +73 -0
  19. package/android/src/main/java/so/oxy/bloom/glassmenu/chrome/SurfaceIcons.kt +114 -0
  20. package/android/src/main/java/so/oxy/bloom/glassmenu/chrome/SurfaceNodesHost.kt +71 -0
  21. package/android/src/main/java/so/oxy/bloom/glassmenu/chrome/SurfaceNodesModule.kt +22 -0
  22. package/android/src/main/java/so/oxy/bloom/glassmenu/chrome/SurfaceNodesView.kt +527 -0
  23. package/android/src/main/java/so/oxy/bloom/glassmenu/content/GlassIcons.kt +68 -0
  24. package/android/src/main/java/so/oxy/bloom/glassmenu/content/GlassMenuContent.kt +349 -0
  25. package/android/src/main/java/so/oxy/bloom/glassmenu/content/GlassRow.kt +19 -0
  26. package/android/src/main/java/so/oxy/bloom/glassmenu/field/GlassFieldTexture.kt +102 -0
  27. package/android/src/main/java/so/oxy/bloom/glassmenu/field/GlassGaussianField.kt +161 -0
  28. package/android/src/main/java/so/oxy/bloom/glassmenu/field/GlassShapes.kt +37 -0
  29. package/android/src/main/java/so/oxy/bloom/glassmenu/field/RoundedField.kt +119 -0
  30. package/android/src/main/java/so/oxy/bloom/glassmenu/field/RoundedUnion.kt +81 -0
  31. package/android/src/main/java/so/oxy/bloom/glassmenu/motion/GlassGroup.kt +225 -0
  32. package/android/src/main/java/so/oxy/bloom/glassmenu/motion/GlassJelly.kt +118 -0
  33. package/android/src/main/java/so/oxy/bloom/glassmenu/motion/GlassMorphFrame.kt +22 -0
  34. package/android/src/main/java/so/oxy/bloom/glassmenu/motion/GlassMorphTuning.kt +31 -0
  35. package/android/src/main/java/so/oxy/bloom/glassmenu/motion/GlassMotion.kt +475 -0
  36. package/android/src/main/java/so/oxy/bloom/glassmenu/motion/GlassSpring.kt +78 -0
  37. package/android/src/main/java/so/oxy/bloom/glassmenu/overlay/GlassDevGuard.kt +31 -0
  38. package/android/src/main/java/so/oxy/bloom/glassmenu/overlay/GlassFeedback.kt +18 -0
  39. package/android/src/main/java/so/oxy/bloom/glassmenu/overlay/GlassMenuOverlay.kt +433 -0
  40. package/android/src/main/java/so/oxy/bloom/glassmenu/overlay/GlassMenuSession.kt +750 -0
  41. package/android/src/main/java/so/oxy/bloom/glassmenu/overlay/GlassScrub.kt +41 -0
  42. package/android/src/main/java/so/oxy/bloom/glassmenu/overlay/GlassSubmenuLayer.kt +290 -0
  43. package/android/src/main/java/so/oxy/bloom/glassmenu/records/GlassAbsorbRecord.kt +9 -0
  44. package/android/src/main/java/so/oxy/bloom/glassmenu/records/GlassMemberRecord.kt +14 -0
  45. package/android/src/main/java/so/oxy/bloom/glassmenu/records/GlassMenuConfigRecord.kt +24 -0
  46. package/android/src/main/java/so/oxy/bloom/glassmenu/records/GlassMenuItemRecord.kt +23 -0
  47. package/android/src/main/java/so/oxy/bloom/glassmenu/records/GlassShrinkRecord.kt +10 -0
  48. package/android/src/main/java/so/oxy/bloom/glassmenu/records/GlassTriggerConfigRecord.kt +19 -0
  49. package/android/src/main/java/so/oxy/bloom/glassmenu/render/GlassRecipe.kt +18 -0
  50. package/android/src/main/java/so/oxy/bloom/glassmenu/render/GlassRenderer.kt +361 -0
  51. package/android/src/main/java/so/oxy/bloom/glassmenu/render/GlassShaders.kt +318 -0
  52. package/android/src/main/java/so/oxy/bloom/glassmenu/render/GlassStill.kt +115 -0
  53. package/android/src/main/java/so/oxy/bloom/glassmenu/render/GlassSurfaceState.kt +38 -0
  54. package/expo-module.config.json +10 -0
  55. package/package.json +29 -4
  56. package/patches/bloom.patch +1908 -0
  57. package/patches/menu/bloom.patch +148 -0
  58. package/src/base.tsx +208 -0
  59. package/src/chrome/compositor-geometry.ts +163 -0
  60. package/src/chrome/glass-header.tsx +155 -0
  61. package/src/chrome/glass-search-fab.tsx +113 -0
  62. package/src/chrome/glass-size-class.tsx +150 -0
  63. package/src/chrome/glass-toolbar.tsx +45 -0
  64. package/src/chrome/interface.ts +17 -0
  65. package/src/chrome/ios-tab-bar.tsx +49 -0
  66. package/src/chrome/surface-layer.ts +91 -0
  67. package/src/chrome/surface-nodes.tsx +54 -0
  68. package/src/index.ts +19 -0
  69. package/src/menu/components/menu/index.ts +22 -0
  70. package/src/menu/components/menu/menu.tsx +97 -0
  71. package/src/menu/components/menu-action-row/index.ts +1 -0
  72. package/src/menu/components/menu-action-row/menu-action-row.tsx +12 -0
  73. package/src/menu/components/menu-content/index.ts +2 -0
  74. package/src/menu/components/menu-content/menu-content.tsx +11 -0
  75. package/src/menu/components/menu-item/index.ts +13 -0
  76. package/src/menu/components/menu-item/menu-item-icon.tsx +10 -0
  77. package/src/menu/components/menu-item/menu-item-subtitle.tsx +14 -0
  78. package/src/menu/components/menu-item/menu-item-title.tsx +11 -0
  79. package/src/menu/components/menu-item/menu-item.tsx +11 -0
  80. package/src/menu/components/menu-label/index.ts +3 -0
  81. package/src/menu/components/menu-label/menu-label.tsx +11 -0
  82. package/src/menu/components/menu-separator/index.ts +3 -0
  83. package/src/menu/components/menu-separator/menu-separator.tsx +7 -0
  84. package/src/menu/components/menu-submenu/index.ts +1 -0
  85. package/src/menu/components/menu-submenu/menu-submenu.tsx +12 -0
  86. package/src/menu/components/menu-trigger/index.ts +3 -0
  87. package/src/menu/components/menu-trigger/interface.ts +41 -0
  88. package/src/menu/components/menu-trigger/menu-trigger.android.tsx +97 -0
  89. package/src/menu/components/menu-trigger/menu-trigger.tsx +15 -0
  90. package/src/menu/components/menu-trigger/native-menu.android.ts +9 -0
  91. package/src/menu/components/menu-trigger-button/index.ts +3 -0
  92. package/src/menu/components/menu-trigger-button/menu-trigger-button.android.tsx +38 -0
  93. package/src/menu/components/menu-trigger-button/menu-trigger-button.tsx +17 -0
  94. package/src/menu/constants/interface.ts +6 -0
  95. package/src/menu/constants/menu.const.ts +11 -0
  96. package/src/menu/context/interface.ts +63 -0
  97. package/src/menu/context/menu.context.ts +7 -0
  98. package/src/menu/index.ts +53 -0
  99. package/src/menu/interface.ts +229 -0
  100. package/src/menu/utils/create-compound-component.util.ts +18 -0
  101. package/src/menu/utils/find-menu-content.util.ts +17 -0
  102. package/src/menu/utils/flatten-elements.util.ts +18 -0
  103. package/src/menu/utils/parse-menu-content.util.ts +98 -0
  104. package/src/menu/utils/parse-menu-item.util.ts +56 -0
  105. package/src/menu/utils/register-component.util.ts +13 -0
  106. package/src/menu/utils/to-native-item.util.ts +24 -0
  107. package/src/rows.tsx +61 -0
  108. package/README.md +0 -3
@@ -0,0 +1,41 @@
1
+ package so.oxy.bloom.glassmenu.overlay
2
+
3
+ import so.oxy.bloom.glassmenu.motion.GlassJelly
4
+
5
+ // The scrub gesture shared by the menu and the chrome: a press on a control deforms it with the jelly, a drag moves the
6
+ // jelly with the finger, a release (or a cancel) lets the jelly settle. The controller tracks the item under the finger
7
+ // (a row of the menu, a tab of the chrome) so the owner can tell when the finger crosses to another item.
8
+ // The highlight, the haptic rule and the selection stay with the owner: they differ between the menu and the chrome.
9
+ internal class GlassScrub(private val jelly: GlassJelly) {
10
+ // The item under the finger, NONE when there is none.
11
+ var current: Int = NONE
12
+ private set
13
+
14
+ fun press(x: Float, y: Float, item: Int): Boolean {
15
+ jelly.down(x, y)
16
+ return update(item)
17
+ }
18
+
19
+ fun drag(x: Float, y: Float, item: Int): Boolean {
20
+ jelly.move(x, y)
21
+ return update(item)
22
+ }
23
+
24
+ fun release() {
25
+ jelly.release()
26
+ current = NONE
27
+ }
28
+
29
+ fun cancel() = release()
30
+
31
+ // True when the item under the finger changed.
32
+ private fun update(item: Int): Boolean {
33
+ val changed = item != current
34
+ current = item
35
+ return changed
36
+ }
37
+
38
+ companion object {
39
+ const val NONE = -1
40
+ }
41
+ }
@@ -0,0 +1,290 @@
1
+ package so.oxy.bloom.glassmenu.overlay
2
+
3
+ import android.graphics.Canvas
4
+ import android.graphics.Rect
5
+ import android.graphics.RectF
6
+ import android.graphics.RenderNode
7
+ import so.oxy.bloom.glassmenu.backdrop.GlassBackdrop
8
+ import so.oxy.bloom.glassmenu.GlassMenuAndroidView
9
+ import so.oxy.bloom.glassmenu.content.GlassMenuContent
10
+ import so.oxy.bloom.glassmenu.content.GlassRow
11
+ import so.oxy.bloom.glassmenu.motion.GlassSpring
12
+ import so.oxy.bloom.glassmenu.motion.GlassSpringSpec
13
+ import so.oxy.bloom.glassmenu.render.GlassRenderer
14
+ import so.oxy.bloom.glassmenu.render.GlassSurfaceState
15
+ import kotlin.math.max
16
+ import kotlin.math.min
17
+
18
+ // The submenu panel: a second glass surface stacked over the root. It is one continuous transform of one
19
+ // panel: a single progress value (0 = the tapped row, 1 = the panel) drives its rect, corner radius and
20
+ // rows. There is no source lobe, no lens and no second morph, so no extra shape can appear during the
21
+ // transition. Opening and closing run the same transform in both directions.
22
+ internal class GlassSubmenuLayer(
23
+ private val anchor: GlassMenuAndroidView,
24
+ private val density: Float,
25
+ val content: GlassMenuContent,
26
+ private val rowsNode: RenderNode?,
27
+ private val plateNode: RenderNode?,
28
+ // This panel's own renderer (its own RenderNodes): nothing is shared with the root.
29
+ private val renderer: GlassRenderer,
30
+ ) {
31
+ private val state = GlassSurfaceState()
32
+ // Draws the parent's own row (the header) at its place: set by the session, which owns that row.
33
+ var drawHeader: ((Canvas, Float) -> Unit)? = null
34
+ val target = RectF()
35
+ private val row = RectF()
36
+ private val shown = RectF()
37
+ private val captureBounds = RectF()
38
+ private val plateRect = RectF()
39
+ private val progress = GlassSpring(ProgressTolerance, ProgressVelocity)
40
+ private var rowsDirty = true
41
+ private var plateVisible = false
42
+ private var activeRow: GlassRow? = null
43
+ private val plateTop = GlassSpring(.25f, 8f)
44
+ private val plateHeight = GlassSpring(.25f, 8f)
45
+ // Horizontal extent of the plate: a list row spans the plate inset; an action cell its column (plateSpan).
46
+ private val plateLeft = GlassSpring(.25f, 8f)
47
+ private val plateRight = GlassSpring(.25f, 8f)
48
+ private val plateAlpha = GlassSpring(.004f, .05f)
49
+ var closing = false
50
+ private set
51
+
52
+ // The transform's progress (1 = the panel, 0 = the row): the root recedes with it.
53
+ val progressValue: Float get() = progress.value.coerceIn(0f, 1f)
54
+
55
+ // Fully open: the transform has arrived at the panel and no close is pending.
56
+ val isOpen: Boolean
57
+ get() = !closing && progress.isSettled && progress.value >= 1f - ProgressTolerance
58
+
59
+ val needsFrame: Boolean
60
+ get() = !progress.isSettled || !plateAlpha.isSettled || !plateTop.isSettled || !plateHeight.isSettled || !plateLeft.isSettled || !plateRight.isSettled
61
+
62
+ // Opens from the row rect (screen px) to the panel rect (screen px).
63
+ fun open(rowRect: RectF, panel: RectF) {
64
+ row.set(rowRect)
65
+ target.set(panel)
66
+ closing = false
67
+ progress.reset(0f)
68
+ progress.target(1f, Spec)
69
+ captureBounds.set(row)
70
+ captureBounds.union(target)
71
+ captureBounds.inset(-CaptureMargin * density, -CaptureMargin * density)
72
+ plateAlpha.reset(0f)
73
+ plateTop.reset(0f)
74
+ plateHeight.reset(0f)
75
+ plateLeft.reset(0f)
76
+ plateRight.reset(0f)
77
+ plateVisible = false
78
+ activeRow = null
79
+ rowsDirty = true
80
+ }
81
+
82
+ // Predictive back: the layer follows the gesture (progress 1 = open, 0 = in the row), no spring.
83
+ fun dragTo(progress: Float) {
84
+ closing = true
85
+ this.progress.reset(progress)
86
+ rowsDirty = true
87
+ }
88
+
89
+ // Cancelled gesture, or a release below the commit point: the layer opens again.
90
+ fun reopen() {
91
+ closing = false
92
+ progress.target(1f, Spec)
93
+ rowsDirty = true
94
+ }
95
+
96
+ // Closes back into the row: the same transform, reversed.
97
+ fun close() {
98
+ closing = true
99
+ // The press/hover plate of the header ends with the close, at once: it must not fade out over the collapse.
100
+ plateVisible = false
101
+ activeRow = null
102
+ plateAlpha.reset(0f)
103
+ progress.target(0f, Spec)
104
+ rowsDirty = true
105
+ }
106
+
107
+ // Advances the transform. Returns true when a closing layer has reached the row (it can be removed).
108
+ fun tick(seconds: Float): Boolean {
109
+ progress.advance(seconds)
110
+ plateTop.advance(seconds)
111
+ plateLeft.advance(seconds)
112
+ plateRight.advance(seconds)
113
+ plateHeight.advance(seconds)
114
+ plateAlpha.advance(seconds)
115
+ rowsDirty = true
116
+ // Closed once the panel is at the row: the glass has already faded out there, so nothing is left behind.
117
+ return closing && progress.value <= CloseDone
118
+ }
119
+
120
+ fun draw(canvas: Canvas, backdrop: GlassBackdrop, limits: Rect) {
121
+ val p = progress.value.coerceIn(0f, 1f)
122
+ lerp(row, target, p, shown)
123
+ val rowRadius = min(row.width(), row.height()) / 2f
124
+ val panelRadius = CornerRadius * density
125
+ val radius = min(lerpF(rowRadius, panelRadius, p), min(shown.width(), shown.height()) / 2f)
126
+ state.incoming.set(shown)
127
+ state.captureBounds.set(captureBounds)
128
+ state.lockedFieldStep = max(NeckSigma * density / FieldCellsPerSigma, max(captureBounds.width(), captureBounds.height()) / FieldCells)
129
+ state.radiusX = radius
130
+ state.radiusY = radius
131
+ state.hasSource = false
132
+ state.sourceRadius = radius
133
+ state.smoothing = 0f
134
+ state.lensHeight = 0f
135
+ state.lensAmount = 0f
136
+ // The glass fades out before it reaches the row (and in while opening): no thin residual shape at the row.
137
+ state.materialProgress = ((p - GlassFadeStart) / (GlassFadeEnd - GlassFadeStart)).coerceIn(0f, 1f)
138
+ // The shadow follows the material: once the glass has faded out, no shadow (or edge) is left at the row.
139
+ state.surfaceOpacity = state.materialProgress
140
+ state.dark = content.dark
141
+ state.config = anchor.config
142
+ state.trigger = anchor.triggerConfig
143
+ // No anchor light: the anchor's press light grows as the panel shrinks into the row, which read as a white flash.
144
+ if (state.materialProgress > 0f) {
145
+ renderer.prepare(state)
146
+ renderer.drawGlass(canvas, backdrop, state, limits)
147
+ }
148
+
149
+ val rowsAlpha = ((p - RowsFadeStart) / RowsFadeSpan).coerceIn(0f, 1f)
150
+ val rows = recordRows()
151
+ if (rows != null && rowsAlpha > 0f) {
152
+ rows.setPivotX(0f)
153
+ rows.setPivotY(0f)
154
+ // Uniform scale: the rows keep their proportions while the panel narrows into the row.
155
+ val scale = shown.width() / target.width()
156
+ rows.setScaleX(scale)
157
+ rows.setScaleY(scale)
158
+ rows.setTranslationX(shown.left)
159
+ rows.setTranslationY(shown.top)
160
+ rows.setAlpha(rowsAlpha)
161
+ rows.setRenderEffect(null)
162
+ }
163
+ val plate = recordPlate()
164
+ if (plate != null && rows != null) {
165
+ plate.setPivotX(0f)
166
+ plate.setPivotY(0f)
167
+ plate.setScaleX(rows.scaleX)
168
+ plate.setScaleY(rows.scaleY)
169
+ plate.setTranslationX(rows.translationX)
170
+ plate.setTranslationY(rows.translationY)
171
+ plate.setAlpha(rowsAlpha)
172
+ }
173
+ renderer.drawForeground(canvas, state, false, 0f) { recording ->
174
+ if (rows != null && rowsAlpha > 0f) {
175
+ // The rows are clipped to the panel: nothing of them is drawn outside the glass.
176
+ recording.save()
177
+ recording.clipRect(shown)
178
+ if (plate != null) recording.drawRenderNode(plate)
179
+ recording.drawRenderNode(rows)
180
+ recording.restore()
181
+ }
182
+ // The header is the parent's row: it stays where it is and its chevron turns from right to down.
183
+ drawHeader?.invoke(recording, BackChevronDown * p)
184
+ }
185
+ }
186
+
187
+ private fun lerp(from: RectF, to: RectF, t: Float, out: RectF) {
188
+ out.set(
189
+ lerpF(from.left, to.left, t), lerpF(from.top, to.top, t),
190
+ lerpF(from.right, to.right, t), lerpF(from.bottom, to.bottom, t),
191
+ )
192
+ }
193
+
194
+ private fun lerpF(a: Float, b: Float, t: Float): Float = a + (b - a) * t
195
+
196
+ private fun recordRows(): RenderNode? {
197
+ val node = rowsNode ?: return null
198
+ val width = target.width().toInt()
199
+ val height = target.height().toInt()
200
+ if (rowsDirty) {
201
+ rowsDirty = false
202
+ node.setPosition(0, 0, width, height)
203
+ // The placeholder header row is not drawn here: the parent's own row is drawn as the header.
204
+ content.draw(node.beginRecording(width, height), 0f) { it.back }
205
+ node.endRecording()
206
+ }
207
+ return node
208
+ }
209
+
210
+ private fun recordPlate(): RenderNode? {
211
+ val node = plateNode ?: return null
212
+ if (plateAlpha.value <= .001f) return null
213
+ val width = target.width().toInt()
214
+ val height = target.height().toInt()
215
+ node.setPosition(0, 0, width, height)
216
+ val recording = node.beginRecording(width, height)
217
+ plateRect.set(plateLeft.value, plateTop.value, plateRight.value, plateTop.value + plateHeight.value)
218
+ content.drawPlate(recording, plateRect, plateAlpha.value, plateRect.centerX(), anchor.config.highlightOpacity, anchor.config.shine)
219
+ node.endRecording()
220
+ return node
221
+ }
222
+
223
+ // Touch: the row under the finger (panel-local coordinates), with the same highlight as the root.
224
+ fun rowAt(x: Float, y: Float): GlassRow? = content.rowAt(x - target.left, y - target.top)
225
+
226
+ fun nearestRow(x: Float, y: Float): GlassRow? = content.nearestRow(x - target.left, y - target.top, ScrubSlack * density)
227
+
228
+ fun contains(x: Float, y: Float): Boolean = target.contains(x, y)
229
+
230
+ // Horizontal extent of the plate for a row, in px: an action cell spans its column; a list row spans the plate inset.
231
+ private fun plateSpan(row: GlassRow): Pair<Float, Float> =
232
+ if (row.isAction) row.rect.left to row.rect.right
233
+ else PlateInset * density to target.width() - PlateInset * density
234
+
235
+ fun highlight(row: GlassRow?, immediate: Boolean) {
236
+ if (row === activeRow) return
237
+ val hadRow = activeRow != null
238
+ activeRow = row
239
+ if (row == null) {
240
+ plateVisible = false
241
+ plateAlpha.target(0f, PlateFade)
242
+ return
243
+ }
244
+ val span = plateSpan(row)
245
+ if (!plateVisible && !hadRow) {
246
+ plateTop.reset(row.rect.top)
247
+ plateHeight.reset(row.rect.height())
248
+ plateLeft.reset(span.first)
249
+ plateRight.reset(span.second)
250
+ } else {
251
+ plateTop.target(row.rect.top, PlateSlide)
252
+ plateHeight.target(row.rect.height(), PlateSlide)
253
+ plateLeft.target(span.first, PlateSlide)
254
+ plateRight.target(span.second, PlateSlide)
255
+ }
256
+ plateVisible = true
257
+ if (immediate) plateAlpha.reset(1f) else plateAlpha.target(1f, PlateFade)
258
+ rowsDirty = true
259
+ }
260
+
261
+ fun release() {
262
+ rowsNode?.discardDisplayList()
263
+ plateNode?.discardDisplayList()
264
+ }
265
+
266
+ private companion object {
267
+ const val NeckSigma = 20f
268
+ const val FieldCellsPerSigma = 4f
269
+ const val FieldCells = 64f
270
+ const val CaptureMargin = 48f
271
+ const val PlateInset = 8f
272
+ const val ScrubSlack = 24f
273
+ const val CornerRadius = 34f
274
+ // Rows fade in over the second half of the transform (and out over the first half when closing).
275
+ // One progress for the whole transition, in both directions. The rows are gone before the glass shrinks
276
+ // (RowsFadeStart), the glass is gone before the panel reaches the row (GlassFadeStart), and the layer is removed
277
+ // only at the row (CloseDone), where nothing of it is drawn. Nothing is fed to the rows that is outside the glass.
278
+ const val RowsFadeStart = .45f
279
+ const val RowsFadeSpan = .3f
280
+ const val GlassFadeStart = .35f
281
+ const val GlassFadeEnd = .5f
282
+ const val CloseDone = .002f
283
+ const val BackChevronDown = 90f
284
+ const val ProgressTolerance = .002f
285
+ const val ProgressVelocity = .01f
286
+ val Spec = GlassSpringSpec(1f, .28f)
287
+ val PlateSlide = GlassSpringSpec(.85f, .13f)
288
+ val PlateFade = GlassSpringSpec(1f, .14f)
289
+ }
290
+ }
@@ -0,0 +1,9 @@
1
+ package so.oxy.bloom.glassmenu.records
2
+
3
+ import expo.modules.kotlin.records.Field
4
+ import expo.modules.kotlin.records.Record
5
+
6
+ class GlassAbsorbRecord : Record {
7
+ @Field val duration: Float? = null
8
+ @Field val damping: Float? = null
9
+ }
@@ -0,0 +1,14 @@
1
+ package so.oxy.bloom.glassmenu.records
2
+
3
+ import expo.modules.kotlin.records.Field
4
+ import expo.modules.kotlin.records.Record
5
+
6
+ // A glass of a group on one base (GlassGroup).
7
+ class GlassMemberRecord : Record {
8
+ // The nativeID of the member's views; several views with one key are one shape around them all (a union).
9
+ @Field val key: String = ""
10
+ // The corner radius in points; null is a capsule.
11
+ @Field val cornerRadius: Float? = null
12
+ // How it arrives and leaves: "matchedGeometry" out of and into the nearest glass, "materialize" where it is.
13
+ @Field val transition: String = "matchedGeometry"
14
+ }
@@ -0,0 +1,24 @@
1
+ package so.oxy.bloom.glassmenu.records
2
+
3
+ import android.graphics.Color
4
+ import expo.modules.kotlin.records.Field
5
+ import expo.modules.kotlin.records.Record
6
+
7
+ class GlassMenuConfigRecord : Record {
8
+ @Field val blur: Float = 16f
9
+ @Field val morphBlur: Float = 1f
10
+ @Field val tintColor: Color? = null
11
+ @Field val tintOpacity: Float? = null
12
+ // Row ink; null keeps the built-in light/dark colours.
13
+ @Field val textColor: Color? = null
14
+ @Field val mutedColor: Color? = null
15
+ @Field val destructiveColor: Color? = null
16
+ @Field val separatorColor: Color? = null
17
+ @Field val saturation: Float = 1f
18
+ @Field val refraction: Float = 1f
19
+ @Field val rim: Float = 1f
20
+ @Field val shine: Float = 1f
21
+ @Field val highlightOpacity: Float = 1f
22
+ @Field val jelly: Float = 1f
23
+ @Field val speed: Float = 1f
24
+ }
@@ -0,0 +1,23 @@
1
+ package so.oxy.bloom.glassmenu.records
2
+
3
+ import expo.modules.kotlin.records.Field
4
+ import expo.modules.kotlin.records.Record
5
+
6
+ class GlassMenuItemRecord : Record {
7
+ @Field val id: String = ""
8
+ @Field val title: String = ""
9
+ @Field val subtitle: String? = null
10
+ @Field val icon: String? = null
11
+ @Field val iconPath: String? = null
12
+ @Field val iconSlot: Int? = null
13
+ @Field val checked: Boolean? = null
14
+ @Field val destructive: Boolean = false
15
+ @Field val disabled: Boolean = false
16
+ @Field val keepOpen: Boolean = false
17
+ @Field val separator: Boolean = false
18
+ @Field val heading: Boolean = false
19
+ // Submenu rows: the child items. Null for plain items.
20
+ @Field val items: List<GlassMenuItemRecord>? = null
21
+ // Action row: its cells (one icon action each), in order. Null for every other row.
22
+ @Field val actions: List<GlassMenuItemRecord>? = null
23
+ }
@@ -0,0 +1,10 @@
1
+ package so.oxy.bloom.glassmenu.records
2
+
3
+ import expo.modules.kotlin.records.Field
4
+ import expo.modules.kotlin.records.Record
5
+
6
+ class GlassShrinkRecord : Record {
7
+ @Field val duration: Float? = null
8
+ @Field val damping: Float? = null
9
+ @Field val scale: Float? = null
10
+ }
@@ -0,0 +1,19 @@
1
+ package so.oxy.bloom.glassmenu.records
2
+
3
+ import android.graphics.Color
4
+ import expo.modules.kotlin.records.Field
5
+ import expo.modules.kotlin.records.Record
6
+
7
+ class GlassTriggerConfigRecord : Record {
8
+ @Field val blur: Float = 1f
9
+ @Field val tintColor: Color? = null
10
+ @Field val tintOpacity: Float? = null
11
+ @Field val saturation: Float = 1f
12
+ @Field val refraction: Float = 1f
13
+ @Field val rim: Float = 1f
14
+ @Field val shine: Float = 1f
15
+ @Field val jelly: Float = 1f
16
+ @Field val morphOrigin: String = "trigger"
17
+ @Field val shrink: GlassShrinkRecord? = null
18
+ @Field val absorb: GlassAbsorbRecord? = null
19
+ }
@@ -0,0 +1,18 @@
1
+ package so.oxy.bloom.glassmenu.render
2
+
3
+ internal class GlassRecipe(
4
+ val saturation: Float,
5
+ val black: Float,
6
+ val white: Float,
7
+ val rollOff: Float,
8
+ val fillAlpha: Float,
9
+ val tint: Float = 0f,
10
+ val tintAlpha: Float = 0f,
11
+ ) {
12
+ companion object {
13
+ val ControlDark = GlassRecipe(1.3f, .125f, 1.125f, .4f, 0f)
14
+ val MenuDark = GlassRecipe(1.3f, .125f, 1.125f, .65f, 0f, tint = .042f, tintAlpha = .7f)
15
+ val ControlLight = GlassRecipe(1.2f, .4f, 1.03f, 0f, .2f)
16
+ val MenuLight = GlassRecipe(1.2f, .4f, 1.03f, 0f, .2f, tint = .975f, tintAlpha = .5f)
17
+ }
18
+ }