@fibery/ui-kit 9.1.1 → 9.1.3

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 (104) hide show
  1. package/lib/actions-menu/actions-menu-item.js +3 -3
  2. package/lib/actions-menu/actions-menu-sub-command-menu.js +2 -2
  3. package/lib/actions-menu/contexts/actions-menu-context.js +2 -2
  4. package/lib/actions-menu/contexts/actions-menu-dangerous-rows.js +3 -3
  5. package/lib/antd/input.d.ts +1 -1
  6. package/lib/automation-avatar.d.ts +8 -0
  7. package/lib/automation-avatar.js +43 -0
  8. package/lib/board-table-loader.js +6 -6
  9. package/lib/button/base-button.js +5 -5
  10. package/lib/checkbox.d.ts +1 -1
  11. package/lib/checkbox.js +3 -3
  12. package/lib/comment.js +3 -3
  13. package/lib/design-system/alpha-coefficients.d.ts +1 -0
  14. package/lib/design-system/alpha-coefficients.js +1 -0
  15. package/lib/design-system/colors.d.ts +6 -8
  16. package/lib/design-system/colors.js +7 -8
  17. package/lib/design-system/theme.d.ts +5 -10
  18. package/lib/design-system/theme.js +1 -1
  19. package/lib/emoji-picker/primitives/content.js +2 -2
  20. package/lib/emoji-picker/primitives/preview-provider.js +3 -3
  21. package/lib/emoji-picker/primitives/root.js +3 -3
  22. package/lib/emoji-picker/primitives/search-provider.js +3 -3
  23. package/lib/emoji-picker/primitives/skin-provider.js +3 -3
  24. package/lib/emoji-picker/stores/emoji-data-store.js +2 -2
  25. package/lib/file-item/file-preview-actions.js +1 -1
  26. package/lib/icons/ast/index.d.ts +4 -1
  27. package/lib/icons/ast/index.js +4 -1
  28. package/lib/icons/ast/integration-claude.d.ts +5 -0
  29. package/lib/icons/ast/integration-claude.js +25 -0
  30. package/lib/icons/ast/integration-gemini.d.ts +5 -0
  31. package/lib/icons/ast/integration-gemini.js +25 -0
  32. package/lib/icons/ast/integration-openai.d.ts +5 -0
  33. package/lib/icons/ast/integration-openai.js +25 -0
  34. package/lib/icons/react/index.d.ts +4 -1
  35. package/lib/icons/react/index.js +4 -1
  36. package/lib/icons/react/integration-claude.d.ts +15 -0
  37. package/lib/icons/react/integration-claude.js +21 -0
  38. package/lib/icons/react/integration-gemini.d.ts +15 -0
  39. package/lib/icons/react/integration-gemini.js +21 -0
  40. package/lib/icons/react/integration-openai.d.ts +15 -0
  41. package/lib/icons/react/integration-openai.js +21 -0
  42. package/lib/images-gallery/images-gallery.js +4 -4
  43. package/lib/loaders.js +4 -4
  44. package/lib/open-popover-tracker.js +2 -2
  45. package/lib/popover/index.js +2 -2
  46. package/lib/popover/mobile-popover-context.js +2 -2
  47. package/lib/popover/popup-stack-context.js +2 -2
  48. package/lib/popover/styles.wyw-in-js.css +1 -1
  49. package/lib/random.d.ts +4 -0
  50. package/lib/random.js +11 -0
  51. package/lib/rich-input-loader.js +3 -3
  52. package/lib/root-theme-provider.js +2 -1
  53. package/lib/root-theme-provider.wyw-in-js.css +1 -1
  54. package/lib/select/select-in-popover.js +5 -3
  55. package/lib/select/select-loader.js +2 -2
  56. package/lib/select/select.js +11 -4
  57. package/lib/sidebar/sidebar-handle.d.ts +14 -0
  58. package/lib/sidebar/sidebar-handle.js +51 -0
  59. package/lib/sidebar/sidebar-handle.wyw-in-js.css +7 -0
  60. package/lib/sidebar/sidebar.d.ts +25 -0
  61. package/lib/sidebar/sidebar.js +60 -0
  62. package/lib/sidebar/sidebar.wyw-in-js.css +3 -0
  63. package/lib/sidebar/use-resize-drag.d.ts +22 -0
  64. package/lib/sidebar/use-resize-drag.js +71 -0
  65. package/lib/skeleton.d.ts +23 -0
  66. package/lib/skeleton.js +47 -0
  67. package/lib/skeleton.wyw-in-js.css +4 -0
  68. package/lib/tab-nav/tab-nav.js +2 -2
  69. package/lib/theme-provider.d.ts +1 -2
  70. package/lib/theme-styles.js +5 -2
  71. package/lib/theming.generated.d.ts +13 -18
  72. package/lib/theming.generated.js +13 -18
  73. package/lib/toast/toast-provider.d.ts +1 -0
  74. package/lib/toast/toast-provider.js +2 -2
  75. package/lib/toast/toast-queue.d.ts +2 -0
  76. package/lib/toast/toast-queue.js +6 -0
  77. package/lib/tooltip.js +1 -1
  78. package/lib/unit/loading-unit-value.d.ts +2 -2
  79. package/lib/unit/loading-unit-value.js +2 -2
  80. package/lib/use-is-phone.js +2 -2
  81. package/lib/use-on-screen-keyboard-data.js +3 -3
  82. package/package.json +3 -6
  83. package/lib/ai/model.d.ts +0 -8
  84. package/lib/ai/model.js +0 -55
  85. package/lib/ai/model.wyw-in-js.css +0 -1
  86. package/lib/antd/auto-width-transparent-textarea.d.ts +0 -8
  87. package/lib/antd/auto-width-transparent-textarea.js +0 -34
  88. package/lib/antd/auto-width-transparent-textarea.wyw-in-js.css +0 -2
  89. package/lib/get-trigger-node-popup-container.d.ts +0 -4
  90. package/lib/get-trigger-node-popup-container.js +0 -8
  91. package/lib/lists/actions-menu-row-surface.d.ts +0 -12
  92. package/lib/lists/actions-menu-row-surface.js +0 -65
  93. package/lib/lists/actions-menu-row-surface.wyw-in-js.css +0 -4
  94. package/lib/loading-sausage.d.ts +0 -24
  95. package/lib/loading-sausage.js +0 -57
  96. package/lib/loading-sausage.wyw-in-js.css +0 -6
  97. package/lib/nested-menu-item.d.ts +0 -1
  98. package/lib/nested-menu-item.js +0 -0
  99. package/lib/not-empty.d.ts +0 -4
  100. package/lib/not-empty.js +0 -6
  101. package/lib/use-why-did-you-update.d.ts +0 -4
  102. package/lib/use-why-did-you-update.js +0 -25
  103. package/lib/with-data.d.ts +0 -77
  104. package/lib/with-data.js +0 -55
package/lib/ai/model.d.ts DELETED
@@ -1,8 +0,0 @@
1
- //#region src/ai/model.d.ts
2
- type Props = {
3
- initialValue: string;
4
- onChange: (s: string) => void;
5
- };
6
- declare const Model: ({ initialValue, onChange }: Props) => import("react/jsx-runtime").JSX.Element;
7
- //#endregion
8
- export { Model };
package/lib/ai/model.js DELETED
@@ -1,55 +0,0 @@
1
- import "./model.wyw-in-js.css";
2
- import { Tooltip } from "../tooltip.js";
3
- import { Emoji } from "../emoji.js";
4
- /* empty css */
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- import { useCallback, useState } from "react";
7
- //#region src/ai/model.tsx
8
- var exampleItemCodeStyle = "e1jf3cc2-exampleItemCode";
9
- var indicators = [{
10
- name: "gpt-3.5-turbo-16k",
11
- symbol: "🤖",
12
- desc: /* @__PURE__ */ jsxs(Fragment, { children: [
13
- /* @__PURE__ */ jsx("p", { children: "$0.003 / 1K tokens" }),
14
- /* @__PURE__ */ jsx("p", { children: "Most capable GPT-3.5 model optimized for chat at 1/30th the cost of GPT-4 model" }),
15
- /* @__PURE__ */ jsx("p", { children: "Good at: Complex intent, cause and effect, summarization for audience" })
16
- ] })
17
- }, {
18
- name: "gpt-4",
19
- symbol: "🧠",
20
- desc: /* @__PURE__ */ jsxs(Fragment, { children: [
21
- /* @__PURE__ */ jsx("p", { children: "$0.0600 / 1K tokens." }),
22
- /* @__PURE__ */ jsx("p", { children: "With broad general knowledge and domain expertise," }),
23
- /* @__PURE__ */ jsx("p", { children: "GPT-4 can follow complex instructions in natural language and solve difficult problems with accuracy" }),
24
- /* @__PURE__ */ jsx("p", { children: "Excellent at: Complex intent, cause and effect, summarization for audience" })
25
- ] })
26
- }];
27
- var delta = 1;
28
- var rotate = (n, min, max) => n > max ? min : n;
29
- var Model = ({ initialValue, onChange }) => {
30
- const [index, setIndex] = useState(indicators.map(({ name }) => name).indexOf(initialValue));
31
- const onUseButtonClick = useCallback(() => {
32
- const nextIndex = rotate(index + delta, 0, indicators.length - 1);
33
- onChange(indicators[nextIndex].name);
34
- setIndex(nextIndex);
35
- }, [onChange, index]);
36
- const item = indicators[index];
37
- return /* @__PURE__ */ jsx("div", { children: jsx(Tooltip, {
38
- title: `Model: ${item.name}`,
39
- description: item.desc,
40
- instant: true,
41
- children: /* @__PURE__ */ jsx("button", {
42
- type: "button",
43
- onClick: onUseButtonClick,
44
- className: exampleItemCodeStyle,
45
- children: /* @__PURE__ */ jsx(Emoji, {
46
- symbol: item.symbol,
47
- label: item.name,
48
- size: 1.25,
49
- inline: true
50
- })
51
- })
52
- }) });
53
- };
54
- //#endregion
55
- export { Model };
@@ -1 +0,0 @@
1
- .e1jf3cc2-exampleItemCode{font-family:"SFMono-Regular",Menlo,Consolas,"PT Mono","Liberation Mono",Courier,monospace;font-size:12px;line-height:1.5;font-weight:410;color:var(--textColor);white-space:initial;text-align:left;border-radius:4px;border:none;background-color:var(--transparent);cursor:pointer;}.e1jf3cc2-exampleItemCode:hover{background-color:var(--colorAccentBgSubtle);}
@@ -1,8 +0,0 @@
1
- import TextArea from "rc-textarea";
2
- //#region src/antd/auto-width-transparent-textarea.d.ts
3
- declare const AutoWidthTransparentTextArea: import("react").ForwardRefExoticComponent<import("rc-textarea").TextAreaProps & {
4
- wrapperClassName?: string;
5
- bypassedRef?: React.ForwardedRef<React.ElementRef<typeof TextArea>>;
6
- } & import("react").RefAttributes<HTMLDivElement>>;
7
- //#endregion
8
- export { AutoWidthTransparentTextArea };
@@ -1,34 +0,0 @@
1
- import "./auto-width-transparent-textarea.wyw-in-js.css";
2
- import { TransparentInputWrapper } from "./input.js";
3
- /* empty css */
4
- import { jsx } from "react/jsx-runtime";
5
- import { forwardRef, useRef } from "react";
6
- import { cx } from "@linaria/core";
7
- import { useComposedRefs } from "@fibery/react/src/use-composed-refs";
8
- import RcTextArea from "rc-textarea";
9
- //#region src/antd/auto-width-transparent-textarea.tsx
10
- var wrapper = "w1dk3li9-wrapper";
11
- var textArea = "twcv412-textArea";
12
- var AutoWidthTransparentTextArea = forwardRef(function AutoWidthTransparentTextArea({ onChange, style, className, wrapperClassName, ...props }, ref) {
13
- const wrapperRef = useRef(null);
14
- const composedRef = useComposedRefs(ref, wrapperRef);
15
- const handleChange = (e) => {
16
- if (wrapperRef.current) wrapperRef.current.dataset.value = e.target.value;
17
- onChange?.(e);
18
- };
19
- return /* @__PURE__ */ jsx(TransparentInputWrapper, {
20
- className: cx(wrapper, wrapperClassName),
21
- "data-value": props.value || props.placeholder,
22
- ref: composedRef,
23
- children: jsx(RcTextArea, {
24
- prefixCls: "ant-input",
25
- className: cx("ant-input", textArea, className),
26
- style,
27
- onChange: handleChange,
28
- cols: 1,
29
- ...props
30
- })
31
- });
32
- });
33
- //#endregion
34
- export { AutoWidthTransparentTextArea };
@@ -1,2 +0,0 @@
1
- .w1dk3li9-wrapper{display:inline-grid;}.w1dk3li9-wrapper::after{content:attr(data-value);white-space:pre-wrap;word-wrap:break-word;visibility:hidden;display:block;grid-area:1/1;min-width:0;height:1px;}
2
- .twcv412-textArea{grid-area:1/1;}
@@ -1,4 +0,0 @@
1
- //#region src/get-trigger-node-popup-container.d.ts
2
- declare const getTriggerNodePopupContainer: (triggerNode: HTMLElement) => HTMLElement;
3
- //#endregion
4
- export { getTriggerNodePopupContainer };
@@ -1,8 +0,0 @@
1
- import { assert } from "@fibery/helpers/utils/trace";
2
- //#region src/get-trigger-node-popup-container.ts
3
- var getTriggerNodePopupContainer = (triggerNode) => {
4
- assert(triggerNode, "triggerNode");
5
- return triggerNode;
6
- };
7
- //#endregion
8
- export { getTriggerNodePopupContainer };
@@ -1,12 +0,0 @@
1
- import { ActionsMenuItemProps } from "../actions-menu/actions-menu-item.js";
2
- import { ListRowContentProps, ListRowSurfaceProps } from "./list-row-surface.js";
3
- //#region src/lists/actions-menu-row-surface.d.ts
4
- interface ActionMenuItemSurfaceProps extends Omit<ActionsMenuItemProps, "description">, Omit<ListRowSurfaceProps, "children" | "darker" | "onSelect" | "id"> {}
5
- declare const actionMenuItemSurface: import("@linaria/core").LinariaClassName;
6
- declare const ActionMenuItemSurface: import("react").ForwardRefExoticComponent<ActionMenuItemSurfaceProps & import("react").RefAttributes<HTMLDivElement>>;
7
- interface ActionMenuItemContentProps extends ListRowContentProps {
8
- description?: string;
9
- }
10
- declare const ActionMenuItemContent: import("react").ForwardRefExoticComponent<ActionMenuItemContentProps & import("react").RefAttributes<HTMLDivElement>>;
11
- //#endregion
12
- export { ActionMenuItemContent, ActionMenuItemSurface, actionMenuItemSurface };
@@ -1,65 +0,0 @@
1
- import "./actions-menu-row-surface.wyw-in-js.css";
2
- import { textClasses } from "../design-system/typography.js";
3
- import { useIsSupportHover } from "../use-is-support-hover.js";
4
- import { useActionsMenuContext } from "../actions-menu/contexts/actions-menu-context.js";
5
- import { useActiveDangerousRow, useSetActiveDangerousRow } from "../actions-menu/contexts/actions-menu-dangerous-rows.js";
6
- import { ListRowContent, listRowSurfaceStylesBase } from "./list-row-surface.js";
7
- /* empty css */
8
- import { noop } from "@fibery/helpers/src/_";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- import { forwardRef, useId } from "react";
11
- import { cx } from "@linaria/core";
12
- import { stopPropagation } from "@fibery/react/src/stop-propagation";
13
- import { useCallbackRef } from "@fibery/react/src/use-callback-ref";
14
- //#region src/lists/actions-menu-row-surface.tsx
15
- var actionMenuItemSurface = "a17pn820-actionMenuItemSurface";
16
- var ActionMenuItemSurface = forwardRef(({ testId, className, loading, selected, hovered, focused, title, disabled, children, dangerous, ...props }, ref) => {
17
- const id = useId();
18
- const platformSupportsHover = useIsSupportHover();
19
- const showWarning = useActiveDangerousRow() === id;
20
- const onSelect = useCallbackRef(props.onSelect || noop);
21
- const { MenuPrimitive } = useActionsMenuContext();
22
- const setActiveDangerousRow = useSetActiveDangerousRow();
23
- const handleSelect = (e) => {
24
- e.stopPropagation();
25
- if (loading || !id) {
26
- e.preventDefault();
27
- return;
28
- }
29
- if (dangerous && !showWarning) {
30
- e.preventDefault();
31
- setActiveDangerousRow(id);
32
- return;
33
- }
34
- setActiveDangerousRow(null);
35
- onSelect(e);
36
- };
37
- return /* @__PURE__ */ jsx(MenuPrimitive.Item, {
38
- ref,
39
- "data-testid": testId,
40
- onClick: stopPropagation,
41
- onSelect: handleSelect,
42
- title: title ? title : "",
43
- className: cx(listRowSurfaceStylesBase, actionMenuItemSurface, className, platformSupportsHover && hovered === void 0 && "natural-hover", focused === void 0 && "natural-focus", focused && "focus", disabled && "done", selected && "selected", dangerous && "dangerous", showWarning && "warn"),
44
- disabled,
45
- children
46
- });
47
- });
48
- var actionMenuItemDescriptionClass = "a11chqvq-actionMenuItemDescription";
49
- var actionMenuItemContentClass = "aw0iqns-actionMenuItemContent";
50
- var actionMenuItemWithDescription = "aldd35y-actionMenuItemWithDescription";
51
- var ActionMenuItemContent = forwardRef(({ contentClassName, description, ...rest }, ref) => {
52
- return /* @__PURE__ */ jsxs("div", {
53
- className: cx(description && actionMenuItemWithDescription),
54
- children: [/* @__PURE__ */ jsx(ListRowContent, {
55
- contentClassName: cx(contentClassName, actionMenuItemContentClass),
56
- ref,
57
- ...rest
58
- }), description ? /* @__PURE__ */ jsx("div", {
59
- className: cx(textClasses.small, actionMenuItemDescriptionClass),
60
- children: description
61
- }) : null]
62
- });
63
- });
64
- //#endregion
65
- export { ActionMenuItemContent, ActionMenuItemSurface, actionMenuItemSurface };
@@ -1,4 +0,0 @@
1
- .a17pn820-actionMenuItemSurface{margin:0 4px;background-color:var(--colorBgListItemGeneral);}.a17pn820-actionMenuItemSurface.natural-hover:hover,.a17pn820-actionMenuItemSurface[data-highlighted]{background-color:var(--colorBgActionsMenuItemHover);}.a17pn820-actionMenuItemSurface.done,.a17pn820-actionMenuItemSurface[data-disabled]{cursor:not-allowed;color:var(--colorTextListItemGeneralDisabled);background-color:var(--colorBgListItemGeneralDisabled);}.a17pn820-actionMenuItemSurface.done.natural-hover:hover,.a17pn820-actionMenuItemSurface[data-disabled].natural-hover:hover,.a17pn820-actionMenuItemSurface.done.hover>*,.a17pn820-actionMenuItemSurface[data-disabled].hover>*{opacity:var(--opacityListItemGeneralDisabled);}.a17pn820-actionMenuItemSurface.selected{cursor:default;background-color:var(--colorBgActionsMenuItemSelected);}.a17pn820-actionMenuItemSurface.selected.natural-hover:hover,.a17pn820-actionMenuItemSurface.selected.hover,.a17pn820-actionMenuItemSurface.selected[data-highlighted]{background-color:var(--colorBgActionsMenuItemSelectedHover);}.a17pn820-actionMenuItemSurface.dangerous{background-color:var(--colorBgActionsMenuItemDangerActive);}.a17pn820-actionMenuItemSurface.dangerous.natural-hover:hover,.a17pn820-actionMenuItemSurface.dangerous.hover,.a17pn820-actionMenuItemSurface.dangerous[data-highlighted]{background-color:var(--colorBgActionsMenuItemDangerActive);}.a17pn820-actionMenuItemSurface.warm{background-color:var(--colorBgActionsMenuItemDangerActive);color:var(--whiteColor);}.a17pn820-actionMenuItemSurface.warm.natural-hover:hover,.a17pn820-actionMenuItemSurface.warm.hover,.a17pn820-actionMenuItemSurface.warm[data-highlighted]{background-color:var(--colorBgActionsMenuItemDangerActive);color:var(--whiteColor);}
2
- .a11chqvq-actionMenuItemDescription{line-height:1;color:var(--accentTextColor);padding:2px 8px 0;}
3
- .aw0iqns-actionMenuItemContent{line-height:32px;padding:0 8px;}
4
- .aldd35y-actionMenuItemWithDescription{min-height:52px;}
@@ -1,24 +0,0 @@
1
- import { ComponentType, ReactNode } from "react";
2
- //#region src/loading-sausage.d.ts
3
- declare const getRandomInt: (min: number, max: number, seed?: number) => number;
4
- type LoadingSausageProps = {
5
- minWidth?: number;
6
- maxWidth?: number;
7
- height?: number;
8
- inverted?: boolean;
9
- animateAppearance?: boolean;
10
- margins?: boolean;
11
- index?: number;
12
- };
13
- declare const LoadingSausage: import("react").MemoExoticComponent<({ minWidth, maxWidth, index, height, inverted, margins, animateAppearance }: LoadingSausageProps) => JSX.Element>;
14
- type SausageListProps = {
15
- amount?: number;
16
- minAmount?: number;
17
- maxAmount?: number;
18
- WrapperComponent?: ComponentType<{
19
- children: ReactNode;
20
- }> | null;
21
- } & Omit<LoadingSausageProps, "index">;
22
- declare const LoadingSausageList: import("react").NamedExoticComponent<SausageListProps>;
23
- //#endregion
24
- export { LoadingSausage, LoadingSausageList, LoadingSausageProps, getRandomInt };
@@ -1,57 +0,0 @@
1
- import "./loading-sausage.wyw-in-js.css";
2
- /* empty css */
3
- import { Fragment, jsx } from "react/jsx-runtime";
4
- import { memo, useState } from "react";
5
- import cx from "classnames";
6
- import { styled } from "@linaria/react";
7
- //#region src/loading-sausage.tsx
8
- var getRandomWithSeed = (seed) => {
9
- const x = Math.sin(seed + 1) * 1e4;
10
- return x - Math.floor(x);
11
- };
12
- var getRandomInt = (min, max, seed) => {
13
- const random = seed !== void 0 ? getRandomWithSeed(seed) : Math.random();
14
- return Math.floor(random * (max - min + 1)) + min;
15
- };
16
- var loadingSausageStyle = "l16t34ge-loadingSausage";
17
- var light = "l9y52vn-light";
18
- var dark = "d13a41xq-dark";
19
- var marginStyle = "m1pjyqzf-margin";
20
- var loadingSausageWithAnimatedAppearanceStyle = "l62e96j-loadingSausageWithAnimatedAppearance";
21
- var _exp6 = () => ((props) => `${props.height / 2}px`);
22
- var Container = /*#__PURE__*/ styled("div")({
23
- name: "Container",
24
- class: "c1ybuoqn-Container",
25
- propsAsIs: false,
26
- vars: { "c1ybuoqn-0": [_exp6()] }
27
- });
28
- var LoadingSausage = memo(function LoadingSausage({ minWidth = 80, maxWidth = 120, index, height = 12, inverted = false, margins = true, animateAppearance = false }) {
29
- const [width] = useState(() => getRandomInt(minWidth, maxWidth, index));
30
- return /* @__PURE__ */ jsx(Container, {
31
- height,
32
- style: {
33
- width,
34
- height
35
- },
36
- className: cx(loadingSausageStyle, inverted ? light : dark, margins && marginStyle, animateAppearance && loadingSausageWithAnimatedAppearanceStyle)
37
- });
38
- });
39
- var LoadingSausageList = memo(function LoadingSausageList({ amount, minAmount = 1, maxAmount = 1, WrapperComponent, ...restProps }) {
40
- const calculatedAmount = amount || getRandomInt(minAmount, maxAmount);
41
- const list = new Array(calculatedAmount).fill(null);
42
- return /* @__PURE__ */ jsx(Fragment, { children: list.map((_, index) => {
43
- const style = { opacity: (calculatedAmount - index) / calculatedAmount };
44
- return /* @__PURE__ */ jsx("div", {
45
- style,
46
- children: WrapperComponent ? /* @__PURE__ */ jsx(WrapperComponent, { children: /* @__PURE__ */ jsx(LoadingSausage, {
47
- index: index + 1,
48
- ...restProps
49
- }) }) : /* @__PURE__ */ jsx(LoadingSausage, {
50
- index: index + 1,
51
- ...restProps
52
- })
53
- }, index);
54
- }) });
55
- });
56
- //#endregion
57
- export { LoadingSausage, LoadingSausageList, getRandomInt };
@@ -1,6 +0,0 @@
1
- .l16t34ge-loadingSausage{vertical-align:middle;position:relative;background:none;}.l16t34ge-loadingSausage::before,.l16t34ge-loadingSausage::after{content:"";display:block;position:absolute;top:0;bottom:0;left:0;right:0;}@keyframes OpacityAnim-l16t34ge-loadingSausage{0%{opacity:1;}100%{opacity:0;}}.l16t34ge-loadingSausage::before{animation:OpacityAnim-l16t34ge-loadingSausage 2s ease-in-out 0s infinite alternate;}.l16t34ge-loadingSausage::after{animation:OpacityAnim-l16t34ge-loadingSausage 2s ease-in-out -2s infinite alternate;}
2
- .l9y52vn-light::before{background-image:linear-gradient(90deg, var(--colorBgSkeletonFrom) 0%, var(--colorBgSkeletonTo) 100%);}.l9y52vn-light::after{background-image:linear-gradient(90deg, var(--colorBgSkeletonTo) 0%, var(--colorBgSkeletonFrom) 100%);}
3
- .d13a41xq-dark::before{background-image:linear-gradient(90deg, var(--separatorColorDimmed) 0%, var(--separatorColor) 100%);}.d13a41xq-dark::after{background-image:linear-gradient(90deg, var(--separatorColor) 0%, var(--separatorColorDimmed) 100%);}
4
- .m1pjyqzf-margin{margin-top:4px;margin-bottom:4px;}
5
- .l62e96j-loadingSausageWithAnimatedAppearance{animation:OpacityAnim-l62e96j-loadingSausageWithAnimatedAppearance 1s cubic-bezier(0.95, 0.05, 0.795, 0.035) 1;}@keyframes OpacityAnim-l62e96j-loadingSausageWithAnimatedAppearance{0%{opacity:0;}100%{opacity:1;}}
6
- .c1ybuoqn-Container::before,.c1ybuoqn-Container::after{border-radius:var(--c1ybuoqn-0);}
@@ -1 +0,0 @@
1
- export {}
File without changes
@@ -1,4 +0,0 @@
1
- //#region src/not-empty.d.ts
2
- declare function notEmpty<TValue>(value: TValue | null | undefined | false): value is TValue;
3
- //#endregion
4
- export { notEmpty };
package/lib/not-empty.js DELETED
@@ -1,6 +0,0 @@
1
- //#region src/not-empty.ts
2
- function notEmpty(value) {
3
- return value !== null && value !== void 0 && value !== false;
4
- }
5
- //#endregion
6
- export { notEmpty };
@@ -1,4 +0,0 @@
1
- //#region src/use-why-did-you-update.d.ts
2
- declare function useWhyDidYouUpdate(name: string, props: Record<string, unknown>): void;
3
- //#endregion
4
- export { useWhyDidYouUpdate as default };
@@ -1,25 +0,0 @@
1
- import { useEffect, useRef } from "react";
2
- //#region src/use-why-did-you-update.tsx
3
- function useWhyDidYouUpdate(name, props) {
4
- const previousProps = useRef();
5
- useEffect(() => {
6
- const current = previousProps.current;
7
- if (current) {
8
- const allKeys = Object.keys({
9
- ...current,
10
- ...props
11
- });
12
- const changesObj = {};
13
- allKeys.forEach((key) => {
14
- if (current[key] !== props[key]) changesObj[key] = {
15
- from: current[key],
16
- to: props[key]
17
- };
18
- });
19
- if (Object.keys(changesObj).length) console.log("[why-did-you-update]", name, changesObj);
20
- }
21
- previousProps.current = props;
22
- });
23
- }
24
- //#endregion
25
- export { useWhyDidYouUpdate as default };
@@ -1,77 +0,0 @@
1
- import { ComponentType } from "react";
2
- //#region src/with-data.d.ts
3
- type FetchState<Value = unknown> = {
4
- fetchState: ":fetch-state/start";
5
- fetchError: null;
6
- fetchValue: null;
7
- } | {
8
- fetchState: ":fetch-state/success";
9
- fetchValue: Value;
10
- fetchError: null;
11
- } | {
12
- fetchState: ":fetch-state/error";
13
- fetchError: Error;
14
- fetchValue: null;
15
- };
16
- type DataSources = Record<string, () => Promise<unknown>>;
17
- type ProvidedState<Sources extends DataSources> = { [Key in keyof Sources]: FetchState<Awaited<ReturnType<Sources[Key]>>>; };
18
- declare function provideData<Sources extends DataSources>({ sources }: {
19
- sources: Sources;
20
- }): <OwnProps extends object>(Component: ComponentType<OwnProps & ProvidedState<Sources>>) => {
21
- new (props: OwnProps): {
22
- state: ProvidedState<Sources>;
23
- _prefetch: <Key extends keyof Sources>(key: Key, fetch: Sources[Key]) => Promise<void>;
24
- setSourceState<Key extends keyof Sources>(key: Key, value: ProvidedState<Sources>[Key]): void;
25
- componentDidMount(): void;
26
- setStateIfMounted(updater: (prevState: ProvidedState<Sources>) => ProvidedState<Sources>): void;
27
- componentWillUnmount(): void;
28
- render(): import("react/jsx-runtime").JSX.Element;
29
- context: unknown;
30
- setState<K extends keyof Sources>(state: Pick<ProvidedState<Sources>, K> | ProvidedState<Sources> | ((prevState: Readonly<ProvidedState<Sources>>, props: Readonly<OwnProps>) => Pick<ProvidedState<Sources>, K> | ProvidedState<Sources> | null) | null, callback?: (() => void) | undefined): void;
31
- forceUpdate(callback?: (() => void) | undefined): void;
32
- readonly props: Readonly<OwnProps>;
33
- refs: {
34
- [key: string]: import("react").ReactInstance;
35
- };
36
- shouldComponentUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): boolean;
37
- componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
38
- getSnapshotBeforeUpdate?(prevProps: Readonly<OwnProps>, prevState: Readonly<ProvidedState<Sources>>): any;
39
- componentDidUpdate?(prevProps: Readonly<OwnProps>, prevState: Readonly<ProvidedState<Sources>>, snapshot?: any): void;
40
- componentWillMount?(): void;
41
- UNSAFE_componentWillMount?(): void;
42
- componentWillReceiveProps?(nextProps: Readonly<OwnProps>, nextContext: any): void;
43
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<OwnProps>, nextContext: any): void;
44
- componentWillUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): void;
45
- UNSAFE_componentWillUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): void;
46
- };
47
- new (props: OwnProps, context: any): {
48
- state: ProvidedState<Sources>;
49
- _prefetch: <Key extends keyof Sources>(key: Key, fetch: Sources[Key]) => Promise<void>;
50
- setSourceState<Key extends keyof Sources>(key: Key, value: ProvidedState<Sources>[Key]): void;
51
- componentDidMount(): void;
52
- setStateIfMounted(updater: (prevState: ProvidedState<Sources>) => ProvidedState<Sources>): void;
53
- componentWillUnmount(): void;
54
- render(): import("react/jsx-runtime").JSX.Element;
55
- context: unknown;
56
- setState<K extends keyof Sources>(state: Pick<ProvidedState<Sources>, K> | ProvidedState<Sources> | ((prevState: Readonly<ProvidedState<Sources>>, props: Readonly<OwnProps>) => Pick<ProvidedState<Sources>, K> | ProvidedState<Sources> | null) | null, callback?: (() => void) | undefined): void;
57
- forceUpdate(callback?: (() => void) | undefined): void;
58
- readonly props: Readonly<OwnProps>;
59
- refs: {
60
- [key: string]: import("react").ReactInstance;
61
- };
62
- shouldComponentUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): boolean;
63
- componentDidCatch?(error: Error, errorInfo: import("react").ErrorInfo): void;
64
- getSnapshotBeforeUpdate?(prevProps: Readonly<OwnProps>, prevState: Readonly<ProvidedState<Sources>>): any;
65
- componentDidUpdate?(prevProps: Readonly<OwnProps>, prevState: Readonly<ProvidedState<Sources>>, snapshot?: any): void;
66
- componentWillMount?(): void;
67
- UNSAFE_componentWillMount?(): void;
68
- componentWillReceiveProps?(nextProps: Readonly<OwnProps>, nextContext: any): void;
69
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<OwnProps>, nextContext: any): void;
70
- componentWillUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): void;
71
- UNSAFE_componentWillUpdate?(nextProps: Readonly<OwnProps>, nextState: Readonly<ProvidedState<Sources>>, nextContext: any): void;
72
- };
73
- contextType?: import("react").Context<any> | undefined;
74
- };
75
- declare const DefaultDependenciesLoader: () => import("react/jsx-runtime").JSX.Element;
76
- //#endregion
77
- export { DefaultDependenciesLoader, provideData };
package/lib/with-data.js DELETED
@@ -1,55 +0,0 @@
1
- import { asError } from "./errors.js";
2
- import { mapValues, noop } from "@fibery/helpers/src/_";
3
- import { jsx } from "react/jsx-runtime";
4
- import { PureComponent } from "react";
5
- //#region src/with-data.tsx
6
- var makeInitialState = (sources) => mapValues(sources, () => ({
7
- fetchState: ":fetch-state/start",
8
- fetchValue: null,
9
- fetchError: null
10
- }));
11
- function provideData({ sources }) {
12
- return (Component) => class DataProvider extends PureComponent {
13
- state = makeInitialState(sources);
14
- _prefetch = async (key, fetch) => {
15
- try {
16
- const fetchValue = await fetch();
17
- this.setSourceState(key, {
18
- fetchState: ":fetch-state/success",
19
- fetchValue,
20
- fetchError: null
21
- });
22
- } catch (fetchError) {
23
- this.setSourceState(key, {
24
- fetchState: ":fetch-state/error",
25
- fetchValue: null,
26
- fetchError: asError(fetchError)
27
- });
28
- }
29
- };
30
- setSourceState(key, value) {
31
- this.setStateIfMounted((state) => ({
32
- ...state,
33
- [key]: value
34
- }));
35
- }
36
- componentDidMount() {
37
- Object.keys(sources).forEach((key) => this._prefetch(key, sources[key]));
38
- }
39
- setStateIfMounted(updater) {
40
- return this.setState(updater);
41
- }
42
- componentWillUnmount() {
43
- this.setStateIfMounted = noop;
44
- }
45
- render() {
46
- return /* @__PURE__ */ jsx(Component, {
47
- ...this.props,
48
- ...this.state
49
- });
50
- }
51
- };
52
- }
53
- var DefaultDependenciesLoader = () => /* @__PURE__ */ jsx("div", {});
54
- //#endregion
55
- export { DefaultDependenciesLoader, provideData };