@molecule/app-spreadsheet-grid-svelte 0.0.0-stage → 1.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.
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Svelte action reproducing react-dom's controlled-input `value` handling for
3
+ * the grid's in-cell editor.
4
+ *
5
+ * Svelte's `value={x}` sets only the `value` property, while a React input
6
+ * carries BOTH the property and the `value` attribute (react-dom applies the
7
+ * value through the `defaultValue` property, whose reflection IS that
8
+ * attribute). Vue writes both for a plain `value` prop, Solid uses
9
+ * `attr:value`, Angular binds `[attr.value]` plus a property sync; this
10
+ * package's raw input needs the same two writes, so this action re-applies
11
+ * React's documented behavior: the property, then the attribute through
12
+ * `defaultValue`, on mount and on every value change.
13
+ *
14
+ * @module
15
+ */
16
+ /**
17
+ * Applies `props.value` to the input the way react-dom applies a controlled
18
+ * `value`: through the `value` property (the live value) and the
19
+ * `defaultValue` property (whose reflection is the DOM `value` attribute), so
20
+ * both reads of the field agree.
21
+ *
22
+ * @param node - The input element.
23
+ * @param props - The controlled value, as React's `<input value>` takes it.
24
+ * @returns The action's update, re-applying on a changed value.
25
+ */
26
+ export declare function reactInputValue(node: HTMLInputElement, props: {
27
+ value?: unknown;
28
+ }): {
29
+ update: (next: {
30
+ value?: unknown;
31
+ }) => void;
32
+ };
33
+ //# sourceMappingURL=value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value.d.ts","sourceRoot":"","sources":["../src/value.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,gBAAgB,EACtB,KAAK,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACzB;IAAE,MAAM,EAAE,CAAC,IAAI,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAA;CAAE,CAajD"}
package/dist/value.js ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Svelte action reproducing react-dom's controlled-input `value` handling for
3
+ * the grid's in-cell editor.
4
+ *
5
+ * Svelte's `value={x}` sets only the `value` property, while a React input
6
+ * carries BOTH the property and the `value` attribute (react-dom applies the
7
+ * value through the `defaultValue` property, whose reflection IS that
8
+ * attribute). Vue writes both for a plain `value` prop, Solid uses
9
+ * `attr:value`, Angular binds `[attr.value]` plus a property sync; this
10
+ * package's raw input needs the same two writes, so this action re-applies
11
+ * React's documented behavior: the property, then the attribute through
12
+ * `defaultValue`, on mount and on every value change.
13
+ *
14
+ * @module
15
+ */
16
+ /**
17
+ * Applies `props.value` to the input the way react-dom applies a controlled
18
+ * `value`: through the `value` property (the live value) and the
19
+ * `defaultValue` property (whose reflection is the DOM `value` attribute), so
20
+ * both reads of the field agree.
21
+ *
22
+ * @param node - The input element.
23
+ * @param props - The controlled value, as React's `<input value>` takes it.
24
+ * @returns The action's update, re-applying on a changed value.
25
+ */
26
+ export function reactInputValue(node, props) {
27
+ const apply = (next) => {
28
+ const { value } = next;
29
+ if (value === undefined || value === null) {
30
+ node.removeAttribute('value');
31
+ return;
32
+ }
33
+ const text = String(value);
34
+ if (node.value !== text)
35
+ node.value = text;
36
+ if (node.defaultValue !== text)
37
+ node.defaultValue = text;
38
+ };
39
+ apply(props);
40
+ return { update: apply };
41
+ }
package/package.json CHANGED
@@ -1,6 +1,79 @@
1
1
  {
2
2
  "name": "@molecule/app-spreadsheet-grid-svelte",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "High-performance virtualized spreadsheet cell grid with frozen rows/columns, range selection, copy/paste as TSV, and in-cell editing — pairs with @molecule/api-formula-engine",
5
+ "homepage": "https://www.molecule.dev/packages/app-spreadsheet-grid-svelte",
6
+ "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "svelte": "./dist/index.js",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "./package.json": "./package.json"
16
+ },
17
+ "svelte": "./dist/index.js",
18
+ "files": [
19
+ "dist",
20
+ "!dist/**/__tests__",
21
+ "!dist/**/*.test.*",
22
+ "!dist/**/*.spec.*",
23
+ "README.md"
24
+ ],
25
+ "scripts": {
26
+ "build": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings && svelte-package --input src --output dist --tsconfig ./tsconfig.json",
27
+ "dev": "svelte-package --input src --output dist --tsconfig ./tsconfig.json --watch",
28
+ "test": "vitest run",
29
+ "test:watch": "vitest"
30
+ },
31
+ "keywords": [
32
+ "molecule",
33
+ "spreadsheet",
34
+ "grid",
35
+ "virtualized",
36
+ "svelte"
37
+ ],
38
+ "author": "Molecule Dev, Inc. (https://molecule.dev)",
39
+ "license": "Apache-2.0",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/molecule-dev/molecule.git",
43
+ "directory": "packages/app/features/spreadsheet-grid-svelte"
44
+ },
45
+ "engines": {
46
+ "node": ">=20"
47
+ },
48
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "peerDependencies": {
53
+ "@molecule/app-clipboard": "^1.0.1",
54
+ "@molecule/app-i18n": "^1.0.1",
55
+ "@molecule/app-svelte": "^3.5.0",
56
+ "@molecule/app-ui": "^1.3.11",
57
+ "@molecule/app-ui-svelte": "^1.1.0",
58
+ "svelte": "^5.0.0"
59
+ },
60
+ "devDependencies": {
61
+ "@molecule/app-clipboard": "1.0.5",
62
+ "@molecule/app-framework-conformance": "0.0.0",
63
+ "@molecule/app-i18n": "1.2.2",
64
+ "@molecule/app-icons": "1.0.4",
65
+ "@molecule/app-svelte": "3.9.0",
66
+ "@molecule/app-ui": "1.5.0",
67
+ "@molecule/app-ui-svelte": "1.2.1",
68
+ "@molecule/app-ui-tailwind": "1.3.0",
69
+ "@sveltejs/package": "3.0.2",
70
+ "@sveltejs/vite-plugin-svelte": "7.1.2",
71
+ "@types/node": "26.6.5",
72
+ "jsdom": "30.1.3",
73
+ "svelte": "5.57.2",
74
+ "svelte-check": "4.7.7",
75
+ "typescript": "6.0.3",
76
+ "vite": "8.3.5",
77
+ "vitest": "4.1.12"
78
+ }
79
+ }