@funnest/charts-ui 0.11.2 → 0.11.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 (2) hide show
  1. package/dist/index.js +61 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -248,6 +248,12 @@ function Q(t3, r3) {
248
248
  var u3, i3, f4, o4;
249
249
  n.__ && n.__(t3, r3), 9 == r3.nodeType && (r3 = r3.documentElement), i3 = (u3 = t3 && 32 & t3.__u) ? null : r3.__k, r3.__k = m($, { children: [t3] }), f4 = [], o4 = [], z(r3, r3.__k, i3 || p, p, r3.namespaceURI, i3 ? null : r3.firstChild ? d.call(r3.childNodes) : null, f4, i3 ? i3.__e : r3.firstChild, u3, o4), E(f4, r3.__k, o4), r3.__k.props.children = null;
250
250
  }
251
+ function W(n2) {
252
+ return n2.children;
253
+ }
254
+ function X(n2, t3) {
255
+ return m(W, { __P: t3, children: n2 });
256
+ }
251
257
  n = { __e: function(n2, t3, r3, u3) {
252
258
  for (var i3, o4, e3; t3 = t3.__; ) if ((i3 = t3.__c) && !(1 & i3.__g)) {
253
259
  i3.__g |= 4;
@@ -2976,7 +2982,9 @@ function SettingsDialog({ ctx }) {
2976
2982
  hint && /* @__PURE__ */ a3(Info, { text: t3[hint] }),
2977
2983
  /* @__PURE__ */ a3("input", { type: "checkbox", role: "switch", class: "fnc-switch", checked: settings[key], onChange: (e3) => set({ [key]: e3.currentTarget.checked }) })
2978
2984
  ] }));
2979
- return /* @__PURE__ */ a3("div", { class: "fnc-backdrop", onPointerDown: (e3) => e3.target === e3.currentTarget && close(), children: /* @__PURE__ */ a3("div", { class: "fnc-dialog fnc-settings-dialog", role: "dialog", "aria-modal": "true", "aria-label": t3.chartSettings, onKeyDown: (e3) => e3.key === "Escape" && close(), children: [
2985
+ const anchor = T2(null);
2986
+ const layer = usePageLayer(anchor, settings);
2987
+ const dialog = /* @__PURE__ */ a3("div", { class: "fnc-backdrop", onPointerDown: (e3) => e3.target === e3.currentTarget && close(), children: /* @__PURE__ */ a3("div", { class: "fnc-dialog fnc-settings-dialog", role: "dialog", "aria-modal": "true", "aria-label": t3.chartSettings, onKeyDown: (e3) => e3.key === "Escape" && close(), children: [
2980
2988
  /* @__PURE__ */ a3("div", { class: "fnc-dialog-head", children: [
2981
2989
  /* @__PURE__ */ a3("b", { children: t3.chartSettings }),
2982
2990
  /* @__PURE__ */ a3("button", { class: "fnc-btn", "aria-label": t3.close, onClick: close, children: /* @__PURE__ */ a3(CloseIcon, {}) })
@@ -3058,6 +3066,45 @@ function SettingsDialog({ ctx }) {
3058
3066
  /* @__PURE__ */ a3("button", { type: "button", class: "fnc-action fnc-action-primary", onClick: close, children: t3.done })
3059
3067
  ] })
3060
3068
  ] }) });
3069
+ return /* @__PURE__ */ a3($, { children: [
3070
+ /* @__PURE__ */ a3("span", { ref: anchor, hidden: true }),
3071
+ layer && X(dialog, layer)
3072
+ ] });
3073
+ }
3074
+ var LOOK_VARS = ["--fnc-accent", "--fnc-bg", "--fnc-border", "--fnc-danger", "--fnc-down", "--fnc-font", "--fnc-radius", "--fnc-shadow", "--fnc-surface", "--fnc-text", "--fnc-text-2", "--fnc-text-3", "--fnc-tip-bg", "--fnc-tip-text", "--fnc-up"];
3075
+ function usePageLayer(anchor, settings) {
3076
+ const [layer, setLayer] = d2(null);
3077
+ F2(() => {
3078
+ const at = anchor.current;
3079
+ if (!at) return;
3080
+ const doc = at.ownerDocument;
3081
+ const el = doc.createElement("div");
3082
+ el.className = "fnc-root fnc-layer";
3083
+ (doc.fullscreenElement ?? doc.body).appendChild(el);
3084
+ setLayer(el);
3085
+ return () => el.remove();
3086
+ }, []);
3087
+ F2(() => {
3088
+ const at = anchor.current;
3089
+ if (!at || !layer) return;
3090
+ const copy = () => {
3091
+ const widget = at.closest(".fnc-root");
3092
+ const from = at.closest(".fnc-stage") ?? widget ?? at;
3093
+ if (widget?.dataset.colorScheme) layer.dataset.colorScheme = widget.dataset.colorScheme;
3094
+ const dir = widget?.closest("[dir]")?.getAttribute("dir");
3095
+ if (dir) layer.setAttribute("dir", dir);
3096
+ const cs = getComputedStyle(from);
3097
+ for (const name of LOOK_VARS) {
3098
+ const value = cs.getPropertyValue(name).trim();
3099
+ if (value) layer.style.setProperty(name, value);
3100
+ else layer.style.removeProperty(name);
3101
+ }
3102
+ };
3103
+ copy();
3104
+ const frame = requestAnimationFrame(copy);
3105
+ return () => cancelAnimationFrame(frame);
3106
+ }, [layer, settings]);
3107
+ return layer;
3061
3108
  }
3062
3109
  function Info({ text }) {
3063
3110
  return /* @__PURE__ */ a3("span", { class: "fnc-info", tabIndex: 0, role: "img", "aria-label": text, onClick: (e3) => e3.preventDefault(), children: [
@@ -4554,13 +4601,18 @@ function Legend({ ctx }) {
4554
4601
  hovering.current = !!hover;
4555
4602
  const measure = T2(() => {
4556
4603
  });
4604
+ const kept = T2({ key: "", px: 0 });
4557
4605
  A2(() => {
4558
4606
  const el = ref.current;
4559
4607
  if (!el) return;
4560
4608
  const update = () => {
4561
4609
  if (tracking.current || hovering.current) return;
4562
4610
  const floating = ctx.legendValues === "crosshair" ? el.querySelector(".fnc-legend-values") : null;
4563
- ctx.chart.setTopInset(el.offsetTop + el.offsetHeight - (floating ? floating.offsetHeight + 2 : 0) + 4);
4611
+ const px = el.offsetTop + el.offsetHeight - (floating ? floating.offsetHeight + 2 : 0) + 4;
4612
+ const { symbol, resolution } = ctx.store.get();
4613
+ const key = `${symbol?.symbol ?? ""}|${resolution}|${el.offsetWidth}|${el.getElementsByTagName("*").length}`;
4614
+ kept.current = key === kept.current.key ? { key, px: Math.max(kept.current.px, px) } : { key, px };
4615
+ ctx.chart.setTopInset(kept.current.px);
4564
4616
  };
4565
4617
  measure.current = update;
4566
4618
  const ro = new ResizeObserver(update);
@@ -6165,12 +6217,14 @@ var CSS = (
6165
6217
  .fnc-seg-sm button { min-width: 36px; height: 26px; padding: 0 6px; font-size: 12px; }
6166
6218
 
6167
6219
  /* \u2500\u2500 \uCC28\uD2B8 \uC124\uC815: tabs and settings on the left, a live demo chart on the right (on top on a phone) \u2500\u2500 */
6220
+ /* The settings dialog's own layer over the page (above a fullscreen chart too). */
6221
+ .fnc-root.fnc-layer { position: fixed; inset: 0; z-index: 2147483001; width: auto; height: auto; background: transparent; overflow: visible; }
6168
6222
  .fnc-dialog.fnc-settings-dialog { width: min(940px, calc(100% - 32px)); height: min(660px, 100%); max-height: none; }
6169
6223
  .fnc-settings-body { display: flex; flex: 1; min-height: 0; }
6170
6224
  .fnc-settings-side { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; border-right: 1px solid var(--fnc-border); }
6171
- .fnc-settings-side .fnc-settings-tabs { flex: none; gap: 2px; padding: 12px 20px 0; }
6172
- /* The tabs share the row, each label centred in its share. */
6173
- .fnc-settings-tabs .fnc-tab { display: inline-flex; align-items: center; justify-content: center; flex: 1 1 0; min-width: 0; padding: 0 4px; }
6225
+ .fnc-settings-side .fnc-settings-tabs { flex: none; justify-content: center; justify-content: safe center; gap: 4px; padding: 12px 16px 0; }
6226
+ /* The tabs as wide as their words (the pill hugs the label), the row of them in the middle. */
6227
+ .fnc-settings-tabs .fnc-tab { display: inline-flex; align-items: center; justify-content: center; flex: none; padding: 0 14px; }
6174
6228
  .fnc-root .fnc-dialog form.fnc-settings-form { flex: 1; min-height: 0; overflow-y: auto; }
6175
6229
  .fnc-settings-preview { display: flex; flex-direction: column; gap: 8px; flex: 1.2 1 0; min-width: 0; padding: 20px; }
6176
6230
  .fnc-settings-preview-chart { position: relative; flex: 1; min-height: 160px; border: 1px solid var(--fnc-border); border-radius: 12px; overflow: hidden; }
@@ -6180,7 +6234,7 @@ var CSS = (
6180
6234
  .fnc-dialog.fnc-settings-dialog { width: 100%; height: 100%; border-radius: 0; }
6181
6235
  .fnc-settings-dialog .fnc-dialog-head { height: 44px; }
6182
6236
  .fnc-settings-side .fnc-settings-tabs { padding: 6px 12px 0; }
6183
- .fnc-settings-tabs .fnc-tab { padding: 0 6px; font-size: 12.5px; }
6237
+ .fnc-settings-tabs .fnc-tab { padding: 0 12px; }
6184
6238
  .fnc-settings-preview { padding: 8px 12px; }
6185
6239
  .fnc-settings-preview .fnc-section, .fnc-settings-preview .fnc-toggle-hint { display: none; }
6186
6240
  .fnc-settings-preview-chart .fnc-ranges { display: none; }
@@ -6247,7 +6301,7 @@ var CSS = (
6247
6301
  .fnc-settings-preview-chart .fnc-ranges { display: none; }
6248
6302
  .fnc-settings-side { flex: 1; min-height: 0; border-right: 0; }
6249
6303
  .fnc-settings-side .fnc-settings-tabs { padding: 8px 12px 0; }
6250
- .fnc-settings-tabs .fnc-tab { padding: 0 6px; font-size: 12.5px; }
6304
+ .fnc-settings-tabs .fnc-tab { padding: 0 12px; }
6251
6305
  .fnc-form-actions.fnc-settings-actions { padding: 8px 16px; }
6252
6306
  }
6253
6307
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnest/charts-ui",
3
- "version": "0.11.2",
3
+ "version": "0.11.3",
4
4
  "description": "Pro trading UI (toolbar, drawing tools, sheets) for Funnest Charts. Framework-agnostic.",
5
5
  "keywords": [
6
6
  "chart",
@@ -42,7 +42,7 @@
42
42
  "NOTICE"
43
43
  ],
44
44
  "dependencies": {
45
- "@funnest/charts": "0.11.2"
45
+ "@funnest/charts": "0.11.3"
46
46
  },
47
47
  "devDependencies": {
48
48
  "preact": "^11.2.0"