@gridsheet/svelte-core 3.0.0-rc.12

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.
@@ -0,0 +1 @@
1
+ export { SvelteComponent as default } from 'svelte';
@@ -0,0 +1,12 @@
1
+ import { writable as n } from "svelte/store";
2
+ import { createBook as a, updateSheet as i } from "@gridsheet/preact-core";
3
+ function c(o = {}) {
4
+ const e = a(o), r = n(e), { registry: t } = e;
5
+ return t.updateSheet = i, t.transmit = (s) => {
6
+ Object.assign(t, s), t.ready && requestAnimationFrame(() => r.set({ registry: t }));
7
+ }, r;
8
+ }
9
+ export {
10
+ c as u
11
+ };
12
+ //# sourceMappingURL=book-CDi1oo09.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"book-CDi1oo09.mjs","sources":["../src/book.ts"],"sourcesContent":["import { writable } from 'svelte/store';\nimport { createBook, updateSheet, type BookType, type RegistryProps, type TransmitProps } from '@gridsheet/preact-core';\n\nexport function useBook(props: RegistryProps = {}) {\n const book = createBook(props);\n const store = writable<BookType>(book);\n const { registry } = book;\n\n registry.updateSheet = updateSheet;\n registry.transmit = (patch?: TransmitProps) => {\n Object.assign(registry, patch);\n if (!registry.ready) {\n return;\n }\n requestAnimationFrame(() => store.set({ registry }));\n };\n\n return store;\n}\n"],"names":["useBook","props","book","createBook","store","writable","registry","updateSheet","patch"],"mappings":";;AAGgB,SAAAA,EAAQC,IAAuB,IAAI;AAC3C,QAAAC,IAAOC,EAAWF,CAAK,GACvBG,IAAQC,EAAmBH,CAAI,GAC/B,EAAE,UAAAI,MAAaJ;AAErB,SAAAI,EAAS,cAAcC,GACdD,EAAA,WAAW,CAACE,MAA0B;AAEzC,IADG,OAAA,OAAOF,GAAUE,CAAK,GACxBF,EAAS,SAGd,sBAAsB,MAAMF,EAAM,IAAI,EAAE,UAAAE,EAAU,CAAA,CAAC;AAAA,EACrD,GAEOF;AACT;"}
package/dist/book.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import { BookType, RegistryProps } from '../../preact-core/dist';
2
+ export declare function useBook(props?: RegistryProps): import('svelte/store').Writable<BookType>;
@@ -0,0 +1,3 @@
1
+ export * from '../../preact-core/dist';
2
+ export { default as GridSheet } from './GridSheet.svelte';
3
+ export { useBook } from './book';
package/dist/index.js ADDED
@@ -0,0 +1,42 @@
1
+ import { render as a, h as N, GridSheet as R } from "@gridsheet/preact-core";
2
+ export * from "@gridsheet/preact-core";
3
+ import "svelte/internal/disclose-version";
4
+ import * as e from "svelte/internal/client";
5
+ import { onMount as k, onDestroy as v } from "svelte";
6
+ import { u as M } from "./book-CDi1oo09.mjs";
7
+ var y = e.from_html("<div></div>");
8
+ function C(l, o) {
9
+ e.push(o, !0);
10
+ let u = e.prop(o, "sheetName", 3, ""), i = e.prop(o, "book", 3, void 0), d = e.prop(o, "sheetRef", 3, void 0), m = e.prop(o, "storeRef", 3, void 0), h = e.prop(o, "options", 19, () => ({})), p = e.prop(o, "className", 3, ""), b = e.prop(o, "style", 19, () => ({})), t, r;
11
+ function n() {
12
+ t && a(
13
+ N(R, {
14
+ initialCells: o.initialCells,
15
+ sheetName: u(),
16
+ book: r,
17
+ sheetRef: d(),
18
+ storeRef: m(),
19
+ options: h(),
20
+ className: p(),
21
+ style: b()
22
+ }),
23
+ t
24
+ );
25
+ }
26
+ k(() => {
27
+ if (i())
28
+ return i().subscribe((c) => {
29
+ r = c, n();
30
+ });
31
+ n();
32
+ }), v(() => {
33
+ t && a(null, t);
34
+ });
35
+ var s = y();
36
+ e.bind_this(s, (f) => t = f, () => t), e.append(l, s), e.pop();
37
+ }
38
+ export {
39
+ C as GridSheet,
40
+ M as useBook
41
+ };
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/GridSheet.svelte"],"sourcesContent":["<script lang=\"ts\">\n import { onMount, onDestroy } from 'svelte';\n import {\n GridSheet as PreactGridSheet,\n h as preactH,\n render as preactRender,\n } from '@gridsheet/preact-core';\n\n import type {\n CellsByAddressType,\n OptionsType,\n BookType,\n SheetHandle,\n StoreHandle,\n } from '@gridsheet/preact-core';\n\n import type { Writable } from 'svelte/store';\n\n interface RefObject<T> {\n readonly current: T | null;\n }\n\n let {\n initialCells,\n sheetName = '',\n book = undefined,\n sheetRef = undefined,\n storeRef = undefined,\n options = {},\n className = '',\n style = {},\n }: {\n initialCells: CellsByAddressType;\n sheetName?: string;\n book?: Writable<BookType>;\n sheetRef?: RefObject<SheetHandle | null>;\n storeRef?: RefObject<StoreHandle | null>;\n options?: OptionsType;\n className?: string;\n style?: Record<string, string>;\n } = $props();\n\n let container: HTMLElement;\n let bookValue: BookType | undefined = undefined;\n\n function renderPreact() {\n if (container) {\n preactRender(\n preactH(PreactGridSheet, {\n initialCells,\n sheetName,\n book: bookValue,\n sheetRef,\n storeRef,\n options,\n className,\n style,\n }),\n container\n );\n }\n }\n\n onMount(() => {\n if (book) {\n const unsubscribe = book.subscribe((value) => {\n bookValue = value;\n renderPreact();\n });\n return unsubscribe;\n } else {\n renderPreact();\n }\n });\n\n onDestroy(() => {\n if (container) {\n preactRender(null, container);\n }\n });\n</script>\n\n<div bind:this={container}></div>\n"],"names":["sheetName","book","sheetRef","storeRef","options","$","$$props","className","style","container","bookValue","renderPreact","preactRender","preactH","PreactGridSheet","onMount","value","onDestroy","div","root","$$value"],"mappings":";;;;;;;iBAAA;;AAwBI,MAAAA,8BAAY,EAAE,GACdC,yBAAO,MAAS,GAChBC,6BAAW,MAAS,GACpBC,6BAAW,MAAS,GACpBC,IAAOC,EAAA,KAAAC,GAAA,WAAA,IAAA,OAAA,CAAA,EAAA,GACPC,8BAAY,EAAE,GACdC,IAAKH,EAAA,KAAAC,GAAA,SAAA,IAAA,OAAA,CAAA,EAAA,GAYHG,GACAC;AAEK,WAAAC,IAAe;AAClB,IAAAF,KACFG;AAAAA,MACEC,EAAQC,GAAe;AAAA,QACrB,cAAYR,EAAA;AAAA,QACZ,WAAAN,EAAS;AAAA,QACT,MAAMU;AAAA,QACN,UAAAR,EAAQ;AAAA,QACR,UAAAC,EAAQ;AAAA,QACR,SAAAC,EAAO;AAAA,QACP,WAAAG,EAAS;AAAA,QACT,OAAAC,EAAK;AAAA;MAEPC;AAAA;;AAKN,EAAAM,QAAc;AACR,QAAAd,EAAI;aACcA,EAAI,EAAC,UAAW,CAAAe,MAAU;AAC5C,QAAAN,IAAYM,GACZL,EAAY;AAAA,OACb;AAGD,IAAAA,EAAY;AAAA,GAEf,GAEDM,QAAgB;AACV,IAAAR,KACFG,EAAa,MAAMH,CAAS;AAAA,GAE/B;MAGFS,IAAGC,EAAA;cAAHD,GAAG,CAAAE,MAAYX,IAASW,GAAA,MAATX,CAAS,eAAxBS,CAAG;AAFI;"}
@@ -0,0 +1,4 @@
1
+ import { RegistryProps } from '../../preact-core/dist';
2
+ export { createSpellbook } from '../../preact-core/dist/spellbook';
3
+ /** useBook with all extended functions pre-loaded (Svelte version). */
4
+ export declare const useSpellbook: ({ additionalFunctions, ...rest }?: RegistryProps) => import('svelte/store').Writable<import('@gridsheet/core').BookType>;
@@ -0,0 +1,9 @@
1
+ import { allFunctions as e } from "@gridsheet/functions";
2
+ import { u as r } from "./book-CDi1oo09.mjs";
3
+ import { createSpellbook as a } from "@gridsheet/preact-core/spellbook";
4
+ const n = ({ additionalFunctions: o, ...t } = {}) => r({ ...t, additionalFunctions: { ...e, ...o } });
5
+ export {
6
+ a as createSpellbook,
7
+ n as useSpellbook
8
+ };
9
+ //# sourceMappingURL=spellbook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spellbook.js","sources":["../src/spellbook.ts"],"sourcesContent":["import { allFunctions } from '@gridsheet/functions';\nimport type { RegistryProps } from '@gridsheet/preact-core';\nimport { useBook } from './book';\n\nexport { createSpellbook } from '@gridsheet/preact-core/spellbook';\n\n/** useBook with all extended functions pre-loaded (Svelte version). */\nexport const useSpellbook = ({ additionalFunctions, ...rest }: RegistryProps = {}) =>\n useBook({ ...rest, additionalFunctions: { ...allFunctions, ...additionalFunctions } });\n"],"names":["useSpellbook","additionalFunctions","rest","useBook","allFunctions"],"mappings":";;;AAOa,MAAAA,IAAe,CAAC,EAAE,qBAAAC,GAAqB,GAAGC,EAAK,IAAmB,CAAA,MAC7EC,EAAQ,EAAE,GAAGD,GAAM,qBAAqB,EAAE,GAAGE,GAAc,GAAGH,EAAA,EAAuB,CAAA;"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@gridsheet/svelte-core",
3
+ "version": "3.0.0-rc.12",
4
+ "description": "Spreadsheet component for Svelte 5",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "svelte": "dist/index.js",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "svelte": "./dist/index.js",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ },
16
+ "./spellbook": {
17
+ "types": "./dist/spellbook.d.ts",
18
+ "import": "./dist/spellbook.js",
19
+ "default": "./dist/spellbook.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "scripts": {
26
+ "dev": "vite example",
27
+ "build": "rm -rf ./dist || true && vite build"
28
+ },
29
+ "homepage": "https://gridsheet.walkframe.com/",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/walkframe/gridsheet.git"
33
+ },
34
+ "peerDependencies": {
35
+ "svelte": "^5.0.0"
36
+ },
37
+ "dependencies": {
38
+ "@gridsheet/preact-core": "workspace:*"
39
+ },
40
+ "devDependencies": {
41
+ "@sveltejs/vite-plugin-svelte": "^5.0.3",
42
+ "@gridsheet/functions": "workspace:*",
43
+ "svelte": "^5.28.2",
44
+ "vite": "^6.3.5",
45
+ "vite-plugin-dts": "^4.5.3"
46
+ },
47
+ "author": "righ",
48
+ "license": "Apache-2.0"
49
+ }