react-dynamic-help
Advanced tools
Comparing version 2.6.0 to 2.6.1
import * as React from "react"; | ||
import { AppTargetsState, SystemState, TargetId, ItemId, AppApiSetter, FlowId, TargetItemHelpers, DynamicHelpStorageAPI, HelpPopupDictionary, HelpPopupPhrase, FlowInfo } from "../DynamicHelpTypes"; | ||
declare type HelpControllerProps = { | ||
type HelpControllerProps = { | ||
provideControllerApi: AppApiSetter; | ||
@@ -11,3 +11,3 @@ dictionary: HelpPopupDictionary; | ||
}; | ||
declare type HelpControllerState = { | ||
type HelpControllerState = { | ||
appTargetsState: AppTargetsState; | ||
@@ -14,0 +14,0 @@ systemState: SystemState; |
@@ -170,2 +170,5 @@ "use strict"; | ||
const state = this.systemState; // just alias for ease of reading | ||
if (!state.itemMap[target]) { | ||
throw new Error(`Apparently undefined target '${target}' passed to signalUsed`); | ||
} | ||
state.itemMap[target].forEach((itemId) => { | ||
@@ -172,0 +175,0 @@ const flowId = state.flowMap[itemId]; |
/// <reference types="react" /> | ||
import * as HelpTypes from "../DynamicHelpTypes"; | ||
declare type HelpFlowProps = { | ||
type HelpFlowProps = { | ||
id: HelpTypes.FlowId; | ||
@@ -5,0 +5,0 @@ description?: string; |
@@ -80,3 +80,3 @@ "use strict"; | ||
React.useEffect(() => { | ||
(0, DynamicHelp_1.log)(debug, "HelpFlow UE", flowId, storageReady); | ||
(0, DynamicHelp_1.log)(debug, "HelpFlow UseEffect", flowId, "with storage ready:", storageReady); | ||
if (!systemState.flows[props.id] && storageReady) { | ||
@@ -105,5 +105,5 @@ (0, DynamicHelp_1.log)(debug, "Help Flow registering:", flowId); | ||
}); | ||
(0, DynamicHelp_1.log)(debug, "HelpFlow render", flowId, storageReady); | ||
(0, DynamicHelp_1.log)(debug, "HelpFlow render", flowId, "with storage ready:", storageReady); | ||
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: childrenWithIds }); | ||
}; | ||
exports.HelpFlow = HelpFlow; |
import * as React from "react"; | ||
import * as HelpTypes from "../DynamicHelpTypes"; | ||
declare type HelpItemProperties = { | ||
type HelpItemProperties = { | ||
target: HelpTypes.TargetId; | ||
@@ -19,3 +19,3 @@ position?: HelpTypes.Position; | ||
export declare function HelpItem({ position, debug, highlightTarget, ...props }: HelpItemProperties): JSX.Element; | ||
declare type ItemStateInfo = [ | ||
type ItemStateInfo = [ | ||
flow: HelpTypes.FlowState | null, | ||
@@ -22,0 +22,0 @@ itemState: HelpTypes.ItemState | null |
@@ -259,3 +259,3 @@ "use strict"; | ||
else { | ||
(0, DynamicHelp_1.log)(debug, "HelpItem render not showing", props.myId); | ||
(0, DynamicHelp_1.log)(debug, "HelpItem render not showing self: ", props.myId, ", target: ", target === null || target === void 0 ? void 0 : target.ref, ", target-display is none:", targetDisplayNone, ", item state:", myState); | ||
if (highlightTarget && (target === null || target === void 0 ? void 0 : target.ref) && props.myId) { | ||
@@ -262,0 +262,0 @@ // if we were the one highlighting the target, we need to undo that |
/// <reference types="react" /> | ||
import { DynamicHelpStorageAPI, HelpPopupDictionary } from "../DynamicHelpTypes"; | ||
declare type HelpProviderProps = { | ||
type HelpProviderProps = { | ||
dictionary?: HelpPopupDictionary; | ||
@@ -5,0 +5,0 @@ storageApi?: DynamicHelpStorageAPI; |
@@ -1,10 +0,10 @@ | ||
export declare type FlowId = string; | ||
export declare type ItemId = string; | ||
export declare type TargetId = string; | ||
export declare type StorageKey = string; | ||
export declare type Position = "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-centre" | "top-center" | "bottom-centre" | "bottom-center" | "center-left" | "centre-left" | "center-right" | "centre-right"; | ||
export type FlowId = string; | ||
export type ItemId = string; | ||
export type TargetId = string; | ||
export type StorageKey = string; | ||
export type Position = "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-centre" | "top-center" | "bottom-centre" | "bottom-center" | "center-left" | "centre-left" | "center-right" | "centre-right"; | ||
/** | ||
* The API for the App, on the Help Controller | ||
*/ | ||
export declare type AppApi = { | ||
export type AppApi = { | ||
registerTargetItem: TargetItemRegisterer; | ||
@@ -20,3 +20,3 @@ triggerFlow: (flowId: FlowId) => void; | ||
}; | ||
export declare type FlowInfo = { | ||
export type FlowInfo = { | ||
id: FlowId; | ||
@@ -27,17 +27,17 @@ description: string; | ||
}; | ||
export declare type HelpSystemStatus = { | ||
export type HelpSystemStatus = { | ||
enabled: boolean; | ||
}; | ||
export declare type TargetItemHelpers = { | ||
export type TargetItemHelpers = { | ||
ref: (targetRef: HTMLElement) => void; | ||
used: () => void; | ||
}; | ||
export declare type TargetItemRegisterer = (id: TargetId) => TargetItemHelpers; | ||
export declare type DictionaryProvider = (dict: HelpPopupDictionary) => void; | ||
export declare type HelpPopupPhrase = "Don't show me these" | "Skip" | "OK"; | ||
export declare type HelpPopupDictionary = { | ||
export type TargetItemRegisterer = (id: TargetId) => TargetItemHelpers; | ||
export type DictionaryProvider = (dict: HelpPopupDictionary) => void; | ||
export type HelpPopupPhrase = "Don't show me these" | "Skip" | "OK"; | ||
export type HelpPopupDictionary = { | ||
[phrase in HelpPopupPhrase]: string; | ||
}; | ||
export declare type FlowSwitch = (flow: FlowId, enabled?: boolean) => void; | ||
export declare type HelpUserState = { | ||
export type FlowSwitch = (flow: FlowId, enabled?: boolean) => void; | ||
export type HelpUserState = { | ||
systemEnabled: boolean; | ||
@@ -50,3 +50,3 @@ flows: { | ||
}; | ||
export declare type DynamicHelpStorageAPI = { | ||
export type DynamicHelpStorageAPI = { | ||
saveState: (userState: string) => string; | ||
@@ -60,3 +60,3 @@ getState: (defaultValue?: string) => string; | ||
*/ | ||
export declare type AppApiSetter = (apiObject: AppApi) => void; | ||
export type AppApiSetter = (apiObject: AppApi) => void; | ||
/** | ||
@@ -68,3 +68,3 @@ * Information passed from Controller to Help Flows and Items: | ||
*/ | ||
export declare type HelpSystemContext = { | ||
export type HelpSystemContext = { | ||
systemState: SystemState; | ||
@@ -75,5 +75,5 @@ appTargetsState: AppTargetsState; | ||
}; | ||
export declare type RegisterFlow = (id: FlowId, showInitially: boolean, description: string) => void; | ||
export declare type RegisterItem = (flowId: FlowId, itemId: ItemId, target: TargetId, index: number) => void; | ||
export declare type ControllerApi = { | ||
export type RegisterFlow = (id: FlowId, showInitially: boolean, description: string) => void; | ||
export type RegisterItem = (flowId: FlowId, itemId: ItemId, target: TargetId, index: number) => void; | ||
export type ControllerApi = { | ||
addHelpFlow: RegisterFlow; | ||
@@ -87,6 +87,6 @@ addHelpItem: RegisterItem; | ||
}; | ||
export declare type AppTargetsState = { | ||
export type AppTargetsState = { | ||
targetItems: TargetTable; | ||
}; | ||
export declare type SystemState = { | ||
export type SystemState = { | ||
userState: HelpUserState; | ||
@@ -98,3 +98,3 @@ flows: FlowStates; | ||
}; | ||
export declare type ItemState = { | ||
export type ItemState = { | ||
visible: boolean; | ||
@@ -104,3 +104,3 @@ flow: FlowId; | ||
}; | ||
export declare type FlowState = { | ||
export type FlowState = { | ||
id: FlowId; | ||
@@ -113,12 +113,12 @@ visible: boolean; | ||
}; | ||
declare type FlowStates = { | ||
type FlowStates = { | ||
[id: FlowId]: FlowState; | ||
}; | ||
declare type FlowMap = { | ||
type FlowMap = { | ||
[item: ItemId]: FlowId; | ||
}; | ||
declare type ItemStates = { | ||
type ItemStates = { | ||
[item: ItemId]: ItemState; | ||
}; | ||
declare type ItemMap = { | ||
type ItemMap = { | ||
[target: TargetId]: ItemId[]; | ||
@@ -130,6 +130,6 @@ }; | ||
*/ | ||
export declare type TargetTable = { | ||
export type TargetTable = { | ||
[target: TargetId]: TargetInfo; | ||
}; | ||
export declare type TargetInfo = { | ||
export type TargetInfo = { | ||
ref: HTMLElement; | ||
@@ -136,0 +136,0 @@ highlighters: Set<ItemId>; |
{ | ||
"name": "react-dynamic-help", | ||
"description": "React Dynamic Help - Create flows of helpful popups in your React App", | ||
"version": "2.6.0", | ||
"version": "2.6.1", | ||
"repository": { | ||
@@ -13,3 +13,3 @@ "type": "git", | ||
"homepage": "https://github.com/greenasjade/react-dynamic-help#readme", | ||
"main": "lib/es5/index.js", | ||
"main": "lib/es5/index.js", | ||
"author": "GreenAsJade", | ||
@@ -16,0 +16,0 @@ "license": "MIT", |
68568
1429