klun-ui 0.1.14 → 0.1.16

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/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to **klun-ui** are documented here. The format follows
5
5
  [Semantic Versioning](https://semver.org/) (pre-1.0: minor/patch bumps may carry
6
6
  small breaking changes).
7
7
 
8
+ ## [0.1.15] — 2026-06-23
9
+
10
+ ### Added
11
+ - **`Markdown` now renders images** — `![alt](url)` becomes an `<img class="klun-md-img">`
12
+ (constrained to `max-width: 100%`, rounded, bordered). `url` accepts http(s) and
13
+ `data:` URIs, so pasted/embedded screenshots render inline.
14
+
8
15
  ## [0.1.14] — 2026-06-23
9
16
 
10
17
  ### Added
@@ -2938,6 +2938,9 @@ var k = 0;
2938
2938
  function inline(text) {
2939
2939
  const patterns = [
2940
2940
  { re: /`([^`]+)`/, node: (m) => /* @__PURE__ */ jsxRuntime.jsx("code", { className: "klun-md-code", children: m[1] }, k++) },
2941
+ // image before link (`![alt](url)` starts with `!` + link syntax). url allows
2942
+ // http(s) and data: URIs (base64 has no `)`), so pasted screenshots embed inline.
2943
+ { re: /!\[([^\]]*)\]\(([^)]+)\)/, node: (m) => /* @__PURE__ */ jsxRuntime.jsx("img", { className: "klun-md-img", src: m[2], alt: m[1] }, k++) },
2941
2944
  { re: /\*\*([^*]+)\*\*/, node: (m) => /* @__PURE__ */ jsxRuntime.jsx("strong", { children: inline(m[1]) }, k++) },
2942
2945
  { re: /~~([^~]+)~~/, node: (m) => /* @__PURE__ */ jsxRuntime.jsx("del", { children: inline(m[1]) }, k++) },
2943
2946
  { re: /\*([^*]+)\*/, node: (m) => /* @__PURE__ */ jsxRuntime.jsx("em", { children: inline(m[1]) }, k++) },
@@ -6452,6 +6455,7 @@ function useSelect({ children, value, defaultValue, disabled, rootRef }) {
6452
6455
  const current = controlled ? String(value ?? "") : internal;
6453
6456
  const [open, setOpen] = react.useState(false);
6454
6457
  const [active, setActive] = react.useState(-1);
6458
+ const [placement, setPlacement] = react.useState("down");
6455
6459
  const triggerRef = react.useRef(null);
6456
6460
  const selectRef = react.useRef(null);
6457
6461
  const selected = options.find((o) => o.value === current) ?? null;
@@ -6472,6 +6476,15 @@ function useSelect({ children, value, defaultValue, disabled, rootRef }) {
6472
6476
  if (disabled) return;
6473
6477
  const idx = options.findIndex((o) => o.value === current);
6474
6478
  setActive(idx >= 0 ? idx : options.findIndex((o) => !o.disabled));
6479
+ const trigger = triggerRef.current;
6480
+ if (trigger && typeof window !== "undefined") {
6481
+ const r = trigger.getBoundingClientRect();
6482
+ const estimated = Math.min(options.length * 36 + 12, 280);
6483
+ const below = window.innerHeight - r.bottom;
6484
+ setPlacement(below < estimated + 8 && r.top > below ? "up" : "down");
6485
+ } else {
6486
+ setPlacement("down");
6487
+ }
6475
6488
  setOpen(true);
6476
6489
  };
6477
6490
  const close = (refocus = true) => {
@@ -6548,6 +6561,7 @@ function useSelect({ children, value, defaultValue, disabled, rootRef }) {
6548
6561
  current,
6549
6562
  selected,
6550
6563
  open,
6564
+ placement,
6551
6565
  active,
6552
6566
  setActive,
6553
6567
  triggerRef,
@@ -6708,7 +6722,8 @@ var CompactSelect = react.forwardRef(
6708
6722
  current: s.current,
6709
6723
  active: s.active,
6710
6724
  onActivate: s.setActive,
6711
- onPick: s.pick
6725
+ onPick: s.pick,
6726
+ className: s.placement === "up" ? "klun-select-listbox--up" : void 0
6712
6727
  }
6713
6728
  ) : null
6714
6729
  ]
@@ -6804,7 +6819,8 @@ var CompactSelectForInput = react.forwardRef(function CompactSelectForInput2({
6804
6819
  current: s.current,
6805
6820
  active: s.active,
6806
6821
  onActivate: s.setActive,
6807
- onPick: s.pick
6822
+ onPick: s.pick,
6823
+ className: s.placement === "up" ? "klun-select-listbox--up" : void 0
6808
6824
  }
6809
6825
  ) : null
6810
6826
  ]
@@ -8104,7 +8120,8 @@ var InlineSelect = react.forwardRef(
8104
8120
  current: s.current,
8105
8121
  active: s.active,
8106
8122
  onActivate: s.setActive,
8107
- onPick: s.pick
8123
+ onPick: s.pick,
8124
+ className: s.placement === "up" ? "klun-select-listbox--up" : void 0
8108
8125
  }
8109
8126
  ) : null
8110
8127
  ]
@@ -8450,7 +8467,8 @@ var Select = react.forwardRef(function Select2({
8450
8467
  current: s.current,
8451
8468
  active: s.active,
8452
8469
  onActivate: s.setActive,
8453
- onPick: s.pick
8470
+ onPick: s.pick,
8471
+ className: s.placement === "up" ? "klun-select-listbox--up" : void 0
8454
8472
  }
8455
8473
  ) : null
8456
8474
  ] });
@@ -10969,5 +10987,5 @@ exports.useSize = useSize;
10969
10987
  exports.viVN = viVN;
10970
10988
  exports.zhCN = zhCN;
10971
10989
  exports.zhTW = zhTW;
10972
- //# sourceMappingURL=chunk-752UKCVU.cjs.map
10973
- //# sourceMappingURL=chunk-752UKCVU.cjs.map
10990
+ //# sourceMappingURL=chunk-6WIXXBXA.cjs.map
10991
+ //# sourceMappingURL=chunk-6WIXXBXA.cjs.map