@octane-xplat/ui 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 1,
3
- "buildId": "34e7eb98-53f0-4d28-9246-10c4851ef1b3",
3
+ "buildId": "75ddb2ef-c36e-4fe9-a527-366022e49e35",
4
4
  "mode": "production",
5
5
  "capabilities": {
6
6
  "independentHydration": false
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 1,
3
- "buildId": "1c2dd44a-dfca-4434-aea5-573ac6a80e5f",
3
+ "buildId": "f3b36f26-7df9-403d-af4d-d1c9ae0de882",
4
4
  "mode": "production",
5
5
  "capabilities": {
6
6
  "independentHydration": false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octane-xplat/ui",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Cross-platform UI for Octane xplat — shared primitives, stacks, routes and theming across web (DOM), iOS and Android (NativeScript)",
5
5
  "keywords": [
6
6
  "android",
@@ -69,8 +69,8 @@
69
69
  "@nativescript-community/octane": "0.2.4",
70
70
  "@nativescript-community/ui-drawer": "0.1.32",
71
71
  "@nativescript/core": "9.1.2",
72
- "@nativescript/types": "9.0.0",
73
- "@octane-xplat/macos-renderer": "0.11.0",
72
+ "@nativescript/types": "9.1.4",
73
+ "@octane-xplat/macos-renderer": "0.11.1",
74
74
  "@octanejs/vite-plugin": "0.1.61",
75
75
  "@tsrx/typescript-plugin": "0.4.11",
76
76
  "jsdom": "30.1.1",
@@ -98,7 +98,7 @@
98
98
  "scripts": {
99
99
  "build": "node ../../scripts/sync-ui-barrels.mjs --check && vite build && vite build --mode native && pnpm typegen && node ../../scripts/check-native-dist.mjs",
100
100
  "test:packed": "node tests/packed-consumer.mjs",
101
- "test:native": "node --test tests/animated-value.test.mjs tests/tap-to-blur.ios.test.mjs tests/bottom-sheet-service.macos.test.mjs && vitest run --config vitest.native.config.mts",
101
+ "test:native": "node --test tests/animated-value.test.mjs tests/tap-to-blur.ios.test.mjs tests/bottom-sheet-service.macos.test.mjs tests/color-scheme.macos.test.mjs && vitest run --config vitest.native.config.mts",
102
102
  "typegen": "tsrx-typegen --target ui",
103
103
  "pack:check": "tsrx-typegen --pack-check",
104
104
  "test:layer:web": "node --test tests/layer-position.web.mjs",
@@ -1,7 +1,7 @@
1
1
  import { useSyncExternalStore } from 'octane'
2
2
  import type { ColorScheme } from './props'
3
3
 
4
- let appearanceListener: (() => void) | undefined
4
+ let unsubscribeAppearance: (() => void) | undefined
5
5
  const listeners = new Set<() => void>()
6
6
  const host = () => (globalThis as any).__xplatAppKit
7
7
 
@@ -15,12 +15,25 @@ export function getColorScheme(): ColorScheme {
15
15
 
16
16
  export function subscribeSystemScheme(callback: () => void): () => void {
17
17
  listeners.add(callback)
18
- if (!appearanceListener) {
19
- appearanceListener = () => listeners.forEach((listener) => listener())
20
- host()?.onAppearanceChange?.(appearanceListener)
18
+ if (!unsubscribeAppearance) {
19
+ unsubscribeAppearance = host()?.onAppearanceChange?.(() => {
20
+ listeners.forEach((listener) => listener())
21
+ })
21
22
  }
22
23
 
23
- return () => listeners.delete(callback)
24
+ let active = true
25
+ return () => {
26
+ if (!active) {
27
+ return
28
+ }
29
+
30
+ active = false
31
+ listeners.delete(callback)
32
+ if (listeners.size === 0) {
33
+ unsubscribeAppearance?.()
34
+ unsubscribeAppearance = undefined
35
+ }
36
+ }
24
37
  }
25
38
 
26
39
  export function useColorScheme(): ColorScheme {
@@ -18,7 +18,9 @@ export function TextInput(inputProps: TextInputProps) @{
18
18
  style={props.style}
19
19
  isEnabled={!props.isDisabled}
20
20
  editable={!isBlocked}
21
+ secure={props.secure}
21
22
  onTextChange={props.onChange}
23
+ onSubmit={props.onSubmit}
22
24
  accessibilityLabel={props.accessibilityLabel ?? props.ariaLabel ?? props.fieldLabel ?? props.label}
23
25
  accessibilityHint={props.accessibilityHint}
24
26
  accessibilityState={{ disabled: props.isDisabled, readonly: props.isReadOnly, busy: props.isLoading, required: props.isRequired && !props.isOptional, invalid: props.status?.type === 'error' }}
@@ -33,5 +35,5 @@ export function TextArea(inputProps: TextAreaProps) @{
33
35
  const props = useFieldControlProps(inputProps)
34
36
  const isBlocked = props.isDisabled || props.isReadOnly
35
37
 
36
- <textview id={props.id} value={props.value} placeholder={props.placeholder} rows={props.autoGrow ? undefined : props.rows ?? 3} className={cx('vx-textarea', props.isDisabled && 'vx-textarea--disabled', props.isReadOnly && 'vx-textarea--readonly', props.isLoading && 'vx-textarea--loading', props.status && `vx-textarea--status-${props.status.type}`, props.size && `vx-textarea--size-${props.size}`, props.className)} style={props.style} isEnabled={!props.isDisabled} editable={!isBlocked} onTextChange={props.onChange} accessibilityLabel={props.accessibilityLabel ?? props.ariaLabel ?? props.fieldLabel ?? props.label} accessibilityHint={props.accessibilityHint} accessibilityState={{ disabled: props.isDisabled, readonly: props.isReadOnly, busy: props.isLoading, required: props.isRequired && !props.isOptional, invalid: props.status?.type === 'error' }} />
38
+ <textview id={props.id} value={props.value} placeholder={props.placeholder} rows={props.autoGrow ? undefined : props.rows ?? 3} className={cx('vx-textarea', props.isDisabled && 'vx-textarea--disabled', props.isReadOnly && 'vx-textarea--readonly', props.isLoading && 'vx-textarea--loading', props.status && `vx-textarea--status-${props.status.type}`, props.size && `vx-textarea--size-${props.size}`, props.className)} style={props.style} isEnabled={!props.isDisabled} editable={!isBlocked} secure={props.secure} onTextChange={props.onChange} onSubmit={props.onSubmit} accessibilityLabel={props.accessibilityLabel ?? props.ariaLabel ?? props.fieldLabel ?? props.label} accessibilityHint={props.accessibilityHint} accessibilityState={{ disabled: props.isDisabled, readonly: props.isReadOnly, busy: props.isLoading, required: props.isRequired && !props.isOptional, invalid: props.status?.type === 'error' }} />
37
39
  }