Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP panel resize #322

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8dab553
feat: new component `FResize` (refs SFKUI-6500)
ext Feb 24, 2025
6e1f7fa
refactor: do not merge (refs SFKUI-6500)
ext Feb 24, 2025
57cb84a
fixup! feat: new component `FResize` (refs SFKUI-6500)
ext Feb 24, 2025
47e1f9c
fixup! fixup! feat: new component `FResize` (refs SFKUI-6500)
ext Feb 24, 2025
5765ed7
fixup! fixup! fixup! feat: new component `FResize` (refs SFKUI-6500)
ext Feb 24, 2025
9da8ffe
fixup! fixup! fixup! fixup! feat: new component `FResize` (refs SFKUI…
ext Feb 24, 2025
97c3df3
fixup! fixup! fixup! fixup! fixup! feat: new component `FResize` (ref…
ext Feb 25, 2025
630a137
fixup! fixup! fixup! fixup! fixup! fixup! feat: new component `FResiz…
ext Feb 25, 2025
070c220
fixup! refactor: do not merge (refs SFKUI-6500)
ext Feb 25, 2025
edbedf7
fixup! fixup! fixup! fixup! fixup! fixup! fixup! feat: new component …
ext Feb 25, 2025
326ddb7
fixup! fixup! refactor: do not merge (refs SFKUI-6500)
ext Feb 25, 2025
7e34898
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! feat: new com…
ext Feb 25, 2025
e7d2012
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! feat: …
ext Feb 25, 2025
b339f52
fixup! fixup! fixup! refactor: do not merge (refs SFKUI-6500)
ext Feb 25, 2025
4a0f9b7
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 25, 2025
94abf6a
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 25, 2025
501a8de
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 25, 2025
c497066
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 25, 2025
4450a7c
fixup! fixup! fixup! fixup! refactor: do not merge (refs SFKUI-6500)
ext Feb 25, 2025
b3d67d1
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 25, 2025
d8a325d
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 25, 2025
d75e8f4
fixup! fixup! fixup! fixup! fixup! refactor: do not merge (refs SFKUI…
ext Feb 25, 2025
bcd1152
fixup! fixup! fixup! fixup! fixup! fixup! refactor: do not merge (ref…
ext Feb 25, 2025
a51d8d1
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 25, 2025
a1a8c2d
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 26, 2025
cf60694
fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor: do not mer…
ext Feb 26, 2025
0a4e8e3
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 26, 2025
50e60be
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! refactor: do …
ext Feb 26, 2025
6a07b8e
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 26, 2025
7dd94da
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 26, 2025
7c3fda9
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 26, 2025
4ad34ee
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! refact…
ext Feb 26, 2025
2c201d9
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup!…
ext Feb 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions etc/vue.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -7254,9 +7254,9 @@ default: string;
validator(value: string): boolean;
};
}>> & Readonly<{}>, {
layout: "standard" | "short";
banner: boolean;
provideScreenReaderContext: boolean;
layout: "standard" | "short";
}, {}, {
FIcon: DefineComponent<ExtractPropTypes< {
name: {
Expand Down Expand Up @@ -14767,13 +14767,13 @@ rotate: string;
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
}, {}, string, ComponentProvideOptions, true, {}, any>;

// Warning: (ae-forgotten-export) The symbol "__VLS_Props_2" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "__VLS_Props_3" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const IComboboxDropdown: DefineComponent<__VLS_Props_2, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
export const IComboboxDropdown: DefineComponent<__VLS_Props_3, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
close: () => any;
select: (option: string) => any;
}, string, PublicProps, Readonly<__VLS_Props_2> & Readonly<{
}, string, PublicProps, Readonly<__VLS_Props_3> & Readonly<{
onClose?: (() => any) | undefined;
onSelect?: ((option: string) => any) | undefined;
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {
Expand Down Expand Up @@ -15341,6 +15341,13 @@ setFocus: boolean;
}, {}, {}, {}, string, ComponentProvideOptions, true, {}, any>;
}, {}, string, ComponentProvideOptions, true, {}, any>;

// Warning: (ae-forgotten-export) The symbol "__VLS_WithTemplateSlots_5" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "__VLS_component_5" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "__VLS_TemplateResult_5" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const IResizePane: __VLS_WithTemplateSlots_5<typeof __VLS_component_5, __VLS_TemplateResult_5["slots"]>;

// @public (undocumented)
export function isContextMenuSeparatorItem(value: ContextMenuItem & {
separator?: true;
Expand Down
159 changes: 158 additions & 1 deletion internal/vue-sandbox/src/App.vue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Denna ska återställas innan merge

Original file line number Diff line number Diff line change
@@ -1,3 +1,160 @@
<script setup lang="ts">
import { ref } from "vue";
import { IResizePane, FPageLayout, FFieldset, FCheckboxField } from "@fkui/vue";

const disabled = ref(false);
const enableLeft = ref(true);
const enableRight = ref(true);
const enableTop = ref(true);
const enableBottom = ref(true);
</script>

<template>
<router-view />
<f-page-layout layout="three-column">
<template #header>
<header v-if="enableTop">
<i-resize-pane :disabled min="100px" max="200px" initial="100%">

Check failure on line 16 in internal/vue-sandbox/src/App.vue

View workflow job for this annotation

GitHub Actions / Lint

Attribute "initial" has invalid value "100%"
<template #default="bindings">
<h2>Sidhuvud</h2>
<p>lorem ipsum dolor sit amet</p>
<pre>{{ JSON.stringify(bindings, null, 2) }}</pre>
</template>
</i-resize-pane>
</header>
</template>

<template #left>
<template v-if="enableLeft">
<i-resize-pane :disabled min="25%" max="40%" initial="400px">

Check failure on line 28 in internal/vue-sandbox/src/App.vue

View workflow job for this annotation

GitHub Actions / Lint

Attribute "min" has invalid value "25%"

Check failure on line 28 in internal/vue-sandbox/src/App.vue

View workflow job for this annotation

GitHub Actions / Lint

Attribute "max" has invalid value "40%"
<template #default="bindings">
<h2>Vänsterpanel</h2>
<p>lorem ipsum dolor sit amet</p>
<pre>{{ JSON.stringify(bindings, null, 2) }}</pre>
</template>
</i-resize-pane>
</template>
</template>

<template #right>
<template v-if="enableRight">
<i-resize-pane :disabled min="25%" max="40%" initial="400px">

Check failure on line 40 in internal/vue-sandbox/src/App.vue

View workflow job for this annotation

GitHub Actions / Lint

Attribute "min" has invalid value "25%"

Check failure on line 40 in internal/vue-sandbox/src/App.vue

View workflow job for this annotation

GitHub Actions / Lint

Attribute "max" has invalid value "40%"
<template #default="bindings">
<h2>Högerpanel</h2>
<p>Lorem ipsum dolor sit amet</p>
<pre>{{ JSON.stringify(bindings, null, 2) }}</pre>
</template>
</i-resize-pane>
</template>
</template>

<template #content>
<main>
<h1>Lorem ipsum</h1>
<p>Dolor sit amet.</p>
<h3>Inställningar</h3>
<f-fieldset>
<template #label>Areas</template>
<template #default>
<f-checkbox-field v-model="enableTop" :value="true">
<template #default>Header</template>
</f-checkbox-field>
<f-checkbox-field v-model="enableLeft" :value="true">
<template #default>Left panel</template>
</f-checkbox-field>
<f-checkbox-field v-model="enableRight" :value="true">
<template #default>Right panel</template>
</f-checkbox-field>
<f-checkbox-field v-model="enableBottom" :value="true">
<template #default>Bottom</template>
</f-checkbox-field>
</template>
</f-fieldset>
<f-fieldset>
<template #label>Settings</template>
<template #default>
<f-checkbox-field v-model="disabled" :value="true">
<template #default>Disabled</template>
</f-checkbox-field>
</template>
</f-fieldset>
<h3>Begränsa storlek</h3>
<p>
Attributen <code>min=".."</code> och <code>max=".."</code> anger minsta respektive största storleken
en yta kan få. Båda kan sättas antingen till ett eller flera värden.
</p>
<ul>
<li>
Om <code>min</code> utelämnas är default <code>0</code>, effektivt sett ingen nedgre gräns för
minsta storlek.
</li>
<li>
Om <code>max</code> utelämnas är default fönstrets totala storlek, effektivt sett ingen övre
gränst för största storlek.
</li>
</ul>
<p>
Värden kan vara i pixlar (<code>px</code>) eller procent (<code>%</code>). För att sätta flera
värden använd ett kommatecken <code>,</code> som separator.
</p>
<ul>
<li><code>200px</code> - min/max storlek satt till exakt 200px.</li>
<li><code>25%</code> - min/max storlek satt till 25% av fönstrets storlek.</li>
<li><code>200px, 25%</code> - min/max storlek satt till minsta/största av 200px eller 25%.</li>
</ul>
<p>
<strong>Notera!</strong> Storlekarna i debug-utskrift inkluderar storleken på handtaget man drar i.
Just nu idag är den 4px så sätter man <code>min</code> till <code>200px</code> rapporteras det som
<code>204px</code> dvs <code>200px + 4px</code>. Det är förväntat beteende.
</p>
<h3>Tangentbord</h3>
<ul>
<li><kbd>Vänster</kbd> ökar/minskar en vertikal panel.</li>
<li><kbd>Höger</kbd> ökar/minskar en vertikal panel.</li>
<li><kbd>Upp</kbd> ökar/minskar en horizontal panel.</li>
<li><kbd>Ner</kbd> ökar/minskar en horizontal panel.</li>
<li><kbd>Home</kbd> minskar ytan till minsta möjliga.</li>
<li><kbd>End</kbd> ökar ytan till största möjliga.</li>
</ul>
</main>
</template>

<template #footer>
<footer v-if="enableBottom">
<i-resize-pane :disabled min="100px" max="200px" initial="100%">

Check failure on line 123 in internal/vue-sandbox/src/App.vue

View workflow job for this annotation

GitHub Actions / Lint

Attribute "initial" has invalid value "100%"
<template #default="bindings">
<h2>Sidfot</h2>
<p>lorem ipsum dolor sit amet</p>
<pre>{{ JSON.stringify(bindings, null, 2) }}</pre>
</template>
</i-resize-pane>
</footer>
</template>
</f-page-layout>
</template>

<style>
body {
background: #eee;
margin: 0;
padding: 0;
}

main {
padding: 1rem;
}

.container {
background: #fff;
}

.resize {
background: rgb(144, 255, 255);
}

kbd {
border: 1px solid #ccc;
border-radius: 4px;
padding: 0.25rem;
background: #fff;
}
</style>
1 change: 1 addition & 0 deletions packages/design/src/internal-components/_all.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
@use "calendar/calendar";
@use "popup/popup";
@use "popupError/popuperror";
@use "resize-panel/all";
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@use "i-resize-handle";
@use "i-resize-pane";
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
@use "variables" as *;

$handle-offset: ($handle-size + $handle-expand) * 0.5;

.resize__handle {
flex: 0 0 $handle-size;
background: $handle-background;
touch-action: none;
user-select: none;
z-index: 1;
position: relative;
transition: z-index 0s $transition-duration;

@media (forced-colors: active) {
background: CanvasText;
}

&[aria-orientation="horizontal"] {
cursor: row-resize;
height: $handle-size;

&::before {
inset: (-$handle-expand) 0;
}
}

&[aria-orientation="vertical"] {
cursor: col-resize;
width: $handle-size;

&::before {
inset: 0 (-$handle-expand);
}
}

&::before {
content: "";
pointer-events: none;
position: absolute;
background-color: transparent;
transition: background-color $transition-duration ease-in;
}

&:focus::before,
&:hover::before,
&.drag::before {
background-color: $handle-highlight;
transition-delay: $transition-delay;

@media (forced-colors: active) {
background-color: Highlight;
}
}

/* disable regular focus indicator as this component has its own */
&:focus {
outline: none;
box-shadow: none;
}

/* when focus by keyboard we dont want the delay or transition */
&:focus::before {
transition: none;
}

/* as the handle area expand we increase z-index for the handle to make sure it covers other separators */
&:hover,
&:focus,
&.drag {
z-index: 2;
transition: z-index 0s 0s;
}

&.disabled {
cursor: auto;

&::before {
display: none;
}
}
}

.resize--left .resize__handle {
left: $handle-offset;
}

.resize--right .resize__handle {
right: $handle-offset;
}

.resize--top .resize__handle {
top: $handle-offset;
}

.resize--bottom .resize__handle {
bottom: $handle-offset;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@use "variables" as *;

.resize {
flex-grow: 1;
display: flex;
align-items: stretch;

&--left {
flex-direction: row;
width: var(--size);
}

&--right {
flex-direction: row-reverse;
width: var(--size);
}

&--top {
flex-direction: column;
height: var(--size);
}

&--bottom {
flex-direction: column-reverse;
height: var(--size);
}

&__content {
flex: 1 1 auto;
overflow: auto;
box-sizing: border-box;
}

&--left,
&--right {
.resize__content {
min-width: calc(var(--min) - $handle-size);
max-width: calc(var(--max) - $handle-size);
}
}

&--top,
&--bottom {
.resize__content {
min-height: calc(var(--min) - $handle-size);
max-height: calc(var(--max) - $handle-size);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* background color */
$handle-background: #ccc;

/* highlight color */
$handle-highlight: hotpink;

/* the width of the handle */
$handle-size: 4px;

/* how much extra space the handle occupies when hovering */
$handle-expand: 2px;

/* how long before visually indicating the hover state */
$transition-delay: 400ms;

/* how long the animation for the visual indicator is */
$transition-duration: 200ms;
6 changes: 6 additions & 0 deletions packages/theme-default/src/_css-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@
--f-logo-size-small: 0.8rem;
--f-logo-size-large: 0.8rem 6.195rem;

// Workaround: used and always set by IResizePane so the fallback plugin
// shouldn't even consider these but there is no way to disable (yet)
--size: 0;
--min: 0;
--max: 0;

// ********************************
// COMPONENT SPECIFIC VARIABLES END
// ********************************
Expand Down
Loading
Loading