@antglobal/copilot-cards-web 0.0.20260828032020-dev.13 → 0.0.20260828032020-dev.17

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 +13 -18
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -9193,28 +9193,15 @@ function createCardNodeAccess(container) {
9193
9193
  }
9194
9194
 
9195
9195
  const DISABLED_MARKER = 'data-copilot-card-disabled';
9196
- const DISABLED_STYLES_MARKER = 'data-copilot-card-disabled-styles';
9197
- const DISABLED_PRESENTATION_CSS = `
9198
- [${DISABLED_MARKER}="true"] {
9199
- background-color: var(--card-disabled-background, #F5F5F5) !important;
9200
- color: var(--card-disabled-foreground, #C0C0C0) !important;
9201
- }
9202
- `;
9203
- function ensureDisabledPresentationStyles(ownerDocument) {
9204
- if (ownerDocument.head.querySelector(`style[${DISABLED_STYLES_MARKER}]`)) {
9205
- return;
9206
- }
9207
- const style = ownerDocument.createElement('style');
9208
- style.setAttribute(DISABLED_STYLES_MARKER, '');
9209
- style.textContent = DISABLED_PRESENTATION_CSS;
9210
- ownerDocument.head.appendChild(style);
9211
- }
9212
9196
  function applyDisabledState(element, disabled) {
9213
9197
  if (!disabled)
9214
9198
  return;
9215
- ensureDisabledPresentationStyles(element.ownerDocument);
9216
9199
  element.setAttribute('data-disabled', 'true');
9217
9200
  element.setAttribute(DISABLED_MARKER, 'true');
9201
+ // Inline declarations work inside host ShadowRoots too. Use the shorthand
9202
+ // to mask background images/gradients, matching the historical disabled state.
9203
+ element.style.background = 'var(--card-disabled-background, #F5F5F5)';
9204
+ element.style.color = 'var(--card-disabled-foreground, #C0C0C0)';
9218
9205
  element.style.pointerEvents = 'none';
9219
9206
  element.style.cursor = 'default';
9220
9207
  }
@@ -9982,7 +9969,12 @@ function renderBoundCard(container, schema, options) {
9982
9969
  try {
9983
9970
  for (const [occurrenceKey, plan] of appendPlans) {
9984
9971
  const prepared = findPreparedByOccurrenceKey(preparedRoot, occurrenceKey);
9985
- if (!prepared?.[REPEAT_APPEND]) {
9972
+ // Hidden or force-replaced ancestors prune their descendants from the
9973
+ // prepared tree. Their normal replacement commits the new variables;
9974
+ // there is no live descendant append to prepare in this transaction.
9975
+ if (!prepared)
9976
+ continue;
9977
+ if (!prepared[REPEAT_APPEND]) {
9986
9978
  throw new Error(`[renderCard] Missing prepared repeat append owner "${occurrenceKey}"`);
9987
9979
  }
9988
9980
  const nextOccurrenceKeys = occurrenceKeysForChildren(plan.current.occurrenceKey, plan.nextNode.children);
@@ -12425,6 +12417,8 @@ function renderStreamingCard(container, options = {}) {
12425
12417
  continue;
12426
12418
  if ('updateProps' in el) {
12427
12419
  el.updateProps(resolved, isMobile, options.responsive);
12420
+ // Some components replace host cssText while updating their props.
12421
+ applyDisabledState(el, wasDisabled);
12428
12422
  propsCache.set(id, key);
12429
12423
  }
12430
12424
  else if (!replaceSubtree(schema, id, el)) {
@@ -13596,6 +13590,7 @@ function renderStreamingCard(container, options = {}) {
13596
13590
  const typeChanged = el.getAttribute('data-card-type') !== element.type;
13597
13591
  if (!typeChanged && 'updateProps' in el) {
13598
13592
  el.updateProps(resolved, isMobile, options.responsive);
13593
+ applyDisabledState(el, wasDisabled);
13599
13594
  propsCache.set(id, key);
13600
13595
  }
13601
13596
  else if (!typeChanged && isChildrenOnlyChange(propsCache.get(id), key, element)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antglobal/copilot-cards-web",
3
- "version": "0.0.20260828032020-dev.13",
3
+ "version": "0.0.20260828032020-dev.17",
4
4
  "description": "Web Component renderer for copilot bot card SDK — PC + Mobile + WebView unified rendering via Custom Elements",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
- "@antglobal/copilot-cards-core": "0.0.20260828032020-dev.13",
31
+ "@antglobal/copilot-cards-core": "0.0.20260828032020-dev.17",
32
32
  "echarts": "^5.6.0",
33
33
  "marked": "^18.0.5",
34
34
  "tslib": "^2.8.1",