@griddle/vue 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Trustybits
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ # @griddle/vue
2
+
3
+ Vue 3 bindings for [Griddle](https://github.com/Trustybits/griddle) — a headless,
4
+ zero-dependency grid/canvas engine. Provides a `<GriddleGrid />` component and a
5
+ `useGriddle()` composable that wrap [`@griddle/core`](https://www.npmjs.com/package/@griddle/core)
6
+ with virtualized rendering, drag/resize handles, and animations.
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ npm install @griddle/vue @griddle/core
12
+ ```
13
+
14
+ `@griddle/core` and `vue` are **peer dependencies**. On npm 7+ the peers are
15
+ installed automatically; with Yarn or pnpm, add `@griddle/core` yourself (as
16
+ shown above). `vue` (>=3.3) is expected to already be in your app.
17
+
18
+ ## Usage
19
+
20
+ ```vue
21
+ <script setup>
22
+ import { GriddleGrid, useGriddle } from '@griddle/vue';
23
+
24
+ const api = useGriddle({
25
+ config: { cols: 12, rows: 12, unitWidth: 75, unitHeight: 75 },
26
+ tiles: [
27
+ { id: '1', col: 0, row: 0, w: 2, h: 2 },
28
+ { id: '2', col: 2, row: 0, w: 1, h: 1 },
29
+ ],
30
+ });
31
+ </script>
32
+
33
+ <template>
34
+ <GriddleGrid :api="api">
35
+ <template #tile="{ tile, selected }">
36
+ <div :data-selected="selected">#{{ tile.id }}</div>
37
+ </template>
38
+ </GriddleGrid>
39
+ </template>
40
+ ```
41
+
42
+ ## Loop mode (infinite gallery)
43
+
44
+ Enable `loop` in the config and the content repeats endlessly with drag-to-pan
45
+ physics — no scrollbars:
46
+
47
+ ```ts
48
+ const api = useGriddle({
49
+ config: {
50
+ cols: 12, rows: 12, unitWidth: 120, unitHeight: 120,
51
+ loop: { enabled: true, interaction: 'pan' }, // 'pan' = viewer, 'edit' = ghost edit
52
+ },
53
+ tiles,
54
+ });
55
+ ```
56
+
57
+ `<GriddleGrid>` automatically switches to the loop renderer when
58
+ `config.loop.enabled` is `true`, so most apps never touch the loop component
59
+ directly. For advanced cases where you want to render the loop plane explicitly,
60
+ `GriddleLoopGrid` is also exported and takes the same props as `GriddleGrid`:
61
+
62
+ ```js
63
+ import { GriddleLoopGrid } from '@griddle/vue';
64
+ ```
65
+
66
+ See the [main repository](https://github.com/Trustybits/griddle) for full docs.
67
+
68
+ ## License
69
+
70
+ MIT © Trustybits
@@ -0,0 +1,57 @@
1
+ import type { CameraState, Tile } from '@griddle/core';
2
+ import type { GriddleApi } from './useGriddle.js';
3
+ type __VLS_Props = {
4
+ api: GriddleApi;
5
+ className?: string;
6
+ height?: number | string;
7
+ showGrid?: boolean;
8
+ /** Controlled selection. If omitted, managed internally. */
9
+ selection?: Set<string>;
10
+ };
11
+ declare var __VLS_14: {
12
+ tile: Tile;
13
+ selected: boolean;
14
+ }, __VLS_16: {
15
+ tile: Tile;
16
+ selected: boolean;
17
+ };
18
+ type __VLS_Slots = {} & {
19
+ tile?: (props: typeof __VLS_14) => any;
20
+ } & {
21
+ tile?: (props: typeof __VLS_16) => any;
22
+ };
23
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
24
+ selectionChange: (selection: Set<string>) => any;
25
+ dragStart: (tileId: string) => any;
26
+ dragEnd: (tileId: string, committed: boolean) => any;
27
+ resizeStart: (tileId: string) => any;
28
+ resizeEnd: (tileId: string, committed: boolean) => any;
29
+ cameraChange: (camera: CameraState) => any;
30
+ drawCreate: (rect: {
31
+ col: number;
32
+ row: number;
33
+ w: number;
34
+ h: number;
35
+ }) => any;
36
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
37
+ onSelectionChange?: ((selection: Set<string>) => any) | undefined;
38
+ onDragStart?: ((tileId: string) => any) | undefined;
39
+ onDragEnd?: ((tileId: string, committed: boolean) => any) | undefined;
40
+ onResizeStart?: ((tileId: string) => any) | undefined;
41
+ onResizeEnd?: ((tileId: string, committed: boolean) => any) | undefined;
42
+ onCameraChange?: ((camera: CameraState) => any) | undefined;
43
+ onDrawCreate?: ((rect: {
44
+ col: number;
45
+ row: number;
46
+ w: number;
47
+ h: number;
48
+ }) => any) | undefined;
49
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
50
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
51
+ export default _default;
52
+ type __VLS_WithSlots<T, S> = T & {
53
+ new (): {
54
+ $slots: S;
55
+ };
56
+ };
57
+ //# sourceMappingURL=GriddleGrid.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GriddleGrid.vue.d.ts","sourceRoot":"","sources":["../src/GriddleGrid.vue"],"names":[],"mappings":"AAwuBA,OAAO,KAAK,EAAE,WAAW,EAAU,IAAI,EAAE,MAAM,eAAe,CAAC;AAc/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,UAAU,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAC5D,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC;AAowBF,QAAA,IAAI,QAAQ;;;CAAW,EAAE,QAAQ;;;CAAY,CAAE;AAC/C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GAC1C;IAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AA8C7C,QAAA,MAAM,eAAe;;;;;;;;aAhzBY,MAAM;aAAO,MAAM;WAAK,MAAM;WAAK,MAAM;;;;;;;;;;aAAzC,MAAM;aAAO,MAAM;WAAK,MAAM;WAAK,MAAM;;kFAuzBxE,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,44 @@
1
+ import type { CameraState, Tile } from '@griddle/core';
2
+ import type { GriddleApi } from './useGriddle.js';
3
+ type __VLS_Props = {
4
+ api: GriddleApi;
5
+ className?: string;
6
+ height?: number | string;
7
+ showGrid?: boolean;
8
+ selection?: Set<string>;
9
+ };
10
+ declare var __VLS_1: {
11
+ tile: Tile;
12
+ selected: boolean;
13
+ }, __VLS_3: {
14
+ tile: Tile;
15
+ selected: boolean;
16
+ };
17
+ type __VLS_Slots = {} & {
18
+ tile?: (props: typeof __VLS_1) => any;
19
+ } & {
20
+ tile?: (props: typeof __VLS_3) => any;
21
+ };
22
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
23
+ selectionChange: (selection: Set<string>) => any;
24
+ dragStart: (tileId: string) => any;
25
+ dragEnd: (tileId: string, committed: boolean) => any;
26
+ resizeStart: (tileId: string) => any;
27
+ resizeEnd: (tileId: string, committed: boolean) => any;
28
+ cameraChange: (camera: CameraState) => any;
29
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
30
+ onSelectionChange?: ((selection: Set<string>) => any) | undefined;
31
+ onDragStart?: ((tileId: string) => any) | undefined;
32
+ onDragEnd?: ((tileId: string, committed: boolean) => any) | undefined;
33
+ onResizeStart?: ((tileId: string) => any) | undefined;
34
+ onResizeEnd?: ((tileId: string, committed: boolean) => any) | undefined;
35
+ onCameraChange?: ((camera: CameraState) => any) | undefined;
36
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
37
+ declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
38
+ export default _default;
39
+ type __VLS_WithSlots<T, S> = T & {
40
+ new (): {
41
+ $slots: S;
42
+ };
43
+ };
44
+ //# sourceMappingURL=LoopGrid.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoopGrid.vue.d.ts","sourceRoot":"","sources":["../src/LoopGrid.vue"],"names":[],"mappings":"AA4nBA,OAAO,KAAK,EAAE,WAAW,EAAmB,IAAI,EAAE,MAAM,eAAe,CAAC;AASxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,UAAU,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACzB,CAAC;AAqnBF,QAAA,IAAI,OAAO;;;CAAU,EAAE,OAAO;;;CAAW,CAAE;AAC3C,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,GACzC;IAAE,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AA8C5C,QAAA,MAAM,eAAe;;;;;;;;;;;;;;kFAOnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { default as GriddleGrid } from './GriddleGrid.vue';
2
+ export { default as GriddleLoopGrid } from './LoopGrid.vue';
3
+ export { useGriddle, type GriddleApi, type UseGriddleInit } from './useGriddle.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC"}