@artooi/ag-ui-web-component 0.20.0 → 0.20.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@artooi/ag-ui-web-component",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "Framework-free <ag-ui-chat> Web Component over the AG-UI protocol. Drop-in chat sidebar with a pluggable client-side tool registry, DOM driver primitives, animations, and destructive-action confirmation modal.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -538,8 +538,12 @@ export class AgUiChat extends HTMLElement {
538
538
 
539
539
  attributeChangedCallback(name: string, previous: string | null, value: string | null): void {
540
540
  if (name === "placement") {
541
- // Placement moves the panel, so the edges its layout holds still change
542
- // with it. Deferred a frame so the new rules have applied.
541
+ // A placement owns the axes it fixes, so hand those back before anything
542
+ // else: a size dragged under the previous placement would otherwise sit
543
+ // inline and outrank the new one.
544
+ this.#releaseOwnedAxes();
545
+ // Placement also moves the panel, so the edges its layout holds still
546
+ // change with it. Deferred a frame so the new rules have applied.
543
547
  requestAnimationFrame(() => this.#syncResizeAnchor());
544
548
  return;
545
549
  }
@@ -1306,22 +1310,47 @@ export class AgUiChat extends HTMLElement {
1306
1310
  }
1307
1311
 
1308
1312
  /**
1309
- * Write a dragged size onto the host as custom properties.
1313
+ * Write a dragged size onto the host, on the axes this placement leaves free.
1310
1314
  *
1311
- * Properties rather than inline `width` / `height`: the placement rules set
1312
- * those same properties, so an inline dimension would outrank them and a
1313
- * panel dragged while floating would keep that width after switching to
1314
- * fullscreen.
1315
+ * Writing the custom property rather than inline `width` / `height` does
1316
+ * **not** by itself leave placement in charge an inline custom property
1317
+ * still outranks a `:host([placement=…])` rule setting the same property, so
1318
+ * a height dragged while floating capped a docked sidebar that had asked for
1319
+ * `100vh`. The cascade cannot arbitrate this; the axis check has to.
1320
+ *
1321
+ * So the rule is explicit: a placement owns the axes it fixes, and a
1322
+ * persisted size is only ever applied to the ones it does not.
1315
1323
  */
1316
1324
  #applySize(size: ResizeSize): void {
1325
+ const axis = this.#resizeAxis();
1326
+ if (axis === "none") {
1327
+ return;
1328
+ }
1317
1329
  if (size.width !== undefined) {
1318
1330
  this.style.setProperty("--ag-ui-width", `${size.width}px`);
1319
1331
  }
1320
- if (size.height !== undefined) {
1332
+ if (size.height !== undefined && axis === "both") {
1321
1333
  this.style.setProperty("--ag-ui-height", `${size.height}px`);
1322
1334
  }
1323
1335
  }
1324
1336
 
1337
+ /**
1338
+ * Drop any dragged size the new placement has taken ownership of.
1339
+ *
1340
+ * Without this a size survives the switch as an inline property and silently
1341
+ * overrides the placement it moved to — the panel keeps a floating height
1342
+ * while docked, and reads as a component that cannot do full height.
1343
+ */
1344
+ #releaseOwnedAxes(): void {
1345
+ const axis = this.#resizeAxis();
1346
+ if (axis !== "both") {
1347
+ this.style.removeProperty("--ag-ui-height");
1348
+ }
1349
+ if (axis === "none") {
1350
+ this.style.removeProperty("--ag-ui-width");
1351
+ }
1352
+ }
1353
+
1325
1354
  /** Persist a dragged size per tab, alongside the collapsed/theme preferences. */
1326
1355
  #persistSize(size: ResizeSize): void {
1327
1356
  const stored = { ...this.#readSize(), ...size };
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION: string = "0.20.0";
1
+ export const VERSION: string = "0.20.1";