dsh-plugin-core-demo 0.20.8 → 0.20.9

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/client.js +24 -13
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -54844,6 +54844,11 @@ var VIEWPORT_EDGE = 12;
54844
54844
  function clamp2(value, low, high) {
54845
54845
  return Math.min(Math.max(value, low), Math.max(low, high));
54846
54846
  }
54847
+ function flipSide(preferred, own, other, min2) {
54848
+ if (own >= min2)
54849
+ return preferred;
54850
+ return other > own ? !preferred : preferred;
54851
+ }
54847
54852
  function placePicker(anchor, viewport, placement = "auto") {
54848
54853
  const vw = viewport.width;
54849
54854
  const vh = viewport.height;
@@ -54853,7 +54858,7 @@ function placePicker(anchor, viewport, placement = "auto") {
54853
54858
  if (placement === "auto") {
54854
54859
  const availBelow = vh - EDGE - (anchor.bottom + GAP2);
54855
54860
  const availAbove = anchor.top - GAP2 - EDGE;
54856
- const below = availBelow >= PICKER_MIN_H || availBelow >= availAbove;
54861
+ const below = flipSide(true, availBelow, availAbove, PICKER_MIN_H);
54857
54862
  const height2 = Math.max(Math.min(PICKER_MAX_H, below ? availBelow : availAbove), PICKER_MIN_FLOOR);
54858
54863
  const left2 = clamp2(anchor.left, EDGE, vw - EDGE - fullWidth);
54859
54864
  const top3 = below ? clamp2(Math.min(anchor.bottom + GAP2, vh - EDGE - height2), EDGE, vh - EDGE - height2) : clamp2(anchor.top - GAP2 - height2, EDGE, vh - EDGE - height2);
@@ -54861,9 +54866,12 @@ function placePicker(anchor, viewport, placement = "auto") {
54861
54866
  }
54862
54867
  const vertical = placement.startsWith("bottom") || placement.startsWith("top");
54863
54868
  if (vertical) {
54864
- const below = placement.startsWith("bottom");
54869
+ const belowAvail = vh - EDGE - (anchor.bottom + GAP2);
54870
+ const aboveAvail = anchor.top - GAP2 - EDGE;
54865
54871
  const startAligned2 = placement.endsWith("start");
54866
- const avail = below ? vh - EDGE - (anchor.bottom + GAP2) : anchor.top - GAP2 - EDGE;
54872
+ const prefersBelow = placement.startsWith("bottom");
54873
+ const below = flipSide(prefersBelow, prefersBelow ? belowAvail : aboveAvail, prefersBelow ? aboveAvail : belowAvail, PICKER_MIN_H);
54874
+ const avail = below ? belowAvail : aboveAvail;
54867
54875
  const height2 = Math.max(Math.min(PICKER_MAX_H, avail), PICKER_MIN_FLOOR);
54868
54876
  const rawLeft2 = startAligned2 ? anchor.left : anchor.right - fullWidth;
54869
54877
  const left2 = clamp2(rawLeft2, EDGE, vw - EDGE - fullWidth);
@@ -54871,9 +54879,12 @@ function placePicker(anchor, viewport, placement = "auto") {
54871
54879
  const top3 = clamp2(rawTop2, EDGE, vh - EDGE - height2);
54872
54880
  return round2({ left: left2, top: top3, width: fullWidth, height: height2 });
54873
54881
  }
54874
- const toRight = placement.startsWith("right");
54875
54882
  const startAligned = placement.endsWith("start");
54876
- const availW = toRight ? vw - EDGE - (anchor.right + GAP2) : anchor.left - GAP2 - EDGE;
54883
+ const rightAvail = vw - EDGE - (anchor.right + GAP2);
54884
+ const leftAvail = anchor.left - GAP2 - EDGE;
54885
+ const prefersRight = placement.startsWith("right");
54886
+ const toRight = flipSide(prefersRight, prefersRight ? rightAvail : leftAvail, prefersRight ? leftAvail : rightAvail, PICKER_MIN_W);
54887
+ const availW = toRight ? rightAvail : leftAvail;
54877
54888
  const width = Math.max(Math.min(PICKER_WIDTH, availW), Math.min(PICKER_MIN_W, Math.max(vw - 2 * EDGE, 0)));
54878
54889
  const height = Math.min(PICKER_MAX_H, Math.max(vh - 2 * EDGE, 0));
54879
54890
  const rawLeft = toRight ? anchor.right + GAP2 : anchor.left - GAP2 - width;
@@ -59126,8 +59137,8 @@ var docData = {
59126
59137
  "type": "PickPlacement",
59127
59138
  "def": "'auto'",
59128
59139
  "desc": {
59129
- "zh": "\u5C55\u5F00\u65B9\u4F4D\u516B\u6863\uFF1A`bottom-start` / `bottom-end`\uFF08\u4E0B\u65B9\uFF0C\u5DE6\u7F18 / \u53F3\u7F18\u5BF9\u9F50\uFF09\u3001`top-start` / `top-end`\uFF08\u4E0A\u65B9\uFF09\u3001`right-start` / `right-end`\uFF08\u53F3\u4FA7\uFF0C\u9876\u8FB9 / \u5E95\u8FB9\u9F50\u5E73\uFF09\u3001`left-start` / `left-end`\uFF08\u5DE6\u4FA7\uFF09\uFF1B`auto` = \u65E7\u884C\u4E3A\uFF08\u4E0B\u65B9\u4F18\u5148\u3001\u4E0B\u65B9\u4E0D\u591F\u7FFB\u4E0A\u65B9\u3001\u6A2A\u5411\u5939\u7D27\uFF09\u3002**\u6307\u5B9A\u65B9\u4F4D\u540E\u4E0D\u518D\u81EA\u52A8\u7FFB\u8FB9**\uFF0C\u53EA\u5728\u8D85\u51FA\u89C6\u53E3\u65F6\u5939\u7D27\u2014\u2014\u6309\u94AE\u8D34\u7740\u5B9A\u5BBD\u533A\u53F3\u8FB9\u754C\u65F6\u7528 `bottom-end` / `left-start`",
59130
- "en": "Expansion side, eight values: `bottom-start` / `bottom-end` (below, left / right edge aligned), `top-start` / `top-end` (above), `right-start` / `right-end` (right of the trigger, top / bottom edge aligned), `left-start` / `left-end` (left of the trigger); `auto` = old behaviour (below first, flip above when short, clamp horizontally). An explicit side **never auto-flips** \u2014 it is only clamped into the viewport, so use `bottom-end` / `left-start` when the trigger sits at the right edge of a fixed-width area"
59140
+ "zh": "\u5C55\u5F00\u65B9\u4F4D\u516B\u6863\uFF1A`bottom-start` / `bottom-end`\uFF08\u4E0B\u65B9\uFF0C\u5DE6\u7F18 / \u53F3\u7F18\u5BF9\u9F50\uFF09\u3001`top-start` / `top-end`\uFF08\u4E0A\u65B9\uFF09\u3001`right-start` / `right-end`\uFF08\u53F3\u4FA7\uFF0C\u9876\u8FB9 / \u5E95\u8FB9\u9F50\u5E73\uFF09\u3001`left-start` / `left-end`\uFF08\u5DE6\u4FA7\uFF09\uFF1B`auto` = \u65E7\u884C\u4E3A\uFF08\u4E0B\u65B9\u4F18\u5148\u3001\u4E0B\u65B9\u4E0D\u591F\u7FFB\u4E0A\u65B9\u3001\u6A2A\u5411\u5939\u7D27\uFF09\u3002\u65B9\u4F4D\u662F**\u4F18\u5148**\uFF1A\u8BE5\u4FA7\u653E\u5F97\u4E0B\u5C31\u7167\u5B83\uFF1B\u653E\u4E0D\u4E0B\u800C\u5BF9\u4FA7\u591F \u21D2 **\u81EA\u52A8\u7FFB\u8FB9**\uFF08bottom\u2194top\u3001left\u2194right\uFF0C\u5BF9\u9F50\u8F74\u4E0D\u53D8\uFF09\uFF1B\u4E24\u4FA7\u90FD\u4E0D\u591F\u624D\u5939\u7D27\u8FDB\u89C6\u53E3\u2014\u2014\u6309\u94AE\u8D34\u7740\u5B9A\u5BBD\u533A\u53F3\u8FB9\u754C\u65F6\u7528 `bottom-end` / `left-start`",
59141
+ "en": "Expansion side, eight values: `bottom-start` / `bottom-end` (below, left / right edge aligned), `top-start` / `top-end` (above), `right-start` / `right-end` (right of the trigger, top / bottom edge aligned), `left-start` / `left-end` (left of the trigger); `auto` = old behaviour (below first, flip above when short, clamp horizontally). The side is a **preference**: used when it fits; if it does not fit but the opposite side does, the panel **flips** (bottom\u2194top, left\u2194right, same start/end alignment); only when neither fits is it clamped into the viewport \u2014 use `bottom-end` / `left-start` when the trigger sits at the right edge of a fixed-width area"
59131
59142
  }
59132
59143
  }
59133
59144
  ]
@@ -65959,9 +65970,9 @@ function ReferencePage() {
65959
65970
  "tbody",
65960
65971
  null,
65961
65972
  [
65962
- [t3("buildCore"), `v${"0.20.8"}`],
65963
- [t3("buildDemo"), `v${"0.20.8"}`],
65964
- [t3("buildStamp"), "261103-065849-385"]
65973
+ [t3("buildCore"), `v${"0.20.9"}`],
65974
+ [t3("buildDemo"), `v${"0.20.9"}`],
65975
+ [t3("buildStamp"), "261103-071505-720"]
65965
65976
  ].map(
65966
65977
  ([label, value]) => (0, import_react86.createElement)(
65967
65978
  "tr",
@@ -66283,9 +66294,9 @@ function DemoPage() {
66283
66294
  lineHeight: "14px"
66284
66295
  }
66285
66296
  },
66286
- (0, import_react88.createElement)("span", null, `core v${"0.20.8"}`),
66287
- (0, import_react88.createElement)("span", null, `demo v${"0.20.8"}`),
66288
- (0, import_react88.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261103-065849-385")
66297
+ (0, import_react88.createElement)("span", null, `core v${"0.20.9"}`),
66298
+ (0, import_react88.createElement)("span", null, `demo v${"0.20.9"}`),
66299
+ (0, import_react88.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261103-071505-720")
66289
66300
  )
66290
66301
  )
66291
66302
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-core-demo",
3
- "version": "0.20.8",
3
+ "version": "0.20.9",
4
4
  "description": "The shared UI foundation for DSH plugins, with a live component preview: design tokens, common controls, workspace browsing and notifications maintained in one place — install it to preview every component in a real host.",
5
5
  "icon": "./assets/icon-components.svg",
6
6
  "keywords": [