@fibery/ui-kit 9.0.1 → 9.1.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.
- package/lib/a11y-color.js +12 -10
- package/lib/actions-menu/actions-menu-item.js +1 -1
- package/lib/actions-menu/actions-menu-props.d.ts +2 -0
- package/lib/actions-menu/actions-menu-separator.d.ts +2 -2
- package/lib/actions-menu/actions-menu-sub-command-menu.js +5 -4
- package/lib/actions-menu/actions-menu.d.ts +1 -1
- package/lib/actions-menu/actions-menu.js +2 -1
- package/lib/actions-menu/contexts/actions-menu-context.js +12 -11
- package/lib/actions-menu/index.d.ts +3 -3
- package/lib/ai/max-tokens.js +6 -5
- package/lib/antd/ant-modal.d.ts +1 -1
- package/lib/antd/ant-modal.js +28 -1
- package/lib/antd/ant-upload.d.ts +1 -1
- package/lib/antd/ant-upload.js +23 -18
- package/lib/antd/input-number.js +2 -2
- package/lib/antd/input.js +7 -6
- package/lib/antd/utils.js +2 -1
- package/lib/avatar-colors.js +1 -1
- package/lib/avatar.d.ts +1 -10
- package/lib/avatar.js +48 -38
- package/lib/avatar.wyw-in-js.css +1 -1
- package/lib/banner/banner-action.js +2 -1
- package/lib/board-table-loader.js +1 -1
- package/lib/button/button.js +1 -1
- package/lib/button/icon-button.js +1 -1
- package/lib/canvas-colors.js +2 -2
- package/lib/card-container.d.ts +2 -6
- package/lib/card-container.js +5 -5
- package/lib/color-filter.js +2 -2
- package/lib/color-inspect.js +1 -1
- package/lib/color-picker/color-picker-or-loader.d.ts +2 -2
- package/lib/color-utils.js +1 -1
- package/lib/comment.d.ts +1 -0
- package/lib/comment.js +29 -20
- package/lib/comment.wyw-in-js.css +9 -7
- package/lib/context-menu/index.js +1 -0
- package/lib/context-menu/index.wyw-in-js.css +1 -1
- package/lib/copy-to-clipboard.js +2 -1
- package/lib/date-picker/autocomplete.js +12 -10
- package/lib/date-picker/date-range-input.js +9 -7
- package/lib/date-picker/day-with-start-end-buttons.js +0 -2
- package/lib/date-picker/get-weekends-for-month.js +4 -2
- package/lib/date-picker/relative-date-picker.js +5 -3
- package/lib/date-picker/single-date-input.js +9 -7
- package/lib/date-picker/single-date-picker.d.ts +1 -2
- package/lib/date-picker/single-date-picker.js +2 -1
- package/lib/date-picker/types.d.ts +1 -2
- package/lib/day-select/day-select.js +2 -1
- package/lib/day-select/week-day-select.d.ts +2 -2
- package/lib/day-select/week-day-select.js +4 -3
- package/lib/design-system/alpha.d.ts +6 -0
- package/lib/design-system/alpha.js +11 -7
- package/lib/design-system/colors-charts.d.ts +4 -0
- package/lib/design-system/colors-charts.js +14 -0
- package/lib/design-system/colors-js.d.ts +2 -4
- package/lib/design-system/colors-js.js +8 -10
- package/lib/design-system/fns.enum.js +7 -4
- package/lib/design-system/fns.icon.js +1 -1
- package/lib/design-system/fns.js +7 -4
- package/lib/design-system/theme.d.ts +7 -7
- package/lib/design-system/theme.js +7 -12
- package/lib/design-system/vars.js +1 -2
- package/lib/design-system.d.ts +3 -2
- package/lib/design-system.js +3 -2
- package/lib/emoji-picker/app-icon-picker.d.ts +2 -2
- package/lib/emoji-picker/emoji-picker-content-with-color.d.ts +2 -2
- package/lib/emoji-picker/emoji-picker.d.ts +2 -2
- package/lib/emoji-picker/icon-emoji-picker.d.ts +1 -2
- package/lib/emoji-picker/primitives/content.js +10 -9
- package/lib/emoji-picker/primitives/emoji.js +22 -14
- package/lib/emoji-picker/primitives/emoji.wyw-in-js.css +4 -3
- package/lib/emoji-picker/primitives/grid.js +0 -1
- package/lib/emoji-picker/primitives/preview-provider.js +4 -3
- package/lib/emoji-picker/primitives/root.js +10 -9
- package/lib/emoji-picker/primitives/skin-provider.js +5 -4
- package/lib/emoji-picker/stores/emoji-data-store.d.ts +2 -2
- package/lib/emoji-picker/stores/emoji-data-store.js +8 -8
- package/lib/emoji-picker/stores/static-emoji-data-store.js +2 -1
- package/lib/emoji.js +5 -2
- package/lib/errors.d.ts +2 -3
- package/lib/fibermoji-placeholder.js +5 -7
- package/lib/field-type-icon.js +2 -1
- package/lib/file-item/file-icon.js +2 -1
- package/lib/file-item.js +3 -10
- package/lib/guide-link.js +1 -1
- package/lib/highlight-colors.js +2 -1
- package/lib/hotkey-scope.js +2 -1
- package/lib/icons/ast/build.d.ts +5 -0
- package/lib/icons/ast/build.js +25 -0
- package/lib/icons/ast/index.d.ts +2 -4
- package/lib/icons/ast/index.js +5 -7
- package/lib/icons/ast/spinner.js +8 -15
- package/lib/icons/icon.js +4 -3
- package/lib/icons/react/{plus.d.ts → build.d.ts} +4 -4
- package/lib/icons/react/{plus.js → build.js} +6 -6
- package/lib/icons/react/index.d.ts +2 -4
- package/lib/icons/react/index.js +5 -7
- package/lib/images-gallery/get-gallery-src.js +1 -1
- package/lib/images-gallery/slide-buttons.js +8 -4
- package/lib/images-gallery/thumbnails-mime-types-white-list.js +1 -1
- package/lib/integration-compact-info-button.js +1 -2
- package/lib/is-in-popup.d.ts +1 -2
- package/lib/is-in-popup.js +6 -0
- package/lib/loaders.d.ts +1 -9
- package/lib/loaders.js +2 -39
- package/lib/loaders.wyw-in-js.css +2 -4
- package/lib/loading-sausage.js +7 -6
- package/lib/mobile-drawer.d.ts +2 -1
- package/lib/mobile-drawer.js +24 -12
- package/lib/mobile-drawer.wyw-in-js.css +4 -3
- package/lib/mobile-keyboard-aware-popup.js +6 -5
- package/lib/modal-menu/contexts/modal-menu-context.d.ts +1 -0
- package/lib/modal-menu/modal-menu-content.d.ts +1 -1
- package/lib/modal-menu/modal-menu-content.js +16 -6
- package/lib/modal-menu/modal-menu-drawer-content.d.ts +7 -0
- package/lib/modal-menu/modal-menu-drawer-content.js +13 -0
- package/lib/modal-menu/modal-menu-root.d.ts +2 -1
- package/lib/modal-menu/modal-menu-root.js +24 -21
- package/lib/modal-menu/modal-submenu.js +10 -9
- package/lib/nested-menu-item.d.ts +1 -1
- package/lib/number-input/number-input-inline-with-autosize.d.ts +1 -2
- package/lib/number-input/number-input-inline-with-autosize.js +9 -6
- package/lib/number-input/number-input-inline-with-autosize.wyw-in-js.css +0 -1
- package/lib/number-input/number-input.js +13 -11
- package/lib/number-input/styles.d.ts +1 -9
- package/lib/number-input/styles.js +3 -9
- package/lib/number-input/styles.wyw-in-js.css +2 -3
- package/lib/number-input/text-area-auto-sized.d.ts +1 -2
- package/lib/number-input/text-area-auto-sized.js +2 -2
- package/lib/number-input/text-input-auto-sized.d.ts +1 -2
- package/lib/number-input/text-input-auto-sized.js +2 -2
- package/lib/online-users.js +2 -2
- package/lib/open-popover-tracker.js +7 -6
- package/lib/palettes/neutral.js +1 -1
- package/lib/palettes/warm.js +1 -1
- package/lib/phone.js +1 -1
- package/lib/popover/index.d.ts +9 -12
- package/lib/popover/index.js +66 -75
- package/lib/popover/mobile-popover-context.js +12 -11
- package/lib/popover/mobile-popover.d.ts +2 -2
- package/lib/popover/mobile-popover.js +16 -15
- package/lib/popover/modifiers.js +4 -4
- package/lib/popover/popup-modifiers-context.d.ts +3 -5
- package/lib/preference-setting.js +6 -8
- package/lib/reactions/reaction-button.js +36 -25
- package/lib/reactions/reaction-button.wyw-in-js.css +16 -16
- package/lib/reactions/reaction-picker.js +22 -10
- package/lib/reactions/reaction-picker.wyw-in-js.css +1 -0
- package/lib/reactions/tootltip.js +2 -1
- package/lib/select/components/drop-down-indicator.js +1 -1
- package/lib/select/components/menu-list-virtualized.js +1 -1
- package/lib/select/components/option.js +2 -1
- package/lib/select/index.d.ts +2 -1
- package/lib/select/select-in-popover.js +1 -1
- package/lib/select/select-trigger.d.ts +4 -0
- package/lib/select/select-trigger.js +25 -0
- package/lib/select/select-trigger.wyw-in-js.css +1 -0
- package/lib/select/select.d.ts +6 -2
- package/lib/select/select.js +13 -8
- package/lib/select/styles.js +2 -2
- package/lib/spinner.d.ts +5 -0
- package/lib/spinner.js +17 -0
- package/lib/spinner.wyw-in-js.css +1 -0
- package/lib/tab-nav/tab-nav.d.ts +4 -2
- package/lib/tab-nav/tab-nav.js +2 -2
- package/lib/thematic.js +322 -321
- package/lib/theme-provider.d.ts +1 -3
- package/lib/theme-settings-core.d.ts +13 -1
- package/lib/theme-settings-core.js +37 -1
- package/lib/theme-settings.d.ts +3 -2
- package/lib/theme-settings.js +7 -2
- package/lib/toast/toast-action.js +2 -1
- package/lib/toast/toast-provider.d.ts +1 -2
- package/lib/toast/toast-queue.d.ts +1 -2
- package/lib/toast/toast-queue.js +7 -8
- package/lib/toast/toast.js +7 -6
- package/lib/toggle.js +3 -3
- package/lib/tooltip-if-overflown.js +2 -1
- package/lib/tooltip.js +1 -1
- package/lib/type-badge.d.ts +8 -28
- package/lib/type-badge.js +39 -50
- package/lib/type-badge.wyw-in-js.css +11 -10
- package/lib/unit/container.d.ts +12 -0
- package/lib/unit/container.js +50 -0
- package/lib/unit/context.d.ts +29 -0
- package/lib/unit/context.js +9 -0
- package/lib/unit/index.d.ts +4 -2
- package/lib/unit/index.js +2 -1
- package/lib/unit/nav-button.d.ts +12 -0
- package/lib/unit/nav-button.js +18 -0
- package/lib/unit/styles.d.ts +6 -9
- package/lib/unit/styles.js +13 -16
- package/lib/unit/styles.wyw-in-js.css +10 -16
- package/lib/unit/unit-content-layout.d.ts +4 -3
- package/lib/unit/unit-content-layout.js +9 -9
- package/lib/unit/unit-content.d.ts +6 -5
- package/lib/unit/unit-content.js +83 -18
- package/lib/unit/unit-content.wyw-in-js.css +6 -2
- package/lib/unit/unit.d.ts +38 -5
- package/lib/unit/unit.js +43 -12
- package/lib/use-long-press.d.ts +6 -6
- package/lib/with-data.d.ts +35 -37
- package/lib/with-data.js +23 -22
- package/lib/workflow-progress-icon.js +2 -2
- package/package.json +4 -4
- package/lib/beta-badge.d.ts +0 -8
- package/lib/beta-badge.js +0 -13
- package/lib/beta-badge.wyw-in-js.css +0 -1
- package/lib/checkbox-multi-select.d.ts +0 -21
- package/lib/checkbox-multi-select.js +0 -41
- package/lib/checkbox-multi-select.wyw-in-js.css +0 -3
- package/lib/country-selector.d.ts +0 -9
- package/lib/country-selector.js +0 -21
- package/lib/features.d.ts +0 -8
- package/lib/features.js +0 -15
- package/lib/flags.d.ts +0 -4
- package/lib/flags.js +0 -7
- package/lib/icons/ast/alert-triangle.d.ts +0 -5
- package/lib/icons/ast/alert-triangle.js +0 -25
- package/lib/icons/ast/field-units-large.d.ts +0 -5
- package/lib/icons/ast/field-units-large.js +0 -25
- package/lib/icons/ast/plus.d.ts +0 -5
- package/lib/icons/ast/plus.js +0 -25
- package/lib/icons/react/alert-triangle.d.ts +0 -15
- package/lib/icons/react/alert-triangle.js +0 -21
- package/lib/icons/react/field-units-large.d.ts +0 -15
- package/lib/icons/react/field-units-large.js +0 -21
- package/lib/layout.d.ts +0 -28
- package/lib/layout.js +0 -66
- package/lib/layout.wyw-in-js.css +0 -2
- package/lib/new-card-placeholder.d.ts +0 -26
- package/lib/new-card-placeholder.js +0 -141
- package/lib/new-card-placeholder.wyw-in-js.css +0 -5
- package/lib/unit/primitive.d.ts +0 -5
- package/lib/unit/primitive.js +0 -108
- package/lib/unit/primitive.wyw-in-js.css +0 -3
- package/lib/unit/types.d.ts +0 -34
- package/lib/unit/types.js +0 -0
- package/lib/unit/unit-button-group.d.ts +0 -13
- package/lib/unit/unit-button-group.js +0 -23
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mixSrgb, produceColor } from "../color-utils.js";
|
|
2
|
+
import { memoizeColor } from "../memoize.js";
|
|
2
3
|
import { ensureLcFloor } from "../apca.js";
|
|
3
4
|
import { mapDef } from "./def.js";
|
|
4
|
-
import { memoizeColor } from "../memoize.js";
|
|
5
5
|
//#region src/design-system/fns.enum.ts
|
|
6
6
|
/**
|
|
7
7
|
* Card color-coding alpha used by {@link paintedCardSurface}. Cards in
|
|
@@ -10,7 +10,7 @@ import { memoizeColor } from "../memoize.js";
|
|
|
10
10
|
*/
|
|
11
11
|
var CARD_COLOR_CODING_ALPHA = .1;
|
|
12
12
|
/** CSS percentage string for the surface side of the card color-mix — pair with {@link CARD_COLOR_CODING_ALPHA}. */
|
|
13
|
-
var CARD_COLOR_CODING_SURFACE_PERCENT =
|
|
13
|
+
var CARD_COLOR_CODING_SURFACE_PERCENT = `90%`;
|
|
14
14
|
/**
|
|
15
15
|
* Reproduce the painted card surface that `box.tsx`'s `colorCodingClassName`
|
|
16
16
|
* renders, so contrast checks can target the surface a badge actually sits on
|
|
@@ -38,10 +38,13 @@ function makeEnumFn(deneutralizeFilterDef, adaptDef, enumDefs) {
|
|
|
38
38
|
const baseSurface = adaptDef[side];
|
|
39
39
|
const { swatchAlpha, minC, surfaceLc, colorCodingLc } = enumDefs.bg[side];
|
|
40
40
|
const bgFromNeutral = memoizeColor((neutralColor) => {
|
|
41
|
-
|
|
41
|
+
const tinted = tintEnum(deneutralize(neutralColor), baseSurface, swatchAlpha, minC);
|
|
42
|
+
return ensureLcFloor(tinted, baseSurface, surfaceLc);
|
|
42
43
|
});
|
|
43
44
|
const bgFromBlend = memoizeColor((neutralColor, cardColorCoding) => {
|
|
44
|
-
|
|
45
|
+
const bare = bgFromNeutral(neutralColor);
|
|
46
|
+
const paintedSurface = paintedCardSurface(cardColorCoding, baseSurface);
|
|
47
|
+
return ensureLcFloor(bare, paintedSurface, colorCodingLc);
|
|
45
48
|
}, (neutralColor, cardColorCoding) => `${neutralColor}|${cardColorCoding}`);
|
|
46
49
|
return (neutralColor, cardColorCoding) => ({ bg: cardColorCoding ? bgFromBlend(neutralColor, cardColorCoding) : bgFromNeutral(neutralColor) });
|
|
47
50
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { colorFromUnsafe, oklchFrom, produceColor } from "../color-utils.js";
|
|
2
|
+
import { memoizeColor } from "../memoize.js";
|
|
2
3
|
import { lightnessFromLc } from "../apca.js";
|
|
3
4
|
import { mapDef } from "./def.js";
|
|
4
|
-
import { memoizeColor } from "../memoize.js";
|
|
5
5
|
//#region src/design-system/fns.icon.ts
|
|
6
6
|
var ACHROMATIC_C = .015;
|
|
7
7
|
var PASTEL_C_CEILING = .06;
|
package/lib/design-system/fns.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { colorFromUnsafe, oklchFrom, produceColor } from "../color-utils.js";
|
|
2
|
+
import { memoizeColor } from "../memoize.js";
|
|
2
3
|
import { alpha } from "./alpha.js";
|
|
3
4
|
import { alphaCoefficients } from "./alpha-coefficients.js";
|
|
4
5
|
import { colorFromLcCompensated, lightnessFromLc } from "../apca.js";
|
|
5
6
|
import { mapDef } from "./def.js";
|
|
6
7
|
import { getDarkenColor } from "./colors-js.js";
|
|
7
8
|
import { a11yColor } from "../a11y-color.js";
|
|
8
|
-
import { memoizeColor } from "../memoize.js";
|
|
9
9
|
import { makeEnumFn } from "./fns.enum.js";
|
|
10
10
|
import { darkIconParams, lightIconParams, makeIconFn, makeIconSide } from "./fns.icon.js";
|
|
11
11
|
//#region src/design-system/fns.ts
|
|
@@ -60,10 +60,12 @@ function createColorFns(deneutralizeFilterDef, defs) {
|
|
|
60
60
|
typeLabelFg: mapDef(deneutralizeFilterDef, (deneutralize, side) => memoizeColor((neutralColor) => typeLabelFgAdapt[side].fg(deneutralize(neutralColor)))),
|
|
61
61
|
badge: mapDef(deneutralizeFilterDef, (deneutralize, side) => memoizeColor((neutralColor) => {
|
|
62
62
|
const oklch = oklchFrom(colorFromUnsafe(neutralColor ?? defs.icon[side]));
|
|
63
|
-
const
|
|
63
|
+
const deneutralized = neutralColor ? deneutralize(neutralColor) : defs.icon[side];
|
|
64
|
+
const darken = getDarkenColor(deneutralized);
|
|
64
65
|
const bg = icon[side](neutralColor ?? defs.icon[side]).fg;
|
|
66
|
+
const bgL = oklchFrom(colorFromUnsafe(bg))?.l ?? 0;
|
|
65
67
|
return {
|
|
66
|
-
fg: colorFromLcCompensated(bg,
|
|
68
|
+
fg: colorFromLcCompensated(bg, bgL > .8 ? 90 : -90, oklch.c, oklch.h ?? 0, deneutralize),
|
|
67
69
|
bg,
|
|
68
70
|
border: bg,
|
|
69
71
|
borderSelected: darken
|
|
@@ -76,8 +78,9 @@ function createColorFns(deneutralizeFilterDef, defs) {
|
|
|
76
78
|
const surface = defs.callout[side];
|
|
77
79
|
return memoizeColor((neutralColor) => {
|
|
78
80
|
const deneutralized = deneutralize(neutralColor);
|
|
81
|
+
const blended = a11yColor(alpha(deneutralized, alphaCoefficients.adaptiveUserColor.calloutBg[side]), surface, side === 0 ? 1 : 1.3);
|
|
79
82
|
return {
|
|
80
|
-
bg: produceColor(
|
|
83
|
+
bg: produceColor(blended, ({ l, c, h }) => {
|
|
81
84
|
const lFloor = lightnessFromLc(surface, side === 0 ? 2 : -2, c, h);
|
|
82
85
|
const lCap = lightnessFromLc(surface, side === 0 ? 20 : -20, c, h);
|
|
83
86
|
const [lo, hi] = side === 0 ? [lCap, lFloor] : [lFloor, lCap];
|
|
@@ -2,7 +2,7 @@ import { ThemePalette } from "./types.js";
|
|
|
2
2
|
import { ThemeMode } from "../theme-settings-core.js";
|
|
3
3
|
import { ThemeDefs } from "./colors.js";
|
|
4
4
|
//#region src/design-system/theme.d.ts
|
|
5
|
-
declare function themeFromDefs(defs: ThemeDefs, mode: ThemeMode
|
|
5
|
+
declare function themeFromDefs(defs: ThemeDefs, mode: ThemeMode): {
|
|
6
6
|
key: string;
|
|
7
7
|
mode: ThemeMode;
|
|
8
8
|
select: <T>(values: {
|
|
@@ -610,10 +610,10 @@ declare function themeFromDefs(defs: ThemeDefs, mode: ThemeMode, ns?: string): {
|
|
|
610
610
|
}>;
|
|
611
611
|
};
|
|
612
612
|
/** @deprecated consider extracting token, internal use only */
|
|
613
|
-
varname: (key:
|
|
613
|
+
varname: (key: string) => string;
|
|
614
614
|
};
|
|
615
615
|
type Theme = ReturnType<typeof themeFromDefs>;
|
|
616
|
-
declare function themeFromPaletteImpl(palette: ThemePalette, mode: ThemeMode
|
|
616
|
+
declare function themeFromPaletteImpl(palette: ThemePalette, mode: ThemeMode): {
|
|
617
617
|
key: string;
|
|
618
618
|
mode: ThemeMode;
|
|
619
619
|
select: <T>(values: {
|
|
@@ -1221,7 +1221,7 @@ declare function themeFromPaletteImpl(palette: ThemePalette, mode: ThemeMode, ns
|
|
|
1221
1221
|
}>;
|
|
1222
1222
|
};
|
|
1223
1223
|
/** @deprecated consider extracting token, internal use only */
|
|
1224
|
-
varname: (key:
|
|
1224
|
+
varname: (key: string) => string;
|
|
1225
1225
|
};
|
|
1226
1226
|
declare const themeFromPalette: typeof themeFromPaletteImpl & import("@fibery/helpers/src/_").MemoizedFunction<string, {
|
|
1227
1227
|
key: string;
|
|
@@ -1831,7 +1831,7 @@ declare const themeFromPalette: typeof themeFromPaletteImpl & import("@fibery/he
|
|
|
1831
1831
|
}>;
|
|
1832
1832
|
};
|
|
1833
1833
|
/** @deprecated consider extracting token, internal use only */
|
|
1834
|
-
varname: (key:
|
|
1834
|
+
varname: (key: string) => string;
|
|
1835
1835
|
}>;
|
|
1836
1836
|
type Styles = Record<string, string>;
|
|
1837
1837
|
declare const stylesFromTheme: ((arg: Pick<{
|
|
@@ -2442,7 +2442,7 @@ declare const stylesFromTheme: ((arg: Pick<{
|
|
|
2442
2442
|
}>;
|
|
2443
2443
|
};
|
|
2444
2444
|
/** @deprecated consider extracting token, internal use only */
|
|
2445
|
-
varname: (key:
|
|
2445
|
+
varname: (key: string) => string;
|
|
2446
2446
|
}, "colors" | "varname">) => Styles) & import("@fibery/helpers/src/_").MemoizedFunction<Pick<{
|
|
2447
2447
|
key: string;
|
|
2448
2448
|
mode: ThemeMode;
|
|
@@ -3051,7 +3051,7 @@ declare const stylesFromTheme: ((arg: Pick<{
|
|
|
3051
3051
|
}>;
|
|
3052
3052
|
};
|
|
3053
3053
|
/** @deprecated consider extracting token, internal use only */
|
|
3054
|
-
varname: (key:
|
|
3054
|
+
varname: (key: string) => string;
|
|
3055
3055
|
}, "colors" | "varname">, Styles>;
|
|
3056
3056
|
//#endregion
|
|
3057
3057
|
export { Styles, Theme, stylesFromTheme, themeFromDefs, themeFromPalette };
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { makeSelect } from "./colors-js.js";
|
|
2
2
|
import { defsFromPalette, sideFromDefs } from "./colors.js";
|
|
3
|
-
import {
|
|
4
|
-
import { typedObjectEntries } from "@fibery/helpers/utils/object";
|
|
3
|
+
import { memoizeLeak, memoizeWeak } from "@fibery/helpers/src/_";
|
|
5
4
|
import { LRUCache } from "lru-cache";
|
|
6
5
|
//#region src/design-system/theme.ts
|
|
7
|
-
function
|
|
8
|
-
if (ns === void 0) return (key) => `--${key}`;
|
|
9
|
-
else return (key) => `--${ns}-${key}`;
|
|
10
|
-
}
|
|
11
|
-
function themeFromDefs(defs, mode, ns) {
|
|
6
|
+
function themeFromDefs(defs, mode) {
|
|
12
7
|
const { colors, fns } = sideFromDefs(defs, mode);
|
|
13
8
|
return {
|
|
14
9
|
key: `${defs.key}-${mode}`,
|
|
@@ -17,16 +12,16 @@ function themeFromDefs(defs, mode, ns) {
|
|
|
17
12
|
colors,
|
|
18
13
|
fns,
|
|
19
14
|
/** @deprecated consider extracting token, internal use only */
|
|
20
|
-
varname:
|
|
15
|
+
varname: (key) => `--${key}`
|
|
21
16
|
};
|
|
22
17
|
}
|
|
23
|
-
function themeFromPaletteImpl(palette, mode
|
|
24
|
-
return themeFromDefs(defsFromPalette(palette), mode
|
|
18
|
+
function themeFromPaletteImpl(palette, mode) {
|
|
19
|
+
return themeFromDefs(defsFromPalette(palette), mode);
|
|
25
20
|
}
|
|
26
|
-
var themeFromPalette =
|
|
21
|
+
var themeFromPalette = memoizeLeak(themeFromPaletteImpl, (palette, mode) => `${palette.key}-${mode}`);
|
|
27
22
|
themeFromPalette.cache = new LRUCache({ max: 4 });
|
|
28
23
|
function stylesFromThemeImpl(theme) {
|
|
29
|
-
return
|
|
24
|
+
return Object.entries(theme.colors).reduce((inlineTheme, [key, value]) => {
|
|
30
25
|
inlineTheme[theme.varname(key)] = value;
|
|
31
26
|
return inlineTheme;
|
|
32
27
|
}, {});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { typedObjectEntries } from "@fibery/helpers/utils/object";
|
|
2
1
|
//#region src/design-system/vars.ts
|
|
3
2
|
function varsFromTheme(theme) {
|
|
4
3
|
const vars = {};
|
|
5
|
-
for (const [key, value] of
|
|
4
|
+
for (const [key, value] of Object.entries(theme.colors)) vars[key] = `var(${theme.varname(key)})`;
|
|
6
5
|
return vars;
|
|
7
6
|
}
|
|
8
7
|
function layoutVarNamesFromPrefix(prefix) {
|
package/lib/design-system.d.ts
CHANGED
|
@@ -5,10 +5,11 @@ import { alphaCoefficients } from "./design-system/alpha-coefficients.js";
|
|
|
5
5
|
import { durations, tooltipDelay, transition, transitionDuration, transitions } from "./design-system/animation.js";
|
|
6
6
|
import { ThemeDefs, cardTypeColors } from "./design-system/colors.js";
|
|
7
7
|
import { dropCursorColor, getBgSwatchBorderColor, getBgSwatchFillColor, getEnumTextColor, getLinearGradient, shadows } from "./design-system/colors-css.js";
|
|
8
|
-
import { getDarkenColor,
|
|
8
|
+
import { getDarkenColor, getObjectColor } from "./design-system/colors-js.js";
|
|
9
|
+
import { palette } from "./design-system/colors-charts.js";
|
|
9
10
|
import { dateFormat, dateTimeFormat, timeFormat } from "./design-system/date.js";
|
|
10
11
|
import { border, iconSize, layout, minPanelWidth, space, spaceNestedTreeInterval, spaceNestedTreeLevel, viewBoxSize } from "./design-system/layout.js";
|
|
11
12
|
import { Styles, Theme, stylesFromTheme, themeFromPalette } from "./design-system/theme.js";
|
|
12
13
|
import { fontFamily, fontFamilyCode, fontSize, fontWeight, lineHeight, tabularNumsClasses, tabularNumsOff, tabularNumsOn, textClasses, textStyles } from "./design-system/typography.js";
|
|
13
14
|
import { layoutVars, listRowSurfaceFontSizeVar, menuItemHeightVar, sidebarMenuIconSizeVar, sidebarMenuItemHeightVar, themeVars } from "./theming.generated.js";
|
|
14
|
-
export { type ColorScale, type Def, type DefMapper, type Defs, type EnumDefs, type HighlightDefs, type HighlightHueName, type HighlightHueNameCap, type ModeDef, type OneBasedScale, type Styles, Swatch, type Theme, type ThemeDefs, type ThemePalette, type ThemePaletteBase, type ThemePaletteCore, type ZeroBasedScale, alpha, alphaCoefficients, border, cardTypeColors, dateFormat, dateTimeFormat, defineAlphaCoefficient, dropCursorColor, durations, fontFamily, fontFamilyCode, fontSize, fontWeight, getBgSwatchBorderColor, getBgSwatchFillColor, getDarkenColor, getEnumTextColor, getLinearGradient,
|
|
15
|
+
export { type ColorScale, type Def, type DefMapper, type Defs, type EnumDefs, type HighlightDefs, type HighlightHueName, type HighlightHueNameCap, type ModeDef, type OneBasedScale, type Styles, Swatch, type Theme, type ThemeDefs, type ThemePalette, type ThemePaletteBase, type ThemePaletteCore, type ZeroBasedScale, alpha, alphaCoefficients, border, cardTypeColors, palette as chartColorPalette, dateFormat, dateTimeFormat, defineAlphaCoefficient, dropCursorColor, durations, fontFamily, fontFamilyCode, fontSize, fontWeight, getBgSwatchBorderColor, getBgSwatchFillColor, getDarkenColor, getEnumTextColor, getLinearGradient, getObjectColor, iconSize, layout, layoutVars, lineHeight, listRowSurfaceFontSizeVar, menuItemHeightVar, minPanelWidth, opacity, shadows, sidebarMenuIconSizeVar, sidebarMenuItemHeightVar, space, spaceNestedTreeInterval, spaceNestedTreeLevel, stylesFromTheme, swatches, tabularNumsClasses, tabularNumsOff, tabularNumsOn, textClasses, textStyles, themeFromPalette, themeVars, timeFormat, tooltipDelay, transition, transitionDuration, transitions, viewBoxSize };
|
package/lib/design-system.js
CHANGED
|
@@ -2,12 +2,13 @@ import { alpha, defineAlphaCoefficient, opacity } from "./design-system/alpha.js
|
|
|
2
2
|
import { Swatch, swatches } from "./design-system/colors-swatches.js";
|
|
3
3
|
import { alphaCoefficients } from "./design-system/alpha-coefficients.js";
|
|
4
4
|
import { durations, tooltipDelay, transition, transitionDuration, transitions } from "./design-system/animation.js";
|
|
5
|
-
import { getDarkenColor,
|
|
5
|
+
import { getDarkenColor, getObjectColor } from "./design-system/colors-js.js";
|
|
6
6
|
import { cardTypeColors } from "./design-system/colors.js";
|
|
7
7
|
import { layoutVars, listRowSurfaceFontSizeVar, menuItemHeightVar, sidebarMenuIconSizeVar, sidebarMenuItemHeightVar, themeVars } from "./theming.generated.js";
|
|
8
8
|
import { dropCursorColor, getBgSwatchBorderColor, getBgSwatchFillColor, getEnumTextColor, getLinearGradient, shadows } from "./design-system/colors-css.js";
|
|
9
|
+
import { palette } from "./design-system/colors-charts.js";
|
|
9
10
|
import { dateFormat, dateTimeFormat, timeFormat } from "./design-system/date.js";
|
|
10
11
|
import { border, iconSize, layout, minPanelWidth, space, spaceNestedTreeInterval, spaceNestedTreeLevel, viewBoxSize } from "./design-system/layout.js";
|
|
11
12
|
import { stylesFromTheme, themeFromPalette } from "./design-system/theme.js";
|
|
12
13
|
import { fontFamily, fontFamilyCode, fontSize, fontWeight, lineHeight, tabularNumsClasses, tabularNumsOff, tabularNumsOn, textClasses, textStyles } from "./design-system/typography.js";
|
|
13
|
-
export { Swatch, alpha, alphaCoefficients, border, cardTypeColors, dateFormat, dateTimeFormat, defineAlphaCoefficient, dropCursorColor, durations, fontFamily, fontFamilyCode, fontSize, fontWeight, getBgSwatchBorderColor, getBgSwatchFillColor, getDarkenColor, getEnumTextColor, getLinearGradient,
|
|
14
|
+
export { Swatch, alpha, alphaCoefficients, border, cardTypeColors, palette as chartColorPalette, dateFormat, dateTimeFormat, defineAlphaCoefficient, dropCursorColor, durations, fontFamily, fontFamilyCode, fontSize, fontWeight, getBgSwatchBorderColor, getBgSwatchFillColor, getDarkenColor, getEnumTextColor, getLinearGradient, getObjectColor, iconSize, layout, layoutVars, lineHeight, listRowSurfaceFontSizeVar, menuItemHeightVar, minPanelWidth, opacity, shadows, sidebarMenuIconSizeVar, sidebarMenuItemHeightVar, space, spaceNestedTreeInterval, spaceNestedTreeLevel, stylesFromTheme, swatches, tabularNumsClasses, tabularNumsOff, tabularNumsOn, textClasses, textStyles, themeFromPalette, themeVars, timeFormat, tooltipDelay, transition, transitionDuration, transitions, viewBoxSize };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EmojiPickerContentWithColorProps } from "./emoji-picker-content-with-color.js";
|
|
2
2
|
import { EmojiItem } from "@fibery/emoji-data";
|
|
3
3
|
//#region src/emoji-picker/app-icon-picker.d.ts
|
|
4
4
|
type AppIconPickerProps = {
|
|
@@ -6,7 +6,7 @@ type AppIconPickerProps = {
|
|
|
6
6
|
emojiSize?: number;
|
|
7
7
|
getHoverColor?: (color: string) => string | undefined;
|
|
8
8
|
colors?: string[];
|
|
9
|
-
onColorSelect?:
|
|
9
|
+
onColorSelect?: EmojiPickerContentWithColorProps["onColorSelect"];
|
|
10
10
|
onSelect: (emoji: EmojiItem) => void;
|
|
11
11
|
autoFocus?: boolean;
|
|
12
12
|
showColorPicker?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ColorPickerProps } from "../color-picker/index.js";
|
|
2
2
|
import { EmojiPickerGridProps } from "./primitives/grid.js";
|
|
3
3
|
//#region src/emoji-picker/emoji-picker-content-with-color.d.ts
|
|
4
4
|
type EmojiPickerContentWithColorProps = {
|
|
@@ -6,7 +6,7 @@ type EmojiPickerContentWithColorProps = {
|
|
|
6
6
|
getHoverColor?: (color: string) => string | undefined;
|
|
7
7
|
getColorOverrideFn?: (color: string) => string;
|
|
8
8
|
colors?: string[];
|
|
9
|
-
onColorSelect?:
|
|
9
|
+
onColorSelect?: ColorPickerProps["onChangeComplete"];
|
|
10
10
|
searchRef?: React.RefObject<HTMLInputElement>;
|
|
11
11
|
searchAutofocus?: boolean;
|
|
12
12
|
} & Pick<EmojiPickerGridProps, "renderEmoji">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EmojiPickerContentWithColorProps } from "./emoji-picker-content-with-color.js";
|
|
2
2
|
import { EmojiItem } from "@fibery/emoji-data";
|
|
3
3
|
//#region src/emoji-picker/emoji-picker.d.ts
|
|
4
4
|
type EmojiPickerProps = {
|
|
@@ -6,7 +6,7 @@ type EmojiPickerProps = {
|
|
|
6
6
|
emojiSize?: number;
|
|
7
7
|
getHoverColor?: (color: string) => string | undefined;
|
|
8
8
|
colors?: string[];
|
|
9
|
-
onColorSelect?:
|
|
9
|
+
onColorSelect?: EmojiPickerContentWithColorProps["onColorSelect"];
|
|
10
10
|
onCustomCategorySettings?: () => void;
|
|
11
11
|
onAddCustomEmoji?: () => void;
|
|
12
12
|
onSelect: (emoji: EmojiItem) => void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { $TSFixMe } from "../tsfixme.js";
|
|
2
1
|
import { AppIconPickerProps } from "./app-icon-picker.js";
|
|
3
2
|
import { EmojiPickerProps } from "./emoji-picker.js";
|
|
4
3
|
//#region src/emoji-picker/icon-emoji-picker.d.ts
|
|
@@ -6,7 +5,7 @@ type TabKey = "icons" | "emojis";
|
|
|
6
5
|
type IconEmojiPickerProps = React.PropsWithChildren<{
|
|
7
6
|
onIconSelect?: AppIconPickerProps["onSelect"];
|
|
8
7
|
onEmojiSelect?: EmojiPickerProps["onSelect"];
|
|
9
|
-
onColorSelect?:
|
|
8
|
+
onColorSelect?: AppIconPickerProps["onColorSelect"];
|
|
10
9
|
onCreateClick?: () => void;
|
|
11
10
|
onCustomEmojisSettings?: () => void;
|
|
12
11
|
onReset?: () => void;
|
|
@@ -11,16 +11,17 @@ var [Provider, useCtx] = createContext$1("EmojiPickerContentSettings");
|
|
|
11
11
|
var EmojiPickerContent = ({ emojiHoverColor, perLine = 9, emojiSize = 20, children }) => {
|
|
12
12
|
const width = perLine * (emojiSize + emojiPadding * 2) + contentHorizontalPadding * 2 + measureScrollbar();
|
|
13
13
|
const emojiContainerSize = emojiSize + emojiPadding * 2;
|
|
14
|
+
const contentSettings = useMemo(() => ({
|
|
15
|
+
emojiContainerSize,
|
|
16
|
+
emojiSize,
|
|
17
|
+
perLine
|
|
18
|
+
}), [
|
|
19
|
+
emojiContainerSize,
|
|
20
|
+
emojiSize,
|
|
21
|
+
perLine
|
|
22
|
+
]);
|
|
14
23
|
return /* @__PURE__ */ jsx(Provider, {
|
|
15
|
-
value:
|
|
16
|
-
emojiContainerSize,
|
|
17
|
-
emojiSize,
|
|
18
|
-
perLine
|
|
19
|
-
}), [
|
|
20
|
-
emojiContainerSize,
|
|
21
|
-
emojiSize,
|
|
22
|
-
perLine
|
|
23
|
-
]),
|
|
24
|
+
value: contentSettings,
|
|
24
25
|
children: jsx("div", {
|
|
25
26
|
style: {
|
|
26
27
|
"--fibery-emoji-container-size": `${emojiContainerSize}px`,
|
|
@@ -9,8 +9,11 @@ import { traceError } from "@fibery/helpers/utils/trace";
|
|
|
9
9
|
//#region src/emoji-picker/primitives/emoji.tsx
|
|
10
10
|
var emojiWrapperCss = "e1tcs44j-emojiWrapper";
|
|
11
11
|
var emojiWrapperSizedCss = "e1tcpvam-emojiWrapperSized";
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var nativeStrikePx = 32;
|
|
13
|
+
var scaleNativeBelowPx = 24;
|
|
14
|
+
var nativeScaledCss = "n1ufy8i3-nativeScaled";
|
|
15
|
+
var emojiInlineImgCss = "e1im6ocj-emojiInlineImg";
|
|
16
|
+
var emojiSizedImgCss = "e1tco1tx-emojiSizedImg";
|
|
14
17
|
var emptyPixel = "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
|
|
15
18
|
function getTitle(emoji) {
|
|
16
19
|
if (emoji.native) return emoji.colons;
|
|
@@ -22,18 +25,23 @@ var Emoji = forwardRef(({ className, emoji: idOrColons, size, version = 14, fall
|
|
|
22
25
|
const config = useEmojiRenderConfig();
|
|
23
26
|
if (!emoji) return fallback === "shortcode" ? /* @__PURE__ */ jsx(Fragment, { children: idOrColons }) : null;
|
|
24
27
|
let emojiNode;
|
|
25
|
-
if ("native" in emoji)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
if ("native" in emoji) {
|
|
29
|
+
if (native && version >= emoji.version) emojiNode = size && size < scaleNativeBelowPx ? /* @__PURE__ */ jsx("span", {
|
|
30
|
+
className: nativeScaledCss,
|
|
31
|
+
style: { "--fibery-emoji-native-scale": size / nativeStrikePx },
|
|
32
|
+
children: emoji.native
|
|
33
|
+
}) : emoji.native;
|
|
34
|
+
else emojiNode = /* @__PURE__ */ jsx("img", {
|
|
35
|
+
alt: emoji.name,
|
|
36
|
+
className: cx(size ? emojiSizedImgCss : emojiInlineImgCss),
|
|
37
|
+
src: emptyPixel,
|
|
38
|
+
style: {
|
|
39
|
+
backgroundImage: `url(${emoji.sprite.src})`,
|
|
40
|
+
backgroundSize: emoji.sprite.size,
|
|
41
|
+
backgroundPosition: emoji.sprite.position
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
} else emojiNode = /* @__PURE__ */ jsx("img", {
|
|
37
45
|
alt: emoji.name,
|
|
38
46
|
loading: config.loading,
|
|
39
47
|
draggable: config.draggable,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
.e1tcs44j-emojiWrapper{color:var(--textColor);font-family:"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Segoe UI","Twemoji Mozilla","Noto Color Emoji","Android Emoji";line-height:1;}
|
|
2
|
-
.e1tcpvam-emojiWrapperSized{display:inline-flex;align-items:center;justify-content:center;}
|
|
3
|
-
.
|
|
4
|
-
.e1im6ocj-
|
|
2
|
+
.e1tcpvam-emojiWrapperSized{position:relative;display:inline-flex;align-items:center;justify-content:center;}
|
|
3
|
+
@supports (-webkit-hyphens: none){.n1ufy8i3-nativeScaled{position:absolute;top:50%;left:50%;font-size:32px;line-height:1;transform-origin:center;transform:translate(-50%, -50%) scale(var(--fibery-emoji-native-scale));}}
|
|
4
|
+
.e1im6ocj-emojiInlineImg{display:inline-block;width:1em;height:1em;vertical-align:-0.1em;object-fit:contain;overflow:hidden;-webkit-touch-callout:none;}
|
|
5
|
+
.e1tco1tx-emojiSizedImg{width:100%;height:100%;object-fit:contain;overflow:hidden;-webkit-touch-callout:none;}
|
|
@@ -6,10 +6,11 @@ var [SetterProvider, useSetterCtx] = createContext$1("EmojiPreviewSetterProvider
|
|
|
6
6
|
var [ValueProvider, useValueCtx] = createContext$1("EmojiPreviewProvider");
|
|
7
7
|
var EmojiPreviewProvider = ({ children }) => {
|
|
8
8
|
const [preview, setPreview] = useState(null);
|
|
9
|
+
const setter = useCallback((v) => {
|
|
10
|
+
setPreview(v);
|
|
11
|
+
}, []);
|
|
9
12
|
return /* @__PURE__ */ jsx(SetterProvider, {
|
|
10
|
-
value:
|
|
11
|
-
setPreview(v);
|
|
12
|
-
}, []),
|
|
13
|
+
value: setter,
|
|
13
14
|
children: /* @__PURE__ */ jsx(ValueProvider, {
|
|
14
15
|
value: preview,
|
|
15
16
|
children
|
|
@@ -46,16 +46,17 @@ var EmojiPickerRoot = ({ i18n, onEmojiSelect, onCustomCategorySettings, children
|
|
|
46
46
|
}), [i18n]);
|
|
47
47
|
const onEmojiSelectCb = useCallbackRef(onEmojiSelect);
|
|
48
48
|
const onCustomCategorySettingsCb = useCallbackRef(onCustomCategorySettings);
|
|
49
|
+
const emojiPickerCtx = useMemo(() => ({
|
|
50
|
+
version: detectEmojiSupportLevel(),
|
|
51
|
+
native: isApple(),
|
|
52
|
+
onCustomCategorySettings: onCustomCategorySettingsCb,
|
|
53
|
+
onEmojiSelect(emoji) {
|
|
54
|
+
onEmojiSelectCb(emoji);
|
|
55
|
+
add(emoji.id);
|
|
56
|
+
}
|
|
57
|
+
}), [onEmojiSelectCb, onCustomCategorySettingsCb]);
|
|
49
58
|
return /* @__PURE__ */ jsx(Provider, {
|
|
50
|
-
value:
|
|
51
|
-
version: detectEmojiSupportLevel(),
|
|
52
|
-
native: isApple(),
|
|
53
|
-
onCustomCategorySettings: onCustomCategorySettingsCb,
|
|
54
|
-
onEmojiSelect(emoji) {
|
|
55
|
-
onEmojiSelectCb(emoji);
|
|
56
|
-
add(emoji.id);
|
|
57
|
-
}
|
|
58
|
-
}), [onEmojiSelectCb, onCustomCategorySettingsCb]),
|
|
59
|
+
value: emojiPickerCtx,
|
|
59
60
|
children: /* @__PURE__ */ jsx(EmojiPreviewProvider, { children: /* @__PURE__ */ jsx(EmojiSkinProvider, { children: /* @__PURE__ */ jsx(EmojiPickerSearchProvider, { children: /* @__PURE__ */ jsx(I18NProvider, {
|
|
60
61
|
value: mergedI18N,
|
|
61
62
|
children
|
|
@@ -7,11 +7,12 @@ var [SetterProvider, useSetterCtx] = createContext$1("EmojiSkinSetterProvider");
|
|
|
7
7
|
var [ValueProvider, useValueCtx] = createContext$1("EmojiSkinProvider");
|
|
8
8
|
var EmojiSkinProvider = ({ children }) => {
|
|
9
9
|
const [skin, setSkin] = useState(() => get("skin") || 1);
|
|
10
|
+
const setter = useCallback((v) => {
|
|
11
|
+
update({ skin: v });
|
|
12
|
+
setSkin(v);
|
|
13
|
+
}, []);
|
|
10
14
|
return /* @__PURE__ */ jsx(SetterProvider, {
|
|
11
|
-
value:
|
|
12
|
-
update({ skin: v });
|
|
13
|
-
setSkin(v);
|
|
14
|
-
}, []),
|
|
15
|
+
value: setter,
|
|
15
16
|
children: /* @__PURE__ */ jsx(ValueProvider, {
|
|
16
17
|
value: skin,
|
|
17
18
|
children
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EmojiData } from "@fibery/emoji-data";
|
|
2
|
-
import {
|
|
2
|
+
import { Subject } from "@fibery/helpers/src/subject";
|
|
3
3
|
//#region src/emoji-picker/stores/emoji-data-store.d.ts
|
|
4
4
|
type EmojiDataStore = EmojiData & {
|
|
5
|
-
|
|
5
|
+
subject: Subject;
|
|
6
6
|
};
|
|
7
7
|
declare const makeEmojiDataStore: (emojiData: EmojiData) => EmojiDataStore;
|
|
8
8
|
declare const EmojiDataStoreProvider: import("react").Provider<EmojiDataStore>;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { useSyncExternalStore } from "react";
|
|
2
2
|
import { createContext as createContext$1 } from "@fibery/react/src/create-context";
|
|
3
|
-
import {
|
|
3
|
+
import { makeSubject } from "@fibery/helpers/src/subject";
|
|
4
4
|
//#region src/emoji-picker/stores/emoji-data-store.tsx
|
|
5
5
|
var makeEmojiDataStore = (emojiData) => {
|
|
6
|
-
const
|
|
6
|
+
const subject = makeSubject();
|
|
7
7
|
return {
|
|
8
8
|
...emojiData,
|
|
9
9
|
setData(...args) {
|
|
10
10
|
emojiData.setData(...args);
|
|
11
|
-
|
|
11
|
+
subject.publish();
|
|
12
12
|
},
|
|
13
13
|
setCustom(...args) {
|
|
14
14
|
emojiData.setCustom(...args);
|
|
15
|
-
|
|
15
|
+
subject.publish();
|
|
16
16
|
},
|
|
17
17
|
addCustomEmoji(...args) {
|
|
18
18
|
emojiData.addCustomEmoji(...args);
|
|
19
|
-
|
|
19
|
+
subject.publish();
|
|
20
20
|
},
|
|
21
21
|
removeCustomEmoji(...args) {
|
|
22
22
|
emojiData.removeCustomEmoji(...args);
|
|
23
|
-
|
|
23
|
+
subject.publish();
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
subject
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
var [DataStoreProvider, useDataStoreCtx] = createContext$1("EmojiDataStore");
|
|
@@ -30,7 +30,7 @@ var EmojiDataStoreProvider = DataStoreProvider;
|
|
|
30
30
|
var useEmojiDataStore = useDataStoreCtx;
|
|
31
31
|
var useEmojiDataStoreSelector = (getter) => {
|
|
32
32
|
const dataStore = useDataStoreCtx();
|
|
33
|
-
return useSyncExternalStore(dataStore.
|
|
33
|
+
return useSyncExternalStore(dataStore.subject.subscribe, () => getter(dataStore));
|
|
34
34
|
};
|
|
35
35
|
var getIsInitialized = (store) => store.getIsInitialized();
|
|
36
36
|
var useIsInitializedEmojiDataStore = () => useEmojiDataStoreSelector(getIsInitialized);
|
|
@@ -12,8 +12,9 @@ import rawData from "@fibery/emoji-data/data";
|
|
|
12
12
|
*/
|
|
13
13
|
var StaticEmojiDataStore = ({ children }) => {
|
|
14
14
|
const emojiData = useMemo(() => makeEmojiData(rawData, { set: getEmojiSet() }), []);
|
|
15
|
+
const emojiDataStore = useMemo(() => makeEmojiDataStore(emojiData), [emojiData]);
|
|
15
16
|
return /* @__PURE__ */ jsx(EmojiDataStoreProvider, {
|
|
16
|
-
value:
|
|
17
|
+
value: emojiDataStore,
|
|
17
18
|
children
|
|
18
19
|
});
|
|
19
20
|
};
|
package/lib/emoji.js
CHANGED
|
@@ -18,13 +18,16 @@ var StyledEmoji = /*#__PURE__*/ styled("span")({
|
|
|
18
18
|
});
|
|
19
19
|
/** @deprecated Use Emoji from emoji-picker instead */
|
|
20
20
|
var Emoji = ({ symbol, label = "", size = 1.4, inline = true, onClick }) => {
|
|
21
|
+
const ariaLabelProps = {
|
|
22
|
+
...label && { label },
|
|
23
|
+
...!label && { "aria-hidden": true }
|
|
24
|
+
};
|
|
21
25
|
return /* @__PURE__ */ jsx(StyledEmoji, {
|
|
22
26
|
size,
|
|
23
27
|
inline,
|
|
24
28
|
role: "img",
|
|
25
29
|
onClick,
|
|
26
|
-
...
|
|
27
|
-
...!label && { "aria-hidden": true },
|
|
30
|
+
...ariaLabelProps,
|
|
28
31
|
children: symbol
|
|
29
32
|
});
|
|
30
33
|
};
|
package/lib/errors.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { $TSFixMe } from "./tsfixme.js";
|
|
2
1
|
//#region src/errors.d.ts
|
|
3
2
|
declare class MissingArgError extends Error {
|
|
4
3
|
constructor(arg: string);
|
|
5
4
|
}
|
|
6
|
-
declare const throwError: (message: string) =>
|
|
7
|
-
declare const throwMissingArgError: (arg: string) =>
|
|
5
|
+
declare const throwError: (message: string) => never;
|
|
6
|
+
declare const throwMissingArgError: (arg: string) => never;
|
|
8
7
|
declare const asError: (x: unknown) => Error;
|
|
9
8
|
//#endregion
|
|
10
9
|
export { MissingArgError, asError, throwError, throwMissingArgError };
|
|
@@ -3,10 +3,9 @@ import { textClasses } from "./design-system/typography.js";
|
|
|
3
3
|
import { useTheme } from "./theme-provider.js";
|
|
4
4
|
import { abbreviateName } from "./abbreviate-name.js";
|
|
5
5
|
import { cyrb53, getAvatarColors, getAvatarNeutralColors } from "./avatar-colors.js";
|
|
6
|
-
import { useFeatures } from "./features.js";
|
|
7
6
|
import LockFilled from "./icons/react/lock-filled.js";
|
|
8
7
|
/* empty css */
|
|
9
|
-
import {
|
|
8
|
+
import { isFlagPresent } from "@fibery/helpers/src/flags";
|
|
10
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
10
|
import { useEffect, useRef } from "react";
|
|
12
11
|
import { cx } from "@linaria/core";
|
|
@@ -16,19 +15,18 @@ var mouths = [
|
|
|
16
15
|
`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="16" viewBox="0 0 32 16" fill="none"><ellipse cx="16" cy="10" rx="8" ry="6" fill="currentColor"/></svg>`,
|
|
17
16
|
`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="16" viewBox="0 0 32 16" fill="none"><g clip-path="url(#clip0_31_1134)"><path d="M4.23177 12.4853C2.41601 11.1761 1.06315 9.59547 0.249133 7.87572C-0.702621 5.86498 1.22002 4 3.51791 4L7 4C7.55229 4 8 4.44772 8 5V13.0522C8 13.7579 7.28869 14.2398 6.6548 13.9296C5.79179 13.5074 4.97984 13.0247 4.23177 12.4853Z" fill="currentColor"/><path d="M31.7509 7.87572C30.9369 9.59547 29.584 11.1761 27.7682 12.4853C27.0202 13.0247 26.2082 13.5074 25.3452 13.9296C24.7113 14.2398 24 13.7579 24 13.0522L24 5C24 4.44772 24.4477 4 25 4L28.4821 4C30.78 4 32.7026 5.86498 31.7509 7.87572Z" fill="currentColor"/><path d="M16 16C14.564 16 13.1472 15.8662 11.7816 15.6082C11.3227 15.5215 11 15.1143 11 14.6473V5C11 4.44772 11.4477 4 12 4L20 4C20.5523 4 21 4.44772 21 5V14.6473C21 15.1143 20.6773 15.5215 20.2184 15.6082C18.8528 15.8662 17.436 16 16 16Z" fill="currentColor"/></g><defs><clipPath id="clip0_31_1134"><rect width="32" height="16" fill="white"/></clipPath></defs></svg>`
|
|
18
17
|
];
|
|
19
|
-
|
|
18
|
+
function getMouth(v) {
|
|
20
19
|
const salted = v + "::mouth";
|
|
21
20
|
return mouths[Math.floor(cyrb53(salted) / Math.pow(2, 53) * mouths.length)];
|
|
22
|
-
}
|
|
21
|
+
}
|
|
23
22
|
var FibermojiPlaceholder = ({ size, radius = "50%", title, hasAccess = true, seed = title ?? "unknown" }) => {
|
|
24
23
|
const eyes = useRef(null);
|
|
25
24
|
const theme = useTheme();
|
|
26
25
|
const { fg, bg } = hasAccess ? getAvatarColors(seed, theme) : getAvatarNeutralColors(theme);
|
|
27
26
|
const mouth = getMouth(seed);
|
|
28
27
|
const letters = abbreviateName(title).split("");
|
|
29
|
-
const features = useFeatures();
|
|
30
28
|
useEffect(() => {
|
|
31
|
-
if (!
|
|
29
|
+
if (!isFlagPresent("animate-avatar-placeholders")) return;
|
|
32
30
|
if (window.matchMedia(`(prefers-reduced-motion: reduce)`).matches) return;
|
|
33
31
|
const listener = (event) => {
|
|
34
32
|
if (!eyes.current) return;
|
|
@@ -49,7 +47,7 @@ var FibermojiPlaceholder = ({ size, radius = "50%", title, hasAccess = true, see
|
|
|
49
47
|
};
|
|
50
48
|
window.addEventListener("mousemove", listener);
|
|
51
49
|
return () => window.removeEventListener("mousemove", listener);
|
|
52
|
-
}, [size
|
|
50
|
+
}, [size]);
|
|
53
51
|
if (!hasAccess) return /* @__PURE__ */ jsx("div", {
|
|
54
52
|
className: "c12gmwzq",
|
|
55
53
|
style: {
|
package/lib/field-type-icon.js
CHANGED
|
@@ -66,7 +66,8 @@ function getFieldIconComponent(iconName) {
|
|
|
66
66
|
return iconName && iconNameToComponent[iconName] || App;
|
|
67
67
|
}
|
|
68
68
|
function FieldTypeIcon({ iconName, color, containerSize, iconSize }) {
|
|
69
|
-
|
|
69
|
+
const Icon = getFieldIconComponent(iconName);
|
|
70
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
70
71
|
color,
|
|
71
72
|
containerSize,
|
|
72
73
|
iconSize
|
|
@@ -18,7 +18,8 @@ function getFileIconComponent(contentType) {
|
|
|
18
18
|
return FileOther;
|
|
19
19
|
}
|
|
20
20
|
function FileIcon({ contentType }) {
|
|
21
|
-
|
|
21
|
+
const Component = getFileIconComponent(contentType);
|
|
22
|
+
return /* @__PURE__ */ jsx(Component, {});
|
|
22
23
|
}
|
|
23
24
|
var ArchiveContentTypes = [
|
|
24
25
|
"application/zip",
|