svelte-flexiboards 0.2.0 → 0.3.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 +59 -13
- package/dist/components/flexi-add.svelte.d.ts +11 -3
- package/dist/components/flexi-announcer.svelte +24 -0
- package/dist/components/flexi-announcer.svelte.d.ts +7 -0
- package/dist/components/flexi-board.svelte +34 -11
- package/dist/components/flexi-board.svelte.d.ts +6 -4
- package/dist/components/flexi-delete.svelte +52 -7
- package/dist/components/flexi-delete.svelte.d.ts +13 -2
- package/dist/components/flexi-grab.svelte +13 -5
- package/dist/components/flexi-grab.svelte.d.ts +3 -3
- package/dist/components/flexi-grid.svelte +9 -1
- package/dist/components/flexi-layout-loader.svelte +1 -1
- package/dist/components/flexi-portal.svelte +2 -1
- package/dist/components/flexi-portal.svelte.d.ts +17 -2
- package/dist/components/flexi-resize.svelte +15 -5
- package/dist/components/flexi-resize.svelte.d.ts +3 -3
- package/dist/components/flexi-target-loader.svelte +1 -1
- package/dist/components/flexi-target.svelte +35 -11
- package/dist/components/flexi-target.svelte.d.ts +3 -2
- package/dist/components/flexi-widget.svelte +48 -7
- package/dist/components/flexi-widget.svelte.d.ts +3 -2
- package/dist/components/rendered-flexi-widget.svelte +26 -13
- package/dist/components/rendered-flexi-widget.svelte.d.ts +2 -2
- package/dist/components/widget-transition-placeholder.svelte +1 -1
- package/dist/index.d.ts +6 -9
- package/dist/index.js +4 -3
- package/dist/system/announcer.svelte.d.ts +12 -0
- package/dist/system/announcer.svelte.js +36 -0
- package/dist/system/base.svelte.d.ts +4 -0
- package/dist/system/base.svelte.js +6 -0
- package/dist/system/board/base.svelte.d.ts +19 -0
- package/dist/system/board/base.svelte.js +1 -0
- package/dist/system/board/controller.svelte.d.ts +44 -0
- package/dist/system/{provider.svelte.js → board/controller.svelte.js} +92 -134
- package/dist/system/board/events.d.ts +2 -0
- package/dist/system/board/events.js +42 -0
- package/dist/system/board/index.d.ts +6 -0
- package/dist/system/board/index.js +36 -0
- package/dist/system/board/types.d.ts +6 -0
- package/dist/system/board/types.js +1 -0
- package/dist/system/grid/base.svelte.d.ts +12 -7
- package/dist/system/grid/base.svelte.js +21 -17
- package/dist/system/grid/flow-grid.svelte.d.ts +0 -9
- package/dist/system/grid/flow-grid.svelte.js +2 -3
- package/dist/system/grid/free-grid.svelte.d.ts +22 -14
- package/dist/system/grid/free-grid.svelte.js +216 -27
- package/dist/system/misc/adder.svelte.d.ts +53 -0
- package/dist/system/misc/adder.svelte.js +134 -0
- package/dist/system/misc/deleter.svelte.d.ts +17 -0
- package/dist/system/misc/deleter.svelte.js +49 -0
- package/dist/system/portal.d.ts +5 -1
- package/dist/system/portal.js +26 -2
- package/dist/system/shared/event-bus.d.ts +26 -0
- package/dist/system/shared/event-bus.js +51 -0
- package/dist/system/shared/utils.svelte.d.ts +70 -0
- package/dist/system/shared/utils.svelte.js +633 -0
- package/dist/system/target/base.svelte.d.ts +38 -0
- package/dist/system/target/base.svelte.js +1 -0
- package/dist/system/target/controller.svelte.d.ts +85 -0
- package/dist/system/{target.svelte.js → target/controller.svelte.js} +248 -103
- package/dist/system/target/index.d.ts +16 -0
- package/dist/system/target/index.js +37 -0
- package/dist/system/target/types.d.ts +52 -0
- package/dist/system/target/types.js +1 -0
- package/dist/system/types.d.ts +62 -26
- package/dist/system/widget/base.svelte.d.ts +127 -0
- package/dist/system/widget/base.svelte.js +245 -0
- package/dist/system/widget/controller.svelte.d.ts +85 -0
- package/dist/system/widget/controller.svelte.js +418 -0
- package/dist/system/widget/events.d.ts +13 -0
- package/dist/system/widget/events.js +190 -0
- package/dist/system/widget/index.d.ts +30 -0
- package/dist/system/widget/index.js +106 -0
- package/dist/system/widget/interpolator.svelte.d.ts +27 -0
- package/dist/system/widget/interpolator.svelte.js +121 -0
- package/dist/system/widget/state.svelte.d.ts +59 -0
- package/dist/system/widget/state.svelte.js +102 -0
- package/dist/system/widget/triggers.svelte.d.ts +21 -0
- package/dist/system/widget/triggers.svelte.js +123 -0
- package/dist/system/widget/types.d.ts +138 -0
- package/dist/system/widget/types.js +7 -0
- package/package.json +3 -3
- package/dist/system/manage.svelte.d.ts +0 -26
- package/dist/system/manage.svelte.js +0 -57
- package/dist/system/provider.svelte.d.ts +0 -52
- package/dist/system/target.svelte.d.ts +0 -184
- package/dist/system/utils.svelte.d.ts +0 -45
- package/dist/system/utils.svelte.js +0 -304
- package/dist/system/widget.svelte.d.ts +0 -288
- package/dist/system/widget.svelte.js +0 -685
|
@@ -1,41 +1,87 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import {
|
|
3
|
-
FlexiAddController,
|
|
3
|
+
type FlexiAddController,
|
|
4
4
|
flexiadd,
|
|
5
|
+
type FlexiAddClasses,
|
|
5
6
|
type FlexiAddWidgetFn
|
|
6
|
-
} from '../system/
|
|
7
|
-
import
|
|
8
|
-
import type { FlexiWidgetConfiguration } from '../system/widget.svelte.js';
|
|
9
|
-
import type { Snippet } from 'svelte';
|
|
7
|
+
} from '../system/misc/adder.svelte.js';
|
|
8
|
+
import { onDestroy, type Snippet } from 'svelte';
|
|
10
9
|
import type { FlexiCommonProps } from '../system/types.js';
|
|
11
10
|
import RenderedFlexiWidget from './rendered-flexi-widget.svelte';
|
|
11
|
+
import { assistiveTextStyle, generateUniqueId } from '../system/shared/utils.svelte.js';
|
|
12
12
|
|
|
13
|
+
/** @deprecated FlexiAdd's children props are now redundant and will be removed in v0.4. */
|
|
13
14
|
type FlexiAddChildrenProps = {
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated This has been replaced with internal pointer management and is redundant. This event will be removed in v0.4.
|
|
17
|
+
*/
|
|
14
18
|
onpointerdown: (event: PointerEvent) => void;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated This has been moved to the internal button so is now redundant. It will be removed in v0.4.
|
|
21
|
+
*/
|
|
15
22
|
style: string;
|
|
16
23
|
};
|
|
17
24
|
|
|
18
25
|
export type FlexiAddProps = FlexiCommonProps<FlexiAddController> & {
|
|
26
|
+
class?: FlexiAddClasses;
|
|
19
27
|
children?: Snippet<[{ adder: FlexiAddController; props: FlexiAddChildrenProps }]>;
|
|
20
28
|
addWidget: FlexiAddWidgetFn;
|
|
21
29
|
};
|
|
22
30
|
</script>
|
|
23
31
|
|
|
24
32
|
<script lang="ts">
|
|
25
|
-
let {
|
|
33
|
+
let {
|
|
34
|
+
children,
|
|
35
|
+
addWidget,
|
|
36
|
+
controller = $bindable(),
|
|
37
|
+
onfirstcreate,
|
|
38
|
+
class: className
|
|
39
|
+
}: FlexiAddProps = $props();
|
|
26
40
|
|
|
27
|
-
const { adder, onpointerdown } = flexiadd(addWidget);
|
|
41
|
+
const { adder, onpointerdown, onkeydown } = flexiadd(addWidget);
|
|
28
42
|
controller = adder;
|
|
43
|
+
onfirstcreate?.(adder);
|
|
44
|
+
|
|
45
|
+
const dummyOnpointerdown = (event: PointerEvent) => {};
|
|
46
|
+
|
|
47
|
+
let derivedClassName = $derived.by(() => {
|
|
48
|
+
if (!adder) {
|
|
49
|
+
return '';
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (typeof className === 'function') {
|
|
53
|
+
return className(adder);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return className;
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
let assistiveTextId = generateUniqueId();
|
|
60
|
+
|
|
61
|
+
// Cleanup adder subscriptions when component is destroyed
|
|
62
|
+
onDestroy(() => {
|
|
63
|
+
adder.destroy();
|
|
64
|
+
});
|
|
29
65
|
</script>
|
|
30
66
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
67
|
+
<!-- TODO: will probably need a breaking change, because we need a ref to get the start widget position -->
|
|
68
|
+
<button
|
|
69
|
+
class={derivedClassName}
|
|
70
|
+
bind:this={adder.ref}
|
|
71
|
+
aria-describedby={assistiveTextId}
|
|
72
|
+
style={'touch-action: none;'}
|
|
73
|
+
{onpointerdown}
|
|
74
|
+
{onkeydown}
|
|
75
|
+
>
|
|
76
|
+
<span style={assistiveTextStyle} id={assistiveTextId}>
|
|
77
|
+
Press Enter to drag a new widget into this board.
|
|
78
|
+
</span>
|
|
79
|
+
{@render children?.({ adder, props: { style: '', onpointerdown: dummyOnpointerdown } })}
|
|
80
|
+
</button>
|
|
35
81
|
|
|
36
82
|
<div style="display: none;">
|
|
37
83
|
<!-- Mimics the behaviour of a FlexiTarget, as we need to render the widget so that we can "drag it in" from -->
|
|
38
84
|
{#if adder.newWidget}
|
|
39
85
|
<RenderedFlexiWidget widget={adder.newWidget} />
|
|
40
|
-
{/if}
|
|
41
|
-
</div>
|
|
86
|
+
{/if}
|
|
87
|
+
</div>
|
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
import { FlexiAddController, type FlexiAddWidgetFn } from '../system/
|
|
2
|
-
import type
|
|
1
|
+
import { type FlexiAddController, type FlexiAddClasses, type FlexiAddWidgetFn } from '../system/misc/adder.svelte.js';
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
3
|
import type { FlexiCommonProps } from '../system/types.js';
|
|
4
|
+
/** @deprecated FlexiAdd's children props are now redundant and will be removed in v0.4. */
|
|
4
5
|
type FlexiAddChildrenProps = {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated This has been replaced with internal pointer management and is redundant. This event will be removed in v0.4.
|
|
8
|
+
*/
|
|
5
9
|
onpointerdown: (event: PointerEvent) => void;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated This has been moved to the internal button so is now redundant. It will be removed in v0.4.
|
|
12
|
+
*/
|
|
6
13
|
style: string;
|
|
7
14
|
};
|
|
8
15
|
export type FlexiAddProps = FlexiCommonProps<FlexiAddController> & {
|
|
16
|
+
class?: FlexiAddClasses;
|
|
9
17
|
children?: Snippet<[{
|
|
10
18
|
adder: FlexiAddController;
|
|
11
19
|
props: FlexiAddChildrenProps;
|
|
12
20
|
}]>;
|
|
13
21
|
addWidget: FlexiAddWidgetFn;
|
|
14
22
|
};
|
|
15
|
-
declare const FlexiAdd: import("svelte").Component<FlexiAddProps, {}, "">;
|
|
23
|
+
declare const FlexiAdd: import("svelte").Component<FlexiAddProps, {}, "controller">;
|
|
16
24
|
type FlexiAdd = ReturnType<typeof FlexiAdd>;
|
|
17
25
|
export default FlexiAdd;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { flexiannouncer } from '../system/announcer.svelte.js';
|
|
3
|
+
import type { InternalFlexiBoardController } from '../system/board/controller.svelte.js';
|
|
4
|
+
import { assistiveTextStyle } from '../system/shared/utils.svelte.js';
|
|
5
|
+
|
|
6
|
+
type FlexiAnnouncerProps = {
|
|
7
|
+
provider: InternalFlexiBoardController;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
let { provider }: FlexiAnnouncerProps = $props();
|
|
11
|
+
|
|
12
|
+
const controller = flexiannouncer(provider);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
role="region"
|
|
17
|
+
aria-live={controller.politeness}
|
|
18
|
+
aria-label="Drag-and-drop announcer"
|
|
19
|
+
aria-atomic="true"
|
|
20
|
+
style={assistiveTextStyle}
|
|
21
|
+
id={controller.id}
|
|
22
|
+
>
|
|
23
|
+
{controller.message}
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InternalFlexiBoardController } from '../system/board/controller.svelte.js';
|
|
2
|
+
type FlexiAnnouncerProps = {
|
|
3
|
+
provider: InternalFlexiBoardController;
|
|
4
|
+
};
|
|
5
|
+
declare const FlexiAnnouncer: import("svelte").Component<FlexiAnnouncerProps, {}, "">;
|
|
6
|
+
type FlexiAnnouncer = ReturnType<typeof FlexiAnnouncer>;
|
|
7
|
+
export default FlexiAnnouncer;
|
|
@@ -1,31 +1,54 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '../system/
|
|
7
|
-
import type { Snippet } from 'svelte';
|
|
8
|
-
import type { FlexiCommonProps, SvelteClassValue } from '../system/types.js';
|
|
2
|
+
import { flexiboard } from '../system/board/index.js';
|
|
3
|
+
import type { FlexiBoardController } from '../system/board/base.svelte.js';
|
|
4
|
+
import type { FlexiBoardConfiguration } from '../system/board/types.js';
|
|
5
|
+
import { onDestroy, type Snippet } from 'svelte';
|
|
6
|
+
import type { FlexiCommonProps } from '../system/types.js';
|
|
9
7
|
import FlexiLayoutLoader from './flexi-layout-loader.svelte';
|
|
10
8
|
|
|
11
9
|
export type FlexiBoardProps = FlexiCommonProps<FlexiBoardController> & {
|
|
12
10
|
children: Snippet;
|
|
13
11
|
config?: FlexiBoardConfiguration;
|
|
14
|
-
class?:
|
|
12
|
+
class?: ClassValue;
|
|
15
13
|
};
|
|
16
14
|
</script>
|
|
17
15
|
|
|
18
16
|
<script lang="ts">
|
|
19
17
|
import FlexiPortal from './flexi-portal.svelte';
|
|
18
|
+
import type { ClassValue } from 'svelte/elements';
|
|
19
|
+
import { generateUniqueId, assistiveTextStyle } from '../system/shared/utils.svelte.js';
|
|
20
|
+
import FlexiAnnouncer from './flexi-announcer.svelte';
|
|
20
21
|
|
|
21
|
-
let { controller
|
|
22
|
+
let { controller = $bindable(), onfirstcreate, ...props }: FlexiBoardProps = $props();
|
|
23
|
+
|
|
24
|
+
const board = flexiboard(props);
|
|
25
|
+
controller = board;
|
|
22
26
|
|
|
23
|
-
board = flexiboard(props);
|
|
24
27
|
onfirstcreate?.(board);
|
|
28
|
+
|
|
29
|
+
let assistiveTextId = generateUniqueId();
|
|
30
|
+
|
|
31
|
+
// Cleanup board subscriptions when component is destroyed
|
|
32
|
+
onDestroy(() => {
|
|
33
|
+
board.destroy();
|
|
34
|
+
});
|
|
25
35
|
</script>
|
|
26
36
|
|
|
27
|
-
<div
|
|
37
|
+
<div
|
|
38
|
+
class={props.class}
|
|
39
|
+
bind:this={board.ref}
|
|
40
|
+
style={board.style}
|
|
41
|
+
role="application"
|
|
42
|
+
aria-label="Interactive drag-and-drop interface"
|
|
43
|
+
aria-describedby={assistiveTextId}
|
|
44
|
+
>
|
|
45
|
+
<span style={assistiveTextStyle} id={assistiveTextId}>
|
|
46
|
+
Press Enter to grab or resize widgets. Once grabbed, use Arrow keys to move/resize the widget,
|
|
47
|
+
Enter to confirm the action, or Esc to cancel it.
|
|
48
|
+
</span>
|
|
28
49
|
{@render props.children()}
|
|
50
|
+
|
|
51
|
+
<FlexiAnnouncer provider={board} />
|
|
29
52
|
</div>
|
|
30
53
|
|
|
31
54
|
<!-- Component that tells the board it can start importing stuff, if needed. -->
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
3
|
-
import
|
|
1
|
+
import type { FlexiBoardController } from '../system/board/base.svelte.js';
|
|
2
|
+
import type { FlexiBoardConfiguration } from '../system/board/types.js';
|
|
3
|
+
import { type Snippet } from 'svelte';
|
|
4
|
+
import type { FlexiCommonProps } from '../system/types.js';
|
|
4
5
|
export type FlexiBoardProps = FlexiCommonProps<FlexiBoardController> & {
|
|
5
6
|
children: Snippet;
|
|
6
7
|
config?: FlexiBoardConfiguration;
|
|
7
|
-
class?:
|
|
8
|
+
class?: ClassValue;
|
|
8
9
|
};
|
|
10
|
+
import type { ClassValue } from 'svelte/elements';
|
|
9
11
|
declare const FlexiBoard: import("svelte").Component<FlexiBoardProps, {}, "controller">;
|
|
10
12
|
type FlexiBoard = ReturnType<typeof FlexiBoard>;
|
|
11
13
|
export default FlexiBoard;
|
|
@@ -1,22 +1,67 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type { FlexiCommonProps
|
|
4
|
-
import {
|
|
3
|
+
import type { FlexiCommonProps } from '../system/types.js';
|
|
4
|
+
import {
|
|
5
|
+
flexidelete,
|
|
6
|
+
FlexiDeleteController,
|
|
7
|
+
type FlexiDeleteClasses
|
|
8
|
+
} from '../system/misc/deleter.svelte.js';
|
|
9
|
+
import { assistiveTextStyle, generateUniqueId } from '../system/shared/utils.svelte.js';
|
|
5
10
|
|
|
11
|
+
/** @deprecated FlexiDelete's children props are now redundant and will be removed in v0.4. */
|
|
6
12
|
type FlexiDeleteChildrenProps = {
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated This has been replaced with internal pointer management and is redundant. These events will be removed in v0.4.
|
|
15
|
+
*/
|
|
7
16
|
onpointerenter: (event: PointerEvent) => void;
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated This has been replaced with internal pointer management and is redundant. These events will be removed in v0.4.
|
|
19
|
+
*/
|
|
8
20
|
onpointerleave: (event: PointerEvent) => void;
|
|
9
21
|
};
|
|
10
22
|
|
|
11
|
-
export type FlexiDeleteProps = {
|
|
12
|
-
|
|
23
|
+
export type FlexiDeleteProps = FlexiCommonProps<FlexiDeleteController> & {
|
|
24
|
+
class?: FlexiDeleteClasses;
|
|
25
|
+
children?: Snippet<[{ deleter: FlexiDeleteController; props: FlexiDeleteChildrenProps }]>;
|
|
13
26
|
};
|
|
14
27
|
</script>
|
|
15
28
|
|
|
16
29
|
<script lang="ts">
|
|
17
|
-
let {
|
|
30
|
+
let {
|
|
31
|
+
class: className,
|
|
32
|
+
children,
|
|
33
|
+
controller = $bindable(),
|
|
34
|
+
onfirstcreate
|
|
35
|
+
}: FlexiDeleteProps = $props();
|
|
18
36
|
|
|
19
|
-
|
|
37
|
+
// TODO: remove pointer events in v0.4
|
|
38
|
+
const { deleter, onpointerenter, onpointerleave } = flexidelete();
|
|
39
|
+
controller = deleter;
|
|
40
|
+
onfirstcreate?.(deleter);
|
|
41
|
+
|
|
42
|
+
let derivedClassName = $derived.by(() => {
|
|
43
|
+
if (!deleter) {
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (typeof className === 'function') {
|
|
48
|
+
return className(deleter);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return className;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
let assistiveTextId = generateUniqueId();
|
|
20
55
|
</script>
|
|
21
56
|
|
|
22
|
-
|
|
57
|
+
<div
|
|
58
|
+
role="region"
|
|
59
|
+
bind:this={deleter.ref}
|
|
60
|
+
class={derivedClassName}
|
|
61
|
+
aria-describedby={assistiveTextId}
|
|
62
|
+
>
|
|
63
|
+
<span style={assistiveTextStyle} id={assistiveTextId}>
|
|
64
|
+
Drag a widget here and press Enter to delete it.
|
|
65
|
+
</span>
|
|
66
|
+
{@render children?.({ deleter, props: { onpointerenter, onpointerleave } })}
|
|
67
|
+
</div>
|
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { FlexiCommonProps } from '../system/types.js';
|
|
3
|
+
import { FlexiDeleteController, type FlexiDeleteClasses } from '../system/misc/deleter.svelte.js';
|
|
4
|
+
/** @deprecated FlexiDelete's children props are now redundant and will be removed in v0.4. */
|
|
2
5
|
type FlexiDeleteChildrenProps = {
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated This has been replaced with internal pointer management and is redundant. These events will be removed in v0.4.
|
|
8
|
+
*/
|
|
3
9
|
onpointerenter: (event: PointerEvent) => void;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated This has been replaced with internal pointer management and is redundant. These events will be removed in v0.4.
|
|
12
|
+
*/
|
|
4
13
|
onpointerleave: (event: PointerEvent) => void;
|
|
5
14
|
};
|
|
6
|
-
export type FlexiDeleteProps = {
|
|
15
|
+
export type FlexiDeleteProps = FlexiCommonProps<FlexiDeleteController> & {
|
|
16
|
+
class?: FlexiDeleteClasses;
|
|
7
17
|
children?: Snippet<[{
|
|
18
|
+
deleter: FlexiDeleteController;
|
|
8
19
|
props: FlexiDeleteChildrenProps;
|
|
9
20
|
}]>;
|
|
10
21
|
};
|
|
11
|
-
declare const FlexiDelete: import("svelte").Component<FlexiDeleteProps, {}, "">;
|
|
22
|
+
declare const FlexiDelete: import("svelte").Component<FlexiDeleteProps, {}, "controller">;
|
|
12
23
|
type FlexiDelete = ReturnType<typeof FlexiDelete>;
|
|
13
24
|
export default FlexiDelete;
|
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import { flexigrab
|
|
2
|
+
import { flexigrab } from '../system/widget/index.js';
|
|
3
|
+
import type { FlexiWidgetController } from '../system/widget/base.svelte.js';
|
|
3
4
|
import type { Snippet } from 'svelte';
|
|
4
|
-
import type {
|
|
5
|
+
import type { ClassValue } from 'svelte/elements';
|
|
5
6
|
|
|
6
7
|
type FlexiGrabProps = {
|
|
7
8
|
children?: Snippet<[{ widget: FlexiWidgetController }]>;
|
|
8
|
-
class?:
|
|
9
|
+
class?: ClassValue;
|
|
9
10
|
};
|
|
10
11
|
</script>
|
|
11
12
|
|
|
12
13
|
<script lang="ts">
|
|
13
14
|
let { class: className, children }: FlexiGrabProps = $props();
|
|
14
15
|
|
|
15
|
-
const { widget, onpointerdown } = flexigrab();
|
|
16
|
+
const { widget, onpointerdown, onkeydown } = flexigrab();
|
|
16
17
|
</script>
|
|
17
18
|
|
|
18
|
-
<button
|
|
19
|
+
<button
|
|
20
|
+
style={'user-select: none; touch-action: none;' +
|
|
21
|
+
(widget.draggable && widget.mounted ? 'cursor: grab;' : 'cursor: not-allowed;')}
|
|
22
|
+
disabled={!widget.draggable || !widget.mounted}
|
|
23
|
+
class={className}
|
|
24
|
+
{onpointerdown}
|
|
25
|
+
{onkeydown}
|
|
26
|
+
>
|
|
19
27
|
{@render children?.({ widget })}
|
|
20
28
|
</button>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FlexiWidgetController } from '../system/widget/base.svelte.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ClassValue } from 'svelte/elements';
|
|
4
4
|
type FlexiGrabProps = {
|
|
5
5
|
children?: Snippet<[{
|
|
6
6
|
widget: FlexiWidgetController;
|
|
7
7
|
}]>;
|
|
8
|
-
class?:
|
|
8
|
+
class?: ClassValue;
|
|
9
9
|
};
|
|
10
10
|
declare const FlexiGrab: import("svelte").Component<FlexiGrabProps, {}, "">;
|
|
11
11
|
type FlexiGrab = ReturnType<typeof FlexiGrab>;
|
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
const { grid } = flexigrid();
|
|
15
15
|
</script>
|
|
16
16
|
|
|
17
|
-
<div
|
|
17
|
+
<div
|
|
18
|
+
class={className}
|
|
19
|
+
role="grid"
|
|
20
|
+
aria-label="Drag-and-drop grid"
|
|
21
|
+
aria-colcount={grid.columns}
|
|
22
|
+
aria-rowcount={grid.rows}
|
|
23
|
+
bind:this={grid.ref}
|
|
24
|
+
style={grid?.style}
|
|
25
|
+
>
|
|
18
26
|
{@render children?.()}
|
|
19
27
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getInternalFlexiboardCtx } from '../system/
|
|
2
|
+
import { getInternalFlexiboardCtx } from '../system/board/index.js';
|
|
3
3
|
|
|
4
4
|
// This is a simple component that triggers the initial layout load.
|
|
5
5
|
// We must do this after instantiating all other components, otherwise we won't have established
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { flexiportal, destroyFlexiportal } from '../system/portal.js';
|
|
3
|
+
import { onMount } from 'svelte';
|
|
3
4
|
|
|
4
5
|
// Simply just wait until we're mounted to the DOM before initialising the portal.
|
|
5
|
-
|
|
6
|
+
onMount(() => {
|
|
6
7
|
flexiportal();
|
|
7
8
|
|
|
8
9
|
// Garbage collect on destroy
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 FlexiPortal: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type FlexiPortal = InstanceType<typeof FlexiPortal>;
|
|
3
18
|
export default FlexiPortal;
|
|
@@ -1,20 +1,30 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import { flexiresize
|
|
2
|
+
import { flexiresize } from '../system/widget/index.js';
|
|
3
|
+
import type { FlexiWidgetController } from '../system/widget/base.svelte.js';
|
|
3
4
|
import type { Snippet } from 'svelte';
|
|
4
|
-
import type {
|
|
5
|
+
import type { ClassValue } from 'svelte/elements';
|
|
5
6
|
|
|
6
7
|
type FlexiResizeProps = {
|
|
7
8
|
children?: Snippet<[{ widget: FlexiWidgetController }]>;
|
|
8
|
-
class?:
|
|
9
|
+
class?: ClassValue;
|
|
9
10
|
};
|
|
10
11
|
</script>
|
|
11
12
|
|
|
12
13
|
<script lang="ts">
|
|
13
14
|
let { class: className, children }: FlexiResizeProps = $props();
|
|
14
15
|
|
|
15
|
-
const { widget, onpointerdown } = flexiresize();
|
|
16
|
+
const { widget, onpointerdown, onkeydown } = flexiresize();
|
|
16
17
|
</script>
|
|
17
18
|
|
|
18
|
-
<button
|
|
19
|
+
<button
|
|
20
|
+
style={'user-select: none; touch-action: none;' +
|
|
21
|
+
(widget.resizability != 'none' && widget.mounted
|
|
22
|
+
? 'cursor: nwse-resize'
|
|
23
|
+
: 'cursor: not-allowed')}
|
|
24
|
+
class={className}
|
|
25
|
+
disabled={widget.resizability == 'none' || !widget.mounted}
|
|
26
|
+
{onpointerdown}
|
|
27
|
+
{onkeydown}
|
|
28
|
+
>
|
|
19
29
|
{@render children?.({ widget })}
|
|
20
30
|
</button>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FlexiWidgetController } from '../system/widget/base.svelte.js';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
-
import type {
|
|
3
|
+
import type { ClassValue } from 'svelte/elements';
|
|
4
4
|
type FlexiResizeProps = {
|
|
5
5
|
children?: Snippet<[{
|
|
6
6
|
widget: FlexiWidgetController;
|
|
7
7
|
}]>;
|
|
8
|
-
class?:
|
|
8
|
+
class?: ClassValue;
|
|
9
9
|
};
|
|
10
10
|
declare const FlexiResize: import("svelte").Component<FlexiResizeProps, {}, "">;
|
|
11
11
|
type FlexiResize = ReturnType<typeof FlexiResize>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { getInternalFlexitargetCtx } from '../system/target.
|
|
2
|
+
import { getInternalFlexitargetCtx } from '../system/target/index.js';
|
|
3
3
|
|
|
4
4
|
// This is a simple component that triggers the initial layout load.
|
|
5
5
|
// We must do this after instantiating all other components, otherwise we won't have established
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
<script module lang="ts">
|
|
2
|
-
import type
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
type FlexiTargetPartialConfiguration
|
|
8
|
-
} from '../system/target.svelte.js';
|
|
2
|
+
import { onDestroy, tick, untrack, type Snippet } from 'svelte';
|
|
3
|
+
import { flexitarget } from '../system/target/index.js';
|
|
4
|
+
import type { FlexiTargetController } from '../system/target/base.svelte.js';
|
|
5
|
+
import type { FlexiTargetPartialConfiguration } from '../system/target/types.js';
|
|
6
|
+
|
|
9
7
|
import type { FlexiCommonProps } from '../system/types.js';
|
|
10
8
|
|
|
11
9
|
export type FlexiTargetProps = FlexiCommonProps<FlexiTargetController> & {
|
|
@@ -52,6 +50,7 @@
|
|
|
52
50
|
import FlexiGrid from './flexi-grid.svelte';
|
|
53
51
|
import FlexiTargetLoader from './flexi-target-loader.svelte';
|
|
54
52
|
import RenderedFlexiWidget from './rendered-flexi-widget.svelte';
|
|
53
|
+
import type { InternalFlexiWidgetController } from '../system/widget/controller.svelte.js';
|
|
55
54
|
|
|
56
55
|
let {
|
|
57
56
|
children,
|
|
@@ -65,24 +64,49 @@
|
|
|
65
64
|
onfirstcreate
|
|
66
65
|
}: FlexiTargetProps = $props();
|
|
67
66
|
|
|
68
|
-
const {
|
|
67
|
+
const { target } = flexitarget(config, key);
|
|
69
68
|
|
|
70
69
|
// Target created, allow the caller to access it.
|
|
71
70
|
controller = target;
|
|
72
71
|
onfirstcreate?.(target);
|
|
72
|
+
|
|
73
|
+
// TODO: probable Svelte bug, causes browser freeze on production builds.
|
|
74
|
+
// Haven't been able to repro on REPL as yet.
|
|
75
|
+
// let orderedWidgets: InternalFlexiWidgetController[] = $derived.by(() => {
|
|
76
|
+
// return Array.from(target.internalWidgets).toSorted((a, b) => {
|
|
77
|
+
// if (a.y !== b.y) {
|
|
78
|
+
// return a.y - b.y;
|
|
79
|
+
// }
|
|
80
|
+
|
|
81
|
+
// if (a.x == b.x) {
|
|
82
|
+
// console.warn('[warning] collision detected between widgets ', a.id, ' and ', b.id);
|
|
83
|
+
// }
|
|
84
|
+
// return a.x - b.x;
|
|
85
|
+
// });
|
|
86
|
+
// });
|
|
87
|
+
|
|
88
|
+
// Cleanup target subscriptions when component is destroyed
|
|
89
|
+
onDestroy(() => {
|
|
90
|
+
target.destroy();
|
|
91
|
+
});
|
|
73
92
|
</script>
|
|
74
93
|
|
|
75
|
-
<div class={containerClass}
|
|
76
|
-
{@render header?.({ target })}
|
|
94
|
+
<div class={containerClass}>
|
|
95
|
+
{@render header?.({ target: target as FlexiTargetController })}
|
|
77
96
|
|
|
78
97
|
<!-- Allow user to specify components directly via a registration component. Once that's done, mount them to the actual target list dynamically -->
|
|
79
98
|
<FlexiGrid class={className}>
|
|
80
99
|
{#if !target.prepared && children}
|
|
81
100
|
{@render children()}
|
|
82
101
|
{:else if target.prepared}
|
|
83
|
-
|
|
102
|
+
<!-- Render widgets in deterministic order for tabbing and consistent DOM ordering -->
|
|
103
|
+
{#each target.orderedWidgets as widget (widget.id)}
|
|
84
104
|
<RenderedFlexiWidget {widget} />
|
|
85
105
|
{/each}
|
|
106
|
+
|
|
107
|
+
{#if target.dropzoneWidget}
|
|
108
|
+
<RenderedFlexiWidget widget={target.dropzoneWidget} />
|
|
109
|
+
{/if}
|
|
86
110
|
{/if}
|
|
87
111
|
</FlexiGrid>
|
|
88
112
|
{@render footer?.({ target })}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
import type { FlexiTargetController } from '../system/target/base.svelte.js';
|
|
3
|
+
import type { FlexiTargetPartialConfiguration } from '../system/target/types.js';
|
|
3
4
|
import type { FlexiCommonProps } from '../system/types.js';
|
|
4
5
|
export type FlexiTargetProps = FlexiCommonProps<FlexiTargetController> & {
|
|
5
6
|
/**
|