Skip to content

Commit

Permalink
refactor(action-bar, action-group, action-pad, shell, shell-panel): r…
Browse files Browse the repository at this point in the history
…emove conditional slot component where not necessary. #6059
  • Loading branch information
driskull committed Oct 1, 2024
1 parent 12f1476 commit 0013d7d
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import {
Watch,
} from "@stencil/core";
import { debounce } from "lodash-es";
import {
ConditionalSlotComponent,
connectConditionalSlotComponent,
disconnectConditionalSlotComponent,
} from "../../utils/conditionalSlot";
import {
focusFirstTabbable,
slotChangeGetAssignedElements,
Expand Down Expand Up @@ -57,9 +52,7 @@ import { geActionDimensions, getOverflowCount, overflowActions, queryActions } f
shadow: true,
assetsDirs: ["assets"],
})
export class ActionBar
implements ConditionalSlotComponent, LoadableComponent, LocalizedComponent, T9nComponent
{
export class ActionBar implements LoadableComponent, LocalizedComponent, T9nComponent {
// --------------------------------------------------------------------------
//
// Properties
Expand Down Expand Up @@ -228,7 +221,6 @@ export class ActionBar
}

this.overflowActions();
connectConditionalSlotComponent(this);
}

async componentWillLoad(): Promise<void> {
Expand All @@ -239,7 +231,6 @@ export class ActionBar
disconnectedCallback(): void {
this.mutationObserver?.disconnect();
this.resizeObserver?.disconnect();
disconnectConditionalSlotComponent(this);
disconnectLocalized(this);
disconnectMessages(this);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import { Component, Element, h, Method, Prop, State, VNode, Watch } from "@stencil/core";
import { CalciteActionMenuCustomEvent } from "../../components";
import {
ConditionalSlotComponent,
connectConditionalSlotComponent,
disconnectConditionalSlotComponent,
} from "../../utils/conditionalSlot";
import {
componentFocusable,
LoadableComponent,
Expand Down Expand Up @@ -40,9 +35,7 @@ import { ICONS, SLOTS, CSS } from "./resources";
},
assetsDirs: ["assets"],
})
export class ActionGroup
implements ConditionalSlotComponent, LoadableComponent, LocalizedComponent, T9nComponent
{
export class ActionGroup implements LoadableComponent, LocalizedComponent, T9nComponent {
// --------------------------------------------------------------------------
//
// Properties
Expand Down Expand Up @@ -163,13 +156,11 @@ export class ActionGroup
connectedCallback(): void {
connectLocalized(this);
connectMessages(this);
connectConditionalSlotComponent(this);
}

disconnectedCallback(): void {
disconnectLocalized(this);
disconnectMessages(this);
disconnectConditionalSlotComponent(this);
}

async componentWillLoad(): Promise<void> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import {
VNode,
Watch,
} from "@stencil/core";
import {
ConditionalSlotComponent,
connectConditionalSlotComponent,
disconnectConditionalSlotComponent,
} from "../../utils/conditionalSlot";
import { slotChangeGetAssignedElements } from "../../utils/dom";
import {
componentFocusable,
Expand Down Expand Up @@ -50,9 +45,7 @@ import { CSS, SLOTS } from "./resources";
},
assetsDirs: ["assets"],
})
export class ActionPad
implements ConditionalSlotComponent, LoadableComponent, LocalizedComponent, T9nComponent
{
export class ActionPad implements LoadableComponent, LocalizedComponent, T9nComponent {
// --------------------------------------------------------------------------
//
// Properties
Expand Down Expand Up @@ -169,7 +162,6 @@ export class ActionPad
// --------------------------------------------------------------------------

connectedCallback(): void {
connectConditionalSlotComponent(this);
connectLocalized(this);
connectMessages(this);
this.mutationObserver?.observe(this.el, { childList: true, subtree: true });
Expand All @@ -178,7 +170,6 @@ export class ActionPad
disconnectedCallback(): void {
disconnectLocalized(this);
disconnectMessages(this);
disconnectConditionalSlotComponent(this);
this.mutationObserver?.disconnect();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ import {
VNode,
Watch,
} from "@stencil/core";
import {
ConditionalSlotComponent,
connectConditionalSlotComponent,
disconnectConditionalSlotComponent,
} from "../../utils/conditionalSlot";
import {
getElementDir,
isPrimaryPointerButton,
Expand Down Expand Up @@ -46,7 +41,7 @@ import { DisplayMode } from "./interfaces";
shadow: true,
assetsDirs: ["assets"],
})
export class ShellPanel implements ConditionalSlotComponent, LocalizedComponent, T9nComponent {
export class ShellPanel implements LocalizedComponent, T9nComponent {
// --------------------------------------------------------------------------
//
// Properties
Expand Down Expand Up @@ -167,7 +162,6 @@ export class ShellPanel implements ConditionalSlotComponent, LocalizedComponent,
//--------------------------------------------------------------------------

connectedCallback(): void {
connectConditionalSlotComponent(this);
connectLocalized(this);
connectMessages(this);
}
Expand All @@ -177,7 +171,6 @@ export class ShellPanel implements ConditionalSlotComponent, LocalizedComponent,
}

disconnectedCallback(): void {
disconnectConditionalSlotComponent(this);
this.disconnectSeparator();
disconnectLocalized(this);
disconnectMessages(this);
Expand Down
21 changes: 1 addition & 20 deletions packages/calcite-components/src/components/shell/shell.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
import { Component, Element, Fragment, h, Listen, Prop, State, VNode, Watch } from "@stencil/core";
import {
ConditionalSlotComponent,
connectConditionalSlotComponent,
disconnectConditionalSlotComponent,
} from "../../utils/conditionalSlot";
import { slotChangeGetAssignedElements, slotChangeHasAssignedElement } from "../../utils/dom";
import { CSS, SLOTS } from "./resources";

Expand All @@ -27,7 +22,7 @@ import { CSS, SLOTS } from "./resources";
styleUrl: "shell.scss",
shadow: true,
})
export class Shell implements ConditionalSlotComponent {
export class Shell {
// --------------------------------------------------------------------------
//
// Properties
Expand Down Expand Up @@ -91,20 +86,6 @@ export class Shell implements ConditionalSlotComponent {
this.hasOnlyPanelBottom = !this.hasPanelTop && this.hasPanelBottom;
}

// --------------------------------------------------------------------------
//
// Lifecycle
//
// --------------------------------------------------------------------------

connectedCallback(): void {
connectConditionalSlotComponent(this);
}

disconnectedCallback(): void {
disconnectConditionalSlotComponent(this);
}

// --------------------------------------------------------------------------
//
// Private Methods
Expand Down

0 comments on commit 0013d7d

Please sign in to comment.