@dou-ui/dashboard 0.1.0-alpha.1 → 0.1.0-alpha.11

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 (100) hide show
  1. package/dist/chart/chart-settings.js.map +1 -1
  2. package/dist/chart/chart-settings.vue_vue_type_script_setup_true_lang.js +10 -8
  3. package/dist/chart/chart-settings.vue_vue_type_script_setup_true_lang.js.map +1 -1
  4. package/dist/chart/chart.js.map +1 -1
  5. package/dist/chart/chart.vue_vue_type_script_setup_true_lang.js +19 -15
  6. package/dist/chart/chart.vue_vue_type_script_setup_true_lang.js.map +1 -1
  7. package/dist/chart/read-props.js +26 -0
  8. package/dist/chart/read-props.js.map +1 -0
  9. package/dist/core/document.js +10 -1
  10. package/dist/core/document.js.map +1 -1
  11. package/dist/core/history.js +23 -0
  12. package/dist/core/history.js.map +1 -1
  13. package/dist/core/transaction.js +8 -2
  14. package/dist/core/transaction.js.map +1 -1
  15. package/dist/dashboard/comment-button.js +6 -0
  16. package/dist/dashboard/comment-button.js.map +1 -0
  17. package/dist/dashboard/comment-button.vue_vue_type_script_setup_true_lang.js +59 -0
  18. package/dist/dashboard/comment-button.vue_vue_type_script_setup_true_lang.js.map +1 -0
  19. package/dist/dashboard/comment-card.js +6 -0
  20. package/dist/dashboard/comment-card.js.map +1 -0
  21. package/dist/dashboard/comment-card.vue_vue_type_script_setup_true_lang.js +128 -0
  22. package/dist/dashboard/comment-card.vue_vue_type_script_setup_true_lang.js.map +1 -0
  23. package/dist/dashboard/comments.js +144 -0
  24. package/dist/dashboard/comments.js.map +1 -0
  25. package/dist/dashboard/dashboard.js.map +1 -1
  26. package/dist/dashboard/dashboard.vue_vue_type_script_setup_true_lang.js +132 -20
  27. package/dist/dashboard/dashboard.vue_vue_type_script_setup_true_lang.js.map +1 -1
  28. package/dist/dashboard/error-boundary.js +64 -0
  29. package/dist/dashboard/error-boundary.js.map +1 -0
  30. package/dist/dashboard/frame-context.js.map +1 -1
  31. package/dist/dashboard/widget-body.js.map +1 -1
  32. package/dist/dashboard/widget-body.vue_vue_type_script_setup_true_lang.js +53 -12
  33. package/dist/dashboard/widget-body.vue_vue_type_script_setup_true_lang.js.map +1 -1
  34. package/dist/dashboard/widget-frame.js.map +1 -1
  35. package/dist/dashboard/widget-frame.vue_vue_type_script_setup_true_lang.js +20 -10
  36. package/dist/dashboard/widget-frame.vue_vue_type_script_setup_true_lang.js.map +1 -1
  37. package/dist/dashboard/widget-settings.js.map +1 -1
  38. package/dist/dashboard/widget-settings.vue_vue_type_script_setup_true_lang.js +31 -5
  39. package/dist/dashboard/widget-settings.vue_vue_type_script_setup_true_lang.js.map +1 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/layout/engine.js +176 -16
  42. package/dist/layout/engine.js.map +1 -1
  43. package/dist/locale.js +12 -0
  44. package/dist/locale.js.map +1 -1
  45. package/dist/pivot/pivot-settings.js.map +1 -1
  46. package/dist/pivot/pivot-settings.vue_vue_type_script_setup_true_lang.js +6 -4
  47. package/dist/pivot/pivot-settings.vue_vue_type_script_setup_true_lang.js.map +1 -1
  48. package/dist/pivot/pivot.js.map +1 -1
  49. package/dist/pivot/pivot.vue_vue_type_script_setup_true_lang.js +5 -2
  50. package/dist/pivot/pivot.vue_vue_type_script_setup_true_lang.js.map +1 -1
  51. package/dist/pivot/read-props.js +44 -0
  52. package/dist/pivot/read-props.js.map +1 -0
  53. package/dist/style.css +1 -1
  54. package/dist/style.js +8 -3
  55. package/dist/types/chart/read-props.d.ts +3 -0
  56. package/dist/types/core/document.d.ts +3 -2
  57. package/dist/types/core/history.d.ts +7 -1
  58. package/dist/types/core/transaction.d.ts +10 -1
  59. package/dist/types/core/types.d.ts +5 -0
  60. package/dist/types/dashboard/comment-button.vue.d.ts +15 -0
  61. package/dist/types/dashboard/comment-card.vue.d.ts +13 -0
  62. package/dist/types/dashboard/comments.d.ts +44 -0
  63. package/dist/types/dashboard/dashboard.vue.d.ts +12 -0
  64. package/dist/types/dashboard/error-boundary.d.ts +12 -0
  65. package/dist/types/dashboard/frame-context.d.ts +4 -0
  66. package/dist/types/dashboard/types.d.ts +47 -0
  67. package/dist/types/dashboard/widget-body.vue.d.ts +2 -0
  68. package/dist/types/dashboard/widget-settings.vue.d.ts +4 -0
  69. package/dist/types/index.d.ts +22 -1
  70. package/dist/types/layout/engine.d.ts +4 -3
  71. package/dist/types/locale.d.ts +8 -0
  72. package/dist/types/pivot/read-props.d.ts +3 -0
  73. package/dist/types/widgets/index.d.ts +1 -1
  74. package/dist/types/widgets/read-props.d.ts +4 -0
  75. package/dist/types/widgets/shared.d.ts +20 -4
  76. package/dist/widgets/index.js +2 -2
  77. package/dist/widgets/index.js.map +1 -1
  78. package/dist/widgets/read-props.js +52 -0
  79. package/dist/widgets/read-props.js.map +1 -0
  80. package/dist/widgets/shared.js +27 -5
  81. package/dist/widgets/shared.js.map +1 -1
  82. package/dist/widgets/stat-settings.js.map +1 -1
  83. package/dist/widgets/stat-settings.vue_vue_type_script_setup_true_lang.js +12 -10
  84. package/dist/widgets/stat-settings.vue_vue_type_script_setup_true_lang.js.map +1 -1
  85. package/dist/widgets/stat.js.map +1 -1
  86. package/dist/widgets/stat.vue_vue_type_script_setup_true_lang.js +10 -13
  87. package/dist/widgets/stat.vue_vue_type_script_setup_true_lang.js.map +1 -1
  88. package/dist/widgets/table-settings.js.map +1 -1
  89. package/dist/widgets/table-settings.vue_vue_type_script_setup_true_lang.js +6 -4
  90. package/dist/widgets/table-settings.vue_vue_type_script_setup_true_lang.js.map +1 -1
  91. package/dist/widgets/table.js.map +1 -1
  92. package/dist/widgets/table.vue_vue_type_script_setup_true_lang.js +4 -1
  93. package/dist/widgets/table.vue_vue_type_script_setup_true_lang.js.map +1 -1
  94. package/dist/widgets/text-settings.js.map +1 -1
  95. package/dist/widgets/text-settings.vue_vue_type_script_setup_true_lang.js +5 -3
  96. package/dist/widgets/text-settings.vue_vue_type_script_setup_true_lang.js.map +1 -1
  97. package/dist/widgets/text.js.map +1 -1
  98. package/dist/widgets/text.vue_vue_type_script_setup_true_lang.js +5 -3
  99. package/dist/widgets/text.vue_vue_type_script_setup_true_lang.js.map +1 -1
  100. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"pivot.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref"],"sources":["../../src/pivot/pivot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { DouPivot } from '@dou-ui/pivot'\nimport type {\n PivotCellEvent,\n PivotConfig,\n PivotDimension,\n PivotExpose,\n PivotField,\n} from '@dou-ui/pivot'\nimport { computed, shallowRef, watch } from 'vue'\nimport { useDashboardWidget } from '../widget/context'\nimport { filterValueOf, rowsOf } from '../widgets/shared'\nimport type { PivotWidgetProps } from './types'\n\ndefineOptions({ name: 'DouDashboardPivotWidget' })\n\ndefineProps<{ fields?: readonly PivotField[] }>()\n\nconst { props, data, size, setFilter, ownFilters, editing, setProps, setWorkbook } =\n useDashboardWidget<PivotWidgetProps>()\nconst pivot = shallowRef<PivotExpose>()\n// the export menu writes the table as it shows: merged heads, totals, number formats\nsetWorkbook(() => pivot.value?.toSheet({ name: '' }))\nconst rows = computed(() => rowsOf(data.value, props.value.path))\n// sorting in the table works while viewing too; only while editing is it saved\nconst config = shallowRef<PivotConfig | undefined>(props.value.config)\nwatch(\n () => props.value.config,\n (next) => (config.value = next),\n)\nfunction onConfig(next: PivotConfig) {\n config.value = next\n if (editing.value) setProps({ config: next }, { group: 'pivot-config' })\n}\nconst nameOf = (dimension: PivotDimension) =>\n typeof dimension === 'string' ? dimension : dimension.field\n\n/** The groups this widget's filters picked, marked in the table. */\nfunction pathOf(dimensions: readonly PivotDimension[] = [], filters: Record<string, unknown>) {\n const path: unknown[] = []\n for (const dimension of dimensions) {\n const value = filters[nameOf(dimension)]\n if (value === undefined) break\n path.push(value)\n }\n return path\n}\nconst highlight = computed(() => {\n if (!props.value.filter) return undefined\n const filters = ownFilters.value\n return {\n row: pathOf(config.value?.rows, filters),\n column: pathOf(config.value?.columns, filters),\n }\n})\n\n/** One filter per field of a group's path; the fields past its end are cleared. */\nfunction apply(\n dimensions: readonly PivotDimension[] = [],\n path: readonly unknown[],\n labels: string[],\n) {\n dimensions.forEach((dimension, i) =>\n i < path.length\n ? setFilter(nameOf(dimension), filterValueOf(path[i]), { label: labels[i] })\n : setFilter(nameOf(dimension), undefined),\n )\n}\n\n/** Sets one filter per field of the clicked cell's groups; a total clears the deeper ones. */\nfunction onCell(cell: PivotCellEvent) {\n if (!props.value.filter) return\n const { rows: rowDims, columns: columnDims } = config.value ?? {}\n apply(rowDims, cell.row, cell.labels.row)\n apply(columnDims, cell.column, cell.labels.column)\n}\n</script>\n\n<template>\n <DouPivot\n ref=\"pivot\"\n class=\"dou-dashboard-pivot\"\n :data=\"rows\"\n :fields=\"fields\"\n :config=\"config\"\n :highlight=\"highlight\"\n size=\"sm\"\n :max-height=\"size.height.value || undefined\"\n @update:config=\"onConfig\"\n @cell-click=\"onCell\"\n />\n</template>\n"],"mappings":";;;;;;;;;;EAkBA,MAAM,EAAE,OAAO,MAAM,MAAM,WAAW,YAAY,SAAS,UAAU,gBACnE,mBAAqC;EACvC,MAAM,QAAQ,WAAwB;EAEtC,kBAAkB,MAAM,OAAO,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC;EACpD,MAAM,OAAO,eAAe,OAAO,KAAK,OAAO,MAAM,MAAM,IAAI,CAAC;EAEhE,MAAM,SAAS,WAAoC,MAAM,MAAM,MAAM;EACrE,YACQ,MAAM,MAAM,SACjB,SAAU,OAAO,QAAQ,IAC5B;EACA,SAAS,SAAS,MAAmB;GACnC,OAAO,QAAQ;GACf,IAAI,QAAQ,OAAO,SAAS,EAAE,QAAQ,KAAK,GAAG,EAAE,OAAO,eAAe,CAAC;EACzE;EACA,MAAM,UAAU,cACd,OAAO,cAAc,WAAW,YAAY,UAAU;;EAGxD,SAAS,OAAO,aAAwC,CAAC,GAAG,SAAkC;GAC5F,MAAM,OAAkB,CAAC;GACzB,KAAK,MAAM,aAAa,YAAY;IAClC,MAAM,QAAQ,QAAQ,OAAO,SAAS;IACtC,IAAI,UAAU,KAAA,GAAW;IACzB,KAAK,KAAK,KAAK;GACjB;GACA,OAAO;EACT;EACA,MAAM,YAAY,eAAe;GAC/B,IAAI,CAAC,MAAM,MAAM,QAAQ,OAAO,KAAA;GAChC,MAAM,UAAU,WAAW;GAC3B,OAAO;IACL,KAAK,OAAO,OAAO,OAAO,MAAM,OAAO;IACvC,QAAQ,OAAO,OAAO,OAAO,SAAS,OAAO;GAC/C;EACF,CAAC;;EAGD,SAAS,MACP,aAAwC,CAAC,GACzC,MACA,QACA;GACA,WAAW,SAAS,WAAW,MAC7B,IAAI,KAAK,SACL,UAAU,OAAO,SAAS,GAAG,cAAc,KAAK,EAAE,GAAG,EAAE,OAAO,OAAO,GAAG,CAAC,IACzE,UAAU,OAAO,SAAS,GAAG,KAAA,CAAS,CAC5C;EACF;;EAGA,SAAS,OAAO,MAAsB;GACpC,IAAI,CAAC,MAAM,MAAM,QAAQ;GACzB,MAAM,EAAE,MAAM,SAAS,SAAS,eAAe,OAAO,SAAS,CAAC;GAChE,MAAM,SAAS,KAAK,KAAK,KAAK,OAAO,GAAG;GACxC,MAAM,YAAY,KAAK,QAAQ,KAAK,OAAO,MAAM;EACnD;;GAIE,OAAAA,UAAA,GAAAC,YAWEC,MAAA,QAAA,GAAA;IAVI,SAAA;IAAJ,KAAI;IACJ,OAAM;IACL,MAAM,KAAA;IACN,QAAQ,QAAA;IACR,QAAQ,OAAA;IACR,WAAW,UAAA;IACZ,MAAK;IACJ,cAAYA,MAAA,IAAA,CAAI,CAAC,OAAO,SAAS,KAAA;IACjC,mBAAe;IACf,aAAY"}
1
+ {"version":3,"file":"pivot.vue_vue_type_script_setup_true_lang.js","names":["_openBlock","_createBlock","_unref"],"sources":["../../src/pivot/pivot.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { DouPivot } from '@dou-ui/pivot'\nimport type {\n PivotCellEvent,\n PivotConfig,\n PivotDimension,\n PivotExpose,\n PivotField,\n} from '@dou-ui/pivot'\nimport { computed, shallowRef, watch } from 'vue'\nimport { useDashboardWidget } from '../widget/context'\nimport { filterValueOf, rowsOf } from '../widgets/shared'\nimport { pivotPropsOf } from './read-props'\n\ndefineOptions({ name: 'DouDashboardPivotWidget' })\n\ndefineProps<{ fields?: readonly PivotField[] }>()\n\nconst {\n props: raw,\n data,\n size,\n setFilter,\n ownFilters,\n editing,\n setProps,\n setWorkbook,\n} = useDashboardWidget()\nconst props = computed(() => pivotPropsOf(raw.value))\nconst pivot = shallowRef<PivotExpose>()\n// the export menu writes the table as it shows: merged heads, totals, number formats\nsetWorkbook(() => pivot.value?.toSheet({ name: '' }))\nconst rows = computed(() => rowsOf(data.value, props.value.path))\n// sorting in the table works while viewing too; only while editing is it saved\nconst config = shallowRef<PivotConfig | undefined>(props.value.config)\n// only a new config from the props replaces it, not a change to another prop\nwatch(\n () => raw.value.config,\n () => (config.value = props.value.config),\n)\nfunction onConfig(next: PivotConfig) {\n config.value = next\n if (editing.value) setProps({ config: next }, { group: 'pivot-config' })\n}\nconst nameOf = (dimension: PivotDimension) =>\n typeof dimension === 'string' ? dimension : dimension.field\n\n/** The groups this widget's filters picked, marked in the table. */\nfunction pathOf(dimensions: readonly PivotDimension[] = [], filters: Record<string, unknown>) {\n const path: unknown[] = []\n for (const dimension of dimensions) {\n const value = filters[nameOf(dimension)]\n if (value === undefined) break\n path.push(value)\n }\n return path\n}\nconst highlight = computed(() => {\n if (!props.value.filter) return undefined\n const filters = ownFilters.value\n return {\n row: pathOf(config.value?.rows, filters),\n column: pathOf(config.value?.columns, filters),\n }\n})\n\n/** One filter per field of a group's path; the fields past its end are cleared. */\nfunction apply(\n dimensions: readonly PivotDimension[] = [],\n path: readonly unknown[],\n labels: string[],\n) {\n dimensions.forEach((dimension, i) =>\n i < path.length\n ? setFilter(nameOf(dimension), filterValueOf(path[i]), { label: labels[i] })\n : setFilter(nameOf(dimension), undefined),\n )\n}\n\n/** Sets one filter per field of the clicked cell's groups; a total clears the deeper ones. */\nfunction onCell(cell: PivotCellEvent) {\n if (!props.value.filter) return\n const { rows: rowDims, columns: columnDims } = config.value ?? {}\n apply(rowDims, cell.row, cell.labels.row)\n apply(columnDims, cell.column, cell.labels.column)\n}\n</script>\n\n<template>\n <DouPivot\n ref=\"pivot\"\n class=\"dou-dashboard-pivot\"\n :bordered=\"false\"\n :data=\"rows\"\n :fields=\"fields\"\n :config=\"config\"\n :highlight=\"highlight\"\n size=\"sm\"\n :max-height=\"size.height.value || undefined\"\n @update:config=\"onConfig\"\n @cell-click=\"onCell\"\n />\n</template>\n"],"mappings":";;;;;;;;;;;EAkBA,MAAM,EACJ,OAAO,KACP,MACA,MACA,WACA,YACA,SACA,UACA,gBACE,mBAAmB;EACvB,MAAM,QAAQ,eAAe,aAAa,IAAI,KAAK,CAAC;EACpD,MAAM,QAAQ,WAAwB;EAEtC,kBAAkB,MAAM,OAAO,QAAQ,EAAE,MAAM,GAAG,CAAC,CAAC;EACpD,MAAM,OAAO,eAAe,OAAO,KAAK,OAAO,MAAM,MAAM,IAAI,CAAC;EAEhE,MAAM,SAAS,WAAoC,MAAM,MAAM,MAAM;EAErE,YACQ,IAAI,MAAM,cACT,OAAO,QAAQ,MAAM,MAAM,MACpC;EACA,SAAS,SAAS,MAAmB;GACnC,OAAO,QAAQ;GACf,IAAI,QAAQ,OAAO,SAAS,EAAE,QAAQ,KAAK,GAAG,EAAE,OAAO,eAAe,CAAC;EACzE;EACA,MAAM,UAAU,cACd,OAAO,cAAc,WAAW,YAAY,UAAU;;EAGxD,SAAS,OAAO,aAAwC,CAAC,GAAG,SAAkC;GAC5F,MAAM,OAAkB,CAAC;GACzB,KAAK,MAAM,aAAa,YAAY;IAClC,MAAM,QAAQ,QAAQ,OAAO,SAAS;IACtC,IAAI,UAAU,KAAA,GAAW;IACzB,KAAK,KAAK,KAAK;GACjB;GACA,OAAO;EACT;EACA,MAAM,YAAY,eAAe;GAC/B,IAAI,CAAC,MAAM,MAAM,QAAQ,OAAO,KAAA;GAChC,MAAM,UAAU,WAAW;GAC3B,OAAO;IACL,KAAK,OAAO,OAAO,OAAO,MAAM,OAAO;IACvC,QAAQ,OAAO,OAAO,OAAO,SAAS,OAAO;GAC/C;EACF,CAAC;;EAGD,SAAS,MACP,aAAwC,CAAC,GACzC,MACA,QACA;GACA,WAAW,SAAS,WAAW,MAC7B,IAAI,KAAK,SACL,UAAU,OAAO,SAAS,GAAG,cAAc,KAAK,EAAE,GAAG,EAAE,OAAO,OAAO,GAAG,CAAC,IACzE,UAAU,OAAO,SAAS,GAAG,KAAA,CAAS,CAC5C;EACF;;EAGA,SAAS,OAAO,MAAsB;GACpC,IAAI,CAAC,MAAM,MAAM,QAAQ;GACzB,MAAM,EAAE,MAAM,SAAS,SAAS,eAAe,OAAO,SAAS,CAAC;GAChE,MAAM,SAAS,KAAK,KAAK,KAAK,OAAO,GAAG;GACxC,MAAM,YAAY,KAAK,QAAQ,KAAK,OAAO,MAAM;EACnD;;GAIE,OAAAA,UAAA,GAAAC,YAYEC,MAAA,QAAA,GAAA;IAXI,SAAA;IAAJ,KAAI;IACJ,OAAM;IACL,UAAU;IACV,MAAM,KAAA;IACN,QAAQ,QAAA;IACR,QAAQ,OAAA;IACR,WAAW,UAAA;IACZ,MAAK;IACJ,cAAYA,MAAA,IAAA,CAAI,CAAC,OAAO,SAAS,KAAA;IACjC,mBAAe;IACf,aAAY"}
@@ -0,0 +1,44 @@
1
+ import { flagOf, oneOf, recordOf, textOf } from "../widgets/shared.js";
2
+ // src/pivot/read-props.ts
3
+ /** A field on the rows or columns: its name, or an object with a text `field`. */
4
+ var isDimension = (item) => typeof item === "string" || typeof recordOf(item)?.field === "string";
5
+ /** A value: a field's name, or an object. */
6
+ var isValue = (item) => typeof item === "string" || recordOf(item) !== void 0;
7
+ var listOf = (value, keep) => Array.isArray(value) ? value.filter(keep) : void 0;
8
+ /**
9
+ * The pivot's config with the right shape at its top: lists where lists go,
10
+ * objects where objects go; what isn't counts as not set. Deeper mistakes,
11
+ * like a filter's `include` that isn't a list, are left to the widget's
12
+ * error state.
13
+ */
14
+ function configOf(value) {
15
+ const config = recordOf(value);
16
+ if (!config) return void 0;
17
+ const filters = recordOf(config.filters);
18
+ const sort = recordOf(config.sort);
19
+ const totals = recordOf(config.totals);
20
+ return {
21
+ rows: listOf(config.rows, isDimension),
22
+ columns: listOf(config.columns, isDimension),
23
+ values: listOf(config.values, isValue),
24
+ filters: filters ? Object.fromEntries(Object.entries(filters).filter(([, filter]) => recordOf(filter))) : void 0,
25
+ valuesOn: oneOf(config.valuesOn, ["columns", "rows"]),
26
+ sort: sort && typeof sort.valueIndex === "number" && oneOf(sort.order, ["asc", "desc"]) ? sort : void 0,
27
+ totals: totals ? {
28
+ ...typeof totals.rows === "boolean" ? { rows: totals.rows } : {},
29
+ ...typeof totals.columns === "boolean" ? { columns: totals.columns } : {}
30
+ } : void 0
31
+ };
32
+ }
33
+ /** The pivot widget's props as its type says; what isn't the right type counts as not set. */
34
+ function pivotPropsOf(props) {
35
+ return {
36
+ source: textOf(props.source),
37
+ path: textOf(props.path),
38
+ config: configOf(props.config),
39
+ filter: flagOf(props.filter)
40
+ };
41
+ }
42
+ export { pivotPropsOf };
43
+
44
+ //# sourceMappingURL=read-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-props.js","names":[],"sources":["../../src/pivot/read-props.ts"],"sourcesContent":["import type { PivotConfig, PivotDimension, PivotValue } from '@dou-ui/pivot'\nimport { flagOf, oneOf, recordOf, textOf } from '../widgets/shared'\nimport type { PivotWidgetProps } from './types'\n\n/** A field on the rows or columns: its name, or an object with a text `field`. */\nconst isDimension = (item: unknown): item is PivotDimension =>\n typeof item === 'string' || typeof recordOf(item)?.field === 'string'\n\n/** A value: a field's name, or an object. */\nconst isValue = (item: unknown): item is PivotValue =>\n typeof item === 'string' || recordOf(item) !== undefined\n\nconst listOf = <T>(value: unknown, keep: (item: unknown) => item is T): T[] | undefined =>\n Array.isArray(value) ? value.filter(keep) : undefined\n\n/**\n * The pivot's config with the right shape at its top: lists where lists go,\n * objects where objects go; what isn't counts as not set. Deeper mistakes,\n * like a filter's `include` that isn't a list, are left to the widget's\n * error state.\n */\nfunction configOf(value: unknown): PivotConfig | undefined {\n const config = recordOf(value)\n if (!config) return undefined\n const filters = recordOf(config.filters)\n const sort = recordOf(config.sort)\n const totals = recordOf(config.totals)\n return {\n rows: listOf(config.rows, isDimension),\n columns: listOf(config.columns, isDimension),\n values: listOf(config.values, isValue),\n filters: filters\n ? (Object.fromEntries(\n Object.entries(filters).filter(([, filter]) => recordOf(filter)),\n ) as PivotConfig['filters'])\n : undefined,\n valuesOn: oneOf(config.valuesOn, ['columns', 'rows'] as const),\n sort:\n sort && typeof sort.valueIndex === 'number' && oneOf(sort.order, ['asc', 'desc'] as const)\n ? (sort as unknown as PivotConfig['sort'])\n : undefined,\n totals: totals\n ? {\n ...(typeof totals.rows === 'boolean' ? { rows: totals.rows } : {}),\n ...(typeof totals.columns === 'boolean' ? { columns: totals.columns } : {}),\n }\n : undefined,\n }\n}\n\n/** The pivot widget's props as its type says; what isn't the right type counts as not set. */\nexport function pivotPropsOf(props: Record<string, unknown>): PivotWidgetProps {\n return {\n source: textOf(props.source),\n path: textOf(props.path),\n config: configOf(props.config),\n filter: flagOf(props.filter),\n }\n}\n"],"mappings":";;;AAKA,IAAM,eAAe,SACnB,OAAO,SAAS,YAAY,OAAO,SAAS,IAAI,CAAC,EAAE,UAAU;;AAG/D,IAAM,WAAW,SACf,OAAO,SAAS,YAAY,SAAS,IAAI,MAAM,KAAA;AAEjD,IAAM,UAAa,OAAgB,SACjC,MAAM,QAAQ,KAAK,IAAI,MAAM,OAAO,IAAI,IAAI,KAAA;;;;;;;AAQ9C,SAAS,SAAS,OAAyC;CACzD,MAAM,SAAS,SAAS,KAAK;CAC7B,IAAI,CAAC,QAAQ,OAAO,KAAA;CACpB,MAAM,UAAU,SAAS,OAAO,OAAO;CACvC,MAAM,OAAO,SAAS,OAAO,IAAI;CACjC,MAAM,SAAS,SAAS,OAAO,MAAM;CACrC,OAAO;EACL,MAAM,OAAO,OAAO,MAAM,WAAW;EACrC,SAAS,OAAO,OAAO,SAAS,WAAW;EAC3C,QAAQ,OAAO,OAAO,QAAQ,OAAO;EACrC,SAAS,UACJ,OAAO,YACN,OAAO,QAAQ,OAAO,CAAC,CAAC,QAAQ,GAAG,YAAY,SAAS,MAAM,CAAC,CACjE,IACA,KAAA;EACJ,UAAU,MAAM,OAAO,UAAU,CAAC,WAAW,MAAM,CAAU;EAC7D,MACE,QAAQ,OAAO,KAAK,eAAe,YAAY,MAAM,KAAK,OAAO,CAAC,OAAO,MAAM,CAAU,IACpF,OACD,KAAA;EACN,QAAQ,SACJ;GACE,GAAI,OAAO,OAAO,SAAS,YAAY,EAAE,MAAM,OAAO,KAAK,IAAI,CAAC;GAChE,GAAI,OAAO,OAAO,YAAY,YAAY,EAAE,SAAS,OAAO,QAAQ,IAAI,CAAC;EAC3E,IACA,KAAA;CACN;AACF;;AAGA,SAAgB,aAAa,OAAkD;CAC7E,OAAO;EACL,QAAQ,OAAO,MAAM,MAAM;EAC3B,MAAM,OAAO,MAAM,IAAI;EACvB,QAAQ,SAAS,MAAM,MAAM;EAC7B,QAAQ,OAAO,MAAM,MAAM;CAC7B;AACF"}
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- @layer dou.components{.dou-grid-layout{--dou-grid-item-radius:var(--dou-radius-container);--dou-grid-col:calc((100cqw - (var(--dou-grid-columns) - 1)*var(--dou-grid-gap-x))/var(--dou-grid-columns));position:relative;box-sizing:border-box;height:calc(var(--dou-grid-rows)*var(--dou-grid-row) + max(var(--dou-grid-rows) - 1,0)*var(--dou-grid-gap-y));container-type:inline-size;width:100%;min-width:0}.dou-grid-layout.is-pointer-dragging{cursor:grabbing}.dou-grid-layout.is-resizing{cursor:nwse-resize}.dou-grid-layout__item,.dou-grid-layout__placeholder{position:absolute;box-sizing:border-box;width:calc(var(--dou-grid-w)*var(--dou-grid-col) + (var(--dou-grid-w) - 1)*var(--dou-grid-gap-x) + var(--dou-grid-dw,0px));height:calc(var(--dou-grid-h)*var(--dou-grid-row) + (var(--dou-grid-h) - 1)*var(--dou-grid-gap-y) + var(--dou-grid-dh,0px));border-radius:var(--dou-grid-item-radius);transform:translate(calc(var(--dou-grid-x)*(var(--dou-grid-col) + var(--dou-grid-gap-x)) + var(--dou-grid-dx,0px)),calc(var(--dou-grid-y)*(var(--dou-grid-row) + var(--dou-grid-gap-y)) + var(--dou-grid-dy,0px)));top:0;left:0}.dou-grid-layout__item{display:grid;grid-template:minmax(0,1fr)/minmax(0,1fr);outline:none;min-width:0}.dou-grid-layout__item:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-grid-layout.is-editable .dou-grid-layout__item.is-movable{user-select:none;-webkit-touch-callout:none}.dou-grid-layout.is-editable:not(:-webkit-any(.is-pointer-dragging,.has-handle)) .dou-grid-layout__item.is-movable,.dou-grid-layout.is-editable.has-handle:not(.is-pointer-dragging) .dou-grid-layout__item.is-movable .dou-grid-layout__handle{cursor:grab}.dou-grid-layout.is-editable:not(:-moz-any(.is-pointer-dragging,.has-handle)) .dou-grid-layout__item.is-movable,.dou-grid-layout.is-editable.has-handle:not(.is-pointer-dragging) .dou-grid-layout__item.is-movable .dou-grid-layout__handle{cursor:grab}.dou-grid-layout.is-editable:not(:is(.is-pointer-dragging,.has-handle)) .dou-grid-layout__item.is-movable,.dou-grid-layout.is-editable.has-handle:not(.is-pointer-dragging) .dou-grid-layout__item.is-movable .dou-grid-layout__handle{cursor:grab}.dou-grid-layout.is-arranging .dou-grid-layout__item{transition:transform var(--dou-motion-duration-normal)var(--dou-motion-easing)}.dou-grid-layout__item.is-dragging,.dou-grid-layout__item.is-resizing{z-index:2;box-shadow:var(--dou-shadow-lg)}.dou-grid-layout.is-pointer-dragging .dou-grid-layout__item.is-dragging,.dou-grid-layout.is-pointer-dragging .dou-grid-layout__item.is-resizing{transition:none}.dou-grid-layout__placeholder{z-index:1;border:1px dashed var(--dou-color-border-strong);background-color:color-mix(in oklab,var(--dou-color-text)4%,transparent);pointer-events:none}.dou-grid-layout.is-arranging .dou-grid-layout__placeholder{transition:transform var(--dou-motion-duration-fast)var(--dou-motion-easing)}.dou-grid-layout__resize{position:absolute;z-index:1;touch-action:none}.dou-grid-layout__resize.is-e{cursor:ew-resize;width:8px;top:8px;bottom:16px;right:-4px}.dou-grid-layout__resize.is-s{cursor:ns-resize;height:8px;bottom:-4px;left:8px;right:16px}.dou-grid-layout__resize.is-se{cursor:nwse-resize;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);width:20px;height:20px;bottom:0;right:0}.dou-grid-layout__resize.is-se:after{position:absolute;box-sizing:border-box;border-right:2px solid var(--dou-color-text-tertiary);border-bottom:2px solid var(--dou-color-text-tertiary);content:"";border-bottom-right-radius:4px;width:8px;height:8px;bottom:5px;right:5px}.dou-grid-layout__item:hover>.dou-grid-layout__resize.is-se,.dou-grid-layout__item.is-resizing>.dou-grid-layout__resize.is-se{opacity:1}.dou-grid-layout__item:focus-visible>.dou-grid-layout__resize.is-se{opacity:1}@media (pointer:coarse){.dou-grid-layout__resize.is-se{opacity:1;width:32px;height:32px}}.dou-grid-layout__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}}@layer dou.components{.dou-dashboard{position:relative;outline:none;min-width:0}.dou-dashboard__widget{display:flex;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:inherit;background-color:var(--dou-color-bg-surface);color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-sm);overflow:hidden;flex-direction:column;min-width:0;min-height:0}.dou-grid-layout__item.is-dragging>.dou-dashboard__widget,.dou-grid-layout__item.is-resizing>.dou-dashboard__widget{border-color:var(--dou-color-border-strong)}.dou-dashboard__widget.has-peers{outline:1.5px solid var(--dou-dashboard-peer-color);outline-offset:2px}.dou-dashboard__peers{position:absolute;z-index:1;display:flex;overflow:hidden;pointer-events:none;gap:4px;max-width:calc(100% - 24px);margin-bottom:-10px;bottom:100%;left:12px}.dou-dashboard__peer{background-color:var(--dou-dashboard-peer-color);color:oklch(from var(--dou-dashboard-peer-color)clamp(.2,(.66 - l)*100,.99)0 0);font-size:var(--dou-font-size-sm);white-space:nowrap;border-radius:4px;flex:none;padding:0 6px;line-height:18px}.dou-dashboard__peer.is-focus{animation:dou-dashboard-peer-name var(--dou-motion-duration-fast)var(--dou-motion-easing)3s forwards}.dou-dashboard__header{display:flex;flex:none;align-items: center;gap:8px;height:40px;padding:0 8px 0 16px}.dou-dashboard__title{overflow:hidden;color:var(--dou-color-text);font-size:var(--dou-font-size-sm);font-weight:var(--dou-font-weight-medium);text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:min(6em,40%)}.dou-dashboard__title .dou-editable__view{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:inherit}.dou-dashboard__links{display:flex;overflow:hidden;flex:0 auto;gap:4px;min-width:0;max-width:60%}.dou-dashboard__links .dou-tag{min-width:0;max-width:100%}.dou-dashboard__links .dou-tag__label{overflow-x:clip;white-space:nowrap;text-overflow:ellipsis;min-width:0}.dou-dashboard__actions{display:flex;color:var(--dou-color-text-tertiary);flex:none;align-items: center;gap:2px}.dou-dashboard__trigger{display:inline-flex;flex:none}.dou-dashboard__export-error{flex:none;padding:0 8px 8px}.dou-dashboard__export-error .dou-alert__description{overflow-y:auto;max-height:4.5lh}.dou-dashboard__body{position:relative;flex:auto;min-width:0;min-height:0;padding:0 16px 16px}.dou-dashboard__body.is-fullscreen{height:100%;padding:0}.dou-dashboard__content{min-width:0;height:100%}.dou-dashboard__notice{display:grid;color:var(--dou-color-text-tertiary);text-align:center;place-items: center;height:100%}.dou-dashboard__status{position:absolute;display:flex;background-color:var(--dou-color-bg-surface);color:var(--dou-color-text-secondary);text-align:center;flex-direction:column;justify-content:center;align-items: center;gap:8px;padding:0 16px 16px;inset:0}.dou-dashboard__status.is-loading{background-color:color-mix(in oklab,var(--dou-color-bg-surface)72%,transparent);animation:dou-dashboard-fade-in var(--dou-motion-duration-fast)var(--dou-motion-easing).12s both}.dou-dashboard__status-icon{color:var(--dou-color-danger);width:20px;height:20px}.dou-dashboard__empty{position:absolute;display:grid;border:1px dashed var(--dou-color-border);border-radius:var(--dou-radius-container);pointer-events:none;place-items: center;inset:0}.dou-dashboard__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}.dou-dashboard__settings{display:flex;flex-direction:column;gap:16px}.dou-dashboard__field{display:flex;flex-direction:column;gap:8px}.dou-dashboard__field-hint{color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm)}.dou-dashboard__field-row{display:flex;flex-wrap:wrap;gap:16px}.dou-dashboard__field-row>.dou-dashboard__field{flex:120px;min-width:0}.dou-dashboard__columns{display:flex;flex-direction:column;gap:8px}.dou-dashboard__column{display:grid;grid-template-columns:minmax(0,1fr)minmax(0,1fr);align-items: center;gap:8px}.dou-dashboard__field-label{color:var(--dou-color-text);font-size:var(--dou-font-size-sm);font-weight:var(--dou-font-weight-medium)}@keyframes dou-dashboard-fade-in{0%{opacity:0}}.dou-dashboard-palette{display:flex;list-style:none;flex-direction:column;gap:8px;margin:0;padding:0}.dou-dashboard-palette.is-horizontal{flex-flow:wrap}.dou-dashboard-palette>li{margin:0}.dou-dashboard-palette__item{display:flex;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);color:var(--dou-color-text);font:inherit;font-size:var(--dou-font-size-sm);cursor:grab;user-select:none;-webkit-touch-callout:none;transition:border-color var(--dou-motion-duration-fast)var(--dou-motion-easing);align-items: center;gap:8px;width:100%;height:32px;padding:0 12px}.dou-dashboard-palette__item:hover:not(:disabled){border-color:var(--dou-color-border-strong)}.dou-dashboard-palette__item:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-dashboard-palette__item:disabled{color:var(--dou-color-text-tertiary);cursor:not-allowed}.dou-dashboard-palette__icon{color:var(--dou-color-text-secondary);flex:none;width:16px;height:16px}.dou-dashboard-palette__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dou-dashboard-filter{display:flex;flex-wrap:wrap;align-items: center;gap:8px 16px}.dou-dashboard-filter__field{display:flex;align-items: center;gap:8px;min-width:0}.dou-dashboard-filter__label{color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-sm);white-space:nowrap;flex:none}.dou-dashboard-filter__control{width:144px;min-width:0}.dou-dashboard-filter__control.is-range{width:272px}.dou-dashboard-filter__extra{display:flex;align-items: center;gap:4px;margin-left:auto}@media (max-width:480px){.dou-dashboard-filter__field{flex:100%}.dou-dashboard-filter__label{width:4em}.dou-dashboard-filter__control,.dou-dashboard-filter__control.is-range{flex:auto;width:auto}}.dou-dashboard-stat{display:flex;container-type:inline-size;flex-direction:column;justify-content:space-between;gap:8px;height:100%}@container (width<=200px){.dou-dashboard-stat .dou-statistic{--dou-statistic-value-size:22px}}.dou-dashboard-stat__spark{flex:none;margin:0 -16px -16px}.dou-dashboard-text{overflow:auto;color:var(--dou-color-text);white-space:pre-wrap;overflow-wrap:anywhere;height:100%;line-height:1.6}.dou-dashboard-text.is-sm{color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-sm)}.dou-dashboard-text.is-md{font-size:var(--dou-font-size-md)}.dou-dashboard-text.is-lg{font-size:var(--dou-font-size-lg);font-weight:var(--dou-font-weight-medium);line-height:1.4}.dou-dashboard.is-exporting .dou-dashboard__actions{display:none}.dou-dashboard.is-exporting .dou-dashboard__links .dou-tag__close{display:none}.dou-dashboard.is-exporting .dou-dashboard__export-error{display:none}.dou-dashboard.is-exporting .dou-dashboard__peers{display:none}.dou-dashboard.is-exporting .dou-grid-layout__resize{display:none}.dou-dashboard.is-exporting .dou-dashboard__live{display:none}.dou-dashboard.is-exporting .dou-grid-layout__item{outline:none}.dou-dashboard.is-exporting .dou-dashboard__widget{outline:none}@media print{.dou-dashboard{print-color-adjust:exact}.dou-dashboard__actions,.dou-dashboard__links .dou-tag__close,.dou-dashboard__export-error,.dou-dashboard__peers,.dou-grid-layout__resize,.dou-dashboard-filter__clear,.dou-dashboard-filter__extra{display:none}.dou-grid-layout__item{outline:none;break-inside:avoid}.dou-dashboard__widget{outline:none}}}@keyframes dou-dashboard-peer-name{to{opacity:0;visibility:hidden}}
1
+ @layer dou.components{.dou-grid-layout{--dou-grid-item-radius:var(--dou-radius-container);--dou-grid-col:calc((100cqw - (var(--dou-grid-columns) - 1)*var(--dou-grid-gap-x))/var(--dou-grid-columns));position:relative;box-sizing:border-box;height:calc(var(--dou-grid-rows)*var(--dou-grid-row) + max(var(--dou-grid-rows) - 1,0)*var(--dou-grid-gap-y));container-type:inline-size;width:100%;min-width:0}.dou-grid-layout.is-pointer-dragging{cursor:grabbing}.dou-grid-layout.is-resizing{cursor:nwse-resize}.dou-grid-layout__item,.dou-grid-layout__placeholder{position:absolute;box-sizing:border-box;width:calc(var(--dou-grid-w)*var(--dou-grid-col) + (var(--dou-grid-w) - 1)*var(--dou-grid-gap-x) + var(--dou-grid-dw,0px));height:calc(var(--dou-grid-h)*var(--dou-grid-row) + (var(--dou-grid-h) - 1)*var(--dou-grid-gap-y) + var(--dou-grid-dh,0px));border-radius:var(--dou-grid-item-radius);transform:translate(calc(var(--dou-grid-x)*(var(--dou-grid-col) + var(--dou-grid-gap-x)) + var(--dou-grid-dx,0px)),calc(var(--dou-grid-y)*(var(--dou-grid-row) + var(--dou-grid-gap-y)) + var(--dou-grid-dy,0px)));top:0;left:0}.dou-grid-layout__item{display:grid;grid-template:minmax(0,1fr)/minmax(0,1fr);outline:none;min-width:0}.dou-grid-layout__item:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-grid-layout.is-editable .dou-grid-layout__item.is-movable{user-select:none;-webkit-touch-callout:none}.dou-grid-layout.is-editable:not(:-webkit-any(.is-pointer-dragging,.has-handle)) .dou-grid-layout__item.is-movable,.dou-grid-layout.is-editable.has-handle:not(.is-pointer-dragging) .dou-grid-layout__item.is-movable .dou-grid-layout__handle{cursor:grab}.dou-grid-layout.is-editable:not(:-moz-any(.is-pointer-dragging,.has-handle)) .dou-grid-layout__item.is-movable,.dou-grid-layout.is-editable.has-handle:not(.is-pointer-dragging) .dou-grid-layout__item.is-movable .dou-grid-layout__handle{cursor:grab}.dou-grid-layout.is-editable:not(:is(.is-pointer-dragging,.has-handle)) .dou-grid-layout__item.is-movable,.dou-grid-layout.is-editable.has-handle:not(.is-pointer-dragging) .dou-grid-layout__item.is-movable .dou-grid-layout__handle{cursor:grab}.dou-grid-layout.is-arranging .dou-grid-layout__item{transition:transform var(--dou-motion-duration-normal)var(--dou-motion-easing)}.dou-grid-layout__item.is-dragging,.dou-grid-layout__item.is-resizing{z-index:2;box-shadow:var(--dou-shadow-lg)}.dou-grid-layout.is-pointer-dragging .dou-grid-layout__item.is-dragging,.dou-grid-layout.is-pointer-dragging .dou-grid-layout__item.is-resizing{transition:none}.dou-grid-layout__placeholder{z-index:1;border:1px dashed var(--dou-color-border-strong);background-color:color-mix(in oklab,var(--dou-color-text)4%,transparent);pointer-events:none}.dou-grid-layout.is-arranging .dou-grid-layout__placeholder{transition:transform var(--dou-motion-duration-fast)var(--dou-motion-easing)}.dou-grid-layout__resize{position:absolute;z-index:1;touch-action:none}.dou-grid-layout__resize.is-e{cursor:ew-resize;width:8px;top:8px;bottom:16px;right:-4px}.dou-grid-layout__resize.is-s{cursor:ns-resize;height:8px;bottom:-4px;left:8px;right:16px}.dou-grid-layout__resize.is-se{cursor:nwse-resize;opacity:0;transition:opacity var(--dou-motion-duration-fast)var(--dou-motion-easing);width:20px;height:20px;bottom:0;right:0}.dou-grid-layout__resize.is-se:after{position:absolute;box-sizing:border-box;border-right:2px solid var(--dou-color-text-tertiary);border-bottom:2px solid var(--dou-color-text-tertiary);content:"";border-bottom-right-radius:4px;width:8px;height:8px;bottom:5px;right:5px}.dou-grid-layout__item:hover>.dou-grid-layout__resize.is-se,.dou-grid-layout__item.is-resizing>.dou-grid-layout__resize.is-se{opacity:1}.dou-grid-layout__item:focus-visible>.dou-grid-layout__resize.is-se{opacity:1}@media (pointer:coarse){.dou-grid-layout__resize.is-se{opacity:1;width:32px;height:32px}}.dou-grid-layout__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}}@layer dou.components{.dou-dashboard{position:relative;outline:none;min-width:0}.dou-dashboard__widget{display:flex;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:inherit;background-color:var(--dou-color-bg-surface);color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-sm);overflow:hidden;flex-direction:column;min-width:0;min-height:0}.dou-grid-layout__item.is-dragging>.dou-dashboard__widget,.dou-grid-layout__item.is-resizing>.dou-dashboard__widget{border-color:var(--dou-color-border-strong)}.dou-dashboard__widget.has-peers{outline:1.5px solid var(--dou-dashboard-peer-color);outline-offset:2px}.dou-dashboard__peers{position:absolute;z-index:1;display:flex;overflow:hidden;pointer-events:none;gap:4px;max-width:calc(100% - 24px);margin-bottom:-10px;bottom:100%;left:12px}.dou-dashboard__peer{background-color:var(--dou-dashboard-peer-color);color:oklch(from var(--dou-dashboard-peer-color)clamp(.2,(.66 - l)*100,.99)0 0);font-size:var(--dou-font-size-sm);white-space:nowrap;border-radius:4px;flex:none;padding:0 6px;line-height:18px}.dou-dashboard__peer.is-focus{animation:dou-dashboard-peer-name var(--dou-motion-duration-fast)var(--dou-motion-easing)3s forwards}.dou-dashboard__header{display:flex;flex:none;align-items: center;gap:8px;height:40px;padding:0 8px 0 16px}.dou-dashboard__title{overflow:hidden;color:var(--dou-color-text);font-size:var(--dou-font-size-sm);font-weight:var(--dou-font-weight-medium);text-overflow:ellipsis;white-space:nowrap;flex:auto;min-width:min(6em,40%)}.dou-dashboard__title .dou-editable__view{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:inherit}.dou-dashboard__links{display:flex;overflow:hidden;flex:0 auto;gap:4px;min-width:0;max-width:60%}.dou-dashboard__links .dou-tag{min-width:0;max-width:100%}.dou-dashboard__links .dou-tag__label{overflow-x:clip;white-space:nowrap;text-overflow:ellipsis;min-width:0}.dou-dashboard__actions{display:flex;color:var(--dou-color-text-tertiary);flex:none;align-items: center;gap:2px}.dou-dashboard__comment{font-variant-numeric:tabular-nums}.dou-dashboard__comment:not(.has-threads){color:var(--dou-color-text-secondary)}@media (pointer:coarse){.dou-dashboard__comment.has-threads:after{position:absolute;content:"";inset:min(0px,50% - 20px)}}.dou-dashboard__fullscreen{display:flex;flex-direction:column;height:100%;min-height:0}.dou-dashboard__fullscreen>.dou-dashboard__body.is-fullscreen{flex:1;min-height:0}.dou-dashboard__fullscreen-bar{display:flex;justify-content:flex-end;margin-bottom:8px}.dou-dashboard__comment-card{box-sizing:border-box;max-height:min(var(--dou-floating-available,100vh),480px,calc(100vh - 32px));overflow-y:auto;overscroll-behavior:contain;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-container);background-color:color-mix(in oklab,var(--dou-color-text)calc(4%*var(--dou-scheme-dark)),var(--dou-color-bg-surface));box-shadow:var(--dou-shadow-md);width:min(340px,100vw - 32px);padding:12px}.dou-dashboard__comment-card>.dou-comment-thread+.dou-comment-thread{border-top:1px solid var(--dou-color-border-subtle);margin-top:12px;padding-top:12px}.dou-dashboard__export-error{flex:none;padding:0 8px 8px}.dou-dashboard__export-error .dou-alert__description{overflow-y:auto;max-height:4.5lh}.dou-dashboard__body{position:relative;flex:auto;min-width:0;min-height:0;padding:0 16px 16px}.dou-dashboard__body.is-fullscreen{height:100%;padding:0}.dou-dashboard__content{min-width:0;height:100%}.dou-dashboard__notice{display:grid;color:var(--dou-color-text-tertiary);text-align:center;place-items: center;height:100%}.dou-dashboard__status{position:absolute;display:flex;background-color:var(--dou-color-bg-surface);color:var(--dou-color-text-secondary);text-align:center;flex-direction:column;justify-content:center;align-items: center;gap:8px;padding:0 16px 16px;inset:0}.dou-dashboard__status.is-loading{background-color:color-mix(in oklab,var(--dou-color-bg-surface)72%,transparent);animation:dou-dashboard-fade-in var(--dou-motion-duration-fast)var(--dou-motion-easing).12s both}.dou-dashboard__settings-error{display:flex;color:var(--dou-color-text-secondary);text-align:center;flex-direction:column;align-items: center;gap:8px;padding:24px 0}.dou-dashboard__status-icon{color:var(--dou-color-danger);width:20px;height:20px}.dou-dashboard__empty{position:absolute;display:grid;border:1px dashed var(--dou-color-border);border-radius:var(--dou-radius-container);pointer-events:none;place-items: center;inset:0}.dou-dashboard__live{position:absolute;overflow:hidden;clip-path:inset(50%);white-space:nowrap;width:1px;height:1px}.dou-dashboard__settings{display:flex;flex-direction:column;gap:16px}.dou-dashboard__field{display:flex;flex-direction:column;gap:8px}.dou-dashboard__field-hint{color:var(--dou-color-text-tertiary);font-size:var(--dou-font-size-sm)}.dou-dashboard__field-row{display:flex;flex-wrap:wrap;gap:16px}.dou-dashboard__field-row>.dou-dashboard__field{flex:120px;min-width:0}.dou-dashboard__columns{display:flex;flex-direction:column;gap:8px}.dou-dashboard__column{display:grid;grid-template-columns:minmax(0,1fr)minmax(0,1fr);align-items: center;gap:8px}.dou-dashboard__field-label{color:var(--dou-color-text);font-size:var(--dou-font-size-sm);font-weight:var(--dou-font-weight-medium)}@keyframes dou-dashboard-fade-in{0%{opacity:0}}.dou-dashboard-palette{display:flex;list-style:none;flex-direction:column;gap:8px;margin:0;padding:0}.dou-dashboard-palette.is-horizontal{flex-flow:wrap}.dou-dashboard-palette>li{margin:0}.dou-dashboard-palette__item{display:flex;box-sizing:border-box;border:1px solid var(--dou-color-border);border-radius:var(--dou-radius-control);background-color:var(--dou-color-bg-surface);color:var(--dou-color-text);font:inherit;font-size:var(--dou-font-size-sm);cursor:grab;user-select:none;-webkit-touch-callout:none;transition:border-color var(--dou-motion-duration-fast)var(--dou-motion-easing);align-items: center;gap:8px;width:100%;height:32px;padding:0 12px}.dou-dashboard-palette__item:hover:not(:disabled){border-color:var(--dou-color-border-strong)}.dou-dashboard-palette__item:focus-visible{outline:2px solid var(--dou-color-focus);outline-offset:2px}.dou-dashboard-palette__item:disabled{color:var(--dou-color-text-tertiary);cursor:not-allowed}.dou-dashboard-palette__icon{color:var(--dou-color-text-secondary);flex:none;width:16px;height:16px}.dou-dashboard-palette__label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dou-dashboard-filter{display:flex;flex-wrap:wrap;align-items: center;gap:8px 16px}.dou-dashboard-filter__field{display:flex;align-items: center;gap:8px;min-width:0}.dou-dashboard-filter__label{color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-sm);white-space:nowrap;flex:none}.dou-dashboard-filter__control{width:144px;min-width:0}.dou-dashboard-filter__control.is-range{width:272px}.dou-dashboard-filter__extra{display:flex;align-items: center;gap:4px;margin-left:auto}@media (max-width:480px){.dou-dashboard-filter__field{flex:100%}.dou-dashboard-filter__label{width:4em}.dou-dashboard-filter__control,.dou-dashboard-filter__control.is-range{flex:auto;width:auto}}.dou-dashboard-stat{display:flex;container-type:inline-size;flex-direction:column;justify-content:space-between;gap:8px;height:100%}@container (width<=200px){.dou-dashboard-stat .dou-statistic{--dou-statistic-value-size:22px}}.dou-dashboard-stat__spark{flex:none;margin:0 -16px -16px}.dou-dashboard-text{overflow:auto;color:var(--dou-color-text);white-space:pre-wrap;overflow-wrap:anywhere;height:100%;line-height:1.6}.dou-dashboard-text.is-sm{color:var(--dou-color-text-secondary);font-size:var(--dou-font-size-sm)}.dou-dashboard-text.is-md{font-size:var(--dou-font-size-md)}.dou-dashboard-text.is-lg{font-size:var(--dou-font-size-lg);font-weight:var(--dou-font-weight-medium);line-height:1.4}.dou-dashboard.is-exporting .dou-dashboard__actions{display:none}.dou-dashboard.is-exporting .dou-dashboard__links .dou-tag__close{display:none}.dou-dashboard.is-exporting .dou-dashboard__export-error{display:none}.dou-dashboard.is-exporting .dou-dashboard__peers{display:none}.dou-dashboard.is-exporting .dou-grid-layout__resize{display:none}.dou-dashboard.is-exporting .dou-dashboard__live{display:none}.dou-dashboard.is-exporting .dou-grid-layout__item{outline:none}.dou-dashboard.is-exporting .dou-dashboard__widget{outline:none}@media print{.dou-dashboard{print-color-adjust:exact}.dou-dashboard__actions,.dou-dashboard__links .dou-tag__close,.dou-dashboard__export-error,.dou-dashboard__peers,.dou-grid-layout__resize,.dou-dashboard-filter__clear,.dou-dashboard-filter__extra{display:none}.dou-grid-layout__item{outline:none;break-inside:avoid}.dou-dashboard__widget{outline:none}}}@keyframes dou-dashboard-peer-name{to{opacity:0;visibility:hidden}}
package/dist/style.js CHANGED
@@ -1,12 +1,17 @@
1
1
  import 'dou-ui/components/alert/style'
2
+ import 'dou-ui/components/autocomplete/style'
3
+ import 'dou-ui/components/comment-thread/style'
2
4
  import 'dou-ui/components/date-picker/style'
3
5
  import 'dou-ui/components/dialog/style'
4
6
  import 'dou-ui/components/drawer/style'
5
7
  import 'dou-ui/components/editable/style'
6
- import 'dou-ui/components/dropdown/style'
7
- import 'dou-ui/components/empty/style'
8
8
  import 'dou-ui/components/grid/style'
9
+ import 'dou-ui/components/input-number/style'
10
+ import 'dou-ui/components/segmented-control/style'
9
11
  import 'dou-ui/components/select/style'
10
- import 'dou-ui/components/tooltip/style'
12
+ import 'dou-ui/components/sparkline/style'
13
+ import 'dou-ui/components/statistic/style'
14
+ import 'dou-ui/components/switch/style'
15
+ import 'dou-ui/components/table/style'
11
16
  import '@dou-ui/sheet/style'
12
17
  import './style.css'
@@ -0,0 +1,3 @@
1
+ import type { ChartWidgetProps } from './types';
2
+ /** The chart widget's props as its type says; what isn't the right type counts as not set. */
3
+ export declare function chartPropsOf(props: Record<string, unknown>): ChartWidgetProps;
@@ -3,7 +3,7 @@ import type { DashboardDocument, DashboardPlace } from './types';
3
3
  /** A dashboard with no widgets, the `v-model` when none is bound. */
4
4
  export declare const emptyDocument: () => DashboardDocument;
5
5
  export interface DocumentProblem {
6
- code: 'version' | 'shape' | 'duplicate-id' | 'missing-id' | 'unknown-type' | 'bad-place';
6
+ code: 'version' | 'shape' | 'duplicate-id' | 'missing-id' | 'unknown-type' | 'bad-place' | 'bad-comments';
7
7
  /** The widget at fault; none for the document's own problems. */
8
8
  widgetId?: string;
9
9
  /** Where the problem is, e.g. `widgets[2]` or `widgets[2].place.lg`; `version` for the version. */
@@ -22,7 +22,8 @@ export declare function isDashboardPlace(value: unknown): value is DashboardPlac
22
22
  /**
23
23
  * The problems of a dashboard document, before it is saved or shown: an
24
24
  * unknown version, widgets without an id or sharing one, types nobody
25
- * registered, and places that are not whole cells.
25
+ * registered, places that are not whole cells, and `comments` that are
26
+ * not a list of thread ids.
26
27
  */
27
28
  export declare function checkDocument(document: DashboardDocument, options?: CheckDocumentOptions): DocumentProblem[];
28
29
  /**
@@ -1,5 +1,5 @@
1
1
  import type { DashboardTransaction } from './transaction';
2
- import type { DashboardDocument } from './types';
2
+ import type { DashboardDocument, DashboardWidget } from './types';
3
3
  /** Undo and redo of a dashboard: the steps of each transaction and the steps that undo them. */
4
4
  export declare class DashboardHistory {
5
5
  private depth;
@@ -11,5 +11,11 @@ export declare class DashboardHistory {
11
11
  record(tr: DashboardTransaction, now?: number): void;
12
12
  undo(document: DashboardDocument): DashboardTransaction | null;
13
13
  redo(document: DashboardDocument): DashboardTransaction | null;
14
+ /**
15
+ * Gives a change kept out of undo to the widget as undo and redo bring it
16
+ * back, too: comments started on a widget stay on it when its adding is
17
+ * undone and redone.
18
+ */
19
+ carry(id: string, patch: Partial<DashboardWidget>): void;
14
20
  clear(): void;
15
21
  }
@@ -31,6 +31,10 @@ export interface DashboardTransactionMeta {
31
31
  origin?: string;
32
32
  [key: string]: unknown;
33
33
  }
34
+ export interface ReplaceWidgetsOptions {
35
+ /** A widget that stays keeps its `comments`; `true` by default. */
36
+ keepComments?: boolean;
37
+ }
34
38
  /** Deep equality of JSON values; key order doesn't matter. */
35
39
  export declare function sameValue(a: unknown, b: unknown): boolean;
36
40
  /**
@@ -82,5 +86,10 @@ export declare const cloneJson: <T>(value: T) => T;
82
86
  * that are gone are removed, new ones added, changed keys updated, and the
83
87
  * fewest widgets taken out and put back to match the order. Unchanged
84
88
  * widgets keep their objects.
89
+ *
90
+ * A widget that stays keeps its `comments`, the discussions on it, as they
91
+ * are: restoring a default layout doesn't take them off. Pass
92
+ * `{ keepComments: false }` for the exact steps, e.g. to apply a shared
93
+ * document.
85
94
  */
86
- export declare function replaceWidgets(tr: DashboardTransaction, next: DashboardDocument): DashboardTransaction;
95
+ export declare function replaceWidgets(tr: DashboardTransaction, next: DashboardDocument, options?: ReplaceWidgetsOptions): DashboardTransaction;
@@ -19,6 +19,11 @@ export interface DashboardWidget<P extends object = Record<string, unknown>> {
19
19
  * main one; a narrower breakpoint without one is laid out from it.
20
20
  */
21
21
  place: Partial<Record<string, DashboardPlace>>;
22
+ /**
23
+ * The ids of the comment threads about this widget, see the dashboard's
24
+ * `comments`. Kept when the widget is removed and brought back by undo.
25
+ */
26
+ comments?: string[];
22
27
  }
23
28
  /** A dashboard: a JSON document the app saves and loads itself. */
24
29
  export interface DashboardDocument {
@@ -0,0 +1,15 @@
1
+ import { type Placement } from 'dou-ui';
2
+ import { type DashboardMessages } from '../locale';
3
+ import type { DashboardComments } from './comments';
4
+ type __VLS_Props = {
5
+ id: string;
6
+ comments: DashboardComments;
7
+ messages: DashboardMessages;
8
+ /** Where the tooltip goes: in the full screen view, clear of the dialog's close button above. */
9
+ tooltipPlacement?: Placement;
10
+ };
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
12
+ tooltipPlacement: Placement;
13
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
@@ -0,0 +1,13 @@
1
+ import type { DashboardMessages } from '../locale';
2
+ import type { DashboardComments } from './comments';
3
+ type __VLS_Props = {
4
+ comments: DashboardComments;
5
+ messages: DashboardMessages;
6
+ /** The comment button of a widget, to put the card by and give the focus back to. */
7
+ buttonOf: (widget: string) => HTMLElement | null;
8
+ /** Where the card goes: the button, or the widget while its button isn't drawn yet. */
9
+ placeOf: (widget: string) => HTMLElement | null;
10
+ };
11
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
+ declare const _default: typeof __VLS_export;
13
+ export default _default;
@@ -0,0 +1,44 @@
1
+ import { type CommentAction, type CommentThread } from 'dou-ui';
2
+ import { type ComputedRef, type Ref } from 'vue';
3
+ import type { DashboardStep, DashboardTransactionMeta } from '../core/transaction';
4
+ import type { DashboardDocument } from '../core/types';
5
+ import type { DashboardCommentAnchor, DashboardEmits, DashboardProps } from './types';
6
+ type Emit = <K extends keyof DashboardEmits>(event: K, ...args: DashboardEmits[K]) => void;
7
+ /** The thread ids on a widget; nothing when a hand-written document has something else there. */
8
+ export declare const commentIdsOf: (widget: {
9
+ comments?: unknown;
10
+ }) => string[];
11
+ /**
12
+ * The comments of a dashboard: which widget each thread is about, the thread
13
+ * open now, and the one being started.
14
+ */
15
+ export declare function useDashboardComments(options: {
16
+ props: Omit<DashboardProps, 'modelValue' | 'filters'>;
17
+ emit: Emit;
18
+ model: Ref<DashboardDocument>;
19
+ run: (steps: DashboardStep[], meta: DashboardTransactionMeta) => unknown;
20
+ /** Keeps a change out of undo on the widget as undo and redo bring it back. */
21
+ carry: (id: string, patch: {
22
+ comments: string[] | undefined;
23
+ }) => void;
24
+ }): {
25
+ enabled: ComputedRef<boolean>;
26
+ writable: ComputedRef<boolean>;
27
+ threads: ComputedRef<readonly CommentThread[]>;
28
+ author: ComputedRef<import("dou-ui").CommentAuthor | undefined>;
29
+ active: ComputedRef<string | null>;
30
+ pending: import("vue").ShallowRef<string | null, string | null>;
31
+ focusRequest: import("vue").ShallowRef<number, number>;
32
+ openOn: ComputedRef<Map<string, string[]>>;
33
+ current: ComputedRef<string | null>;
34
+ shown: ComputedRef<CommentThread[]>;
35
+ start: (widget: string, focus?: boolean) => boolean;
36
+ apply: (action: CommentAction) => void;
37
+ open: (id: string | null) => void;
38
+ close: () => void;
39
+ openedHere: (id: string | null) => boolean;
40
+ anchors: () => Record<string, DashboardCommentAnchor | null>;
41
+ widgetOf: (id: string) => string | null;
42
+ };
43
+ export type DashboardComments = ReturnType<typeof useDashboardComments>;
44
+ export {};
@@ -15,19 +15,31 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, Das
15
15
  breakpointChange: (breakpoint: string) => any;
16
16
  "update:filters": (value: DashboardFilters) => any;
17
17
  exportError: (event: DashboardExportErrorEvent) => any;
18
+ widgetError: (event: import("./types").DashboardWidgetErrorEvent) => any;
19
+ "update:comments": (threads: import("dou-ui").CommentThread[]) => any;
20
+ "update:activeComment": (id: string | null) => any;
21
+ commentAction: (action: import("dou-ui").CommentAction) => any;
18
22
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
19
23
  onChange?: ((transaction: DashboardTransaction) => any) | undefined;
20
24
  "onUpdate:modelValue"?: ((value: DashboardDocument) => any) | undefined;
21
25
  onBreakpointChange?: ((breakpoint: string) => any) | undefined;
22
26
  "onUpdate:filters"?: ((value: DashboardFilters) => any) | undefined;
23
27
  onExportError?: ((event: DashboardExportErrorEvent) => any) | undefined;
28
+ onWidgetError?: ((event: import("./types").DashboardWidgetErrorEvent) => any) | undefined;
29
+ "onUpdate:comments"?: ((threads: import("dou-ui").CommentThread[]) => any) | undefined;
30
+ "onUpdate:activeComment"?: ((id: string | null) => any) | undefined;
31
+ onCommentAction?: ((action: import("dou-ui").CommentAction) => any) | undefined;
24
32
  }>, {
33
+ comments: import("dou-ui").CommentThread[];
25
34
  columns: number | Record<string, number>;
26
35
  breakpoints: Record<string, number>;
27
36
  rowHeight: number;
28
37
  gap: number | [number, number];
29
38
  compact: import("..").GridCompact;
30
39
  widgets: DashboardWidgetType<any>[];
40
+ author: import("dou-ui").CommentAuthor;
41
+ activeComment: string | null;
42
+ commentable: boolean;
31
43
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
32
44
  declare const _default: typeof __VLS_export;
33
45
  export default _default;
@@ -0,0 +1,12 @@
1
+ import type { Ref } from 'vue';
2
+ /**
3
+ * Whether an error broke what a component shows. Errors in event handlers,
4
+ * watchers and the like leave it showing: they go on to the app as usual.
5
+ */
6
+ export declare function breaksView(info: string): boolean;
7
+ /**
8
+ * Keeps an error that breaks a widget's content or settings in that part:
9
+ * `failed` turns on, `report` is told, and the error goes no further. The
10
+ * caller shows the error state and turns `failed` off to try again.
11
+ */
12
+ export declare function useErrorBoundary(label: () => string, report: (error: unknown) => void): Ref<boolean>;
@@ -1,6 +1,7 @@
1
1
  import type { SheetWorkbook } from '@dou-ui/sheet/core';
2
2
  import type { Component, InjectionKey } from 'vue';
3
3
  import type { DashboardPeer } from '../core/collaboration';
4
+ import type { DashboardComments } from './comments';
4
5
  import type { DashboardWidget } from '../core/types';
5
6
  import type { DashboardLinkedFilter } from '../data/types';
6
7
  import type { DashboardMessages } from '../locale';
@@ -18,6 +19,7 @@ export interface FrameExporter {
18
19
  * that widget's frame again, not every frame on the grid.
19
20
  */
20
21
  export interface FrameContext {
22
+ comments: DashboardComments;
21
23
  widget: (id: string) => DashboardWidget | undefined;
22
24
  type: (widget: DashboardWidget) => DashboardWidgetType<any> | undefined;
23
25
  title: (widget: DashboardWidget) => string;
@@ -50,5 +52,7 @@ export interface FrameContext {
50
52
  /** Why the last export from a widget's menu failed. */
51
53
  exportError: (id: string) => string | undefined;
52
54
  clearExportError: (id: string) => void;
55
+ /** A widget's content broke, for `widgetError`. */
56
+ reportError: (id: string, error: unknown) => void;
53
57
  }
54
58
  export declare const frameContextKey: InjectionKey<FrameContext>;
@@ -1,3 +1,4 @@
1
+ import type { CommentAction, CommentAuthor, CommentThread } from 'dou-ui';
1
2
  import type { SheetExporterOptionsOf } from '@dou-ui/sheet';
2
3
  import type { SheetExporter } from '@dou-ui/sheet/core';
3
4
  import type { DashboardCollaboration } from '../core/collaboration';
@@ -8,6 +9,10 @@ import type { GridCompact } from '../layout/types';
8
9
  import type { DashboardMessagesOverride } from '../locale';
9
10
  import type { DashboardWidgetType } from '../widget/define';
10
11
  import type { DashboardImageOptions } from './export';
12
+ /** What a comment thread is about: a widget. */
13
+ export interface DashboardCommentAnchor {
14
+ widget: string;
15
+ }
11
16
  export interface DashboardProps {
12
17
  /** The dashboard, bound with `v-model`; a new document object after every change. */
13
18
  modelValue?: DashboardDocument;
@@ -58,6 +63,18 @@ export interface DashboardProps {
58
63
  * such as PNG, are left out.
59
64
  */
60
65
  exporters?: readonly SheetExporter[];
66
+ /**
67
+ * The comment threads, bound with `v-model:comments`. The widget a thread
68
+ * is about keeps the thread's id in its `comments`. Left out, there are
69
+ * no comments.
70
+ */
71
+ comments?: CommentThread[];
72
+ /** Who is commenting. Without it comments can be read but not written. */
73
+ author?: CommentAuthor;
74
+ /** The thread open now, bound with `v-model:activeComment`. */
75
+ activeComment?: string | null;
76
+ /** Threads can be started and replied to; also while not `editable`. On by default. */
77
+ commentable?: boolean;
61
78
  }
62
79
  /** Options of a dashboard's `exportWidget`. */
63
80
  export interface DashboardExportOptions<Options = any> {
@@ -71,6 +88,17 @@ export interface DashboardSaveOptions<Options = any> extends DashboardExportOpti
71
88
  /** The file's name, with its extension; the widget's title by default. */
72
89
  fileName?: string;
73
90
  }
91
+ /**
92
+ * A widget's component threw while setting up or drawing its content or
93
+ * settings form; that part shows an error with a retry button instead.
94
+ */
95
+ export interface DashboardWidgetErrorEvent {
96
+ /** The widget's id. */
97
+ widget: string;
98
+ /** Which part broke: what the widget shows, or its settings form. */
99
+ part: 'content' | 'settings';
100
+ error: unknown;
101
+ }
74
102
  /** A widget's export from its menu failed. */
75
103
  export interface DashboardExportErrorEvent {
76
104
  /** The widget's id. */
@@ -92,6 +120,16 @@ export interface DashboardEmits {
92
120
  breakpointChange: [breakpoint: string];
93
121
  /** Exporting a widget from its menu or `saveWidget` failed; the widget tells of it unless prevented. */
94
122
  exportError: [event: DashboardExportErrorEvent];
123
+ /**
124
+ * A widget's content or settings form threw while it set up or drew; it
125
+ * shows an error in its place, and the error goes no further. To report
126
+ * to error tracking.
127
+ */
128
+ widgetError: [event: DashboardWidgetErrorEvent];
129
+ 'update:comments': [threads: CommentThread[]];
130
+ 'update:activeComment': [id: string | null];
131
+ /** A change to the comments made here: to send to a server, notify people, keep a log. */
132
+ commentAction: [action: CommentAction];
95
133
  }
96
134
  export interface DashboardAddOptions {
97
135
  /** Where on the widest breakpoint; defaults to the first spot it fits. */
@@ -114,6 +152,15 @@ export interface DashboardExpose {
114
152
  /** Adds a widget of a registered type; returns its id, or `undefined` for an unknown type. */
115
153
  addWidget: (type: string, options?: DashboardAddOptions) => string | undefined;
116
154
  removeWidget: (id: string) => void;
155
+ /**
156
+ * Opens the open threads on a widget (the one holding the focus when
157
+ * left out), ready to reply, or starts one there; `false` when there is
158
+ * no such widget, comments are off, or there is nothing to open and
159
+ * comments can't be written.
160
+ */
161
+ comment: (id?: string) => boolean;
162
+ /** The widget each thread is about; `null` when it is gone. Not reactive. */
163
+ getCommentAnchors: () => Record<string, DashboardCommentAnchor | null>;
117
164
  /** Adds a copy of a widget next to it; returns the copy's id. */
118
165
  duplicateWidget: (id: string) => string | undefined;
119
166
  focusWidget: (id: string) => void;
@@ -13,6 +13,8 @@ type __VLS_Props = {
13
13
  }) => void;
14
14
  /** Where the widget's workbook goes, for its export menu; the full-screen copy has none. */
15
15
  setWorkbook?: (id: string, get: () => SheetWorkbook | undefined) => () => void;
16
+ /** Told when the widget's content breaks, for the dashboard's `widgetError`. */
17
+ reportError?: (id: string, error: unknown) => void;
16
18
  };
17
19
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
20
  declare const _default: typeof __VLS_export;
@@ -1,11 +1,15 @@
1
1
  import type { DashboardWidget } from '../core/types';
2
+ import type { DashboardMessages } from '../locale';
2
3
  import type { DashboardWidgetType } from '../widget/define';
3
4
  type __VLS_Props = {
4
5
  widget: DashboardWidget;
5
6
  type: DashboardWidgetType<any>;
7
+ messages: DashboardMessages;
6
8
  setProps: (id: string, patch: Record<string, unknown>, options?: {
7
9
  group?: string;
8
10
  }) => void;
11
+ /** Told when the settings form breaks, for the dashboard's `widgetError`. */
12
+ reportError?: (id: string, error: unknown) => void;
9
13
  };
10
14
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
15
  "update:props": (props: Record<string, unknown>) => any;
@@ -154,6 +154,7 @@ export declare const DouGridLayoutHandle: import("dou-ui").WithInstall<{
154
154
  };
155
155
  }), import("vue").HTMLAttributes>;
156
156
  export declare const DouDashboard: import("dou-ui").WithInstall<import("vue").DefineComponent<{
157
+ comments?: import("dou-ui").CommentThread[] | undefined;
157
158
  columns?: (number | Record<string, number>) | undefined;
158
159
  editable?: boolean | undefined;
159
160
  label?: string | undefined;
@@ -167,6 +168,9 @@ export declare const DouDashboard: import("dou-ui").WithInstall<import("vue").De
167
168
  createId?: ((type: string) => string) | undefined;
168
169
  collaboration?: import("./index.js").DashboardCollaboration | undefined;
169
170
  exporters?: readonly import("@dou-ui/sheet").SheetExporter[] | undefined;
171
+ author?: import("dou-ui").CommentAuthor | undefined;
172
+ activeComment?: string | null | undefined;
173
+ commentable?: boolean | undefined;
170
174
  } & {
171
175
  modelValue?: import("./index.js").DashboardDocument;
172
176
  filters?: import("./index.js").DashboardFilters;
@@ -176,7 +180,12 @@ export declare const DouDashboard: import("dou-ui").WithInstall<import("vue").De
176
180
  breakpointChange: (breakpoint: string) => any;
177
181
  "update:filters": (value: import("./index.js").DashboardFilters) => any;
178
182
  exportError: (event: import("./index.js").DashboardExportErrorEvent) => any;
183
+ widgetError: (event: import("./index.js").DashboardWidgetErrorEvent) => any;
184
+ "update:comments": (threads: import("dou-ui").CommentThread[]) => any;
185
+ "update:activeComment": (id: string | null) => any;
186
+ commentAction: (action: import("dou-ui").CommentAction) => any;
179
187
  }, string, import("vue").PublicProps, Readonly<{
188
+ comments?: import("dou-ui").CommentThread[] | undefined;
180
189
  columns?: (number | Record<string, number>) | undefined;
181
190
  editable?: boolean | undefined;
182
191
  label?: string | undefined;
@@ -190,6 +199,9 @@ export declare const DouDashboard: import("dou-ui").WithInstall<import("vue").De
190
199
  createId?: ((type: string) => string) | undefined;
191
200
  collaboration?: import("./index.js").DashboardCollaboration | undefined;
192
201
  exporters?: readonly import("@dou-ui/sheet").SheetExporter[] | undefined;
202
+ author?: import("dou-ui").CommentAuthor | undefined;
203
+ activeComment?: string | null | undefined;
204
+ commentable?: boolean | undefined;
193
205
  } & {
194
206
  modelValue?: import("./index.js").DashboardDocument;
195
207
  filters?: import("./index.js").DashboardFilters;
@@ -199,13 +211,21 @@ export declare const DouDashboard: import("dou-ui").WithInstall<import("vue").De
199
211
  onBreakpointChange?: ((breakpoint: string) => any) | undefined;
200
212
  "onUpdate:filters"?: ((value: import("./index.js").DashboardFilters) => any) | undefined;
201
213
  onExportError?: ((event: import("./index.js").DashboardExportErrorEvent) => any) | undefined;
214
+ onWidgetError?: ((event: import("./index.js").DashboardWidgetErrorEvent) => any) | undefined;
215
+ "onUpdate:comments"?: ((threads: import("dou-ui").CommentThread[]) => any) | undefined;
216
+ "onUpdate:activeComment"?: ((id: string | null) => any) | undefined;
217
+ onCommentAction?: ((action: import("dou-ui").CommentAction) => any) | undefined;
202
218
  }>, {
219
+ comments: import("dou-ui").CommentThread[];
203
220
  columns: number | Record<string, number>;
204
221
  breakpoints: Record<string, number>;
205
222
  rowHeight: number;
206
223
  gap: number | [number, number];
207
224
  compact: import("./layout").GridCompact;
208
225
  widgets: import("./index.js").DashboardWidgetType<any>[];
226
+ author: import("dou-ui").CommentAuthor;
227
+ activeComment: string | null;
228
+ commentable: boolean;
209
229
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, import("vue").HTMLAttributes>;
210
230
  export declare const DouDashboardPalette: import("dou-ui").WithInstall<{
211
231
  new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("./index.js").DashboardPaletteProps> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
@@ -264,11 +284,12 @@ export declare const DouDashboardFilterBar: import("dou-ui").WithInstall<{
264
284
  default?: () => unknown;
265
285
  };
266
286
  }), import("vue").HTMLAttributes>;
267
- export type { DashboardAddOptions, DashboardEmits, DashboardExportErrorEvent, DashboardExportOptions, DashboardSaveOptions, DashboardExpose, DashboardFilterBarProps, DashboardPaletteProps, DashboardProps, } from './dashboard/types';
287
+ export type { DashboardAddOptions, DashboardEmits, DashboardExportErrorEvent, DashboardWidgetErrorEvent, DashboardExportOptions, DashboardSaveOptions, DashboardCommentAnchor, DashboardExpose, DashboardFilterBarProps, DashboardPaletteProps, DashboardProps, } from './dashboard/types';
268
288
  export type { DashboardDocument, DashboardPlace, DashboardWidget } from './core/types';
269
289
  export { checkDocument, emptyDocument, isDashboardPlace, migrateDocument } from './core/document';
270
290
  export type { CheckDocumentOptions, DocumentProblem } from './core/document';
271
291
  export { applySteps, DashboardTransaction, replaceWidgets, sameValue } from './core/transaction';
292
+ export type { ReplaceWidgetsOptions } from './core/transaction';
272
293
  export type { DashboardCollaboration, DashboardCollaborationHost, DashboardPeer, DashboardPresence, DashboardPresenceAction, } from './core/collaboration';
273
294
  export type { DashboardStep, DashboardTransactionMeta, DashboardWidgetPatch, } from './core/transaction';
274
295
  export { DashboardHistory } from './core/history';
@@ -42,9 +42,10 @@ export declare function resizeItemBy(items: readonly GridItem[], id: string, dw:
42
42
  export declare function findPlace(items: readonly GridItem[], size: GridSize, options: GridLayoutOptions): GridPosition;
43
43
  /**
44
44
  * The layout worked out for a grid of another width: positions and widths
45
- * scaled by the ratio of the columns, then settled. On a single column the
46
- * items are stacked in reading order (top to bottom, then left to right),
47
- * each keeping its height.
45
+ * scaled by the ratio of the columns, then settled. Items in a row that
46
+ * were equally wide stay equally wide, by wrapping the row or leaving
47
+ * columns empty (see the docs). On a single column the items are stacked
48
+ * in reading order (top to bottom, then left to right), each keeping its height.
48
49
  */
49
50
  export declare function deriveLayout(items: readonly GridItem[], from: number, options: GridLayoutOptions): readonly GridItem[];
50
51
  export {};
@@ -37,6 +37,10 @@ export interface DashboardMessages {
37
37
  nothingToExport: string;
38
38
  duplicate: string;
39
39
  remove: string;
40
+ /** The comment button and the card of a widget's discussions. */
41
+ comment: string;
42
+ /** The comment button of a widget with discussions; `{count}` is how many are open. */
43
+ comments: string;
40
44
  /** The settings drawer's title: `{title}`. */
41
45
  settingsTitle: string;
42
46
  /** The title field in the settings drawer. */
@@ -49,6 +53,10 @@ export interface DashboardMessages {
49
53
  /** A widget's status. */
50
54
  loading: string;
51
55
  error: string;
56
+ /** A widget that failed to show, e.g. for props it can't use. */
57
+ renderError: string;
58
+ /** A widget's settings form that failed to show. */
59
+ settingsError: string;
52
60
  empty: string;
53
61
  retry: string;
54
62
  /** A dashboard without widgets, while editing. */
@@ -0,0 +1,3 @@
1
+ import type { PivotWidgetProps } from './types';
2
+ /** The pivot widget's props as its type says; what isn't the right type counts as not set. */
3
+ export declare function pivotPropsOf(props: Record<string, unknown>): PivotWidgetProps;