@akin2unde/flowui-core 1.0.0 → 1.0.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.
- package/dist/index.cjs +46 -0
- package/dist/index.d.cts +14 -2
- package/dist/index.d.ts +14 -2
- package/dist/index.js +44 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -23,6 +23,7 @@ __export(index_exports, {
|
|
|
23
23
|
AsyncLabelStore: () => AsyncLabelStore,
|
|
24
24
|
clampNumber: () => clampNumber,
|
|
25
25
|
createAsyncLabelStore: () => createAsyncLabelStore,
|
|
26
|
+
createNotificationTimer: () => createNotificationTimer,
|
|
26
27
|
createTheme: () => createTheme,
|
|
27
28
|
defaultTheme: () => defaultTheme,
|
|
28
29
|
enabledSelectableDescendants: () => enabledSelectableDescendants,
|
|
@@ -33,6 +34,7 @@ __export(index_exports, {
|
|
|
33
34
|
flattenTree: () => flattenTree,
|
|
34
35
|
flowClass: () => flowClass,
|
|
35
36
|
formatLocalDateTime: () => formatLocalDateTime,
|
|
37
|
+
notificationDuration: () => notificationDuration,
|
|
36
38
|
resolveColorValue: () => resolveColorValue,
|
|
37
39
|
resolveFlowStyle: () => resolveFlowStyle,
|
|
38
40
|
resolveTooltipLocation: () => resolveTooltipLocation,
|
|
@@ -993,11 +995,54 @@ function resolveTooltipLocation(preferred, anchor, tooltip, viewport, gap = 6) {
|
|
|
993
995
|
const required = preferred === "top" || preferred === "bottom" ? tooltip.height + gap : tooltip.width + gap;
|
|
994
996
|
return available[preferred] < required && available[opposite[preferred]] > available[preferred] ? opposite[preferred] : preferred;
|
|
995
997
|
}
|
|
998
|
+
|
|
999
|
+
// src/notification.ts
|
|
1000
|
+
var defaultDurations = {
|
|
1001
|
+
success: 4e3,
|
|
1002
|
+
info: 5e3,
|
|
1003
|
+
warning: 7e3,
|
|
1004
|
+
error: 8e3
|
|
1005
|
+
};
|
|
1006
|
+
function notificationDuration(type, duration, defaultDuration) {
|
|
1007
|
+
if (type === "decision") return 0;
|
|
1008
|
+
if (!(typeof duration === "number" && Number.isFinite(duration) && duration > 0))
|
|
1009
|
+
duration = defaultDuration;
|
|
1010
|
+
return typeof duration === "number" && Number.isFinite(duration) && duration > 0 ? Math.min(duration, 2147483647) : defaultDurations[type];
|
|
1011
|
+
}
|
|
1012
|
+
function createNotificationTimer(duration, onElapsed) {
|
|
1013
|
+
let remaining = duration;
|
|
1014
|
+
let started = 0;
|
|
1015
|
+
let timer;
|
|
1016
|
+
let done = false;
|
|
1017
|
+
return {
|
|
1018
|
+
resume() {
|
|
1019
|
+
if (done || timer !== void 0 || duration === 0) return;
|
|
1020
|
+
started = Date.now();
|
|
1021
|
+
timer = setTimeout(() => {
|
|
1022
|
+
timer = void 0;
|
|
1023
|
+
done = true;
|
|
1024
|
+
onElapsed();
|
|
1025
|
+
}, remaining);
|
|
1026
|
+
},
|
|
1027
|
+
pause() {
|
|
1028
|
+
if (timer === void 0) return;
|
|
1029
|
+
clearTimeout(timer);
|
|
1030
|
+
timer = void 0;
|
|
1031
|
+
remaining = Math.max(0, remaining - (Date.now() - started));
|
|
1032
|
+
},
|
|
1033
|
+
dispose() {
|
|
1034
|
+
done = true;
|
|
1035
|
+
clearTimeout(timer);
|
|
1036
|
+
timer = void 0;
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
996
1040
|
// Annotate the CommonJS export names for ESM import in node:
|
|
997
1041
|
0 && (module.exports = {
|
|
998
1042
|
AsyncLabelStore,
|
|
999
1043
|
clampNumber,
|
|
1000
1044
|
createAsyncLabelStore,
|
|
1045
|
+
createNotificationTimer,
|
|
1001
1046
|
createTheme,
|
|
1002
1047
|
defaultTheme,
|
|
1003
1048
|
enabledSelectableDescendants,
|
|
@@ -1008,6 +1053,7 @@ function resolveTooltipLocation(preferred, anchor, tooltip, viewport, gap = 6) {
|
|
|
1008
1053
|
flattenTree,
|
|
1009
1054
|
flowClass,
|
|
1010
1055
|
formatLocalDateTime,
|
|
1056
|
+
notificationDuration,
|
|
1011
1057
|
resolveColorValue,
|
|
1012
1058
|
resolveFlowStyle,
|
|
1013
1059
|
resolveTooltipLocation,
|
package/dist/index.d.cts
CHANGED
|
@@ -442,7 +442,7 @@ interface BreadcrumbProps extends BaseUIProps {
|
|
|
442
442
|
items: BreadcrumbItem[];
|
|
443
443
|
separatorIcon?: string;
|
|
444
444
|
}
|
|
445
|
-
type NotificationType = "success" | "error" | "warning" | "info";
|
|
445
|
+
type NotificationType = "success" | "error" | "warning" | "info" | "decision";
|
|
446
446
|
type NotificationHorizontal = "left" | "center" | "right";
|
|
447
447
|
type NotificationVertical = "top" | "bottom";
|
|
448
448
|
interface NotificationProps extends BaseUIProps {
|
|
@@ -451,6 +451,7 @@ interface NotificationProps extends BaseUIProps {
|
|
|
451
451
|
horizontal?: NotificationHorizontal;
|
|
452
452
|
vertical?: NotificationVertical;
|
|
453
453
|
duration?: number;
|
|
454
|
+
defaultDuration?: number;
|
|
454
455
|
dismissible?: boolean;
|
|
455
456
|
}
|
|
456
457
|
interface KnobProps extends BaseUIProps, DisableableProps {
|
|
@@ -623,4 +624,15 @@ declare function resolveTooltipLocation(preferred: TooltipLocation, anchor: {
|
|
|
623
624
|
height: number;
|
|
624
625
|
}, gap?: number): TooltipLocation;
|
|
625
626
|
|
|
626
|
-
|
|
627
|
+
declare function notificationDuration(type: NotificationType, duration?: number, defaultDuration?: number): number;
|
|
628
|
+
declare function createNotificationTimer(duration: number, onElapsed: () => void): {
|
|
629
|
+
resume(): void;
|
|
630
|
+
pause(): void;
|
|
631
|
+
dispose(): void;
|
|
632
|
+
};
|
|
633
|
+
interface NotificationAction {
|
|
634
|
+
label: string;
|
|
635
|
+
onClick: () => void | Promise<void>;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export { type AlignValue, type AsyncLabelCode, type AsyncLabelConfig, type AsyncLabelOptions, type AsyncLabelState, AsyncLabelStore, type AutocompleteProps, type BadgeProps, type BaseUIProps, type BorderProps, type BreadcrumbItem, type BreadcrumbProps, type BreakpointName, type ButtonGroupProps, type ButtonProps, type CSSLength, type CSSVariableStyle, type CardProps, type CarouselProps, type ChartData, type ChartProps, type ChartSeries, type ChartType, type ColorPalette, type ColorScale, type ColorShade, type ColorValue, type ComponentSize, type ComponentVariant, type DateTimeMode, type DateTimeProps, type DeepPartial, type DialogPosition, type DimensionValue, type DisableableProps, type DividerProps, type DropdownBehaviorProps, type DropdownModel, type FieldFocusStyle, type FileUploadProps, type FlexContainerProps, type FlexDirection, type FlexItemProps, type FlexWrap, type FlowInputMode, type FlowUIStyle, type FlowUITheme, type FocusableProps, type HStackProps, type IconProps, type ImageProps, type InputProps, type JustifyValue, type KnobProps, type LabelLookup, type LabelProps, type LabelResolverContext, type LabelResults, type LayoutProps, type ListboxProps, type LoadingProps, type MenuItem, type MultiSelectProps, type NotificationAction, type NotificationHorizontal, type NotificationProps, type NotificationType, type NotificationVertical, type OTPInputProps, type Orientation, type PaletteColor, type PasswordInputProps, type PhoneCountry, type PhoneInputProps, type PhoneNumberValue, type PopoverProps, type PositionProps, type PositionValue, type RadiusToken, type RadiusValue, type RatingProps, type ReadOnlyProps, type RequiredProps, type ResolvedStyle, type ResponsiveObject, type ResponsiveValue, type SchemeColor, type SelectOption, type SelectionValue, type SliderProps, type SortDirection, type SortState, type SpacingProps, type SpacingToken, type SpacingValue, type StackProps, type StyleResolution, type SwitchProps, type TabItem, type TabSelectedStyle, type TableColumn, type TableLoadMoreContext, type ThemeColorScheme, type ThemeMode, type TimelineItem, type TimelineProps, type TooltipLocation, type TooltipProps, type TreeDropdownProps, type TreeModel, type TreeMultiSelectProps, type TreeProps, type TypographyProps, type VStackProps, type VisualProps, clampNumber, createAsyncLabelStore, createNotificationTimer, createTheme, defaultTheme, enabledSelectableDescendants, exportTableToCsv, exportTableToExcel, exportTableToPdf, filterTree, flattenTree, flowClass, formatLocalDateTime, notificationDuration, resolveColorValue, resolveFlowStyle, resolveTooltipLocation, responsiveCSS, sanitizeInputValue, selectedTreeModels, setLocalDayBoundary, tableToCsv, themeToCSS };
|
package/dist/index.d.ts
CHANGED
|
@@ -442,7 +442,7 @@ interface BreadcrumbProps extends BaseUIProps {
|
|
|
442
442
|
items: BreadcrumbItem[];
|
|
443
443
|
separatorIcon?: string;
|
|
444
444
|
}
|
|
445
|
-
type NotificationType = "success" | "error" | "warning" | "info";
|
|
445
|
+
type NotificationType = "success" | "error" | "warning" | "info" | "decision";
|
|
446
446
|
type NotificationHorizontal = "left" | "center" | "right";
|
|
447
447
|
type NotificationVertical = "top" | "bottom";
|
|
448
448
|
interface NotificationProps extends BaseUIProps {
|
|
@@ -451,6 +451,7 @@ interface NotificationProps extends BaseUIProps {
|
|
|
451
451
|
horizontal?: NotificationHorizontal;
|
|
452
452
|
vertical?: NotificationVertical;
|
|
453
453
|
duration?: number;
|
|
454
|
+
defaultDuration?: number;
|
|
454
455
|
dismissible?: boolean;
|
|
455
456
|
}
|
|
456
457
|
interface KnobProps extends BaseUIProps, DisableableProps {
|
|
@@ -623,4 +624,15 @@ declare function resolveTooltipLocation(preferred: TooltipLocation, anchor: {
|
|
|
623
624
|
height: number;
|
|
624
625
|
}, gap?: number): TooltipLocation;
|
|
625
626
|
|
|
626
|
-
|
|
627
|
+
declare function notificationDuration(type: NotificationType, duration?: number, defaultDuration?: number): number;
|
|
628
|
+
declare function createNotificationTimer(duration: number, onElapsed: () => void): {
|
|
629
|
+
resume(): void;
|
|
630
|
+
pause(): void;
|
|
631
|
+
dispose(): void;
|
|
632
|
+
};
|
|
633
|
+
interface NotificationAction {
|
|
634
|
+
label: string;
|
|
635
|
+
onClick: () => void | Promise<void>;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
export { type AlignValue, type AsyncLabelCode, type AsyncLabelConfig, type AsyncLabelOptions, type AsyncLabelState, AsyncLabelStore, type AutocompleteProps, type BadgeProps, type BaseUIProps, type BorderProps, type BreadcrumbItem, type BreadcrumbProps, type BreakpointName, type ButtonGroupProps, type ButtonProps, type CSSLength, type CSSVariableStyle, type CardProps, type CarouselProps, type ChartData, type ChartProps, type ChartSeries, type ChartType, type ColorPalette, type ColorScale, type ColorShade, type ColorValue, type ComponentSize, type ComponentVariant, type DateTimeMode, type DateTimeProps, type DeepPartial, type DialogPosition, type DimensionValue, type DisableableProps, type DividerProps, type DropdownBehaviorProps, type DropdownModel, type FieldFocusStyle, type FileUploadProps, type FlexContainerProps, type FlexDirection, type FlexItemProps, type FlexWrap, type FlowInputMode, type FlowUIStyle, type FlowUITheme, type FocusableProps, type HStackProps, type IconProps, type ImageProps, type InputProps, type JustifyValue, type KnobProps, type LabelLookup, type LabelProps, type LabelResolverContext, type LabelResults, type LayoutProps, type ListboxProps, type LoadingProps, type MenuItem, type MultiSelectProps, type NotificationAction, type NotificationHorizontal, type NotificationProps, type NotificationType, type NotificationVertical, type OTPInputProps, type Orientation, type PaletteColor, type PasswordInputProps, type PhoneCountry, type PhoneInputProps, type PhoneNumberValue, type PopoverProps, type PositionProps, type PositionValue, type RadiusToken, type RadiusValue, type RatingProps, type ReadOnlyProps, type RequiredProps, type ResolvedStyle, type ResponsiveObject, type ResponsiveValue, type SchemeColor, type SelectOption, type SelectionValue, type SliderProps, type SortDirection, type SortState, type SpacingProps, type SpacingToken, type SpacingValue, type StackProps, type StyleResolution, type SwitchProps, type TabItem, type TabSelectedStyle, type TableColumn, type TableLoadMoreContext, type ThemeColorScheme, type ThemeMode, type TimelineItem, type TimelineProps, type TooltipLocation, type TooltipProps, type TreeDropdownProps, type TreeModel, type TreeMultiSelectProps, type TreeProps, type TypographyProps, type VStackProps, type VisualProps, clampNumber, createAsyncLabelStore, createNotificationTimer, createTheme, defaultTheme, enabledSelectableDescendants, exportTableToCsv, exportTableToExcel, exportTableToPdf, filterTree, flattenTree, flowClass, formatLocalDateTime, notificationDuration, resolveColorValue, resolveFlowStyle, resolveTooltipLocation, responsiveCSS, sanitizeInputValue, selectedTreeModels, setLocalDayBoundary, tableToCsv, themeToCSS };
|
package/dist/index.js
CHANGED
|
@@ -946,10 +946,53 @@ function resolveTooltipLocation(preferred, anchor, tooltip, viewport, gap = 6) {
|
|
|
946
946
|
const required = preferred === "top" || preferred === "bottom" ? tooltip.height + gap : tooltip.width + gap;
|
|
947
947
|
return available[preferred] < required && available[opposite[preferred]] > available[preferred] ? opposite[preferred] : preferred;
|
|
948
948
|
}
|
|
949
|
+
|
|
950
|
+
// src/notification.ts
|
|
951
|
+
var defaultDurations = {
|
|
952
|
+
success: 4e3,
|
|
953
|
+
info: 5e3,
|
|
954
|
+
warning: 7e3,
|
|
955
|
+
error: 8e3
|
|
956
|
+
};
|
|
957
|
+
function notificationDuration(type, duration, defaultDuration) {
|
|
958
|
+
if (type === "decision") return 0;
|
|
959
|
+
if (!(typeof duration === "number" && Number.isFinite(duration) && duration > 0))
|
|
960
|
+
duration = defaultDuration;
|
|
961
|
+
return typeof duration === "number" && Number.isFinite(duration) && duration > 0 ? Math.min(duration, 2147483647) : defaultDurations[type];
|
|
962
|
+
}
|
|
963
|
+
function createNotificationTimer(duration, onElapsed) {
|
|
964
|
+
let remaining = duration;
|
|
965
|
+
let started = 0;
|
|
966
|
+
let timer;
|
|
967
|
+
let done = false;
|
|
968
|
+
return {
|
|
969
|
+
resume() {
|
|
970
|
+
if (done || timer !== void 0 || duration === 0) return;
|
|
971
|
+
started = Date.now();
|
|
972
|
+
timer = setTimeout(() => {
|
|
973
|
+
timer = void 0;
|
|
974
|
+
done = true;
|
|
975
|
+
onElapsed();
|
|
976
|
+
}, remaining);
|
|
977
|
+
},
|
|
978
|
+
pause() {
|
|
979
|
+
if (timer === void 0) return;
|
|
980
|
+
clearTimeout(timer);
|
|
981
|
+
timer = void 0;
|
|
982
|
+
remaining = Math.max(0, remaining - (Date.now() - started));
|
|
983
|
+
},
|
|
984
|
+
dispose() {
|
|
985
|
+
done = true;
|
|
986
|
+
clearTimeout(timer);
|
|
987
|
+
timer = void 0;
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
}
|
|
949
991
|
export {
|
|
950
992
|
AsyncLabelStore,
|
|
951
993
|
clampNumber,
|
|
952
994
|
createAsyncLabelStore,
|
|
995
|
+
createNotificationTimer,
|
|
953
996
|
createTheme,
|
|
954
997
|
defaultTheme,
|
|
955
998
|
enabledSelectableDescendants,
|
|
@@ -960,6 +1003,7 @@ export {
|
|
|
960
1003
|
flattenTree,
|
|
961
1004
|
flowClass,
|
|
962
1005
|
formatLocalDateTime,
|
|
1006
|
+
notificationDuration,
|
|
963
1007
|
resolveColorValue,
|
|
964
1008
|
resolveFlowStyle,
|
|
965
1009
|
resolveTooltipLocation,
|