dsh-plugin-core-demo 0.42.1 → 0.42.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/client.js +35 -19
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -6571,10 +6571,30 @@ var hostHandlers = null;
6571
6571
  function registerHostDialog(handlers2) {
6572
6572
  hostHandlers = handlers2;
6573
6573
  }
6574
+ var HOST_CONFIRM_FIELDS = ["title", "message", "confirmText", "cancelText", "tone", "skin"];
6575
+ var HOST_ALERT_FIELDS = ["title", "message", "confirmText", "skin"];
6576
+ function hostIgnoredFields(opts, allowed) {
6577
+ const ignored = [];
6578
+ for (const [key, value] of Object.entries(opts)) {
6579
+ if (value === void 0)
6580
+ continue;
6581
+ if (Array.isArray(value) && value.length === 0)
6582
+ continue;
6583
+ if (key === "lockExceptions" && value === false)
6584
+ continue;
6585
+ if (!allowed.includes(key))
6586
+ ignored.push(key);
6587
+ }
6588
+ return ignored;
6589
+ }
6574
6590
  function confirmModal(opts) {
6575
- const lockExceptions = opts.lockExceptions;
6576
6591
  if (opts.skin === "host") {
6577
- if (hostHandlers !== null && (lockExceptions === void 0 || lockExceptions.length === 0)) {
6592
+ const ignored = hostIgnoredFields(opts, HOST_CONFIRM_FIELDS);
6593
+ if (opts.tone !== void 0 && opts.tone !== "danger" && opts.tone !== "primary")
6594
+ ignored.push("tone");
6595
+ if (ignored.length > 0) {
6596
+ console.warn(`[dsh-plugin-core] confirmModal skin:"host" \u4E0D\u652F\u6301 ${ignored.join(" / ")}\uFF0C\u5DF2\u56DE\u843D\u5230 core \u76AE\u80A4\uFF1B\u8981\u4FDD\u4F4F host \u76AE\u80A4\u8BF7\u53BB\u6389\u8FD9\u4E9B\u5B57\u6BB5\uFF0C\u6216\u76F4\u63A5\u7701\u6389 skin:"host" \u7528 core`);
6597
+ } else if (hostHandlers !== null) {
6578
6598
  return hostHandlers.confirm({
6579
6599
  title: opts.title == null ? void 0 : String(opts.title),
6580
6600
  description: opts.message == null ? void 0 : String(opts.message),
@@ -6582,9 +6602,6 @@ function confirmModal(opts) {
6582
6602
  cancelText: opts.cancelText,
6583
6603
  danger: opts.tone === "danger"
6584
6604
  });
6585
- }
6586
- if (lockExceptions !== void 0 && lockExceptions.length > 0) {
6587
- console.warn('[dsh-plugin-core] confirmModal skin:"host" \u4E0D\u652F\u6301 lockExceptions\uFF0C\u5DF2\u56DE\u843D\u5230 core \u76AE\u80A4');
6588
6605
  } else {
6589
6606
  console.warn('[dsh-plugin-core] confirmModal skin:"host" \u9700\u5148\u5F15\u5165\u5B98\u65B9\u9002\u914D\u5C42 official.js\uFF0C\u5DF2\u56DE\u843D\u5230 core \u76AE\u80A4');
6590
6607
  }
@@ -6632,17 +6649,16 @@ function confirmModal(opts) {
6632
6649
  });
6633
6650
  }
6634
6651
  function alertModal(opts) {
6635
- const wantsExceptions = opts.lockExceptions === true;
6636
6652
  if (opts.skin === "host") {
6637
- if (hostHandlers !== null && !wantsExceptions) {
6653
+ const ignored = hostIgnoredFields(opts, HOST_ALERT_FIELDS);
6654
+ if (ignored.length > 0) {
6655
+ console.warn(`[dsh-plugin-core] alertModal skin:"host" \u4E0D\u652F\u6301 ${ignored.join(" / ")}\uFF0C\u5DF2\u56DE\u843D\u5230 core \u76AE\u80A4\uFF1B\u8981\u4FDD\u4F4F host \u76AE\u80A4\u8BF7\u53BB\u6389\u8FD9\u4E9B\u5B57\u6BB5\uFF0C\u6216\u76F4\u63A5\u7701\u6389 skin:"host" \u7528 core`);
6656
+ } else if (hostHandlers !== null) {
6638
6657
  return hostHandlers.alert({
6639
6658
  title: opts.title == null ? void 0 : String(opts.title),
6640
6659
  description: opts.message == null ? void 0 : String(opts.message),
6641
6660
  confirmText: opts.confirmText
6642
6661
  });
6643
- }
6644
- if (wantsExceptions) {
6645
- console.warn('[dsh-plugin-core] alertModal skin:"host" \u4E0D\u652F\u6301 lockExceptions\uFF0C\u5DF2\u56DE\u843D\u5230 core \u76AE\u80A4');
6646
6662
  } else {
6647
6663
  console.warn('[dsh-plugin-core] alertModal skin:"host" \u9700\u5148\u5F15\u5165\u5B98\u65B9\u9002\u914D\u5C42 official.js\uFF0C\u5DF2\u56DE\u843D\u5230 core \u76AE\u80A4');
6648
6664
  }
@@ -68343,7 +68359,7 @@ var docData = {
68343
68359
  "en": "The mask\u2019s right edge reads `--dshpc-page-inset-right` (summed across docks) and yields to the right column, centering the dialog in the **remaining** area. The dialog needs no mask props; never measure the column yourself (mounting is async, it always reads 0)."
68344
68360
  },
68345
68361
  {
68346
- "zh": "\u547D\u4EE4\u5F0F `confirmModal(opts)` / `alertModal(opts)` \u8FD4\u56DE Promise\uFF1A\u524D\u8005 resolve `true`\uFF08\u786E\u5B9A\uFF09\u6216 `false`\uFF08\u53D6\u6D88 / \u906E\u7F69 / Esc\uFF09\uFF0C\u540E\u8005\u5173\u95ED\u5373 resolve\u3002\u56DE\u8C03\u8FD4\u56DE Promise \u65F6\u5BF9\u5E94\u6309\u94AE\u81EA\u5DF1\u8F6C\u5708\u3001\u6574\u6846\u9501\u6B7B\uFF0Csettle \u540E\u624D\u5173\u3002\u8981\u300C\u9501\u5B9A\u671F\u95F4\u7559\u53D6\u6D88\u94AE\u300D\u4F20 `lockExceptions`\uFF08`confirmModal` \u6536 `['cancel']`\u3001`alertModal` \u6536 `true`\uFF09\uFF1B\u8BE5\u80FD\u529B\u53EA\u5728 core \u76AE\u80A4\u751F\u6548\uFF0C`skin:\"host\"` \u4F20\u4E86\u4F1A\u544A\u8B66\u5E76\u56DE\u843D core\uFF0C\u4E0D\u9759\u9ED8\u541E\u6389\u3002",
68362
+ "zh": "\u547D\u4EE4\u5F0F `confirmModal(opts)` / `alertModal(opts)` \u8FD4\u56DE Promise\uFF1A\u524D\u8005 resolve `true`\uFF08\u786E\u5B9A\uFF09\u6216 `false`\uFF08\u53D6\u6D88 / \u906E\u7F69 / Esc\uFF09\uFF0C\u540E\u8005\u5173\u95ED\u5373 resolve\u3002\u56DE\u8C03\u8FD4\u56DE Promise \u65F6\u5BF9\u5E94\u6309\u94AE\u81EA\u5DF1\u8F6C\u5708\u3001\u6574\u6846\u9501\u6B7B\uFF0Csettle \u540E\u624D\u5173\u3002\u8981\u300C\u9501\u5B9A\u671F\u95F4\u7559\u53D6\u6D88\u94AE\u300D\u4F20 `lockExceptions`\uFF08`confirmModal` \u6536 `['cancel']`\u3001`alertModal` \u6536 `true`\uFF09\uFF1B\u8BE5\u80FD\u529B\u53EA\u5728 core \u76AE\u80A4\u751F\u6548\uFF0C`skin:\"host\"` \u4F20\u4E86\u4F1A\u544A\u8B66\u5E76\u56DE\u843D core\uFF0C\u4E0D\u9759\u9ED8\u541E\u6389\u3002host \u76AE\u80A4\u672C\u8EAB\u53EA\u8F6C\u4EA4 `title` / `message` / `confirmText` / `cancelText` / `danger`\uFF0C\u5176\u4F59\u5B57\u6BB5\uFF08\u56DE\u8C03\u3001`notice`\u3001`size`\u3001\u5BBD\u5EA6\u3001`loadingText`\u3001`closeOnMask`\u3001`tone: warning` \u7B49\uFF09\u4F20\u4E86\u540C\u6837\u544A\u8B66\u5E76\u56DE\u843D core\u3002",
68347
68363
  "en": "The imperative `confirmModal(opts)` / `alertModal(opts)` return a Promise: the former resolves `true` (confirmed) or `false` (cancel / mask / Esc), the latter resolves on close. When a callback returns a Promise, its button spins and the dialog locks until it settles. To keep the cancel button clickable while locked, pass `lockExceptions` (`confirmModal` takes `['cancel']`, `alertModal` takes `true`); it only works on the core skin \u2014 `skin:\"host\"` warns and falls back to core instead of swallowing it silently."
68348
68364
  },
68349
68365
  {
@@ -68981,8 +68997,8 @@ var docData = {
68981
68997
  "type": "'core' | 'host'",
68982
68998
  "def": "'core'",
68983
68999
  "desc": {
68984
- "zh": "host \u8D70\u5BBF\u4E3B\u539F\u751F Modal\uFF08\u9700\u5148\u5F15\u5165\u9002\u914D\u5C42 `official.js`\uFF0C\u672A\u6CE8\u518C\u5219\u56DE\u843D core \u5E76\u544A\u8B66\uFF09\uFF1B**host \u4E0D\u652F\u6301 `lockExceptions`**\uFF0C\u4F20\u4E86\u4F1A\u544A\u8B66\u5E76\u56DE\u843D core",
68985
- "en": "host uses the host\u2019s native Modal (requires the `official.js` adapter; falls back to core with a warning when unregistered); **host does not support `lockExceptions`** \u2014 passing it warns and falls back to core"
69000
+ "zh": "host \u8D70\u5BBF\u4E3B\u539F\u751F Modal\uFF08\u9700\u5148\u5F15\u5165\u9002\u914D\u5C42 `official.js`\uFF0C\u672A\u6CE8\u518C\u5219\u56DE\u843D core \u5E76\u544A\u8B66\uFF09\u3002host \u53EA\u8BA4 `title` / `message` / `confirmText` / `cancelText` / `tone: danger`\uFF1B\u4F20\u4E86\u5176\u4ED6\u4EFB\u4F55\u5B57\u6BB5\uFF08`onConfirm` / `onCancel`\u3001`notice`\u3001`size`\u3001\u5BBD\u5EA6\u3001`loadingText`\u3001`closeOnMask`\u3001`tone: warning`\u3001`lockExceptions`\u2026\uFF09\u90FD\u4F1A**\u544A\u8B66\u5E76\u56DE\u843D core**\uFF0C\u4E0D\u4F1A\u9759\u9ED8\u964D\u7EA7",
69001
+ "en": "host uses the host\u2019s native Modal (requires the `official.js` adapter; falls back to core with a warning when unregistered). host accepts only `title` / `message` / `confirmText` / `cancelText` / `tone: danger`; passing anything else (`onConfirm` / `onCancel`, `notice`, `size`, widths, `loadingText`, `closeOnMask`, `tone: warning`, `lockExceptions`\u2026) **warns and falls back to core** instead of silently degrading"
68986
69002
  }
68987
69003
  },
68988
69004
  {
@@ -77246,9 +77262,9 @@ function ReferencePage() {
77246
77262
  "tbody",
77247
77263
  null,
77248
77264
  [
77249
- [t3("buildCore"), `v${"0.42.1"}`],
77250
- [t3("buildDemo"), `v${"0.42.1"}`],
77251
- [t3("buildStamp"), "261117-064545-153"]
77265
+ [t3("buildCore"), `v${"0.42.3"}`],
77266
+ [t3("buildDemo"), `v${"0.42.3"}`],
77267
+ [t3("buildStamp"), "261117-073410-180"]
77252
77268
  ].map(
77253
77269
  ([label, value]) => (0, import_react110.createElement)(
77254
77270
  "tr",
@@ -77567,9 +77583,9 @@ function DemoPage() {
77567
77583
  lineHeight: "14px"
77568
77584
  }
77569
77585
  },
77570
- (0, import_react112.createElement)("span", null, `core v${"0.42.1"}`),
77571
- (0, import_react112.createElement)("span", null, `demo v${"0.42.1"}`),
77572
- (0, import_react112.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261117-064545-153")
77586
+ (0, import_react112.createElement)("span", null, `core v${"0.42.3"}`),
77587
+ (0, import_react112.createElement)("span", null, `demo v${"0.42.3"}`),
77588
+ (0, import_react112.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261117-073410-180")
77573
77589
  )
77574
77590
  )
77575
77591
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-core-demo",
3
- "version": "0.42.1",
3
+ "version": "0.42.3",
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": [