@@ -19,39 +19,46 @@ This package requires the following peer dependency:
1919``` vue
2020<template>
2121 <main>
22- <h1>GridSheet Vue Example</h1>
23- <div class="grid-container">
24- <GridSheet
25- :hub="hub"
26- :initialCells="{
27- A1: { value: 'Hello' },
28- B1: { value: 'Vue', style: { backgroundColor: '#448888'} },
29- A2: { value: 123 },
30- B2: { value: 456 },
31- A3: { value: 789},
32- C10: { value: '=SUM(A2:B2)' },
33- }"
34- :options="{
35- mode: 'dark',
36- }"
37- sheetName="Sheet1"
38- />
39-
40- <GridSheet
41- :hub="hub"
42- :initialCells="{
43- C3: { value: '=SUM(Sheet1!A2:B3)' },
44- }"
45- :options="{}"
46- sheetName="Sheet2"
47- />
48- </div>
22+ <GridSheet
23+ :book="book"
24+ :initialCells="{
25+ A1: { value: 'Hello' },
26+ B1: { value: 'Vue', style: { backgroundColor: '#448888'} },
27+ A2: { value: 123 },
28+ B2: { value: 456 },
29+ A3: { value: 789},
30+ C6: { value: '=SUM(A2:B2)' },
31+ }"
32+ :options="{
33+ mode: 'dark',
34+ }"
35+ sheetName="Sheet1"
36+ />
37+
38+ <GridSheet
39+ :book="book"
40+ :initialCells="{
41+ C3: { value: '=SUM(Sheet1!A2:B3)' },
42+ }"
43+ :options="{}"
44+ sheetName="Sheet2"
45+ />
4946 </main>
5047</template>
5148
5249<script setup>
53- import { GridSheet, useHub } from '@gridsheet/vue-core';
54- const hub = useHub();
50+ import { GridSheet, useBook } from '@gridsheet/vue-core';
51+ const book = useBook();
52+ </script>
53+ ```
54+
55+ ### With Extended Functions (Spellbook)
56+
57+ ``` vue
58+ <script setup>
59+ import { GridSheet } from '@gridsheet/vue-core';
60+ import { useSpellbook } from '@gridsheet/vue-core/spellbook';
61+ const book = useSpellbook();
5562</script>
5663```
5764
@@ -62,22 +69,41 @@ const hub = useHub();
6269The main spreadsheet component for Vue 3 applications.
6370
6471** Props:**
65- - ` hub ` - Reactive hub for data binding and state management
72+ - ` book ` - Book object for cross-sheet data binding and state management
6673- ` initialCells ` - Initial cell data with values, styles, and formulas
6774- ` options ` - GridSheet options (e.g., mode: 'dark')
6875- ` sheetName ` - Name of the sheet
76+ - ` sheetRef ` - Ref object to access sheet handle
77+ - ` storeRef ` - Ref object to access store handle
78+ - ` className ` - CSS class name
79+ - ` style ` - Inline styles
6980
70- ### useHub
81+ ### useBook
7182
72- A Vue 3-specific composable for creating reactive hubs that can be used for data binding and state management.
83+ A Vue 3-specific composable for creating a reactive book. Returns a ` shallowRef<BookType> ` .
84+
85+ ``` js
86+ import { useBook } from ' @gridsheet/vue-core' ;
87+ const book = useBook ({ /* RegistryProps */ });
88+ ```
89+
90+ ### useSpellbook
91+
92+ Same as ` useBook ` but with all extended functions (` @gridsheet/functions ` ) pre-loaded.
93+
94+ ``` js
95+ import { useSpellbook } from ' @gridsheet/vue-core/spellbook' ;
96+ const book = useSpellbook ({ /* RegistryProps */ });
97+ ```
7398
7499## Exports
75100
76101This package exports:
77102
78103- All core GridSheet functionality from ` @gridsheet/preact-core `
79104- ` GridSheet ` - Vue 3 component
80- - ` useHub ` - Vue 3-specific reactive hub composable
105+ - ` useBook ` - Vue 3-specific reactive book composable
106+ - ` @gridsheet/vue-core/spellbook ` - ` useSpellbook ` , ` createSpellbook `
81107
82108## Docs
83109
@@ -92,11 +118,8 @@ pnpm dev
92118
93119# Build the package
94120pnpm build
95-
96- # Preview the build
97- pnpm preview
98121```
99122
100123## License
101124
102- Apache-2.0
125+ Apache-2.0
0 commit comments