Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/Disable.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import * as React from "react";
import { EnableProps } from "./Enable";
import * as React from 'react';
import type { EnableProps } from './Enable';
export declare const Disable: React.FC<EnableProps>;
2 changes: 1 addition & 1 deletion dist/Enable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ export interface EnableProps {
readonly allFeatures?: string[];
children: React.ReactNode;
}
export declare function Enable({ feature, allFeatures, children }: EnableProps): JSX.Element | null;
export declare function Enable({ feature, allFeatures, children, }: EnableProps): JSX.Element | null;
2 changes: 1 addition & 1 deletion dist/EnableContext.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference types="react" />
import { FeatureValue } from './FeatureState';
import type { FeatureValue } from './FeatureState';
export declare type EnableContextType = (feature: string) => FeatureValue;
export declare const EnableContext: import("react").Context<EnableContextType>;
4 changes: 2 additions & 2 deletions dist/FeatureContext.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="react" />
import { FeaturesDispatch, FeaturesState } from './FeaturesState';
import { FeatureDescription, FeatureValue } from './FeatureState';
import type { FeatureDescription, FeatureValue } from './FeatureState';
import type { FeaturesDispatch, FeaturesState } from './FeaturesState';
export declare const FeatureContext: import("react").Context<FeatureContextType | null>;
export interface FeatureContextType {
overridesSend: FeaturesDispatch;
Expand Down
42 changes: 12 additions & 30 deletions dist/FeatureState.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { InterpreterFrom, StateFrom } from 'xstate';
import type { Dispatch } from 'react';
export declare type FeatureValue = false | true | undefined;
export declare type FeatureState = StateFrom<typeof FeatureMachine>;
export declare type FeatureDispatch = InterpreterFrom<typeof FeatureMachine>['send'];
export declare type FeatureStateValue = 'initial' | 'enabled' | 'disabled' | 'unspecified' | 'asyncEnabled' | 'asyncDisabled' | 'asyncUnspecified';
export interface FeatureState {
value: FeatureStateValue;
featureDesc?: FeatureDescription;
}
export declare type FeatureDispatch = Dispatch<FeatureAction>;
export declare function valueForState(featureState: FeatureState): [FeatureValue, boolean];
export interface FeatureDescription<K extends string = string> {
readonly name: K;
Expand All @@ -11,31 +15,6 @@ export interface FeatureDescription<K extends string = string> {
readonly noOverride?: boolean;
readonly defaultValue?: FeatureValue;
}
interface FeatureContext {
featureDesc?: FeatureDescription;
}
declare type FeatureTypeState = {
value: 'asyncDenabled';
context: FeatureContext;
} | {
value: 'asyncDisabled';
context: FeatureContext;
} | {
value: 'asyncUnspecied';
context: FeatureContext;
} | {
value: 'disabled';
context: FeatureContext;
} | {
value: 'enabled';
context: FeatureContext;
} | {
value: 'initial';
context: never;
} | {
value: 'unspecied';
context: FeatureContext;
};
export declare type FeatureAction = {
type: 'DISABLE';
} | {
Expand All @@ -50,6 +29,9 @@ export declare type FeatureAction = {
type: 'TOGGLE';
} | {
type: 'UNSET';
} | {
type: 'ASYNC_DONE';
value: FeatureValue;
};
export declare const FeatureMachine: import("xstate").StateMachine<FeatureContext, any, FeatureAction, FeatureTypeState, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, FeatureAction, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
export {};
export declare const initialFeatureState: FeatureState;
export declare function featureReducer(state: FeatureState, action: FeatureAction): FeatureState;
4 changes: 2 additions & 2 deletions dist/Features.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNode } from 'react';
import { FeatureDescription } from './FeatureState';
import { type ReactNode } from 'react';
import type { FeatureDescription } from './FeatureState';
interface FeatureProps {
readonly features: readonly FeatureDescription[];
readonly children?: ReactNode;
Expand Down
20 changes: 12 additions & 8 deletions dist/FeaturesState.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ActorRefFrom, InterpreterFrom, StateFrom } from 'xstate';
import { FeatureMachine, FeatureDescription, FeatureValue } from './FeatureState';
import type { Dispatch } from 'react';
import { type FeatureDescription, type FeatureState, type FeatureValue } from './FeatureState';
export interface FeaturesContext {
features: {
[x: string]: ActorRefFrom<typeof FeatureMachine>;
[x: string]: FeatureState;
};
}
export declare type FeaturesAction = {
Expand Down Expand Up @@ -31,12 +31,16 @@ export declare type FeaturesAction = {
} | {
type: 'UNSET';
name: string;
} | {
type: 'ASYNC_DONE';
name: string;
value: FeatureValue;
};
export interface FeaturesTypeState {
value: 'ready';
export interface FeaturesState {
value: 'idle' | 'ready';
context: FeaturesContext;
}
export declare type FeaturesState = StateFrom<typeof FeaturesMachine>;
export declare type FeaturesDispatch = InterpreterFrom<typeof FeaturesMachine>['send'];
export declare type FeaturesDispatch = Dispatch<FeaturesAction>;
export declare function valueOfFeature(featuresState: FeaturesState, feature: string): [FeatureValue, boolean];
export declare const FeaturesMachine: import("xstate").StateMachine<FeaturesContext, any, FeaturesAction, FeaturesTypeState, import("xstate").BaseActionObject, import("xstate").ServiceMap, import("xstate").ResolveTypegenMeta<import("xstate").TypegenDisabled, FeaturesAction, import("xstate").BaseActionObject, import("xstate").ServiceMap>>;
export declare const initialFeaturesState: FeaturesState;
export declare function featuresReducer(state: FeaturesState, action: FeaturesAction): FeaturesState;
4 changes: 2 additions & 2 deletions dist/GlobalEnable.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { FeaturesDispatch } from './FeaturesState';
import { FeatureDescription, FeatureValue } from './FeatureState';
import type { FeatureDescription, FeatureValue } from './FeatureState';
import type { FeaturesDispatch } from './FeaturesState';
export declare class GlobalEnable {
private readonly featureDesc;
private readonly dispatch;
Expand Down
4 changes: 2 additions & 2 deletions dist/ToggleFeatures.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// <reference types="react" />
export declare function ToggleFeatures({ defaultOpen, hidden }: {
export declare function ToggleFeatures({ defaultOpen, hidden, }: {
defaultOpen?: boolean;
hidden?: boolean;
}): JSX.Element | null;
export declare function ToggleFeatureUnwrapped({ defaultOpen, hidden }: {
export declare function ToggleFeatureUnwrapped({ defaultOpen, hidden, }: {
defaultOpen?: boolean;
hidden?: boolean;
}): JSX.Element | null;
Loading