svelte-flexiboards 0.1.1 → 0.2.0
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/dist/components/flexi-add.svelte +11 -5
- package/dist/components/flexi-add.svelte.d.ts +1 -0
- package/dist/components/flexi-board.svelte +5 -0
- package/dist/components/flexi-grab.svelte +1 -1
- package/dist/components/flexi-grid.svelte +1 -1
- package/dist/components/flexi-portal.svelte +13 -0
- package/dist/components/flexi-portal.svelte.d.ts +3 -0
- package/dist/components/flexi-resize.svelte +1 -1
- package/dist/components/flexi-target.svelte +13 -15
- package/dist/components/rendered-flexi-widget.svelte +7 -0
- package/dist/components/widget-transition-placeholder.svelte +12 -0
- package/dist/components/widget-transition-placeholder.svelte.d.ts +18 -0
- package/dist/index.d.ts +17 -16
- package/dist/index.js +11 -9
- package/dist/system/grid/base.svelte.d.ts +49 -0
- package/dist/system/grid/base.svelte.js +92 -0
- package/dist/system/grid/flow-grid.svelte.d.ts +49 -0
- package/dist/system/grid/flow-grid.svelte.js +380 -0
- package/dist/system/grid/free-grid.svelte.d.ts +46 -0
- package/dist/system/grid/free-grid.svelte.js +338 -0
- package/dist/system/grid/index.d.ts +4 -0
- package/dist/system/grid/index.js +4 -0
- package/dist/system/manage.svelte.d.ts +1 -0
- package/dist/system/manage.svelte.js +8 -5
- package/dist/system/portal.d.ts +25 -0
- package/dist/system/portal.js +100 -0
- package/dist/system/provider.svelte.d.ts +7 -6
- package/dist/system/provider.svelte.js +52 -28
- package/dist/system/target.svelte.d.ts +21 -16
- package/dist/system/target.svelte.js +55 -37
- package/dist/system/types.d.ts +2 -0
- package/dist/system/utils.svelte.d.ts +27 -3
- package/dist/system/utils.svelte.js +167 -19
- package/dist/system/widget.svelte.d.ts +79 -16
- package/dist/system/widget.svelte.js +290 -52
- package/package.json +61 -56
- package/LICENSE.md +0 -21
- package/dist/system/grid.svelte.d.ts +0 -146
- package/dist/system/grid.svelte.js +0 -815
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
type FlexiAddChildrenProps = {
|
|
14
14
|
onpointerdown: (event: PointerEvent) => void;
|
|
15
|
+
style: string;
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export type FlexiAddProps = FlexiCommonProps<FlexiAddController> & {
|
|
@@ -27,9 +28,14 @@
|
|
|
27
28
|
controller = adder;
|
|
28
29
|
</script>
|
|
29
30
|
|
|
30
|
-
{@render children?.({ adder, props: {
|
|
31
|
+
{@render children?.({ adder, props: {
|
|
32
|
+
onpointerdown,
|
|
33
|
+
style: 'touch-action: none;'
|
|
34
|
+
} })}
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
{
|
|
36
|
+
<div style="display: none;">
|
|
37
|
+
<!-- Mimics the behaviour of a FlexiTarget, as we need to render the widget so that we can "drag it in" from -->
|
|
38
|
+
{#if adder.newWidget}
|
|
39
|
+
<RenderedFlexiWidget widget={adder.newWidget} />
|
|
40
|
+
{/if}
|
|
41
|
+
</div>
|
|
@@ -3,6 +3,7 @@ import type { Snippet } from 'svelte';
|
|
|
3
3
|
import type { FlexiCommonProps } from '../system/types.js';
|
|
4
4
|
type FlexiAddChildrenProps = {
|
|
5
5
|
onpointerdown: (event: PointerEvent) => void;
|
|
6
|
+
style: string;
|
|
6
7
|
};
|
|
7
8
|
export type FlexiAddProps = FlexiCommonProps<FlexiAddController> & {
|
|
8
9
|
children?: Snippet<[{
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
18
|
<script lang="ts">
|
|
19
|
+
import FlexiPortal from './flexi-portal.svelte';
|
|
20
|
+
|
|
19
21
|
let { controller: board = $bindable(), onfirstcreate, ...props }: FlexiBoardProps = $props();
|
|
20
22
|
|
|
21
23
|
board = flexiboard(props);
|
|
@@ -28,3 +30,6 @@
|
|
|
28
30
|
|
|
29
31
|
<!-- Component that tells the board it can start importing stuff, if needed. -->
|
|
30
32
|
<FlexiLayoutLoader />
|
|
33
|
+
|
|
34
|
+
<!-- Component that uses a shared portal for rendering grabbed widgets over the pointer. -->
|
|
35
|
+
<FlexiPortal />
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
const { widget, onpointerdown } = flexigrab();
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<button class={className} {onpointerdown}>
|
|
18
|
+
<button style={"user-select: none; cursor: grab; touch-action: none;"} class={className} {onpointerdown}>
|
|
19
19
|
{@render children?.({ widget })}
|
|
20
20
|
</button>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { flexiportal, destroyFlexiportal } from '../system/portal.js';
|
|
3
|
+
|
|
4
|
+
// Simply just wait until we're mounted to the DOM before initialising the portal.
|
|
5
|
+
$effect(() => {
|
|
6
|
+
flexiportal();
|
|
7
|
+
|
|
8
|
+
// Garbage collect on destroy
|
|
9
|
+
return () => {
|
|
10
|
+
destroyFlexiportal();
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
</script>
|
|
@@ -15,6 +15,6 @@
|
|
|
15
15
|
const { widget, onpointerdown } = flexiresize();
|
|
16
16
|
</script>
|
|
17
17
|
|
|
18
|
-
<button class={className} {onpointerdown}>
|
|
18
|
+
<button style={"user-select: none; cursor: nwse-resize; touch-action: none;"} class={className} {onpointerdown}>
|
|
19
19
|
{@render children?.({ widget })}
|
|
20
20
|
</button>
|
|
@@ -72,22 +72,20 @@
|
|
|
72
72
|
onfirstcreate?.(target);
|
|
73
73
|
</script>
|
|
74
74
|
|
|
75
|
-
<div>
|
|
76
|
-
|
|
77
|
-
{@render header?.({ target })}
|
|
75
|
+
<div class={containerClass} {onpointerenter} {onpointerleave} role="grid" tabindex={0}>
|
|
76
|
+
{@render header?.({ target })}
|
|
78
77
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
</div>
|
|
78
|
+
<!-- Allow user to specify components directly via a registration component. Once that's done, mount them to the actual target list dynamically -->
|
|
79
|
+
<FlexiGrid class={className}>
|
|
80
|
+
{#if !target.prepared && children}
|
|
81
|
+
{@render children()}
|
|
82
|
+
{:else if target.prepared}
|
|
83
|
+
{#each target.widgets as widget (widget)}
|
|
84
|
+
<RenderedFlexiWidget {widget} />
|
|
85
|
+
{/each}
|
|
86
|
+
{/if}
|
|
87
|
+
</FlexiGrid>
|
|
88
|
+
{@render footer?.({ target })}
|
|
91
89
|
</div>
|
|
92
90
|
|
|
93
91
|
<FlexiTargetLoader />
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import { renderedflexiwidget, type FlexiWidgetController } from '../system/widget.svelte.js';
|
|
3
|
+
import WidgetTransitionPlaceholder from './widget-transition-placeholder.svelte';
|
|
3
4
|
|
|
4
5
|
export type RenderedFlexiWidgetProps = {
|
|
5
6
|
widget: FlexiWidgetController;
|
|
@@ -35,6 +36,7 @@
|
|
|
35
36
|
{#if widget.snippet}
|
|
36
37
|
{@render widget.snippet({
|
|
37
38
|
widget,
|
|
39
|
+
// NEXT: Remove these in v0.3
|
|
38
40
|
component: widget.component,
|
|
39
41
|
componentProps: widget.componentProps
|
|
40
42
|
})}
|
|
@@ -42,3 +44,8 @@
|
|
|
42
44
|
<widget.component {...widget.componentProps ?? {}} />
|
|
43
45
|
{/if}
|
|
44
46
|
</div>
|
|
47
|
+
|
|
48
|
+
<!-- When it exists, this temporarily occupies the widget's destination space, allowing the widget to be absolutely positioned to interpolate to its final destination. -->
|
|
49
|
+
{#if widget.shouldDrawPlaceholder}
|
|
50
|
+
<WidgetTransitionPlaceholder />
|
|
51
|
+
{/if}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { getFlexiwidgetInterpolatorCtx } from '../system/widget.svelte.js';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
4
|
+
|
|
5
|
+
const interpolator = getFlexiwidgetInterpolatorCtx();
|
|
6
|
+
|
|
7
|
+
let ref: HTMLElement;
|
|
8
|
+
|
|
9
|
+
onMount(() => interpolator.onPlaceholderMount(ref));
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div style={interpolator.placeholderStyle} bind:this={ref}></div>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const WidgetTransitionPlaceholder: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type WidgetTransitionPlaceholder = InstanceType<typeof WidgetTransitionPlaceholder>;
|
|
18
|
+
export default WidgetTransitionPlaceholder;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import FlexiBoard, { type FlexiBoardProps } from
|
|
2
|
-
import FlexiTarget, { type FlexiTargetProps } from
|
|
3
|
-
import FlexiWidget, { type FlexiWidgetProps } from
|
|
4
|
-
import FlexiGrab from
|
|
5
|
-
import FlexiResize from
|
|
6
|
-
import FlexiAdd from
|
|
7
|
-
import FlexiDelete from
|
|
8
|
-
import type { FlexiBoardConfiguration } from
|
|
9
|
-
import type { FlexiTargetConfiguration } from
|
|
10
|
-
import type
|
|
11
|
-
import type { FlexiBoardController } from
|
|
12
|
-
import type { FlexiTargetController } from
|
|
13
|
-
import type { FlexiWidgetController } from
|
|
14
|
-
import type { AdderWidgetConfiguration, FlexiAddController, FlexiAddWidgetFn } from
|
|
15
|
-
|
|
16
|
-
export
|
|
1
|
+
import FlexiBoard, { type FlexiBoardProps } from './components/flexi-board.svelte';
|
|
2
|
+
import FlexiTarget, { type FlexiTargetProps } from './components/flexi-target.svelte';
|
|
3
|
+
import FlexiWidget, { type FlexiWidgetProps } from './components/flexi-widget.svelte';
|
|
4
|
+
import FlexiGrab from './components/flexi-grab.svelte';
|
|
5
|
+
import FlexiResize from './components/flexi-resize.svelte';
|
|
6
|
+
import FlexiAdd from './components/flexi-add.svelte';
|
|
7
|
+
import FlexiDelete from './components/flexi-delete.svelte';
|
|
8
|
+
import type { FlexiBoardConfiguration } from './system/provider.svelte.js';
|
|
9
|
+
import type { FlexiTargetConfiguration } from './system/target.svelte.js';
|
|
10
|
+
import { type FlexiWidgetChildrenSnippet, type FlexiWidgetChildrenSnippetParameters, type FlexiWidgetConfiguration, type FlexiWidgetTriggerConfiguration, getFlexiwidgetCtx } from './system/widget.svelte.js';
|
|
11
|
+
import type { FlexiBoardController } from './system/provider.svelte.js';
|
|
12
|
+
import type { FlexiTargetController } from './system/target.svelte.js';
|
|
13
|
+
import type { FlexiWidgetController } from './system/widget.svelte.js';
|
|
14
|
+
import type { AdderWidgetConfiguration, FlexiAddController, FlexiAddWidgetFn } from './system/manage.svelte.js';
|
|
15
|
+
import { immediateTriggerConfig, longPressTriggerConfig, type PointerTriggerCondition } from './system/utils.svelte.js';
|
|
16
|
+
export * from './system/types.js';
|
|
17
|
+
export { FlexiBoard, type FlexiBoardConfiguration, type FlexiBoardProps, FlexiTarget, type FlexiTargetConfiguration, type FlexiTargetProps, FlexiWidget, type FlexiWidgetConfiguration, type FlexiWidgetProps, FlexiGrab, FlexiResize, FlexiAdd, FlexiDelete, type FlexiAddWidgetFn, type AdderWidgetConfiguration, type FlexiWidgetController, type FlexiBoardController, type FlexiTargetController, type FlexiAddController, type FlexiWidgetChildrenSnippet, type FlexiWidgetChildrenSnippetParameters, type PointerTriggerCondition, type FlexiWidgetTriggerConfiguration, immediateTriggerConfig, longPressTriggerConfig, getFlexiwidgetCtx };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// Reexport your entry components here
|
|
2
|
-
import FlexiBoard, {} from
|
|
3
|
-
import FlexiTarget, {} from
|
|
4
|
-
import FlexiWidget, {} from
|
|
5
|
-
import FlexiGrab from
|
|
6
|
-
import FlexiResize from
|
|
7
|
-
import FlexiAdd from
|
|
8
|
-
import FlexiDelete from
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import FlexiBoard, {} from './components/flexi-board.svelte';
|
|
3
|
+
import FlexiTarget, {} from './components/flexi-target.svelte';
|
|
4
|
+
import FlexiWidget, {} from './components/flexi-widget.svelte';
|
|
5
|
+
import FlexiGrab from './components/flexi-grab.svelte';
|
|
6
|
+
import FlexiResize from './components/flexi-resize.svelte';
|
|
7
|
+
import FlexiAdd from './components/flexi-add.svelte';
|
|
8
|
+
import FlexiDelete from './components/flexi-delete.svelte';
|
|
9
|
+
import { getFlexiwidgetCtx } from './system/widget.svelte.js';
|
|
10
|
+
import { immediateTriggerConfig, longPressTriggerConfig } from './system/utils.svelte.js';
|
|
11
|
+
export * from './system/types.js';
|
|
12
|
+
export { FlexiBoard, FlexiTarget, FlexiWidget, FlexiGrab, FlexiResize, FlexiAdd, FlexiDelete, immediateTriggerConfig, longPressTriggerConfig, getFlexiwidgetCtx };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { InternalFlexiTargetController, FlexiTargetConfiguration } from "../target.svelte.js";
|
|
2
|
+
import { GridDimensionTracker } from "../utils.svelte.js";
|
|
3
|
+
import type { FlexiWidgetController } from "../widget.svelte.js";
|
|
4
|
+
export type MoveOperation = {
|
|
5
|
+
widget: FlexiWidgetController;
|
|
6
|
+
newX: number;
|
|
7
|
+
newY: number;
|
|
8
|
+
oldX: number;
|
|
9
|
+
oldY: number;
|
|
10
|
+
};
|
|
11
|
+
export type WidgetSnapshot = {
|
|
12
|
+
widget: FlexiWidgetController;
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
18
|
+
export declare abstract class FlexiGrid {
|
|
19
|
+
#private;
|
|
20
|
+
abstract tryPlaceWidget(widget: FlexiWidgetController, cellX?: number, cellY?: number, width?: number, height?: number): boolean;
|
|
21
|
+
abstract removeWidget(widget: FlexiWidgetController): boolean;
|
|
22
|
+
abstract takeSnapshot(): unknown;
|
|
23
|
+
abstract restoreFromSnapshot(snapshot: unknown): void;
|
|
24
|
+
abstract mapRawCellToFinalCell(x: number, y: number): [number, number];
|
|
25
|
+
_target: InternalFlexiTargetController;
|
|
26
|
+
_targetConfig: FlexiTargetConfiguration;
|
|
27
|
+
mouseCellPosition: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
_dimensionTracker: GridDimensionTracker;
|
|
32
|
+
constructor(target: InternalFlexiTargetController, targetConfig: FlexiTargetConfiguration);
|
|
33
|
+
style: string;
|
|
34
|
+
watchGridElementDimensions(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Clears the grid layout.
|
|
37
|
+
*/
|
|
38
|
+
abstract clear(): void;
|
|
39
|
+
onpointermove(event: PointerEvent): void;
|
|
40
|
+
forceUpdatePointerPosition(clientX: number, clientY: number): void;
|
|
41
|
+
abstract get rows(): number;
|
|
42
|
+
abstract get columns(): number;
|
|
43
|
+
get ref(): HTMLElement | null;
|
|
44
|
+
set ref(ref: HTMLElement | null);
|
|
45
|
+
}
|
|
46
|
+
export declare function flexigrid(): {
|
|
47
|
+
grid: FlexiGrid;
|
|
48
|
+
};
|
|
49
|
+
export declare function getFlexigridCtx(): FlexiGrid | undefined;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { setContext } from "svelte";
|
|
2
|
+
import { getContext } from "svelte";
|
|
3
|
+
import { getInternalFlexitargetCtx } from "../target.svelte.js";
|
|
4
|
+
import { GridDimensionTracker } from "../utils.svelte.js";
|
|
5
|
+
export class FlexiGrid {
|
|
6
|
+
_target;
|
|
7
|
+
_targetConfig;
|
|
8
|
+
mouseCellPosition = $state({
|
|
9
|
+
x: 0,
|
|
10
|
+
y: 0
|
|
11
|
+
});
|
|
12
|
+
#ref = $state({ ref: null });
|
|
13
|
+
_dimensionTracker;
|
|
14
|
+
constructor(target, targetConfig) {
|
|
15
|
+
this._target = target;
|
|
16
|
+
this._targetConfig = targetConfig;
|
|
17
|
+
this._dimensionTracker = new GridDimensionTracker(this, targetConfig);
|
|
18
|
+
this.onpointermove = this.onpointermove.bind(this);
|
|
19
|
+
$effect(() => {
|
|
20
|
+
window.addEventListener('pointermove', this.onpointermove);
|
|
21
|
+
return () => {
|
|
22
|
+
window.removeEventListener('pointermove', this.onpointermove);
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
style = $derived.by(() => {
|
|
27
|
+
return `display: grid; grid-template-columns: ${this.#getSizing(this.columns, this._targetConfig.columnSizing)}; grid-template-rows: ${this.#getSizing(this.rows, this._targetConfig.rowSizing)};`;
|
|
28
|
+
});
|
|
29
|
+
#getSizing(axisCount, sizing) {
|
|
30
|
+
if (typeof sizing === "string") {
|
|
31
|
+
return `repeat(${axisCount}, ${sizing})`;
|
|
32
|
+
}
|
|
33
|
+
return sizing({ target: this._target, grid: this });
|
|
34
|
+
}
|
|
35
|
+
#updatePointerPosition(clientX, clientY) {
|
|
36
|
+
if (!this.ref) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const rawCell = this._dimensionTracker.getCellFromPointerPosition(clientX, clientY);
|
|
40
|
+
let cell = rawCell;
|
|
41
|
+
if (rawCell) {
|
|
42
|
+
const [x, y] = this.mapRawCellToFinalCell(rawCell.column, rawCell.row);
|
|
43
|
+
cell = {
|
|
44
|
+
row: y,
|
|
45
|
+
column: x
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
this.mouseCellPosition.x = cell?.column ?? 0;
|
|
49
|
+
this.mouseCellPosition.y = cell?.row ?? 0;
|
|
50
|
+
this._target.onmousegridcellmove({
|
|
51
|
+
cellX: this.mouseCellPosition.x,
|
|
52
|
+
cellY: this.mouseCellPosition.y
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
watchGridElementDimensions() {
|
|
56
|
+
if (!this.ref) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this._dimensionTracker.watchGrid();
|
|
60
|
+
}
|
|
61
|
+
onpointermove(event) {
|
|
62
|
+
this.#updatePointerPosition(event.clientX, event.clientY);
|
|
63
|
+
}
|
|
64
|
+
forceUpdatePointerPosition(clientX, clientY) {
|
|
65
|
+
this.#updatePointerPosition(clientX, clientY);
|
|
66
|
+
}
|
|
67
|
+
get ref() {
|
|
68
|
+
return this.#ref.ref;
|
|
69
|
+
}
|
|
70
|
+
set ref(ref) {
|
|
71
|
+
this.#ref.ref = ref;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const contextKey = Symbol('flexigrid');
|
|
75
|
+
export function flexigrid() {
|
|
76
|
+
const target = getInternalFlexitargetCtx();
|
|
77
|
+
if (!target) {
|
|
78
|
+
throw new Error("A FlexiGrid was instantiated outside of a FlexiTarget context. Ensure that flexigrid() is called within a FlexiTarget component.");
|
|
79
|
+
}
|
|
80
|
+
const grid = target.createGrid();
|
|
81
|
+
setContext(contextKey, grid);
|
|
82
|
+
// Tell the grid's dimension tracker to watch the grid element.
|
|
83
|
+
$effect(() => {
|
|
84
|
+
grid.watchGridElementDimensions();
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
grid
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export function getFlexigridCtx() {
|
|
91
|
+
return getContext(contextKey);
|
|
92
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The layout configuration for a flow layout based grid.
|
|
3
|
+
*/
|
|
4
|
+
export type FlowTargetLayout = {
|
|
5
|
+
type: 'flow';
|
|
6
|
+
/**
|
|
7
|
+
* Specifies how widgets should be added when no coordinates are specified.
|
|
8
|
+
*
|
|
9
|
+
* - "append" will add a widget after the last widget in the grid.
|
|
10
|
+
* - "prepend" will add a widget before the first widget in the grid.
|
|
11
|
+
*/
|
|
12
|
+
placementStrategy: 'append' | 'prepend';
|
|
13
|
+
/**
|
|
14
|
+
* When set to true, the grid will ignore coordinates provided when adding widgets and instead
|
|
15
|
+
* default to the placement strategy's behaviour.
|
|
16
|
+
*/
|
|
17
|
+
disallowInsert?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The axis that widgets are placed along.
|
|
20
|
+
*
|
|
21
|
+
* - When set to "row", widgets are added along the columns of a row before wrapping to the next row.
|
|
22
|
+
* - When set to "column", widgets are added along the rows of a column before wrapping to the next column.
|
|
23
|
+
*/
|
|
24
|
+
flowAxis: 'row' | 'column';
|
|
25
|
+
/**
|
|
26
|
+
* Whether the grid should be blocked from automatically expanding when all cell space is used.
|
|
27
|
+
*
|
|
28
|
+
* - When unset and the flow axis is set to "row", the grid will create new rows when the last row is full.
|
|
29
|
+
* - When unset and the flow axis is set to "column", the grid will create new columns when the last column is full.
|
|
30
|
+
* - When set to true, the grid will be at capacity when all cells are used.
|
|
31
|
+
* @deprecated Use maxFlowAxis == rows or columns to control expandability.
|
|
32
|
+
*/
|
|
33
|
+
disallowExpansion?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The maximum number of rows or columns that can be used depending on what the flow axis is set to.
|
|
36
|
+
*
|
|
37
|
+
* - When flowAxis is set to "row", the grid will not allow more rows than this value.
|
|
38
|
+
* - When flowAxis is set to "column", the grid will not allow more columns than this value.
|
|
39
|
+
*/
|
|
40
|
+
maxFlowAxis?: number;
|
|
41
|
+
/**
|
|
42
|
+
* The number of rows that the grid should have.
|
|
43
|
+
*/
|
|
44
|
+
rows?: number;
|
|
45
|
+
/**
|
|
46
|
+
* The number of columns that the grid should have.
|
|
47
|
+
*/
|
|
48
|
+
columns?: number;
|
|
49
|
+
};
|