@fibery/ui-kit 13.0.1 → 14.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.
Files changed (73) hide show
  1. package/lib/actions-menu/actions-menu-item.js +4 -3
  2. package/lib/actions-menu/actions-menu-sub-command-menu.d.ts +2 -0
  3. package/lib/actions-menu/actions-menu-sub-command-menu.js +3 -2
  4. package/lib/actions-menu/actions-menu.js +2 -2
  5. package/lib/actions-menu/context-actions-menu.js +2 -2
  6. package/lib/banner/banner.wyw-in-js.css +2 -2
  7. package/lib/button/button.js +2 -1
  8. package/lib/color-picker/color-picker-or-loader.d.ts +5 -0
  9. package/lib/color-picker/color-picker-or-loader.js +18 -5
  10. package/lib/color-picker/color-picker-or-loader.wyw-in-js.css +1 -1
  11. package/lib/color-picker/index.js +5 -5
  12. package/lib/color-picker/index.wyw-in-js.css +4 -5
  13. package/lib/color-picker/swatch-grid.d.ts +11 -0
  14. package/lib/color-picker/swatch-grid.js +14 -0
  15. package/lib/color-picker/swatch-grid.wyw-in-js.css +1 -0
  16. package/lib/color-picker/swatch.js +2 -9
  17. package/lib/command-menu/nested-command-menu.js +1 -1
  18. package/lib/date-picker/date-range-picker-popup-content.js +7 -3
  19. package/lib/date-picker/date-range-picker.js +3 -2
  20. package/lib/date-picker/single-date-picker-popup-content.js +1 -1
  21. package/lib/date-picker/single-date-picker.js +3 -2
  22. package/lib/emoji-picker/utils/store.js +3 -2
  23. package/lib/file-item/file-item-preview.d.ts +7 -0
  24. package/lib/file-item/file-item-preview.js +31 -0
  25. package/lib/file-item/file-item-preview.wyw-in-js.css +4 -0
  26. package/lib/form-field-loader.d.ts +5 -6
  27. package/lib/form-field-loader.js +7 -10
  28. package/lib/form-field-loader.wyw-in-js.css +2 -1
  29. package/lib/lists/list-row-surface.wyw-in-js.css +1 -1
  30. package/lib/open-popover-tracker.d.ts +2 -4
  31. package/lib/open-popover-tracker.js +14 -22
  32. package/lib/popover/index.js +2 -2
  33. package/lib/preference-setting.d.ts +2 -1
  34. package/lib/preference-setting.js +4 -4
  35. package/lib/reactions/get-word-divider.d.ts +1 -1
  36. package/lib/reactions/get-word-divider.js +7 -6
  37. package/lib/rich-text-skeleton.d.ts +9 -0
  38. package/lib/rich-text-skeleton.js +32 -0
  39. package/lib/rich-text-skeleton.wyw-in-js.css +2 -0
  40. package/lib/select/components/menu-list-virtua.js +2 -1
  41. package/lib/select/components/menu-list-virtualized.js +37 -44
  42. package/lib/select/components/menu.d.ts +1 -4
  43. package/lib/select/components/menu.js +2 -9
  44. package/lib/select/components/option.js +5 -2
  45. package/lib/select/select-loader.js +5 -2
  46. package/lib/select/select.d.ts +1 -1
  47. package/lib/select/select.js +2 -2
  48. package/lib/select/styles.js +4 -3
  49. package/lib/select/util.d.ts +2 -0
  50. package/lib/select/util.js +3 -1
  51. package/lib/storage-keys.d.ts +12 -0
  52. package/lib/storage-keys.js +20 -0
  53. package/lib/storage.d.ts +9 -0
  54. package/lib/storage.js +5 -0
  55. package/lib/text.d.ts +5 -0
  56. package/lib/text.js +5 -0
  57. package/lib/thematic-cvd.js +2 -2
  58. package/lib/thematic-state.js +1 -0
  59. package/lib/thematic.js +8 -18
  60. package/lib/theme-bootstrap.js +3 -1
  61. package/lib/theme-css-fallback.d.ts +5 -0
  62. package/lib/theme-css-fallback.js +29 -0
  63. package/lib/theme-css-snapshot.d.ts +8 -1
  64. package/lib/theme-css-snapshot.js +34 -8
  65. package/lib/theme-settings-core.js +7 -8
  66. package/lib/theme-styles.js +5 -8
  67. package/lib/unit/labeled-unit.d.ts +2 -0
  68. package/lib/unit/labeled-unit.js +3 -3
  69. package/lib/unit/labeled-unit.wyw-in-js.css +1 -1
  70. package/package.json +4 -4
  71. package/lib/rich-input-loader.d.ts +0 -7
  72. package/lib/rich-input-loader.js +0 -34
  73. package/lib/rich-input-loader.wyw-in-js.css +0 -2
@@ -1,8 +1,31 @@
1
1
  import { withDisplayGamut } from "./color-gamut.js";
2
2
  import { serializeCssColors } from "./color-serialization.js";
3
+ import { archThemeClassName, builtinThemeClassName, darkThemeClassName, warmThemeClassName } from "./theme-bootstrap.js";
3
4
  import { themeTokenNames } from "./theming.generated.js";
4
5
  import { cacheThemeValues } from "./theme-values.js";
5
6
  //#region src/theme-css-snapshot.ts
7
+ var fallback;
8
+ function themeProbe(className) {
9
+ const probe = document.createElement("div");
10
+ probe.className = className;
11
+ probe.style.display = "none";
12
+ document.documentElement.append(probe);
13
+ return probe;
14
+ }
15
+ function themeCssApplied() {
16
+ const probe = themeProbe(builtinThemeClassName);
17
+ const applied = getComputedStyle(probe).getPropertyValue("--bg-canvas").trim() !== "";
18
+ probe.remove();
19
+ return applied;
20
+ }
21
+ async function ensureThemeValues() {
22
+ if (fallback || themeCssApplied()) return false;
23
+ ({themeStylesFallback: fallback} = await import(
24
+ /* webpackChunkName: "theme-css-fallback" */
25
+ "./theme-css-fallback.js"
26
+ ));
27
+ return true;
28
+ }
6
29
  var themeCssSnapshotTrace = {
7
30
  enabled: typeof location !== "undefined" && new URLSearchParams(location.search).has("trace-theme-css"),
8
31
  count: 0,
@@ -12,20 +35,23 @@ var themeCssSnapshotTrace = {
12
35
  duration: 0
13
36
  };
14
37
  if (themeCssSnapshotTrace.enabled) Object.assign(globalThis, { __FIBERY_THEME_CSS_TRACE: themeCssSnapshotTrace });
15
- function themeCssValues(key, className, gamut) {
38
+ function themeCssValues(key, source, gamut) {
39
+ const className = [
40
+ builtinThemeClassName,
41
+ source.warm ? warmThemeClassName : "",
42
+ source.arch ? archThemeClassName : "",
43
+ source.mode === "dark" ? darkThemeClassName : ""
44
+ ].join(" ");
16
45
  let computed;
46
+ let fallbackStyles;
17
47
  return {
18
48
  ...cacheThemeValues(themeTokenNames, (name) => {
19
49
  const started = themeCssSnapshotTrace.enabled ? performance.now() : 0;
20
50
  if (!computed) {
21
- const probe = document.createElement("div");
22
- probe.className = className;
23
- probe.style.display = "none";
24
- document.documentElement.append(probe);
25
- computed = getComputedStyle(probe);
51
+ computed = getComputedStyle(themeProbe(className));
26
52
  if (themeCssSnapshotTrace.enabled) themeCssSnapshotTrace.count += 1;
27
53
  }
28
- const raw = computed.getPropertyValue(name).trim();
54
+ const raw = computed.getPropertyValue(name).trim() || (fallbackStyles ??= fallback?.(source, gamut))?.get(name);
29
55
  const cssDuration = themeCssSnapshotTrace.enabled ? performance.now() - started : 0;
30
56
  if (!raw) throw new Error(`Theme CSS is unavailable: ${key}.${name}`);
31
57
  const value = withDisplayGamut(gamut, () => serializeCssColors(raw));
@@ -49,4 +75,4 @@ function themeCssValues(key, className, gamut) {
49
75
  };
50
76
  }
51
77
  //#endregion
52
- export { themeCssSnapshotTrace, themeCssValues };
78
+ export { ensureThemeValues, themeCssSnapshotTrace, themeCssValues };
@@ -1,6 +1,7 @@
1
1
  import { getThemeMode, getThemePreference, themePreferenceStorageKey } from "./theme-bootstrap.js";
2
2
  import { getMediaQueryList, subscribeOnChange } from "./media-query-utils.js";
3
3
  import { isPhoneMode } from "./phone.js";
4
+ import { localStorage } from "./storage.js";
4
5
  import { createPreferenceSetting } from "./preference-setting.js";
5
6
  //#region src/theme-settings-core.ts
6
7
  var listenersThemeMode = /* @__PURE__ */ new Map();
@@ -25,38 +26,36 @@ function setThemePreference(preference) {
25
26
  function subscribeOnThemePreferenceChange(cb) {
26
27
  listenersThemePreference.set(cb, cb);
27
28
  let currentPref = getThemePreference();
28
- const storageListener = () => {
29
+ const unsubscribeOtherTabs = localStorage.subscribe(themePreferenceStorageKey, () => {
29
30
  const newPref = getThemePreference();
30
31
  if (currentPref !== newPref) {
31
32
  currentPref = newPref;
32
33
  cb(newPref);
33
34
  }
34
- };
35
- window.addEventListener("storage", storageListener);
35
+ });
36
36
  return () => {
37
37
  listenersThemePreference.delete(cb);
38
- window.removeEventListener("storage", storageListener);
38
+ unsubscribeOtherTabs();
39
39
  };
40
40
  }
41
41
  function subscribeOnThemeModeChange(cb) {
42
42
  listenersThemeMode.set(cb, cb);
43
43
  let currentPref = getThemePreference();
44
44
  const darkMediaQuery = getDarkMediaQuery();
45
- const storageListener = () => {
45
+ const unsubscribeOtherTabs = localStorage.subscribe(themePreferenceStorageKey, () => {
46
46
  const newPref = getThemePreference();
47
47
  if (currentPref !== newPref) {
48
48
  currentPref = newPref;
49
49
  cb(getThemeMode());
50
50
  }
51
- };
52
- window.addEventListener("storage", storageListener);
51
+ });
53
52
  const unsubscribe = subscribeOnChange(darkMediaQuery, () => {
54
53
  if (getThemePreference() === "auto") cb(getThemeMode());
55
54
  });
56
55
  return () => {
57
56
  listenersThemeMode.delete(cb);
58
57
  unsubscribe();
59
- window.removeEventListener("storage", storageListener);
58
+ unsubscribeOtherTabs();
60
59
  };
61
60
  }
62
61
  var { has: hasWarmPreference, load: loadWarmPreference, store: storeWarmPreference, subscribe: subscribeOnWarmPreferenceChange } = createPreferenceSetting({
@@ -3,7 +3,6 @@ import { displayGamutKey, getCssGamut } from "./color-gamut.js";
3
3
  import { makeColorTransform } from "./color-filter-base.js";
4
4
  import { makeSelect } from "./design-system/colors-js.js";
5
5
  import { colorFnsForGamut, createColorFnsForMode } from "./design-system/fns.js";
6
- import { archThemeClassName, builtinThemeClassName, darkThemeClassName, warmThemeClassName } from "./theme-bootstrap.js";
7
6
  import { registerThemeValues } from "./theme-values.js";
8
7
  import { themeCssValues } from "./theme-css-snapshot.js";
9
8
  import "./styles.neutral-dark.generated.css";
@@ -15,13 +14,11 @@ function make(palette, gamut) {
15
14
  function makeTheme(mode) {
16
15
  let fns;
17
16
  const key = displayGamutKey(`${palette.key}-${mode}`, gamut);
18
- const className = [
19
- builtinThemeClassName,
20
- palette.warm ? warmThemeClassName : "",
21
- palette.arch ? archThemeClassName : "",
22
- mode === "dark" ? darkThemeClassName : ""
23
- ].join(" ");
24
- const values = themeCssValues(key, className, gamut);
17
+ const values = themeCssValues(key, {
18
+ warm: palette.warm,
19
+ arch: palette.arch,
20
+ mode
21
+ }, gamut);
25
22
  const theme = {
26
23
  key,
27
24
  mode,
@@ -1,4 +1,6 @@
1
1
  //#region src/unit/labeled-unit.d.ts
2
+ export declare const unitLabelCss: import("@linaria/core").LinariaClassName;
3
+ export declare const labeledUnitCss: import("@linaria/core").LinariaClassName;
2
4
  export declare const UnitLabel: ({ children }: {
3
5
  children: React.ReactNode;
4
6
  }) => import("react").JSX.Element;
@@ -4,10 +4,10 @@ import { textClasses } from "../design-system/typography.js";
4
4
  import { cx } from "@linaria/core";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/unit/labeled-unit.tsx
7
- var labelCss = "lfktfg3-label";
7
+ var unitLabelCss = "ufktfg3-unitLabel";
8
8
  var labeledUnitCss = "l3ngueb-labeledUnit";
9
9
  var UnitLabel = ({ children }) => /* @__PURE__ */ jsx("div", {
10
- className: cx(textClasses.heading7, labelCss),
10
+ className: cx(textClasses.heading7, unitLabelCss),
11
11
  children
12
12
  });
13
13
  var LabeledUnit = ({ label, children }) => /* @__PURE__ */ jsxs("div", {
@@ -15,4 +15,4 @@ var LabeledUnit = ({ label, children }) => /* @__PURE__ */ jsxs("div", {
15
15
  children: [/* @__PURE__ */ jsx(UnitLabel, { children: label }), children]
16
16
  });
17
17
  //#endregion
18
- export { LabeledUnit, UnitLabel };
18
+ export { LabeledUnit, UnitLabel, labeledUnitCss, unitLabelCss };
@@ -1,2 +1,2 @@
1
- .lfktfg3-label{padding-bottom:2px;padding-top:6px;}
1
+ .ufktfg3-unitLabel{padding-bottom:2px;padding-top:6px;}
2
2
  .l3ngueb-labeledUnit{display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;line-height:1.2;width:100%;}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/ui-kit",
3
- "version": "13.0.1",
3
+ "version": "14.0.1",
4
4
  "license": "UNLICENSED",
5
5
  "files": [
6
6
  "lib"
@@ -85,9 +85,9 @@
85
85
  },
86
86
  "dependencies": {
87
87
  "@fibery/emoji-data": "4.0.0",
88
- "@fibery/helpers": "5.1.0",
88
+ "@fibery/helpers": "5.3.0",
89
89
  "@fibery/icons": "0.1.0",
90
- "@fibery/react": "3.1.1",
90
+ "@fibery/react": "3.1.3",
91
91
  "@linaria/core": "8.2.0",
92
92
  "@linaria/react": "8.2.0",
93
93
  "@popperjs/core": "2.11.6",
@@ -110,7 +110,7 @@
110
110
  "cmdk": "1.1.1",
111
111
  "color-hash": "1.0.3",
112
112
  "culori": "4.0.2",
113
- "date-fns": "2.29.2",
113
+ "date-fns": "3.6.0",
114
114
  "invariant": "2.2.4",
115
115
  "lru-cache": "11.5.3",
116
116
  "moment": "2.31.0",
@@ -1,7 +0,0 @@
1
- //#region src/rich-input-loader.d.ts
2
- interface LoaderProps {
3
- className?: string;
4
- }
5
- export declare const RichInputLoader: import("react").NamedExoticComponent<LoaderProps>;
6
- export declare function RichFieldLoader(): import("react").JSX.Element;
7
- //#endregion
@@ -1,34 +0,0 @@
1
- import "./rich-input-loader.wyw-in-js.css";
2
- import { SkeletonList, SkeletonTextLine } from "./skeleton.js";
3
- import { regularRichEditorHTMLStyles } from "./html-styles.js";
4
- /* empty css */
5
- import { cx } from "@linaria/core";
6
- import { jsx, jsxs } from "react/jsx-runtime";
7
- import { memo } from "react";
8
- //#region src/rich-input-loader.tsx
9
- var RichInputLoader = memo(function RichInputLoaderComponent({ className = "" }) {
10
- return /* @__PURE__ */ jsx("div", {
11
- className,
12
- children: jsx(SkeletonList, {
13
- amount: 3,
14
- WrapperComponent: SkeletonTextLine
15
- })
16
- });
17
- });
18
- function RichFieldLoader() {
19
- return /* @__PURE__ */ jsxs("div", {
20
- className: cx("ProseMirror", regularRichEditorHTMLStyles, "cgnhmrn"),
21
- children: [/* @__PURE__ */ jsx("p", {
22
- className: "empty-node",
23
- children: /* @__PURE__ */ jsx("br", { className: "ProseMirror-trailingBreak" })
24
- }), /* @__PURE__ */ jsx("div", {
25
- className: "czwej5w",
26
- children: /* @__PURE__ */ jsx(SkeletonList, {
27
- amount: 1,
28
- WrapperComponent: SkeletonTextLine
29
- })
30
- })]
31
- });
32
- }
33
- //#endregion
34
- export { RichFieldLoader, RichInputLoader };
@@ -1,2 +0,0 @@
1
- .cgnhmrn{position:relative;}
2
- .czwej5w{position:absolute;inset:0;display:grid;align-content:center;}