@witchcraft/layout 0.1.0 → 0.1.2

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.
Files changed (29) hide show
  1. package/README.md +5 -4
  2. package/dist/module.json +1 -1
  3. package/dist/runtime/components/LayoutDecos.vue +0 -9
  4. package/dist/runtime/components/LayoutEdges.d.vue.ts +4 -14
  5. package/dist/runtime/components/LayoutEdges.vue +11 -11
  6. package/dist/runtime/components/LayoutEdges.vue.d.ts +4 -14
  7. package/dist/runtime/components/LayoutFrame.d.vue.ts +4 -23
  8. package/dist/runtime/components/LayoutFrame.vue +7 -3
  9. package/dist/runtime/components/LayoutFrame.vue.d.ts +4 -23
  10. package/dist/runtime/components/LayoutShapeSquare.d.vue.ts +2 -25
  11. package/dist/runtime/components/LayoutShapeSquare.vue +6 -3
  12. package/dist/runtime/components/LayoutShapeSquare.vue.d.ts +2 -25
  13. package/dist/runtime/components/LayoutWindow.d.vue.ts +3 -1
  14. package/dist/runtime/components/LayoutWindow.vue +10 -10
  15. package/dist/runtime/components/LayoutWindow.vue.d.ts +3 -1
  16. package/dist/runtime/demo/App.vue +1 -1
  17. package/dist/runtime/demo/DemoControls.vue +1 -1
  18. package/dist/runtime/types/index.d.ts +23 -3
  19. package/dist/runtime/utils/KnownError.d.ts +2 -2
  20. package/package.json +6 -6
  21. package/src/runtime/components/LayoutDecos.vue +0 -10
  22. package/src/runtime/components/LayoutEdges.vue +15 -22
  23. package/src/runtime/components/LayoutFrame.vue +8 -8
  24. package/src/runtime/components/LayoutShapeSquare.vue +6 -7
  25. package/src/runtime/components/LayoutWindow.vue +11 -11
  26. package/src/runtime/demo/App.vue +1 -1
  27. package/src/runtime/demo/DemoControls.vue +1 -1
  28. package/src/runtime/types/index.ts +34 -4
  29. package/src/runtime/utils/KnownError.ts +3 -3
package/README.md CHANGED
@@ -42,8 +42,7 @@ export {}
42
42
 
43
43
  ```
44
44
 
45
- Or if using zod, you can do something like this. Note that you will need to create/extend `zLayoutWindow/Frame` or use `zLayoutWindow/FrameLoose` to allow for extra properties. All zod types have been made `strict` where possible as it's easy to accidentally use the wrong type and loose properties silently otherwise.
46
-
45
+ Or if using zod, you can do something like this. Note that you will need to create/extend `zLayoutWindow/Frame` or use `zLayoutWindow/FrameLoose` to allow for extra properties. They also use a basic `z.uuid()`, if you need something more specific you'll have to extend the type.
47
46
  ```ts
48
47
  import { zLayoutFrameLoose, layoutCreate } from "@witchcraft/layout"
49
48
  import { z } from "zod"
@@ -64,16 +63,18 @@ export const zAppFrame = z.discriminatedUnion("type", [
64
63
  }),
65
64
  }),
66
65
  ]).and(z.object({
67
- id: z.uuid(),
66
+ id: z.uuidv4(), // here we can specify a specific uuid type
68
67
  }))
69
68
 
69
+
70
70
  declare module "@witchcraft/layout" {
71
71
  interface Register {
72
- // Register the type
72
+ // Register the type, this allows importing the type from the package, while also allowing the types to be extended
73
73
  ExtendedLayoutFrame: z.infer<typeof zAppFrame>
74
74
  }
75
75
  }
76
76
  ```
77
+ Note that `zFrameId` and `zWinId` are different as they also support constants (`zFrameIdConstants` and `zWindowIdConstants`).
77
78
 
78
79
  ## Basics
79
80
 
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@witchcraft/layout",
3
3
  "configKey": "witchcraftLayout",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
@@ -1,8 +1,4 @@
1
1
  <template>
2
- <!-- <div -->
3
- <!-- v-bind="$attrs" -->
4
- <!-- class="decos" -->
5
- <!-- > -->
6
2
  <template
7
3
  v-for="(deco) of splitDecos"
8
4
  :key="deco.id"
@@ -34,18 +30,13 @@
34
30
  :css="getShapeSquareCss(frames[deco.id], `var(--layoutEdgeWidth,2px)`)"
35
31
  />
36
32
  </template>
37
- <!-- </div> -->
38
33
  </template>
39
34
 
40
35
  <script setup>
41
- import { twMerge } from "@witchcraft/ui/utils/twMerge";
42
- import { computed, inject, ref, useAttrs } from "vue";
43
36
  import LayoutShapeSquare from "./LayoutShapeSquare.vue";
44
- import { dirToOrientation } from "../helpers/dirToOrientation.js";
45
37
  import { getShapeSquareCss } from "../helpers/getShapeSquareCss";
46
38
  import { getVisualEdgeCss } from "../helpers/getVisualEdgeCss";
47
39
  import {} from "../types/index.js";
48
- const $attrs = useAttrs();
49
40
  const props = defineProps({
50
41
  frames: { type: Object, required: true },
51
42
  splitDecos: { type: Array, required: true },
@@ -1,26 +1,16 @@
1
- import { type Edge, type IntersectionEntry, type LayoutFrame, type LayoutWindow } from "../types/index.js";
2
- type __VLS_Props = {
3
- edges: Edge[];
4
- intersections: IntersectionEntry[];
5
- /** The owning window, needed so we can correctly scale coordinates. */
6
- win: LayoutWindow;
7
- /** The active frame, used to render the active edges. Calculate it from the `frames` returned by `useFrames` composable because otherwise it will be the wrong size while dragging. */
8
- activeFrame?: LayoutFrame;
9
- draggingEdge?: Edge;
10
- draggingIntersection?: IntersectionEntry;
11
- };
12
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
1
+ import { type Edge, type IntersectionEntry, type LayoutEdgesProps } from "../types/index.js";
2
+ declare const _default: import("vue").DefineComponent<LayoutEdgesProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
3
  dragStart: (e: PointerEvent, args_1: {
14
4
  edge?: Edge;
15
5
  intersection?: IntersectionEntry;
16
6
  }) => any;
17
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
7
+ }, string, import("vue").PublicProps, Readonly<LayoutEdgesProps> & Readonly<{
18
8
  onDragStart?: ((e: PointerEvent, args_1: {
19
9
  edge?: Edge;
20
10
  intersection?: IntersectionEntry;
21
11
  }) => any) | undefined;
22
12
  }>, {
23
- activeFrame: LayoutFrame;
13
+ activeFrame: import("../types/index.js").LayoutFrame;
24
14
  draggingEdge: Edge;
25
15
  draggingIntersection: IntersectionEntry;
26
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -9,8 +9,10 @@
9
9
  z-0
10
10
  border-blue-500
11
11
  border
12
- `
12
+ `,
13
+ $attrs.class
13
14
  )"
15
+ v-bind="{ ...$attrs, class: void 0 }"
14
16
  />
15
17
 
16
18
  <template
@@ -77,17 +79,18 @@
77
79
 
78
80
  <script setup>
79
81
  import { twMerge } from "@witchcraft/ui/utils/twMerge";
80
- import { computed, ref, useAttrs } from "vue";
82
+ import { computed, useAttrs } from "vue";
81
83
  import LayoutShapeSquare from "./LayoutShapeSquare.vue";
82
- import { frameToEdges } from "../helpers/frameToEdges.js";
83
84
  import { getIntersectionsCss } from "../helpers/getIntersectionsCss.js";
84
85
  import { getShapeSquareCss } from "../helpers/getShapeSquareCss.js";
85
86
  import { getVisualEdgesCss } from "../helpers/getVisualEdgesCss.js";
86
87
  import { isEdgeEqual } from "../helpers/isEdgeEqual.js";
87
- import { toWindowCoord } from "../helpers/toWindowCoord.js";
88
88
  import {
89
89
  } from "../types/index.js";
90
90
  const $attrs = useAttrs();
91
+ defineOptions({
92
+ inheritAttrs: false
93
+ });
91
94
  const emit = defineEmits(["dragStart"]);
92
95
  const props = defineProps({
93
96
  edges: { type: Array, required: true },
@@ -95,13 +98,10 @@ const props = defineProps({
95
98
  win: { type: Object, required: true },
96
99
  activeFrame: { type: Object, required: false, default: void 0 },
97
100
  draggingEdge: { type: null, required: false, default: void 0 },
98
- draggingIntersection: { type: Object, required: false, default: void 0 }
99
- });
100
- const activeFrameCssEdges = computed(() => {
101
- if (!props.activeFrame) return [];
102
- return getVisualEdgesCss(Object.values(frameToEdges(props.activeFrame)), {
103
- edgeWidth: `var(--layoutEdgeWidth, 2px)`
104
- });
101
+ draggingIntersection: { type: Object, required: false, default: void 0 },
102
+ css: { type: Object, required: false },
103
+ style: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
104
+ class: { type: String, required: false }
105
105
  });
106
106
  const cssDragEdges = computed(() => {
107
107
  const thickEdges = getVisualEdgesCss(
@@ -1,26 +1,16 @@
1
- import { type Edge, type IntersectionEntry, type LayoutFrame, type LayoutWindow } from "../types/index.js";
2
- type __VLS_Props = {
3
- edges: Edge[];
4
- intersections: IntersectionEntry[];
5
- /** The owning window, needed so we can correctly scale coordinates. */
6
- win: LayoutWindow;
7
- /** The active frame, used to render the active edges. Calculate it from the `frames` returned by `useFrames` composable because otherwise it will be the wrong size while dragging. */
8
- activeFrame?: LayoutFrame;
9
- draggingEdge?: Edge;
10
- draggingIntersection?: IntersectionEntry;
11
- };
12
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
1
+ import { type Edge, type IntersectionEntry, type LayoutEdgesProps } from "../types/index.js";
2
+ declare const _default: import("vue").DefineComponent<LayoutEdgesProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
3
  dragStart: (e: PointerEvent, args_1: {
14
4
  edge?: Edge;
15
5
  intersection?: IntersectionEntry;
16
6
  }) => any;
17
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
7
+ }, string, import("vue").PublicProps, Readonly<LayoutEdgesProps> & Readonly<{
18
8
  onDragStart?: ((e: PointerEvent, args_1: {
19
9
  edge?: Edge;
20
10
  intersection?: IntersectionEntry;
21
11
  }) => any) | undefined;
22
12
  }>, {
23
- activeFrame: LayoutFrame;
13
+ activeFrame: import("../types/index.js").LayoutFrame;
24
14
  draggingEdge: Edge;
25
15
  draggingIntersection: IntersectionEntry;
26
16
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,32 +1,13 @@
1
- import { type PropType } from "vue";
2
- import { type LayoutFrame } from "../types/index.js";
1
+ import { type LayoutFrameProps } from "../types/index.js";
3
2
  declare var __VLS_8: {};
4
3
  type __VLS_Slots = {} & {
5
4
  default?: (props: typeof __VLS_8) => any;
6
5
  };
7
- declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
- frame: {
9
- type: PropType<LayoutFrame>;
10
- required: true;
11
- };
12
- isActiveFrame: {
13
- type: BooleanConstructor;
14
- required: true;
15
- };
16
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
6
+ declare const __VLS_component: import("vue").DefineComponent<LayoutFrameProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
17
7
  focus: () => any;
18
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
- frame: {
20
- type: PropType<LayoutFrame>;
21
- required: true;
22
- };
23
- isActiveFrame: {
24
- type: BooleanConstructor;
25
- required: true;
26
- };
27
- }>> & Readonly<{
8
+ }, string, import("vue").PublicProps, Readonly<LayoutFrameProps> & Readonly<{
28
9
  onFocus?: (() => any) | undefined;
29
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
11
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
31
12
  export default _default;
32
13
  type __VLS_WithSlots<T, S> = T & {
@@ -1,5 +1,4 @@
1
1
  <template>
2
- <!-- @vue-expect-error just let it inherit extra attrs -->
3
2
  <!-- overflow-hidden is just in case, if the frame's css is not properly set to h-full, overflow-auto, or the border/padding are too large, we can still get overflows -->
4
3
  <LayoutShapeSquare
5
4
  tabindex="0"
@@ -26,9 +25,11 @@
26
25
 
27
26
  <script setup>
28
27
  import { twMerge } from "@witchcraft/ui/utils/twMerge";
29
- import {} from "vue";
30
28
  import { useAttrs } from "vue";
31
29
  const $attrs = useAttrs();
30
+ defineOptions({
31
+ inheritAttrs: false
32
+ });
32
33
  import LayoutShapeSquare from "./LayoutShapeSquare.vue";
33
34
  import { getShapeSquareCss } from "../helpers/getShapeSquareCss";
34
35
  import { debugFrame } from "../layout/debugFrame.js";
@@ -36,6 +37,9 @@ import {} from "../types/index.js";
36
37
  const emit = defineEmits(["focus"]);
37
38
  defineProps({
38
39
  frame: { type: Object, required: true },
39
- isActiveFrame: { type: Boolean, required: true }
40
+ isActiveFrame: { type: Boolean, required: true },
41
+ css: { type: Object, required: false },
42
+ style: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
43
+ class: { type: String, required: false }
40
44
  });
41
45
  </script>
@@ -1,32 +1,13 @@
1
- import { type PropType } from "vue";
2
- import { type LayoutFrame } from "../types/index.js";
1
+ import { type LayoutFrameProps } from "../types/index.js";
3
2
  declare var __VLS_8: {};
4
3
  type __VLS_Slots = {} & {
5
4
  default?: (props: typeof __VLS_8) => any;
6
5
  };
7
- declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
- frame: {
9
- type: PropType<LayoutFrame>;
10
- required: true;
11
- };
12
- isActiveFrame: {
13
- type: BooleanConstructor;
14
- required: true;
15
- };
16
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
6
+ declare const __VLS_component: import("vue").DefineComponent<LayoutFrameProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
17
7
  focus: () => any;
18
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
19
- frame: {
20
- type: PropType<LayoutFrame>;
21
- required: true;
22
- };
23
- isActiveFrame: {
24
- type: BooleanConstructor;
25
- required: true;
26
- };
27
- }>> & Readonly<{
8
+ }, string, import("vue").PublicProps, Readonly<LayoutFrameProps> & Readonly<{
28
9
  onFocus?: (() => any) | undefined;
29
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
10
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
11
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
31
12
  export default _default;
32
13
  type __VLS_WithSlots<T, S> = T & {
@@ -1,32 +1,9 @@
1
- import { type PropType } from "vue";
2
- import type { BaseSquareCss } from "../types/index.js";
1
+ import type { LayoutShapeSquareProps } from "../types/index.js";
3
2
  declare var __VLS_1: {};
4
3
  type __VLS_Slots = {} & {
5
4
  default?: (props: typeof __VLS_1) => any;
6
5
  };
7
- declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
- style: {
9
- type: StringConstructor;
10
- required: false;
11
- default: string;
12
- };
13
- css: {
14
- type: PropType<BaseSquareCss>;
15
- required: true;
16
- };
17
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
18
- style: {
19
- type: StringConstructor;
20
- required: false;
21
- default: string;
22
- };
23
- css: {
24
- type: PropType<BaseSquareCss>;
25
- required: true;
26
- };
27
- }>> & Readonly<{}>, {
28
- style: string;
29
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const __VLS_component: import("vue").DefineComponent<LayoutShapeSquareProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LayoutShapeSquareProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
7
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
31
8
  export default _default;
32
9
  type __VLS_WithSlots<T, S> = T & {
@@ -26,11 +26,14 @@
26
26
 
27
27
  <script setup>
28
28
  import { twMerge } from "@witchcraft/ui/utils/twMerge";
29
- import {} from "vue";
30
29
  import { useAttrs } from "vue";
31
30
  const $attrs = useAttrs();
31
+ defineOptions({
32
+ inheritAttrs: false
33
+ });
32
34
  const props = defineProps({
33
- style: { type: String, required: false, default: "" },
34
- css: { type: Object, required: true }
35
+ css: { type: Object, required: true },
36
+ style: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
37
+ class: { type: String, required: false }
35
38
  });
36
39
  </script>
@@ -1,32 +1,9 @@
1
- import { type PropType } from "vue";
2
- import type { BaseSquareCss } from "../types/index.js";
1
+ import type { LayoutShapeSquareProps } from "../types/index.js";
3
2
  declare var __VLS_1: {};
4
3
  type __VLS_Slots = {} & {
5
4
  default?: (props: typeof __VLS_1) => any;
6
5
  };
7
- declare const __VLS_component: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
- style: {
9
- type: StringConstructor;
10
- required: false;
11
- default: string;
12
- };
13
- css: {
14
- type: PropType<BaseSquareCss>;
15
- required: true;
16
- };
17
- }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
18
- style: {
19
- type: StringConstructor;
20
- required: false;
21
- default: string;
22
- };
23
- css: {
24
- type: PropType<BaseSquareCss>;
25
- required: true;
26
- };
27
- }>> & Readonly<{}>, {
28
- style: string;
29
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
+ declare const __VLS_component: import("vue").DefineComponent<LayoutShapeSquareProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LayoutShapeSquareProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
30
7
  declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
31
8
  export default _default;
32
9
  type __VLS_WithSlots<T, S> = T & {
@@ -1,5 +1,5 @@
1
1
  import { type DragState, type IDragAction } from "../drag/types.js";
2
- import { type LayoutWindow } from "../types/index.js";
2
+ import { type LayoutEdgesProps, type LayoutFrameProps, type LayoutWindow } from "../types/index.js";
3
3
  type __VLS_Props = {
4
4
  additionalDragActions?: IDragAction[];
5
5
  splitKeyHandler?: (e: PointerEvent | KeyboardEvent, state: DragState) => boolean;
@@ -14,6 +14,8 @@ type __VLS_Props = {
14
14
  * When this is turned back on again, it will trigger an update. You can also trigger updates manually with the exposed updateWindowSize function.
15
15
  */
16
16
  allowWindowSizeUpdate?: boolean;
17
+ frameProps?: Partial<Omit<LayoutFrameProps, "frame" | "isActiveFrame" | "onFocus">>;
18
+ edgesProps?: Partial<Omit<LayoutEdgesProps, "edges" | "intersections" | "win">>;
17
19
  };
18
20
  declare function updateWindowSize(): void;
19
21
  type __VLS_PublicProps = __VLS_Props & {
@@ -7,17 +7,17 @@
7
7
  `,
8
8
  isDragging && `dragging cursor-pointer`,
9
9
  requestType && `request-${requestType}`,
10
- $attrs.attrs.class
10
+ $attrs.class
11
11
  )"
12
12
  ref="windowEl"
13
- v-bind="{ ...$attrs.attrs, class: void 0 }"
13
+ v-bind="{ ...$attrs, class: void 0 }"
14
14
  >
15
15
  <template v-if="windowEl && win">
16
16
  <LayoutFrameComponent :frame="frame"
17
17
  :is-active-frame="frame.id === win.activeFrame"
18
18
  v-for="frame of frames"
19
19
  :key="frame.id"
20
- v-bind="$attrs.frameAttrs"
20
+ v-bind="frameProps"
21
21
  @focus="windowSetActiveFrame(win, frame.id)"
22
22
  >
23
23
  <slot :name="`frame-${frame.id}`" v-bind="{ frame }"/>
@@ -29,14 +29,13 @@
29
29
  :intersections="intersections"
30
30
  :dragging-edge="draggingEdges.length === 1 ? draggingEdges[0] : void 0"
31
31
  :dragging-intersection="draggingIntersection"
32
- v-bind="$attrs.edgesAttrs"
32
+ v-bind="edgesProps"
33
33
  @drag-start="dragStart"
34
34
  />
35
35
  <LayoutDecosComponent
36
36
  :frames="frames"
37
37
  :split-decos="splitDecos"
38
38
  :close-decos="closeDecos"
39
- v-bind="$attrs.decosAttrs"
40
39
  />
41
40
  <slot name="extra-decos"/>
42
41
  </template>
@@ -45,7 +44,6 @@
45
44
  <span
46
45
  class="
47
46
  after:content-['┃']
48
- after:text-accent-500
49
47
  last:after:content-none
50
48
  after:mx-1
51
49
  after:text-gray-500
@@ -61,10 +59,10 @@
61
59
  </template>
62
60
 
63
61
  <script setup>
64
- import { useDivideAttrs } from "@witchcraft/ui/composables/useDivideAttrs";
65
62
  import { useGlobalResizeObserver } from "@witchcraft/ui/composables/useGlobalResizeObserver";
66
63
  import { twMerge } from "@witchcraft/ui/utils/twMerge";
67
- import { computed, ref, watch } from "vue";
64
+ import { computed, ref, useAttrs, watch } from "vue";
65
+ import {} from "vue";
68
66
  import LayoutDecosComponent from "./LayoutDecos.vue";
69
67
  import LayoutEdgesComponent from "./LayoutEdges.vue";
70
68
  import LayoutFrameComponent from "./LayoutFrame.vue";
@@ -76,7 +74,7 @@ import {} from "../drag/types.js";
76
74
  import { updateWindowWithEvent } from "../helpers/updateWindowSizeWithEvent.js";
77
75
  import { windowSetActiveFrame } from "../layout/windowSetActiveFrame.js";
78
76
  import {} from "../types/index.js";
79
- const $attrs = useDivideAttrs(["frame", "edges", "decos"]);
77
+ const $attrs = useAttrs();
80
78
  const win = defineModel("win", { type: Object, ...{ required: true } });
81
79
  const props = defineProps({
82
80
  additionalDragActions: { type: Array, required: false, default: () => [] },
@@ -84,7 +82,9 @@ const props = defineProps({
84
82
  closeKeyHandler: { type: Function, required: false, default: void 0 },
85
83
  usageInstructions: { type: Object, required: false, default: () => ({}) },
86
84
  instructionsTeleportTo: { type: null, required: true },
87
- allowWindowSizeUpdate: { type: Boolean, required: false, default: true }
85
+ allowWindowSizeUpdate: { type: Boolean, required: false, default: true },
86
+ frameProps: { type: Object, required: false },
87
+ edgesProps: { type: Object, required: false }
88
88
  });
89
89
  const emit = defineEmits(["isShowingDrag", "dragState"]);
90
90
  const filteredUsageInstructions = computed(() => Object.values(props.usageInstructions).filter((_) => _ !== void 0).map((_) => _));
@@ -1,5 +1,5 @@
1
1
  import { type DragState, type IDragAction } from "../drag/types.js";
2
- import { type LayoutWindow } from "../types/index.js";
2
+ import { type LayoutEdgesProps, type LayoutFrameProps, type LayoutWindow } from "../types/index.js";
3
3
  type __VLS_Props = {
4
4
  additionalDragActions?: IDragAction[];
5
5
  splitKeyHandler?: (e: PointerEvent | KeyboardEvent, state: DragState) => boolean;
@@ -14,6 +14,8 @@ type __VLS_Props = {
14
14
  * When this is turned back on again, it will trigger an update. You can also trigger updates manually with the exposed updateWindowSize function.
15
15
  */
16
16
  allowWindowSizeUpdate?: boolean;
17
+ frameProps?: Partial<Omit<LayoutFrameProps, "frame" | "isActiveFrame" | "onFocus">>;
18
+ edgesProps?: Partial<Omit<LayoutEdgesProps, "edges" | "intersections" | "win">>;
17
19
  };
18
20
  declare function updateWindowSize(): void;
19
21
  type __VLS_PublicProps = __VLS_Props & {
@@ -60,7 +60,7 @@
60
60
 
61
61
  <script setup>
62
62
  import { keys } from "@alanscodelog/utils/keys";
63
- import WRoot from "@witchcraft/ui/components/LibRoot";
63
+ import WRoot from "@witchcraft/ui/components/WRoot";
64
64
  import { twMerge } from "@witchcraft/ui/utils/twMerge";
65
65
  import { computed, onBeforeMount, ref } from "vue";
66
66
  import DemoControls from "./DemoControls.vue";
@@ -7,7 +7,7 @@
7
7
  </template>
8
8
 
9
9
  <script setup>
10
- import WDarkModeSwitcher from "@witchcraft/ui/components/LibDarkModeSwitcher";
10
+ import WDarkModeSwitcher from "@witchcraft/ui/components/WDarkModeSwitcher";
11
11
  defineProps({
12
12
  frames: { type: Array, required: true }
13
13
  });
@@ -1,6 +1,7 @@
1
1
  import type { EnumLike } from "@alanscodelog/utils";
2
2
  import { z } from "zod";
3
3
  export * from "../drag/types.js";
4
+ import type { HTMLAttributes, StyleValue } from "vue";
4
5
  export declare const zUuid: z.ZodUUID;
5
6
  export type AnyUuid = z.infer<typeof zUuid>;
6
7
  export declare const zWindowIdConstants: z.ZodEnum<{
@@ -381,9 +382,8 @@ export declare const LAYOUT_ERROR: {
381
382
  CANT_CLOSE_WITHOUT_FORCE: "CANT_CLOSE_WITHOUT_FORCE";
382
383
  };
383
384
  export type LayoutError = EnumLike<typeof LAYOUT_ERROR>;
384
- export type AllErrors = LayoutError;
385
- export type ErrorInfo<T extends AllErrors> = AllErrorsInfo[T] extends undefined ? never : AllErrorsInfo[T];
386
- type AllErrorsInfo = {
385
+ export type LayoutErrorInfo<T extends LayoutError> = LayoutErrorsInfo[T] extends undefined ? never : LayoutErrorsInfo[T];
386
+ export type LayoutErrorsInfo = {
387
387
  [LAYOUT_ERROR.INVALID_ID]: {
388
388
  id: string | undefined;
389
389
  };
@@ -457,3 +457,23 @@ export declare const zFrameCreate: z.ZodObject<{
457
457
  x: z.ZodOptional<z.ZodNumber>;
458
458
  y: z.ZodOptional<z.ZodNumber>;
459
459
  }, z.core.$loose>;
460
+ export type LayoutShapeSquareProps = {
461
+ css: BaseSquareCss;
462
+ style?: StyleValue;
463
+ } & /** @vue-ignore */ Omit<HTMLAttributes, "class" | "onFocus"> & {
464
+ class?: string;
465
+ };
466
+ export type LayoutEdgesProps = {
467
+ edges: Edge[];
468
+ intersections: IntersectionEntry[];
469
+ /** The owning window, needed so we can correctly scale coordinates. */
470
+ win: LayoutWindow;
471
+ /** The active frame, used to render the active edges. Calculate it from the `frames` returned by `useFrames` composable because otherwise it will be the wrong size while dragging. */
472
+ activeFrame?: LayoutFrame;
473
+ draggingEdge?: Edge;
474
+ draggingIntersection?: IntersectionEntry;
475
+ } & Partial<LayoutShapeSquareProps>;
476
+ export type LayoutFrameProps = {
477
+ frame: LayoutFrame;
478
+ isActiveFrame: boolean;
479
+ } & Partial<LayoutShapeSquareProps>;
@@ -1,9 +1,9 @@
1
- import type { AllErrors, ErrorInfo } from "../types/index.js";
1
+ import type { LayoutError, LayoutErrorInfo } from "../types/index.js";
2
2
  /**
3
3
  * Creates a known error that extends the base Error with some extra information.
4
4
  * All the variables used to create the error message are stored in it's info property so we can easily re-craft error messages for users.
5
5
  */
6
- export declare class KnownError<T extends AllErrors = AllErrors, TInfo extends ErrorInfo<T> = ErrorInfo<T>> extends Error {
6
+ export declare class KnownError<T extends LayoutError = LayoutError, TInfo extends LayoutErrorInfo<T> = LayoutErrorInfo<T>> extends Error {
7
7
  code: T;
8
8
  info: TInfo;
9
9
  constructor(code: T, str: string, info: TInfo);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@witchcraft/layout",
3
3
  "description": "Headless layout manager.",
4
- "version": "0.1.0",
4
+ "version": "0.1.2",
5
5
  "main": "./dist/runtime/index.js",
6
6
  "type": "module",
7
7
  "sideEffects": false,
@@ -28,13 +28,13 @@
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
- "@alanscodelog/utils": "^6.0.1",
31
+ "@alanscodelog/utils": "^6.2.0",
32
32
  "@iconify/json": "^2.2.383",
33
33
  "es-toolkit": "^1.39.10"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@witchcraft/nuxt-utils": "^0.3.6",
37
- "@witchcraft/ui": "^0.3.7"
37
+ "@witchcraft/ui": "0.4.0-beta.3"
38
38
  },
39
39
  "peerDependenciesMeta": {
40
40
  "@witchcraft/ui": {
@@ -47,8 +47,8 @@
47
47
  "devDependencies": {
48
48
  "@alanscodelog/commitlint-config": "^3.1.2",
49
49
  "@alanscodelog/eslint-config": "^6.3.0",
50
- "@alanscodelog/semantic-release-config": "^6.0.0",
51
- "@alanscodelog/tsconfigs": "^6.2.0",
50
+ "@alanscodelog/semantic-release-config": "^6.0.2",
51
+ "@alanscodelog/tsconfigs": "^6.3.0",
52
52
  "@alanscodelog/vite-config": "^0.0.6",
53
53
  "@commitlint/cli": "^19.8.1",
54
54
  "@nuxt/eslint-config": "^1.9.0",
@@ -61,7 +61,7 @@
61
61
  "@vitejs/plugin-vue": "^6.0.1",
62
62
  "@vitest/coverage-c8": "^0.33.0",
63
63
  "@witchcraft/nuxt-utils": "^0.3.6",
64
- "@witchcraft/ui": "^0.3.7",
64
+ "@witchcraft/ui": "0.4.0-beta.3",
65
65
  "concurrently": "^9.2.1",
66
66
  "cross-env": "^10.0.0",
67
67
  "fast-glob": "^3.3.3",
@@ -1,8 +1,4 @@
1
1
  <template>
2
- <!-- <div -->
3
- <!-- v-bind="$attrs" -->
4
- <!-- class="decos" -->
5
- <!-- > -->
6
2
  <template
7
3
  v-for="(deco) of splitDecos"
8
4
  :key="deco.id"
@@ -34,21 +30,15 @@
34
30
  :css="getShapeSquareCss( frames[deco.id], `var(--layoutEdgeWidth,2px)`)"
35
31
  />
36
32
  </template>
37
- <!-- </div> -->
38
33
  </template>
39
34
  <script lang="ts" setup>
40
- import { twMerge } from "@witchcraft/ui/utils/twMerge"
41
- import type { PropType } from "vue"
42
- import { computed, inject, ref, useAttrs } from "vue"
43
35
 
44
36
  import LayoutShapeSquare from "./LayoutShapeSquare.vue"
45
37
 
46
- import { dirToOrientation } from "../helpers/dirToOrientation.js"
47
38
  import { getShapeSquareCss } from "../helpers/getShapeSquareCss"
48
39
  import { getVisualEdgeCss } from "../helpers/getVisualEdgeCss"
49
40
  import { type CloseDeco, type LayoutFrames, type Size, type SplitDeco } from "../types/index.js"
50
41
 
51
- const $attrs = useAttrs()
52
42
 
53
43
  const props = withDefaults(defineProps<{
54
44
  frames: LayoutFrames
@@ -9,7 +9,9 @@
9
9
  border-blue-500
10
10
  border
11
11
  `,
12
+ ($attrs as any).class
12
13
  )"
14
+ v-bind="{...$attrs, class: undefined}"
13
15
  />
14
16
 
15
17
  <template
@@ -73,51 +75,42 @@
73
75
  </template>
74
76
  <script lang="ts" setup>
75
77
  import { twMerge } from "@witchcraft/ui/utils/twMerge"
76
- import { computed,type PropType, ref,useAttrs } from "vue"
78
+ import { computed,useAttrs } from "vue"
77
79
 
78
80
  import LayoutShapeSquare from "./LayoutShapeSquare.vue"
79
81
 
80
- import { frameToEdges } from "../helpers/frameToEdges.js"
81
82
  import { getIntersectionsCss } from "../helpers/getIntersectionsCss.js"
82
83
  import { getShapeSquareCss } from "../helpers/getShapeSquareCss.js"
83
84
  import { getVisualEdgesCss } from "../helpers/getVisualEdgesCss.js"
84
85
  import { isEdgeEqual } from "../helpers/isEdgeEqual.js"
85
- import { toWindowCoord } from "../helpers/toWindowCoord.js"
86
86
  import {
87
87
  type Edge,
88
88
  type EdgeCss,
89
89
  type IntersectionEntry,
90
- type LayoutFrame,
91
- type LayoutWindow,
92
- type Point,
90
+ type LayoutEdgesProps,
93
91
  } from "../types/index.js"
94
92
  const $attrs = useAttrs()
95
93
 
94
+ defineOptions({
95
+ inheritAttrs: false,
96
+ })
97
+
96
98
  const emit = defineEmits<{
97
99
  dragStart: [e: PointerEvent, { edge?: Edge, intersection?: IntersectionEntry }]
98
100
  }>()
99
- const props = withDefaults(defineProps< {
100
- edges: Edge[]
101
- intersections: IntersectionEntry[]
102
- /** The owning window, needed so we can correctly scale coordinates. */
103
- win: LayoutWindow
104
- /** The active frame, used to render the active edges. Calculate it from the `frames` returned by `useFrames` composable because otherwise it will be the wrong size while dragging. */
105
- activeFrame?: LayoutFrame
106
- draggingEdge?: Edge
107
- draggingIntersection?: IntersectionEntry
108
- }>(), {
101
+ const props = withDefaults(defineProps<LayoutEdgesProps>(), {
109
102
  activeFrame: undefined,
110
103
  draggingEdge: undefined,
111
104
  draggingIntersection: undefined,
112
105
  })
113
106
 
114
107
 
115
- const activeFrameCssEdges = computed(() => {
116
- if (!props.activeFrame) return []
117
- return getVisualEdgesCss(Object.values(frameToEdges(props.activeFrame)), {
118
- edgeWidth: `var(--layoutEdgeWidth, 2px)`,
119
- })
120
- })
108
+ // const activeFrameCssEdges = computed(() => {
109
+ // if (!props.activeFrame) return []
110
+ // return getVisualEdgesCss(Object.values(frameToEdges(props.activeFrame)), {
111
+ // edgeWidth: `var(--layoutEdgeWidth, 2px)`,
112
+ // })
113
+ // })
121
114
 
122
115
  const cssDragEdges = computed(() => {
123
116
  const thickEdges = getVisualEdgesCss(
@@ -1,5 +1,4 @@
1
1
  <template>
2
- <!-- @vue-expect-error just let it inherit extra attrs -->
3
2
  <!-- overflow-hidden is just in case, if the frame's css is not properly set to h-full, overflow-auto, or the border/padding are too large, we can still get overflows -->
4
3
  <LayoutShapeSquare
5
4
  tabindex="0"
@@ -9,7 +8,7 @@
9
8
  p-[var(--layoutEdgeWidth,_2px)]
10
9
  overflow-hidden
11
10
  `,
12
- $attrs.class
11
+ ($attrs as any).class
13
12
  )"
14
13
  v-bind="{...$attrs, class: undefined}"
15
14
  @focus="emit('focus')"
@@ -24,15 +23,18 @@
24
23
  </template>
25
24
  <script lang="ts" setup>
26
25
  import { twMerge } from "@witchcraft/ui/utils/twMerge"
27
- import { type PropType } from "vue"
28
26
  import { useAttrs } from "vue"
29
27
  const $attrs = useAttrs()
30
28
 
29
+ defineOptions({
30
+ inheritAttrs: false,
31
+ })
32
+
31
33
  import LayoutShapeSquare from "./LayoutShapeSquare.vue"
32
34
 
33
35
  import { getShapeSquareCss } from "../helpers/getShapeSquareCss"
34
36
  import { debugFrame } from "../layout/debugFrame.js"
35
- import { type LayoutFrame } from "../types/index.js"
37
+ import { type LayoutFrameProps } from "../types/index.js"
36
38
 
37
39
 
38
40
  const emit = defineEmits<{
@@ -40,8 +42,6 @@ const emit = defineEmits<{
40
42
  (e: "focus"): void
41
43
  }>()
42
44
 
43
- /* const props = */defineProps({
44
- frame: { type: Object as PropType<LayoutFrame>, required: true },
45
- isActiveFrame: { type: Boolean, required: true },
46
- })
45
+ /* const props = */defineProps<LayoutFrameProps>(
46
+ )
47
47
  </script>
@@ -15,7 +15,7 @@
15
15
  left-[var(--posX)]
16
16
  `,
17
17
  css.translate && `[transform:var(--translate)]`,
18
- $attrs.class as any
18
+ ($attrs as any).class
19
19
  )"
20
20
  v-bind="{...$attrs, class: undefined}"
21
21
  >
@@ -24,15 +24,14 @@
24
24
  </template>
25
25
  <script setup lang="ts">
26
26
  import { twMerge } from "@witchcraft/ui/utils/twMerge"
27
- import { type PropType } from "vue"
28
27
  import { useAttrs } from "vue"
29
28
 
30
- import type { BaseSquareCss } from "../types/index.js"
29
+ import type { LayoutShapeSquareProps } from "../types/index.js"
31
30
  const $attrs = useAttrs()
32
31
 
33
-
34
- const props = defineProps({
35
- style: { type: String, required: false, default: "" },
36
- css: { type: Object as PropType<BaseSquareCss>, required: true },
32
+ defineOptions({
33
+ inheritAttrs: false,
37
34
  })
35
+
36
+ const props = defineProps<LayoutShapeSquareProps>()
38
37
  </script>
@@ -7,17 +7,17 @@
7
7
  `,
8
8
  isDragging && `dragging cursor-pointer`,
9
9
  requestType && `request-${requestType}`,
10
- $attrs.attrs.class
10
+ ($attrs as any).class
11
11
  )"
12
12
  ref="windowEl"
13
- v-bind="{...$attrs.attrs, class: undefined}"
13
+ v-bind="{...$attrs, class: undefined}"
14
14
  >
15
15
  <template v-if="windowEl && win">
16
16
  <LayoutFrameComponent :frame="frame"
17
17
  :is-active-frame="frame.id === win.activeFrame"
18
18
  v-for="frame of frames"
19
19
  :key="frame.id"
20
- v-bind="$attrs.frameAttrs"
20
+ v-bind="frameProps"
21
21
  @focus="windowSetActiveFrame(win, frame.id)"
22
22
  >
23
23
  <slot :name="`frame-${frame.id}`" v-bind="{frame}"/>
@@ -29,14 +29,13 @@
29
29
  :intersections="intersections"
30
30
  :dragging-edge="draggingEdges.length === 1 ? draggingEdges[0] : undefined"
31
31
  :dragging-intersection="draggingIntersection"
32
- v-bind="$attrs.edgesAttrs"
32
+ v-bind="edgesProps"
33
33
  @drag-start="dragStart"
34
34
  />
35
35
  <LayoutDecosComponent
36
36
  :frames="frames"
37
37
  :split-decos="splitDecos"
38
38
  :close-decos="closeDecos"
39
- v-bind="$attrs.decosAttrs"
40
39
  />
41
40
  <slot name="extra-decos"/>
42
41
  </template>
@@ -45,7 +44,6 @@
45
44
  <span
46
45
  class="
47
46
  after:content-['┃']
48
- after:text-accent-500
49
47
  last:after:content-none
50
48
  after:mx-1
51
49
  after:text-gray-500
@@ -60,10 +58,10 @@
60
58
  </div>
61
59
  </template>
62
60
  <script lang="ts" setup>
63
- import { useDivideAttrs } from "@witchcraft/ui/composables/useDivideAttrs"
64
61
  import { useGlobalResizeObserver } from "@witchcraft/ui/composables/useGlobalResizeObserver"
65
62
  import { twMerge } from "@witchcraft/ui/utils/twMerge"
66
- import { computed, ref,watch } from "vue"
63
+ import { computed, ref,useAttrs,watch } from "vue"
64
+ import { type HTMLAttributes } from "vue"
67
65
 
68
66
  import LayoutDecosComponent from "./LayoutDecos.vue"
69
67
  import LayoutEdgesComponent from "./LayoutEdges.vue"
@@ -76,10 +74,10 @@ import { SplitAction } from "../drag/SplitAction.js"
76
74
  import { type DragState, type IDragAction } from "../drag/types.js"
77
75
  import { updateWindowWithEvent } from "../helpers/updateWindowSizeWithEvent.js"
78
76
  import { windowSetActiveFrame } from "../layout/windowSetActiveFrame.js"
79
- import { type CloseDeco, type LayoutWindow, type SplitDeco } from "../types/index.js"
77
+ import { type CloseDeco, type LayoutEdgesProps, type LayoutFrameProps, type LayoutWindow, type SplitDeco } from "../types/index.js"
80
78
 
81
- const $attrs = useDivideAttrs(["frame", "edges", "decos"] as const)
82
79
 
80
+ const $attrs = useAttrs()
83
81
  const win = defineModel<LayoutWindow>("win", { required: true })
84
82
 
85
83
  const props = withDefaults(defineProps<{
@@ -96,13 +94,15 @@ const props = withDefaults(defineProps<{
96
94
  * When this is turned back on again, it will trigger an update. You can also trigger updates manually with the exposed updateWindowSize function.
97
95
  */
98
96
  allowWindowSizeUpdate?: boolean
97
+ frameProps?: Partial<Omit<LayoutFrameProps, "frame" | "isActiveFrame" | "onFocus">>,
98
+ edgesProps?: Partial<Omit<LayoutEdgesProps, "edges" | "intersections" | "win">>
99
99
  }>(), {
100
100
  additionalDragActions: () => ([]),
101
101
  splitKeyHandler: undefined,
102
102
  closeKeyHandler: undefined,
103
103
  usageInstructions: () => ({ }),
104
104
  instructionTeleportTo: undefined,
105
- allowWindowSizeUpdate: true
105
+ allowWindowSizeUpdate: true,
106
106
  })
107
107
  const emit = defineEmits<{
108
108
  (e: "isShowingDrag", value: boolean): void
@@ -60,7 +60,7 @@
60
60
  import { keys } from "@alanscodelog/utils/keys"
61
61
  // playground not resolving???
62
62
  // todo this breaks the non-playground build
63
- import WRoot from "@witchcraft/ui/components/LibRoot"
63
+ import WRoot from "@witchcraft/ui/components/WRoot"
64
64
  import { twMerge } from "@witchcraft/ui/utils/twMerge"
65
65
  import { computed, onBeforeMount, ref } from "vue"
66
66
 
@@ -6,7 +6,7 @@
6
6
  </div>
7
7
  </template>
8
8
  <script lang="ts" setup>
9
- import WDarkModeSwitcher from "@witchcraft/ui/components/LibDarkModeSwitcher"
9
+ import WDarkModeSwitcher from "@witchcraft/ui/components/WDarkModeSwitcher"
10
10
 
11
11
  import type { LayoutFrame } from "../types/index.js"
12
12
 
@@ -4,6 +4,8 @@ import { z } from "zod"
4
4
 
5
5
  export * from "../drag/types.js"
6
6
 
7
+ import type { HTMLAttributes, StyleValue } from "vue"
8
+
7
9
  import { getMaxInt } from "../settings.js"
8
10
 
9
11
  export const zUuid = z.uuid()
@@ -234,11 +236,9 @@ export const LAYOUT_ERROR = enumFromArray([
234
236
 
235
237
  export type LayoutError = EnumLike<typeof LAYOUT_ERROR>
236
238
 
237
- export type AllErrors = LayoutError
238
-
239
- export type ErrorInfo<T extends AllErrors> = AllErrorsInfo[T] extends undefined ? never : AllErrorsInfo[T]
239
+ export type LayoutErrorInfo<T extends LayoutError> = LayoutErrorsInfo[T] extends undefined ? never : LayoutErrorsInfo[T]
240
240
 
241
- type AllErrorsInfo = {
241
+ export type LayoutErrorsInfo = {
242
242
  [LAYOUT_ERROR.INVALID_ID]: {
243
243
  id: string | undefined
244
244
  }
@@ -291,3 +291,33 @@ export const zFrameCreate = zLayoutFrame.partial({
291
291
  width: true,
292
292
  height: true
293
293
  })
294
+
295
+
296
+ export type LayoutShapeSquareProps
297
+ = & {
298
+ css: BaseSquareCss
299
+ style?: StyleValue
300
+ }
301
+ & /** @vue-ignore */ Omit<HTMLAttributes, "class" | "onFocus"> & { class?: string }
302
+
303
+
304
+ export type LayoutEdgesProps
305
+ = & {
306
+ edges: Edge[]
307
+ intersections: IntersectionEntry[]
308
+ /** The owning window, needed so we can correctly scale coordinates. */
309
+ win: LayoutWindow
310
+ /** The active frame, used to render the active edges. Calculate it from the `frames` returned by `useFrames` composable because otherwise it will be the wrong size while dragging. */
311
+ activeFrame?: LayoutFrame
312
+ draggingEdge?: Edge
313
+ draggingIntersection?: IntersectionEntry
314
+ }
315
+ & Partial<LayoutShapeSquareProps>
316
+
317
+
318
+ export type LayoutFrameProps
319
+ = & {
320
+ frame: LayoutFrame
321
+ isActiveFrame: boolean
322
+ }
323
+ & Partial<LayoutShapeSquareProps>
@@ -1,12 +1,12 @@
1
- import type { AllErrors, ErrorInfo } from "../types/index.js"
1
+ import type { LayoutError, LayoutErrorInfo } from "../types/index.js"
2
2
 
3
3
  /**
4
4
  * Creates a known error that extends the base Error with some extra information.
5
5
  * All the variables used to create the error message are stored in it's info property so we can easily re-craft error messages for users.
6
6
  */
7
7
  export class KnownError<
8
- T extends AllErrors = AllErrors,
9
- TInfo extends ErrorInfo<T> = ErrorInfo<T>
8
+ T extends LayoutError = LayoutError,
9
+ TInfo extends LayoutErrorInfo<T> = LayoutErrorInfo<T>
10
10
  > extends Error {
11
11
  code: T
12
12