@sheetpane/review 0.0.0-stage → 0.4.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 @@
1
+ {"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../src/xml.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,wFAAwF;AACxF,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,WAAW,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7E,eAAO,MAAM,QAAQ,oEAA8D,CAAC;AACpF,eAAO,MAAM,OAAO,8DAA8D,CAAC;AACnF,eAAO,MAAM,IAAI,wEAAwE,CAAC;AAC1F,eAAO,MAAM,aAAa,kFAAsB,CAAC;AACjD,eAAO,MAAM,YAAY,8EAA8E,CAAC;AAExG,kCAAkC;AAClC,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAE9B,iGAAiG;AACjG,eAAO,MAAM,SAAS,SAAU,MAAM,2BAAwG,CAAC;AAE/I,4CAA4C;AAC5C,eAAO,MAAM,OAAO,QAAS,MAAM,KAAG,MAAkC,CAAC;AAEzE,6HAA6H;AAC7H,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,SAAK,GAAG,MAAM,CAKpD;AAID,+HAA+H;AAC/H,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAKvE;AAED,uFAAuF;AACvF,wBAAgB,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAI5F;AAED,sFAAsF;AACtF,eAAO,MAAM,QAAQ,QAAS,MAAM,QAAQ,MAAM,KAAG,MAAgE,CAAC"}
package/dist/xml.js ADDED
@@ -0,0 +1,41 @@
1
+ // String-level XML helpers the review's write path needs beyond @sheetpane/export's:
2
+ // `exportPatch` runs in browsers and in Node, so no DOMParser.
3
+ import { cleanXmlChars, encodeOoxmlString, escapeText } from '@sheetpane/export';
4
+ export const XML_DECL = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
5
+ export const NS_MAIN = 'http://schemas.openxmlformats.org/spreadsheetml/2006/main';
6
+ export const NS_R = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships';
7
+ export const REL_WORKSHEET = `${NS_R}/worksheet`;
8
+ export const CT_WORKSHEET = 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml';
9
+ /** The most text a cell holds. */
10
+ export const MAX_TEXT = 32767;
11
+ /** An element, self-closed or not, by local name (any prefix): `<x:xf …/>` or `<xf …>…</xf>`. */
12
+ export const elementRe = (name, flags = 'g') => new RegExp(`<(?:\\w+:)?${name}\\b[^>]*?(?:/>|>[\\s\\S]*?</(?:\\w+:)?${name}>)`, flags);
13
+ /** The opening tag of an element's text. */
14
+ export const openTag = (xml) => /^<[^>]*>/.exec(xml)[0];
15
+ /** A cell's text as an inline-string body: cleaned of what XML forbids, at most 32,767 characters, SpreadsheetML-escaped. */
16
+ export function inlineText(s, P = '') {
17
+ let text = cleanXmlChars(s.replace(/\r\n?/g, '\n')).text;
18
+ if (text.length > MAX_TEXT)
19
+ text = text.slice(0, MAX_TEXT);
20
+ const keep = /^\s|\s$|\n|\t| {2}/.test(text) ? ' xml:space="preserve"' : '';
21
+ return `<${P}is><${P}t${keep}>${escapeText(encodeOoxmlString(text))}</${P}t></${P}is>`;
22
+ }
23
+ const dirOf = (p) => p.slice(0, p.lastIndexOf('/') + 1);
24
+ /** The relative target from one part to another: `xl/workbook.xml` → `xl/worksheets/sheet3.xml` is `worksheets/sheet3.xml`. */
25
+ export function relativeTarget(fromPart, toPart) {
26
+ const from = dirOf(fromPart).split('/').filter(Boolean), to = toPart.split('/');
27
+ let i = 0;
28
+ while (i < from.length && i < to.length - 1 && from[i] === to[i])
29
+ i++;
30
+ return [...Array(from.length - i).fill('..'), ...to.slice(i)].join('/');
31
+ }
32
+ /** A part name that does not exist yet: `prefix` + n + `suffix`, smallest n from 1. */
33
+ export function freeName(has, prefix, suffix) {
34
+ let n = 1;
35
+ while (has(`${prefix}${n}${suffix}`))
36
+ n++;
37
+ return `${prefix}${n}${suffix}`;
38
+ }
39
+ /** The namespace prefix (with its colon, or `''`) the root element of a part uses. */
40
+ export const prefixOf = (xml, root) => new RegExp(`<(\\w+:)?${root}\\b`).exec(xml)?.[1] ?? '';
41
+ //# sourceMappingURL=xml.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml.js","sourceRoot":"","sources":["../src/xml.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAMjF,MAAM,CAAC,MAAM,QAAQ,GAAG,2DAA2D,CAAC;AACpF,MAAM,CAAC,MAAM,OAAO,GAAG,2DAA2D,CAAC;AACnF,MAAM,CAAC,MAAM,IAAI,GAAG,qEAAqE,CAAC;AAC1F,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,IAAI,YAAY,CAAC;AACjD,MAAM,CAAC,MAAM,YAAY,GAAG,2EAA2E,CAAC;AAExG,kCAAkC;AAClC,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC;AAE9B,iGAAiG;AACjG,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAY,EAAE,KAAK,GAAG,GAAG,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,cAAc,IAAI,yCAAyC,IAAI,IAAI,EAAE,KAAK,CAAC,CAAC;AAE/I,4CAA4C;AAC5C,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAE,CAAC,CAAC,CAAC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AG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClF,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,QAAQ,CAAC,GAA2B,EAAE,MAAc,EAAE,MAAc;IAClF,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,GAAG,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,MAAM,EAAE,CAAC;QAAE,CAAC,EAAE,CAAC;IAC1C,OAAO,GAAG,MAAM,GAAG,CAAC,GAAG,MAAM,EAAE,CAAC;AAClC,CAAC;AAED,sFAAsF;AACtF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,IAAY,EAAU,EAAE,CAAC,IAAI,MAAM,CAAC,YAAY,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,48 @@
1
1
  {
2
2
  "name": "@sheetpane/review",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.4.0",
4
+ "description": "The review written into the download as a sheet of its own — every error with a link to its cell — and, optionally, each flagged cell filled by severity. An export-only plugin for sheetpane.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/arpitarya/sheetpane.git",
9
+ "directory": "packages/review"
10
+ },
11
+ "type": "module",
12
+ "sideEffects": [
13
+ "./dist/index.js",
14
+ "./src/index.ts"
15
+ ],
16
+ "engines": {
17
+ "node": ">=22"
18
+ },
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "peerDependencies": {
29
+ "@sheetpane/grid": "0.4.0"
30
+ },
31
+ "dependencies": {
32
+ "@sheetpane/export": "0.4.0",
33
+ "@sheetpane/skills": "0.4.0"
34
+ },
35
+ "devDependencies": {
36
+ "@sheetpane/grid": "0.4.0",
37
+ "@sheetpane/comments": "0.4.0",
38
+ "@sheetpane/testing": "0.4.0",
39
+ "@sheetpane/import": "0.4.0"
40
+ },
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "scripts": {
45
+ "build": "tsc -p tsconfig.build.json",
46
+ "typecheck": "tsc -p tsconfig.json --noEmit"
47
+ }
6
48
  }