@altertable/data-app-examples 0.78.0 → 0.80.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.
Files changed (28) hide show
  1. package/dist/index.js +2 -2
  2. package/dist/index.js.map +1 -1
  3. package/dist/types/index.d.ts +2 -2
  4. package/package.json +1 -1
  5. package/templates/starter-data-app/index.tsx +70 -676
  6. package/templates/starter-finding-data-app/index.tsx +9 -31
  7. package/templates/starter-local-data-app/AGENTS.md +1 -1
  8. package/templates/starter-local-data-app/README.md +5 -8
  9. package/templates/starter-local-data-app/app.ts +15 -246
  10. package/templates/starter-local-data-app/package.json +3 -3
  11. package/templates/starter-local-data-app/src/App.tsx +32 -253
  12. package/templates/starter-local-data-app/src/data-context.ts +8 -27
  13. package/templates/starter-local-data-app/src/filters.ts +9 -30
  14. package/templates/starter-local-data-app/src/operations.ts +9 -125
  15. package/templates/starter-local-finding-data-app/AGENTS.md +1 -1
  16. package/templates/starter-local-finding-data-app/README.md +2 -2
  17. package/templates/starter-local-finding-data-app/package.json +3 -3
  18. package/templates/starter-local-finding-data-app/src/App.tsx +7 -23
  19. package/templates/starter-local-finding-data-app/src/data-context.ts +3 -9
  20. package/templates/starter-local-metric-data-app/AGENTS.md +1 -1
  21. package/templates/starter-local-metric-data-app/README.md +2 -2
  22. package/templates/starter-local-metric-data-app/app.ts +4 -4
  23. package/templates/starter-local-metric-data-app/package.json +3 -3
  24. package/templates/starter-local-metric-data-app/src/App.tsx +4 -8
  25. package/templates/starter-local-metric-data-app/src/data-context.ts +4 -8
  26. package/templates/starter-local-metric-data-app/src/filters.ts +1 -0
  27. package/templates/starter-local-metric-data-app/src/operations.ts +4 -12
  28. package/templates/starter-metric-data-app/index.tsx +18 -32
package/dist/index.js CHANGED
@@ -8,13 +8,13 @@ const dataAppExamples = [
8
8
  {
9
9
  id: "starter-data-app",
10
10
  title: "Hosted data app",
11
- description: "A single-file React app for hosted execution.",
11
+ description: "One query, view, and chart in a single file for hosted execution.",
12
12
  mode: "hosted"
13
13
  },
14
14
  {
15
15
  id: "starter-local-data-app",
16
16
  title: "Local data app",
17
- description: "A Bun and React project with server-side lakehouse access.",
17
+ description: "One query, view, and chart in a Bun project with server-side lakehouse access.",
18
18
  mode: "local"
19
19
  },
20
20
  {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { cp, mkdir, readdir, rename, rm } from 'node:fs/promises';\nimport { join, relative, sep } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst templateFileRenames = new Map([['_gitignore', '.gitignore']]);\n\n/** Canonical starters available to scaffolding tools. IDs are stable across releases. */\nexport const dataAppExamples = [\n {\n id: 'starter-data-app',\n title: 'Hosted data app',\n description: 'A single-file React app for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-data-app',\n title: 'Local data app',\n description: 'A Bun and React project with server-side lakehouse access.',\n mode: 'local',\n },\n {\n id: 'starter-metric-data-app',\n title: 'Hosted metric illustration',\n description: 'A focused metric app for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-finding-data-app',\n title: 'Hosted Finding exploration',\n description:\n 'An interactive companion to a Finding’s text for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-metric-data-app',\n title: 'Local metric illustration',\n description: 'A focused metric app for local execution.',\n mode: 'local',\n },\n {\n id: 'starter-local-finding-data-app',\n title: 'Local Finding exploration',\n description:\n 'An interactive companion to a Finding’s text for local execution.',\n mode: 'local',\n },\n] as const;\n\n/** Stable identifier for a canonical starter. */\nexport type DataAppExampleId = (typeof dataAppExamples)[number]['id'];\n\n/** Absolute source directory. Use copyExample() to restore npm-excluded filenames. */\nexport function getExampleDirectory(id: DataAppExampleId): string {\n const example = dataAppExamples.find(example => example.id === id);\n if (!example) throw new Error(`Unknown data app example: ${id}`);\n return fileURLToPath(new URL(`../templates/${example.id}/`, import.meta.url));\n}\n\n/** Copy a starter into a new directory; reject existing destinations. */\nexport async function copyExample(\n id: DataAppExampleId,\n destination: string\n): Promise<void> {\n const source = getExampleDirectory(id);\n await mkdir(destination);\n try {\n await cp(source, destination, {\n recursive: true,\n filter: path =>\n relative(source, path)\n .split(sep)\n .every(\n part =>\n part !== 'node_modules' &&\n part !== 'dist' &&\n !part.startsWith('.env')\n ),\n });\n for (const filename of await readdir(destination)) {\n const target = templateFileRenames.get(filename);\n if (target)\n await rename(join(destination, filename), join(destination, target));\n }\n } catch (error) {\n await rm(destination, { recursive: true, force: true });\n throw error;\n }\n}\n"],"mappings":";;;;AAIA,MAAM,sCAAsB,IAAI,IAAI,CAAC,CAAC,cAAc,YAAY,CAAC,CAAC;;AAGlE,MAAa,kBAAkB;CAC7B;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;AACF;;AAMA,SAAgB,oBAAoB,IAA8B;CAChE,MAAM,UAAU,gBAAgB,MAAK,YAAW,QAAQ,OAAO,EAAE;CACjE,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,6BAA6B,IAAI;CAC/D,OAAO,cAAc,IAAI,IAAI,gBAAgB,QAAQ,GAAG,IAAI,YAAY,GAAG,CAAC;AAC9E;;AAGA,eAAsB,YACpB,IACA,aACe;CACf,MAAM,SAAS,oBAAoB,EAAE;CACrC,MAAM,MAAM,WAAW;CACvB,IAAI;EACF,MAAM,GAAG,QAAQ,aAAa;GAC5B,WAAW;GACX,SAAQ,SACN,SAAS,QAAQ,IAAI,CAAC,CACnB,MAAM,GAAG,CAAC,CACV,OACC,SACE,SAAS,kBACT,SAAS,UACT,CAAC,KAAK,WAAW,MAAM,CAC3B;EACN,CAAC;EACD,KAAK,MAAM,YAAY,MAAM,QAAQ,WAAW,GAAG;GACjD,MAAM,SAAS,oBAAoB,IAAI,QAAQ;GAC/C,IAAI,QACF,MAAM,OAAO,KAAK,aAAa,QAAQ,GAAG,KAAK,aAAa,MAAM,CAAC;EACvE;CACF,SAAS,OAAO;EACd,MAAM,GAAG,aAAa;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EACtD,MAAM;CACR;AACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { cp, mkdir, readdir, rename, rm } from 'node:fs/promises';\nimport { join, relative, sep } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst templateFileRenames = new Map([['_gitignore', '.gitignore']]);\n\n/** Canonical starters available to scaffolding tools. IDs are stable across releases. */\nexport const dataAppExamples = [\n {\n id: 'starter-data-app',\n title: 'Hosted data app',\n description:\n 'One query, view, and chart in a single file for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-data-app',\n title: 'Local data app',\n description:\n 'One query, view, and chart in a Bun project with server-side lakehouse access.',\n mode: 'local',\n },\n {\n id: 'starter-metric-data-app',\n title: 'Hosted metric illustration',\n description: 'A focused metric app for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-finding-data-app',\n title: 'Hosted Finding exploration',\n description:\n 'An interactive companion to a Finding’s text for hosted execution.',\n mode: 'hosted',\n },\n {\n id: 'starter-local-metric-data-app',\n title: 'Local metric illustration',\n description: 'A focused metric app for local execution.',\n mode: 'local',\n },\n {\n id: 'starter-local-finding-data-app',\n title: 'Local Finding exploration',\n description:\n 'An interactive companion to a Finding’s text for local execution.',\n mode: 'local',\n },\n] as const;\n\n/** Stable identifier for a canonical starter. */\nexport type DataAppExampleId = (typeof dataAppExamples)[number]['id'];\n\n/** Absolute source directory. Use copyExample() to restore npm-excluded filenames. */\nexport function getExampleDirectory(id: DataAppExampleId): string {\n const example = dataAppExamples.find(example => example.id === id);\n if (!example) throw new Error(`Unknown data app example: ${id}`);\n return fileURLToPath(new URL(`../templates/${example.id}/`, import.meta.url));\n}\n\n/** Copy a starter into a new directory; reject existing destinations. */\nexport async function copyExample(\n id: DataAppExampleId,\n destination: string\n): Promise<void> {\n const source = getExampleDirectory(id);\n await mkdir(destination);\n try {\n await cp(source, destination, {\n recursive: true,\n filter: path =>\n relative(source, path)\n .split(sep)\n .every(\n part =>\n part !== 'node_modules' &&\n part !== 'dist' &&\n !part.startsWith('.env')\n ),\n });\n for (const filename of await readdir(destination)) {\n const target = templateFileRenames.get(filename);\n if (target)\n await rename(join(destination, filename), join(destination, target));\n }\n } catch (error) {\n await rm(destination, { recursive: true, force: true });\n throw error;\n }\n}\n"],"mappings":";;;;AAIA,MAAM,sCAAsB,IAAI,IAAI,CAAC,CAAC,cAAc,YAAY,CAAC,CAAC;;AAGlE,MAAa,kBAAkB;CAC7B;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;CACR;CACA;EACE,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;CACR;AACF;;AAMA,SAAgB,oBAAoB,IAA8B;CAChE,MAAM,UAAU,gBAAgB,MAAK,YAAW,QAAQ,OAAO,EAAE;CACjE,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,6BAA6B,IAAI;CAC/D,OAAO,cAAc,IAAI,IAAI,gBAAgB,QAAQ,GAAG,IAAI,YAAY,GAAG,CAAC;AAC9E;;AAGA,eAAsB,YACpB,IACA,aACe;CACf,MAAM,SAAS,oBAAoB,EAAE;CACrC,MAAM,MAAM,WAAW;CACvB,IAAI;EACF,MAAM,GAAG,QAAQ,aAAa;GAC5B,WAAW;GACX,SAAQ,SACN,SAAS,QAAQ,IAAI,CAAC,CACnB,MAAM,GAAG,CAAC,CACV,OACC,SACE,SAAS,kBACT,SAAS,UACT,CAAC,KAAK,WAAW,MAAM,CAC3B;EACN,CAAC;EACD,KAAK,MAAM,YAAY,MAAM,QAAQ,WAAW,GAAG;GACjD,MAAM,SAAS,oBAAoB,IAAI,QAAQ;GAC/C,IAAI,QACF,MAAM,OAAO,KAAK,aAAa,QAAQ,GAAG,KAAK,aAAa,MAAM,CAAC;EACvE;CACF,SAAS,OAAO;EACd,MAAM,GAAG,aAAa;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EACtD,MAAM;CACR;AACF"}
@@ -3,12 +3,12 @@
3
3
  export declare const dataAppExamples: readonly [{
4
4
  readonly id: 'starter-data-app';
5
5
  readonly title: 'Hosted data app';
6
- readonly description: 'A single-file React app for hosted execution.';
6
+ readonly description: 'One query, view, and chart in a single file for hosted execution.';
7
7
  readonly mode: 'hosted';
8
8
  }, {
9
9
  readonly id: 'starter-local-data-app';
10
10
  readonly title: 'Local data app';
11
- readonly description: 'A Bun and React project with server-side lakehouse access.';
11
+ readonly description: 'One query, view, and chart in a Bun project with server-side lakehouse access.';
12
12
  readonly mode: 'local';
13
13
  }, {
14
14
  readonly id: 'starter-metric-data-app';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altertable/data-app-examples",
3
- "version": "0.78.0",
3
+ "version": "0.80.0",
4
4
  "description": "Canonical starter templates for Altertable data apps.",
5
5
  "keywords": [
6
6
  "altertable",