@gjsify/react-native 0.43.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 (56) hide show
  1. package/README.md +253 -0
  2. package/lib/esm/_virtual/_rolldown/runtime.js +1 -0
  3. package/lib/esm/apis/color-scheme.js +1 -0
  4. package/lib/esm/apis/index.js +1 -0
  5. package/lib/esm/apis/linking.js +1 -0
  6. package/lib/esm/apis/platform.js +1 -0
  7. package/lib/esm/apis/share.js +2 -0
  8. package/lib/esm/app-registry.js +1 -0
  9. package/lib/esm/components.js +1 -0
  10. package/lib/esm/event-emitter.js +1 -0
  11. package/lib/esm/generated/unsupported-exports.js +1 -0
  12. package/lib/esm/hooks.js +1 -0
  13. package/lib/esm/index.js +1 -0
  14. package/lib/esm/primitives/classes.js +1 -0
  15. package/lib/esm/primitives/errors.js +1 -0
  16. package/lib/esm/primitives/index.js +1 -0
  17. package/lib/esm/primitives/intents.js +1 -0
  18. package/lib/esm/primitives/resolve.js +1 -0
  19. package/lib/esm/primitives/style.js +1 -0
  20. package/lib/esm/primitives/table.js +1 -0
  21. package/lib/esm/solid/index.js +1 -0
  22. package/lib/esm/style-config.js +1 -0
  23. package/lib/esm/support-table.js +1 -0
  24. package/lib/esm/unsupported.js +1 -0
  25. package/lib/types/apis/apis.spec.d.ts +2 -0
  26. package/lib/types/apis/color-scheme.d.ts +16 -0
  27. package/lib/types/apis/index.d.ts +7 -0
  28. package/lib/types/apis/linking.d.ts +35 -0
  29. package/lib/types/apis/platform.d.ts +28 -0
  30. package/lib/types/apis/share.d.ts +27 -0
  31. package/lib/types/app-registry.d.ts +50 -0
  32. package/lib/types/components.d.ts +77 -0
  33. package/lib/types/event-emitter.d.ts +29 -0
  34. package/lib/types/event-emitter.spec.d.ts +2 -0
  35. package/lib/types/generated/unsupported-exports.d.ts +78 -0
  36. package/lib/types/hooks.d.ts +13 -0
  37. package/lib/types/index.d.ts +22 -0
  38. package/lib/types/primitives/classes.d.ts +23 -0
  39. package/lib/types/primitives/classes.spec.d.ts +2 -0
  40. package/lib/types/primitives/errors.d.ts +9 -0
  41. package/lib/types/primitives/index.d.ts +11 -0
  42. package/lib/types/primitives/intents.d.ts +65 -0
  43. package/lib/types/primitives/primitives.spec.d.ts +2 -0
  44. package/lib/types/primitives/resolve.d.ts +71 -0
  45. package/lib/types/primitives/style.d.ts +73 -0
  46. package/lib/types/primitives/table.d.ts +122 -0
  47. package/lib/types/primitives/widgets.spec.d.ts +2 -0
  48. package/lib/types/solid/index.d.ts +101 -0
  49. package/lib/types/solid/solid.spec.d.ts +2 -0
  50. package/lib/types/style-config.d.ts +28 -0
  51. package/lib/types/support-table.d.ts +38 -0
  52. package/lib/types/support-table.spec.d.ts +2 -0
  53. package/lib/types/unsupported.d.ts +21 -0
  54. package/lib/types/unsupported.spec.d.ts +2 -0
  55. package/package.json +111 -0
  56. package/react-native-surface.json +108 -0
@@ -0,0 +1,50 @@
1
+ import { type ComponentType } from 'react';
2
+ /** What `registerComponent` is handed: a function returning the root component. */
3
+ export type ComponentProvider = () => ComponentType<Record<string, unknown>>;
4
+ /** The gjsify-shaped half of `runApplication`'s parameters. */
5
+ export interface RunApplicationOptions {
6
+ /**
7
+ * GApplication id. REQUIRED, and the declared divergence from React Native:
8
+ * a phone host supplies the application identity, a desktop one is the
9
+ * application.
10
+ */
11
+ applicationId: string;
12
+ /** Window title. Defaults to the registered app key. */
13
+ title?: string;
14
+ /** Initial window size. Defaults to 900x700, which is an ordinary desktop default. */
15
+ defaultWidth?: number;
16
+ defaultHeight?: number;
17
+ /** Props handed to the root component — React Native's `initialProps`. */
18
+ initialProps?: Record<string, unknown>;
19
+ /** CSS applied display-wide on startup. The class compiler's output goes here. */
20
+ css?: string;
21
+ }
22
+ interface Registration {
23
+ readonly provider: ComponentProvider;
24
+ }
25
+ export declare const AppRegistry: {
26
+ /** Register a root component under `appKey`. React Native's own signature. */
27
+ readonly registerComponent: (appKey: string, componentProvider: ComponentProvider) => string;
28
+ /** Every registered key, in registration order. React Native's own signature. */
29
+ readonly getAppKeys: () => string[];
30
+ /** Whether `appKey` was registered. */
31
+ readonly getRunnable: (appKey: string) => Registration | undefined;
32
+ /**
33
+ * Create the application, mount the registered component, and run the loop.
34
+ *
35
+ * Resolves with the application's exit code, so a caller can `await` it and
36
+ * still `return process.exit(code)` — a bare `process.exit()` in a GJS app is
37
+ * the core-dump shape recorded in the CLI's own notes.
38
+ */
39
+ readonly runApplication: (appKey: string, options: RunApplicationOptions) => Promise<number>;
40
+ /** React Native's teardown hook. Unmounts the tree; the loop is the caller's. */
41
+ readonly unmountApplicationComponentAtRootTag: () => void;
42
+ };
43
+ /**
44
+ * Expo's spelling: register under `"main"` and run.
45
+ *
46
+ * The one line an Expo entry file contains, so an application's `index.js` needs no
47
+ * `.gtk` variant just to start.
48
+ */
49
+ export declare function registerRootComponent(component: ComponentType<Record<string, unknown>>, options: RunApplicationOptions): Promise<number>;
50
+ export {};
@@ -0,0 +1,77 @@
1
+ import { type ReactElement, type ReactNode, type Ref } from 'react';
2
+ import type { ClassNameInput } from './primitives/classes.js';
3
+ import type { StyleInput } from './primitives/style.js';
4
+ /** What every primitive accepts on top of its own props. */
5
+ export interface CommonProps {
6
+ className?: ClassNameInput;
7
+ style?: StyleInput;
8
+ children?: ReactNode;
9
+ /** The `Gtk.Widget` itself — the host's `getPublicInstance` hands back the real widget. */
10
+ ref?: Ref<unknown>;
11
+ testID?: string;
12
+ }
13
+ export interface ViewProps extends CommonProps {
14
+ /** `auto` and `none` only — GTK's `can-target` covers the widget AND its subtree. */
15
+ pointerEvents?: 'auto' | 'none';
16
+ }
17
+ export declare function View(props: ViewProps): ReactElement;
18
+ export interface TextProps extends CommonProps {
19
+ numberOfLines?: number;
20
+ ellipsizeMode?: 'head' | 'middle' | 'tail';
21
+ selectable?: boolean;
22
+ }
23
+ export declare function Text(props: TextProps): ReactElement;
24
+ export interface PressableProps extends CommonProps {
25
+ onPress?: () => void;
26
+ disabled?: boolean;
27
+ pointerEvents?: 'auto' | 'none';
28
+ /**
29
+ * `ReactNode`, NEVER a function.
30
+ *
31
+ * ADR 0032 § 7: children-as-a-function-of-`{ pressed }` belongs to the "usable"
32
+ * milestone and is a NAMED BUILD-TIME REFUSAL until then. This declaration is
33
+ * that build-time half — `children={({ pressed }) => …}` becomes a type error
34
+ * naming the property — and it earns its place on its own: the press state is
35
+ * the GTK CSS `:active` pseudo-class, so `active:opacity-70` already does what
36
+ * nearly every use of the function form does, with no re-render at all. Measured
37
+ * in the application ADR 0032 read: ZERO occurrences of the function form.
38
+ */
39
+ children?: ReactNode;
40
+ }
41
+ export declare function Pressable(props: PressableProps): ReactElement;
42
+ export interface ScrollViewProps extends CommonProps {
43
+ horizontal?: boolean;
44
+ showsVerticalScrollIndicator?: boolean;
45
+ showsHorizontalScrollIndicator?: boolean;
46
+ contentContainerStyle?: StyleInput;
47
+ /** NativeWind's spelling for the inner node's class list. See `ContentSpec.classNameProp`. */
48
+ contentContainerClassName?: ClassNameInput;
49
+ }
50
+ export declare function ScrollView(props: ScrollViewProps): ReactElement;
51
+ export interface ActivityIndicatorProps extends CommonProps {
52
+ animating?: boolean;
53
+ size?: 'small' | 'large' | number;
54
+ color?: string;
55
+ hidesWhenStopped?: boolean;
56
+ }
57
+ export declare function ActivityIndicator(props: ActivityIndicatorProps): ReactElement;
58
+ export interface TextInputProps extends CommonProps {
59
+ value?: string;
60
+ defaultValue?: string;
61
+ placeholder?: string;
62
+ onChangeText?: (text: string) => void;
63
+ onSubmitEditing?: () => void;
64
+ /** One prop, two widgets: `Gtk.Entry` without it, `Gtk.TextView` with it. */
65
+ multiline?: boolean;
66
+ editable?: boolean;
67
+ maxLength?: number;
68
+ secureTextEntry?: boolean;
69
+ keyboardType?: 'default' | 'email-address' | 'phone-pad' | 'number-pad' | 'numeric' | 'decimal-pad' | 'url';
70
+ }
71
+ export declare function TextInput(props: TextInputProps): ReactElement;
72
+ export interface SwitchProps extends CommonProps {
73
+ value?: boolean;
74
+ onValueChange?: (value: boolean) => void;
75
+ disabled?: boolean;
76
+ }
77
+ export declare function Switch(props: SwitchProps): ReactElement;
@@ -0,0 +1,29 @@
1
+ /** What `addListener` hands back. Removal is by object, never by function identity. */
2
+ export interface EventSubscription {
3
+ remove(): void;
4
+ }
5
+ export declare class EventEmitter<TEvents extends Record<string, readonly unknown[]> = Record<string, readonly unknown[]>> {
6
+ #private;
7
+ /**
8
+ * Call `listener` on every `emit` of `eventType`, until the subscription is removed.
9
+ *
10
+ * `context` is React Native's own third parameter: the `this` the listener is
11
+ * called with. Kept because code in the wild passes it, even though a bound
12
+ * function or an arrow is the better spelling.
13
+ */
14
+ addListener<K extends keyof TEvents & string>(eventType: K, listener: (...args: TEvents[K]) => void, context?: unknown): EventSubscription;
15
+ /**
16
+ * Call every current listener of `eventType`.
17
+ *
18
+ * The list is COPIED before iterating. Without that, a listener that removes
19
+ * itself shifts the array under the loop and the next listener is skipped — a
20
+ * self-unsubscribing listener is the common case, so this is not a corner. The
21
+ * `removed` flag then covers the other half: a listener removed by an EARLIER
22
+ * listener in the same emit must not be called from the copy.
23
+ */
24
+ emit<K extends keyof TEvents & string>(eventType: K, ...args: TEvents[K]): void;
25
+ /** Drop every listener of `eventType`, or every listener of every type. */
26
+ removeAllListeners<K extends keyof TEvents & string>(eventType?: K): void;
27
+ /** How many listeners `eventType` currently has. */
28
+ listenerCount<K extends keyof TEvents & string>(eventType: K): number;
29
+ }
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,78 @@
1
+ export declare const Modal: never;
2
+ export declare const StyleSheet: never;
3
+ export declare const FlatList: never;
4
+ export declare const SectionList: never;
5
+ export declare const VirtualizedList: never;
6
+ export declare const VirtualizedSectionList: never;
7
+ export declare const Image: never;
8
+ export declare const ImageBackground: never;
9
+ export declare const TouchableOpacity: never;
10
+ export declare const TouchableHighlight: never;
11
+ export declare const TouchableWithoutFeedback: never;
12
+ export declare const Button: never;
13
+ export declare const Dimensions: never;
14
+ export declare const useWindowDimensions: never;
15
+ export declare const Alert: never;
16
+ export declare const Appearance: never;
17
+ export declare const SafeAreaView: never;
18
+ export declare const StatusBar: never;
19
+ export declare const KeyboardAvoidingView: never;
20
+ export declare const Keyboard: never;
21
+ export declare const RefreshControl: never;
22
+ export declare const AppState: never;
23
+ export declare const PixelRatio: never;
24
+ export declare const PlatformColor: never;
25
+ export declare const AccessibilityInfo: never;
26
+ export declare const Animated: never;
27
+ export declare const Easing: never;
28
+ export declare const LayoutAnimation: never;
29
+ export declare const InteractionManager: never;
30
+ export declare const useAnimatedValue: never;
31
+ export declare const useAnimatedValueXY: never;
32
+ export declare const useAnimatedColor: never;
33
+ export declare const PanResponder: never;
34
+ export declare const usePressability: never;
35
+ export declare const DrawerLayoutAndroid: never;
36
+ export declare const I18nManager: never;
37
+ export declare const LogBox: never;
38
+ export declare const Systrace: never;
39
+ export declare const Vibration: never;
40
+ export declare const ToastAndroid: never;
41
+ export declare const InputAccessoryView: never;
42
+ export declare const TouchableNativeFeedback: never;
43
+ export declare const ActionSheetIOS: never;
44
+ export declare const PushNotificationIOS: never;
45
+ export declare const PermissionsAndroid: never;
46
+ export declare const Settings: never;
47
+ export declare const Clipboard: never;
48
+ export declare const BackHandler: never;
49
+ export declare const DynamicColorIOS: never;
50
+ export declare const processColor: never;
51
+ export declare const UTFSequence: never;
52
+ export declare const experimental_LayoutConformance: never;
53
+ export declare const unstable_VirtualView: never;
54
+ export declare const VirtualViewMode: never;
55
+ export declare const unstable_NativeText: never;
56
+ export declare const unstable_NativeView: never;
57
+ export declare const unstable_TextAncestorContext: never;
58
+ export declare const ReactNativeVersion: never;
59
+ export declare const DeviceInfo: never;
60
+ export declare const DevMenu: never;
61
+ export declare const DevSettings: never;
62
+ export declare const NativeModules: never;
63
+ export declare const TurboModuleRegistry: never;
64
+ export declare const NativeComponentRegistry: never;
65
+ export declare const requireNativeComponent: never;
66
+ export declare const codegenNativeComponent: never;
67
+ export declare const codegenNativeCommands: never;
68
+ export declare const UIManager: never;
69
+ export declare const findNodeHandle: never;
70
+ export declare const registerCallableModule: never;
71
+ export declare const Networking: never;
72
+ export declare const NativeDialogManagerAndroid: never;
73
+ export declare const ProgressBarAndroid: never;
74
+ export declare const Touchable: never;
75
+ export declare const NativeEventEmitter: never;
76
+ export declare const DeviceEventEmitter: never;
77
+ export declare const NativeAppEventEmitter: never;
78
+ export declare const RootTagContext: never;
@@ -0,0 +1,13 @@
1
+ import { type ColorSchemeName } from './apis/color-scheme.js';
2
+ /**
3
+ * The desktop's current colour scheme, re-rendering when it changes.
4
+ *
5
+ * Reports what the user is LOOKING AT (`Adw.StyleManager:dark`), not what the
6
+ * application asked for — see `apis/color-scheme.ts` for why those are two
7
+ * different questions and which one React Native means.
8
+ *
9
+ * The server snapshot is the same read: there is no server, and returning a
10
+ * different value there is what produces a hydration mismatch in the one
11
+ * environment that has none.
12
+ */
13
+ export declare function useColorScheme(): ColorSchemeName;
@@ -0,0 +1,22 @@
1
+ export { AppRegistry, registerRootComponent } from './app-registry.js';
2
+ export type { ComponentProvider, RunApplicationOptions } from './app-registry.js';
3
+ export { EventEmitter } from './event-emitter.js';
4
+ export type { EventSubscription } from './event-emitter.js';
5
+ export { ActivityIndicator, Pressable, ScrollView, Switch, Text, TextInput, View } from './components.js';
6
+ export type { ActivityIndicatorProps, CommonProps, PressableProps, ScrollViewProps, SwitchProps, TextInputProps, TextProps, ViewProps, } from './components.js';
7
+ export { Linking, Platform, Share } from './apis/index.js';
8
+ export type { ColorSchemeName, PlatformOS, PlatformSelectSpec, ShareAction, ShareContent } from './apis/index.js';
9
+ export { useColorScheme } from './hooks.js';
10
+ export { configureStyle, resetStyleConfig, styleConfig } from './style-config.js';
11
+ export type { StyleConfig } from './style-config.js';
12
+ export * as primitives from './primitives/index.js';
13
+ export { PrimitiveError } from './primitives/errors.js';
14
+ /**
15
+ * React 19 batches every update on its own, so this is the identity call it already
16
+ * is upstream — kept because application code and libraries still wrap in it, and an
17
+ * absent export would refuse something that costs nothing to honour.
18
+ */
19
+ export declare function unstable_batchedUpdates<T, R>(callback: (argument: T) => R, argument: T): R;
20
+ export * from './generated/unsupported-exports.js';
21
+ export { SUPPORT_TABLE, SUPPORTED_NAMES, explainUnsupported, isImportable, type SupportEntry, type SupportStatus, type SupportTier, } from './support-table.js';
22
+ export { UnsupportedError } from './unsupported.js';
@@ -0,0 +1,23 @@
1
+ /** A class list split into the base group and one group per variant. */
2
+ export interface ClassGroups {
3
+ /** Utilities with no variant prefix, in author order — last wins downstream. */
4
+ readonly base: readonly string[];
5
+ /** Variant name → its utilities, in author order. */
6
+ readonly variants: Readonly<Record<string, readonly string[]>>;
7
+ }
8
+ /** What React Native / NativeWind accept as a `className`. */
9
+ export type ClassNameInput = string | readonly (string | false | null | undefined)[] | null | undefined;
10
+ /**
11
+ * A class list → `{ base, variants }`.
12
+ *
13
+ * `primitive` is carried only so a refusal can name the element the author wrote;
14
+ * nothing about the split depends on it.
15
+ *
16
+ * WHITESPACE, NOT A SINGLE SPACE: 24 of the measured application's `className=`
17
+ * sites are computed rather than literal (ADR 0032 § 3), and a template literal
18
+ * across lines produces newlines and runs of spaces. Splitting on `' '` left empty
19
+ * tokens, and an empty token reaching `resolveUtility` is an "unknown utility"
20
+ * naming the empty string — a diagnostic that describes the splitter rather than
21
+ * the input.
22
+ */
23
+ export declare function splitVariants(className: ClassNameInput, primitive: string): ClassGroups;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,9 @@
1
+ /** A primitive, prop or combination this layer cannot answer for, and why. */
2
+ export declare class PrimitiveError extends Error {
3
+ readonly name = "PrimitiveError";
4
+ /** The primitive the refusal is about — `View`, `Text`, … */
5
+ readonly primitive: string;
6
+ /** The prop, utility or combination that caused it. Empty when it is the primitive itself. */
7
+ readonly subject: string;
8
+ constructor(primitive: string, subject: string, detail: string);
9
+ }
@@ -0,0 +1,11 @@
1
+ export { splitVariants } from './classes.js';
2
+ export type { ClassGroups, ClassNameInput } from './classes.js';
3
+ export { PrimitiveError } from './errors.js';
4
+ export { resolveIntent } from './intents.js';
5
+ export type { ChildContext, ChildFacts, IntentInput, IntentResolution, Orientation, WidgetFacts } from './intents.js';
6
+ export { declaresAbsolute, resolvePrimitive } from './resolve.js';
7
+ export type { PrimitiveContext, PrimitivePlan, PrimitiveProps, ResolvedEvent, WidgetNode } from './resolve.js';
8
+ export { flattenStyle, mintClass, normalise, variantDeclarations } from './style.js';
9
+ export type { ClassNameSink, StyleAuthored, StyleInput, StyleObject } from './style.js';
10
+ export { FRAMEWORK_PROPS, PRIMITIVE_NAMES, PRIMITIVES } from './table.js';
11
+ export type { Coercion, ContentSpec, EventRoute, IgnoredRoute, PrimitiveSpec, PropRoute, PropertyRoute, RefusedRoute, StylePropertyRoute, } from './table.js';
@@ -0,0 +1,65 @@
1
+ import type { LayoutIntent } from '@gjsify/gtk-host/style';
2
+ export type Orientation = 'horizontal' | 'vertical';
3
+ /**
4
+ * What a parent tells its children — and what a child reads about its parent.
5
+ *
6
+ * ONE record in both directions on purpose: every field is a fact the parent knows
7
+ * and the child needs, so a second shape for "what I publish" versus "what I read"
8
+ * would be the same four fields under different names.
9
+ */
10
+ export interface ChildContext {
11
+ /** The parent's own orientation. The axis a child's `flex-1` expands along. */
12
+ readonly orientation: Orientation;
13
+ /**
14
+ * Properties every child carries unless it overrides them.
15
+ *
16
+ * A resolved `alignItems`. It is a DEFAULT rather than a command, because
17
+ * `align-self` beats `align-items` in flexbox and a child that set its own
18
+ * `self-*` must win — which it does, by being merged after this.
19
+ */
20
+ readonly props: Readonly<Record<string, unknown>>;
21
+ /** True when the parent is a `Gtk.Overlay` and can take an absolutely positioned child. */
22
+ readonly overlay: boolean;
23
+ /** A `textAlign` still looking for a widget that aligns text. */
24
+ readonly textAlign?: 'left' | 'center' | 'right' | 'justify';
25
+ }
26
+ /** What the element's own children change about the element. */
27
+ export interface ChildFacts {
28
+ /** How many children declare `position: absolute` — non-zero makes a `View` an overlay. */
29
+ readonly absolute: number;
30
+ /** How many children there are at all. */
31
+ readonly count: number;
32
+ /** Whether any child is a text run, which competes with a prop for the text sink. */
33
+ readonly text: boolean;
34
+ }
35
+ /** What the element's own widget can take. Declared per primitive, measured in the spec. */
36
+ export interface WidgetFacts {
37
+ /** Installs `orientation` and `spacing` — a `Gtk.Box`. */
38
+ readonly box: boolean;
39
+ /** Installs `xalign` and `justify` — a `Gtk.Label`. */
40
+ readonly alignsText: boolean;
41
+ }
42
+ export interface IntentInput {
43
+ readonly primitive: string;
44
+ readonly intent: LayoutIntent;
45
+ /** The element's own orientation, for the node its children go into. */
46
+ readonly orientation: Orientation;
47
+ readonly widget: WidgetFacts;
48
+ readonly parent?: ChildContext;
49
+ readonly children?: ChildFacts;
50
+ /** Widget properties already emitted by L1, read only to catch a clash. */
51
+ readonly emittedProps: Readonly<Record<string, unknown>>;
52
+ }
53
+ export interface IntentResolution {
54
+ /** Widget properties this resolution adds, GTK spelling. */
55
+ readonly props: Readonly<Record<string, unknown>>;
56
+ /** GTK CSS declarations this resolution adds, before the class is minted. */
57
+ readonly css: readonly string[];
58
+ /** What this element publishes to its children. */
59
+ readonly childContext: ChildContext;
60
+ /** The `slot` this element declares to its parent, or null. */
61
+ readonly slot: string | null;
62
+ /** What is still unresolved, for a caller that knows more. */
63
+ readonly remaining: LayoutIntent;
64
+ }
65
+ export declare function resolveIntent(input: IntentInput): IntentResolution;
@@ -0,0 +1,2 @@
1
+ declare const _default: () => Promise<void>;
2
+ export default _default;
@@ -0,0 +1,71 @@
1
+ import type { LayoutIntent, StyleTokens } from '@gjsify/gtk-host/style';
2
+ import type { ClassNameInput } from './classes.js';
3
+ import { type ChildContext, type ChildFacts, type Orientation, type WidgetFacts } from './intents.js';
4
+ import { type ClassNameSink, type StyleInput } from './style.js';
5
+ /** Everything L2 needs that is not the primitive and not its props. */
6
+ export interface PrimitiveContext {
7
+ /** The project's own token scales. ADR 0032 § 3: the families are declared, the values are the project's. */
8
+ readonly tokens: StyleTokens;
9
+ /** Where a declaration set becomes a class name. `StyleSheet` satisfies this structurally. */
10
+ readonly sheet: ClassNameSink;
11
+ /** What the parent published. Absent at a root, and then `expand`/`alignSelf` pass up. */
12
+ readonly parent?: ChildContext;
13
+ /** What the element's own children are. Absent means "no children", not "unknown". */
14
+ readonly children?: ChildFacts;
15
+ }
16
+ /** One GTK node in the plan. */
17
+ export interface WidgetNode {
18
+ /** GType name — the tag the host takes. */
19
+ readonly tag: string;
20
+ /** Widget properties in GTK's own spelling, for the host to coerce and apply. */
21
+ readonly props: Readonly<Record<string, unknown>>;
22
+ /** `css-classes`. At most one generated name, plus whatever the primitive always carries. */
23
+ readonly cssClasses: readonly string[];
24
+ }
25
+ /** A GTK signal this element binds, and how to build the React Native argument. */
26
+ export interface ResolvedEvent {
27
+ /** The React Native prop that supplied the callback. */
28
+ readonly prop: string;
29
+ /** The GObject signal name, in GObject's spelling. */
30
+ readonly signal: string;
31
+ /** The widget property to read for the callback's argument, or null for no argument. */
32
+ readonly read: string | null;
33
+ }
34
+ export interface PrimitivePlan {
35
+ readonly primitive: string;
36
+ /** The node the PARENT adopts. */
37
+ readonly node: WidgetNode;
38
+ /** The node the element's ordinary children go into, when it is not `node`. */
39
+ readonly content: WidgetNode | null;
40
+ /** The `slot` this element declares to its parent, or null. */
41
+ readonly slot: string | null;
42
+ /** Where an absolutely positioned CHILD goes: into `node`, under this slot. */
43
+ readonly absoluteSlot: string | null;
44
+ readonly events: readonly ResolvedEvent[];
45
+ /** Where a text child goes, or null when text under this primitive is refused. */
46
+ readonly textSink: string | null;
47
+ /** What this element publishes to its children. */
48
+ readonly childContext: ChildContext;
49
+ /** What L2 could not answer. Empty when the caller supplied a parent. */
50
+ readonly intent: LayoutIntent;
51
+ }
52
+ /** What one element authored, in React Native's own spelling. */
53
+ export type PrimitiveProps = Readonly<Record<string, unknown>> & {
54
+ readonly className?: ClassNameInput;
55
+ readonly style?: StyleInput;
56
+ };
57
+ /**
58
+ * Does this style declare `position: absolute`?
59
+ *
60
+ * A PARENT needs the answer about its CHILDREN — `absolute` is triggered by the
61
+ * child, never by the element (ADR 0032 § 3) — and the parent has the children's
62
+ * props before it has their plans.
63
+ *
64
+ * It runs the real resolution rather than testing for the literal string
65
+ * `absolute`, because the syntactic test is exact only while L1's vocabulary has
66
+ * exactly one spelling for it. It has two today (`absolute`, and `style={{
67
+ * position: 'absolute' }}`) and nothing stops it having three.
68
+ */
69
+ export declare function declaresAbsolute(props: PrimitiveProps, tokens: StyleTokens, primitive?: string): boolean;
70
+ export declare function resolvePrimitive(primitive: string, props: PrimitiveProps, context: PrimitiveContext): PrimitivePlan;
71
+ export type { ChildContext, ChildFacts, Orientation, WidgetFacts };
@@ -0,0 +1,73 @@
1
+ import { partition, type Partitioned, type StyleProps } from '@gjsify/gtk-host/style';
2
+ import type { StyleTokens } from '@gjsify/gtk-host/style';
3
+ import { type ClassGroups, type ClassNameInput } from './classes.js';
4
+ /**
5
+ * A React Native `style` prop.
6
+ *
7
+ * Arrays nest, and `false` / `null` / `undefined` are what a short-circuit
8
+ * (`style={[base, active && overlay]}`) leaves behind — React Native's own
9
+ * `StyleSheet.flatten` accepts all of it, so the alias has to as well.
10
+ */
11
+ export type StyleInput = StyleObject | StyleInputArray | false | null | undefined;
12
+ export type StyleObject = Readonly<Record<string, unknown>>;
13
+ interface StyleInputArray extends ReadonlyArray<StyleInput> {
14
+ }
15
+ /**
16
+ * A `style` prop → one flat object, later entries winning.
17
+ *
18
+ * React Native's own rule, and the reason it is spelled out rather than assumed:
19
+ * `[a, b]` means "b over a", so a `reduce` that merged in the other direction
20
+ * would make every conditional override a no-op — and a no-op override looks
21
+ * exactly like a style that was never written.
22
+ */
23
+ export declare function flattenStyle(style: StyleInput): StyleObject;
24
+ /** What one element authored, before any of it has been interpreted. */
25
+ export interface StyleAuthored {
26
+ readonly className?: ClassNameInput;
27
+ readonly style?: StyleInput;
28
+ }
29
+ /**
30
+ * `{ className, style }` → the property record L1 partitions.
31
+ *
32
+ * The class list's VARIANTS do not come through here: they are a different
33
+ * question (WHEN a declaration applies) with a different destination (a
34
+ * pseudo-class on the generated selector), so they are returned beside the record
35
+ * rather than folded into it.
36
+ */
37
+ export declare function normalise(authored: StyleAuthored, tokens: StyleTokens, primitive: string): {
38
+ readonly props: StyleProps;
39
+ readonly groups: ClassGroups;
40
+ };
41
+ /**
42
+ * A variant group → the CSS declarations its pseudo-class carries.
43
+ *
44
+ * A VARIANT CAN ONLY CHANGE CSS, and that is the refusal this function exists for.
45
+ * `active:opacity-70` is a declaration on `.x:active` and costs nothing at
46
+ * runtime — GTK animates the state itself (ADR 0032 § 7). `active:flex-1` asks for
47
+ * the widget property `hexpand` to change while a finger is down, and GTK has no
48
+ * pseudo-class form of a widget property at all: there is no `:active` variant of
49
+ * `hexpand`. Letting that through would emit a class whose `:active` rule is empty
50
+ * and a widget property applied unconditionally — a style that is wrong in both
51
+ * states and loud in neither.
52
+ */
53
+ export declare function variantDeclarations(groups: ClassGroups, tokens: StyleTokens, primitive: string): Readonly<Record<string, readonly string[]>>;
54
+ /** The narrow half of `StyleSheet` L2 needs: declarations in, a class name out. */
55
+ export interface ClassNameSink {
56
+ classFor(declarations: readonly string[], variants?: Readonly<Record<string, readonly string[]>>): string;
57
+ }
58
+ /**
59
+ * Mint the ONE class name a set of declarations gets, or `null` for "no style".
60
+ *
61
+ * A STRUCTURAL interface rather than `StyleSheet` itself, and the reason is the
62
+ * test rather than the abstraction: `StyleSheet` constructs a `Gtk.CssProvider` and
63
+ * installs it on a `Gdk.Display`, so a spec that wanted to assert which class a
64
+ * `<View className="…">` gets would need a display to check a pure-data decision.
65
+ * `StyleSheet` satisfies this interface without knowing it exists.
66
+ *
67
+ * `classFor` REFUSES an empty declaration set by name ("an empty class would name
68
+ * nothing"), so the empty case is answered here instead of being handed on.
69
+ */
70
+ export declare function mintClass(sheet: ClassNameSink, declarations: readonly string[], variants: Readonly<Record<string, readonly string[]>>): string | null;
71
+ /** `partition`, re-exported so a caller of L2 needs one import for the style path. */
72
+ export type { Partitioned, StyleProps, StyleTokens };
73
+ export { partition };