@mittwald/flow-remote-vue-components 1.6.0-next.4 → 1.6.0-next.41

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 (53) hide show
  1. package/README.md +2 -2
  2. package/dist/js/components-base/src/index.mjs +5 -2
  3. package/dist/js/components-base/src/list/filter/ListDateRangeFilter.mjs +1 -0
  4. package/dist/js/components-base/src/list/filter/ListDateRangeFilter.mjs.map +1 -1
  5. package/dist/js/components-base/src/list/filter/ListFilter.mjs +4 -1
  6. package/dist/js/components-base/src/list/filter/ListFilter.mjs.map +1 -1
  7. package/dist/js/components-base/src/list/filter/dateRange.mjs +37 -13
  8. package/dist/js/components-base/src/list/filter/dateRange.mjs.map +1 -1
  9. package/dist/js/components-base/src/list/filter/dateTimeRangeFields.mjs +53 -0
  10. package/dist/js/components-base/src/list/filter/dateTimeRangeFields.mjs.map +1 -0
  11. package/dist/js/components-base/src/list/filter/formatDateRange.mjs +25 -0
  12. package/dist/js/components-base/src/list/filter/formatDateRange.mjs.map +1 -0
  13. package/dist/js/components-base/src/overlay/OverlayState.mjs +194 -0
  14. package/dist/js/components-base/src/overlay/OverlayState.mjs.map +1 -0
  15. package/dist/js/index.mjs +2 -1
  16. package/dist/js/remote-vue-components/src/components/Action.mjs +1 -1
  17. package/dist/js/remote-vue-components/src/components/DeprecationWarningProvider.mjs +15 -9
  18. package/dist/js/remote-vue-components/src/components/DeprecationWarningProvider.mjs.map +1 -1
  19. package/dist/js/remote-vue-components/src/list/ActiveFilters.mjs +5 -2
  20. package/dist/js/remote-vue-components/src/list/ActiveFilters.mjs.map +1 -1
  21. package/dist/js/remote-vue-components/src/list/AllFiltersModal.mjs +3 -2
  22. package/dist/js/remote-vue-components/src/list/AllFiltersModal.mjs.map +1 -1
  23. package/dist/js/remote-vue-components/src/list/DateTimeRangeFields.mjs +100 -0
  24. package/dist/js/remote-vue-components/src/list/DateTimeRangeFields.mjs.map +1 -0
  25. package/dist/js/remote-vue-components/src/list/Header.mjs +12 -7
  26. package/dist/js/remote-vue-components/src/list/Header.mjs.map +1 -1
  27. package/dist/js/remote-vue-components/src/list/dateRangeFilter.mjs +14 -6
  28. package/dist/js/remote-vue-components/src/list/dateRangeFilter.mjs.map +1 -1
  29. package/dist/js/remote-vue-components/src/list/locales.mjs +14 -0
  30. package/dist/js/remote-vue-components/src/list/locales.mjs.map +1 -1
  31. package/dist/js/remote-vue-components/src/list/styles.mjs +7 -1
  32. package/dist/js/remote-vue-components/src/list/styles.mjs.map +1 -1
  33. package/dist/js/remote-vue-components/src/overlays/Modal.mjs +14 -18
  34. package/dist/js/remote-vue-components/src/overlays/Modal.mjs.map +1 -1
  35. package/dist/js/remote-vue-components/src/overlays/overlayController.mjs +57 -63
  36. package/dist/js/remote-vue-components/src/overlays/overlayController.mjs.map +1 -1
  37. package/dist/js/remote-vue-components/src/version.mjs +1 -1
  38. package/dist/types/_bundled/flow-components-base/index.d.ts +4 -1
  39. package/dist/types/_bundled/flow-components-base/list/filter/ListFilter.d.ts +2 -0
  40. package/dist/types/_bundled/flow-components-base/list/filter/dateRange.d.ts +24 -1
  41. package/dist/types/_bundled/flow-components-base/list/filter/dateTimeRangeFields.d.ts +34 -0
  42. package/dist/types/_bundled/flow-components-base/list/filter/formatDateRange.d.ts +7 -0
  43. package/dist/types/_bundled/flow-components-base/overlay/OverlayState.d.ts +94 -0
  44. package/dist/types/components/DeprecationWarningProvider.d.ts +2 -4
  45. package/dist/types/list/DateTimeRangeFields.d.ts +43 -0
  46. package/dist/types/list/dateRangeFilter.d.ts +6 -6
  47. package/dist/types/list/index.d.ts +1 -0
  48. package/dist/types/list/locales.d.ts +14 -0
  49. package/dist/types/list/styles.d.ts +6 -0
  50. package/dist/types/list/types.d.ts +8 -2
  51. package/dist/types/overlays/Modal.d.ts +2 -2
  52. package/dist/types/overlays/overlayController.d.ts +28 -18
  53. package/package.json +14 -14
@@ -1 +1 @@
1
- {"version":3,"file":"dateRangeFilter.mjs","names":[],"sources":["../../../../../src/list/dateRangeFilter.ts"],"sourcesContent":["import { ListDateRangeFilter } from \"@mittwald/flow-components-base\";\nimport type {\n ListDateParts,\n ListDateRange,\n ListModelContext,\n} from \"@mittwald/flow-components-base\";\nimport type { ListRendered, VueListFilterShape } from \"./types\";\n\n/**\n * A date-range filter, with the options its calendar takes.\n *\n * The column, the comparison and the stored value are the shared\n * `ListDateRangeFilter`, so a Vue list and a React list filter the same dates\n * the same way. What a binding adds is only what its calendar accepts.\n */\nexport class DateRangeFilter<T = never> extends ListDateRangeFilter<\n T,\n never,\n ListRendered\n> {\n /** Handed to the `RangeCalendar` — a minimum date, unavailable days, … */\n public readonly dateRangeOptions?: Record<string, unknown>;\n\n public constructor(\n context: ListModelContext<T>,\n shape: VueListFilterShape<T>,\n ) {\n super(context, shape as never);\n this.dateRangeOptions = (\n shape as { dateRangeOptions?: Record<string, unknown> }\n ).dateRangeOptions;\n }\n}\n\n/** Whether a filter is one of these, without reaching for the class. */\nexport const isDateRangeFilter = (filter: {\n readonly mode: string;\n}): filter is DateRangeFilter<never> => filter.mode === \"dateRange\";\n\n/** `01/03/2024`, the way `Intl` writes it for the host's locale. */\nexport const formatDate = (date: ListDateParts): string =>\n new Date(date.year, date.month - 1, date.day).toLocaleDateString();\n\nexport const formatDateRange = (range: ListDateRange): string =>\n [range.start, range.end]\n .map((date) => (date ? formatDate(date) : \"\"))\n .join(\" - \");\n"],"mappings":";;;;;;;;;;AAeA,IAAa,kBAAb,cAAgD,oBAI9C;;CAEA;CAEA,YACE,SACA,OACA;EACA,MAAM,SAAS,KAAc;EAC7B,KAAK,mBACH,MACA;CACJ;AACF;;AAGA,IAAa,qBAAqB,WAEM,OAAO,SAAS;;AAGxD,IAAa,cAAc,SACzB,IAAI,KAAK,KAAK,MAAM,KAAK,QAAQ,GAAG,KAAK,GAAG,CAAC,CAAC,mBAAmB;AAEnE,IAAa,mBAAmB,UAC9B,CAAC,MAAM,OAAO,MAAM,GAAG,CAAC,CACrB,KAAK,SAAU,OAAO,WAAW,IAAI,IAAI,EAAG,CAAC,CAC7C,KAAK,KAAK"}
1
+ {"version":3,"file":"dateRangeFilter.mjs","names":[],"sources":["../../../../../src/list/dateRangeFilter.ts"],"sourcesContent":["import { ListDateRangeFilter } from \"@mittwald/flow-components-base\";\nimport type {\n ListDateTimeRangeLimits,\n ListModelContext,\n} from \"@mittwald/flow-components-base\";\nimport type { ListRendered, VueListFilterShape } from \"./types\";\n\n/**\n * A date-range filter, with the options its fields take.\n *\n * The column, the comparison and the stored value are the shared\n * `ListDateRangeFilter`, so a Vue list and a React list filter the same dates\n * the same way. What a binding adds is only what its fields accept.\n */\nexport class DateRangeFilter<T = never> extends ListDateRangeFilter<\n T,\n never,\n ListRendered\n> {\n /** Handed to the `RangeCalendar` — a minimum date, unavailable days, … */\n public readonly dateRangeOptions?: Record<string, unknown>;\n\n public constructor(\n context: ListModelContext<T>,\n shape: VueListFilterShape<T>,\n ) {\n super(context, shape as never);\n this.dateRangeOptions = (\n shape as { dateRangeOptions?: Record<string, unknown> }\n ).dateRangeOptions;\n }\n\n public get granularity(): \"day\" | \"minute\" {\n return this.dateRangeOptions?.granularity === \"minute\" ? \"minute\" : \"day\";\n }\n\n public get rangeCalendarProps(): Record<string, unknown> {\n if (this.granularity === \"minute\") {\n return {};\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { granularity, ...props } = this.dateRangeOptions ?? {};\n return props;\n }\n\n public get dateTimeRangeLimits(): ListDateTimeRangeLimits | undefined {\n return this.granularity === \"minute\"\n ? (this.dateRangeOptions as ListDateTimeRangeLimits)\n : undefined;\n }\n}\n\n/** Whether a filter is one of these, without reaching for the class. */\nexport const isDateRangeFilter = (filter: {\n readonly mode: string;\n}): filter is DateRangeFilter<never> => filter.mode === \"dateRange\";\n"],"mappings":";;;;;;;;;;AAcA,IAAa,kBAAb,cAAgD,oBAI9C;;CAEA;CAEA,YACE,SACA,OACA;EACA,MAAM,SAAS,KAAc;EAC7B,KAAK,mBACH,MACA;CACJ;CAEA,IAAW,cAAgC;EACzC,OAAO,KAAK,kBAAkB,gBAAgB,WAAW,WAAW;CACtE;CAEA,IAAW,qBAA8C;EACvD,IAAI,KAAK,gBAAgB,UACvB,OAAO,CAAC;EAGV,MAAM,EAAE,aAAa,GAAG,UAAU,KAAK,oBAAoB,CAAC;EAC5D,OAAO;CACT;CAEA,IAAW,sBAA2D;EACpE,OAAO,KAAK,gBAAgB,WACvB,KAAK,mBACN,KAAA;CACN;AACF;;AAGA,IAAa,qBAAqB,WAEM,OAAO,SAAS"}
@@ -4,6 +4,13 @@ import { computed } from "vue";
4
4
  var texts = {
5
5
  "en-US": {
6
6
  dateRange: "Date range",
7
+ "dateRange.endBeforeStart": "The end must not be before the start.",
8
+ "dateRange.endDate": "End date",
9
+ "dateRange.endTime": "End time",
10
+ "dateRange.from": "from {date}",
11
+ "dateRange.startDate": "Start date",
12
+ "dateRange.startTime": "Start time",
13
+ "dateRange.until": "until {date}",
7
14
  filters: "Filters",
8
15
  "filters.all": "All filters",
9
16
  "filters.clear": "Clear filters",
@@ -34,6 +41,13 @@ var texts = {
34
41
  },
35
42
  "de-DE": {
36
43
  dateRange: "Zeitraum",
44
+ "dateRange.endBeforeStart": "Das Ende darf nicht vor dem Start liegen.",
45
+ "dateRange.endDate": "Enddatum",
46
+ "dateRange.endTime": "Endzeit",
47
+ "dateRange.from": "ab {date}",
48
+ "dateRange.startDate": "Startdatum",
49
+ "dateRange.startTime": "Startzeit",
50
+ "dateRange.until": "bis {date}",
37
51
  filters: "Filter",
38
52
  "filters.all": "Alle Filter",
39
53
  "filters.clear": "Filter entfernen",
@@ -1 +1 @@
1
- {"version":3,"file":"locales.mjs","names":[],"sources":["../../../../../src/list/locales.ts"],"sourcesContent":["import { useLanguage } from \"@/composables/remoteContext\";\nimport { computed, type ComputedRef } from \"vue\";\n\n/*\n * Copied from `packages/components/src/components/List/locales/*.locale.json`.\n *\n * Flow's strings are compiled into the React bundle by a locale plugin and are\n * not importable from a published package, so a Vue binding has to carry its\n * own — the same trade as the overlays' strings (`src/overlays/locales.ts`), at\n * a larger count. A rewording on the Flow side fails\n * `src/tests/CopiedTexts.test.ts`.\n */\nexport const texts = {\n \"en-US\": {\n dateRange: \"Date range\",\n filters: \"Filters\",\n \"filters.all\": \"All filters\",\n \"filters.clear\": \"Clear filters\",\n \"filters.clearSelection\": \"Clear selection\",\n \"filters.deselectAll\": \"Deselect all\",\n \"filters.reset\": \"Reset filters\",\n \"filters.selectAll\": \"Select all\",\n \"filters.store\": \"Store filters\",\n loadingMore: \"Loading more items\",\n \"noItems.heading\": \"No items available\",\n \"noItems.text\":\n \"Once there are items available, they will be displayed here.\",\n \"noResult.heading\": \"No search results found\",\n \"noResult.text\":\n \"Your search did not return any results. Please adjust the search query or your filters.\",\n options: \"Options\",\n paginationInfo: \"Showing {visibleItemsCount} of {totalItemsCount}\",\n reset: \"Reset\",\n /*\n * One key per branch, because Flow's is ICU (`{n, select, 1 {…} other {…}}`)\n * and this binding carries a `{name}` formatter rather than an ICU parser.\n * The two branches are picked in code — see `AllFiltersModal`.\n */\n \"results.show.one\": \"Show {totalItemCount} result\",\n \"results.show.other\": \"Show {totalItemCount} Results\",\n settings: \"Settings\",\n \"settings.viewMode\": \"View\",\n \"settings.viewMode.list\": \"List\",\n \"settings.viewMode.table\": \"Table\",\n \"settings.viewMode.tiles\": \"Tiles\",\n showMore: \"Show more\",\n sorting: \"Sorting\",\n \"toggleExpandButton.collapse\": \"Show less\",\n \"toggleExpandButton.expand\": \"Show more\",\n },\n \"de-DE\": {\n dateRange: \"Zeitraum\",\n filters: \"Filter\",\n \"filters.all\": \"Alle Filter\",\n \"filters.clear\": \"Filter entfernen\",\n \"filters.clearSelection\": \"Auswahl aufheben\",\n \"filters.deselectAll\": \"Alle abwählen\",\n \"filters.reset\": \"Filter zurücksetzen\",\n \"filters.selectAll\": \"Alle auswählen\",\n \"filters.store\": \"Filter speichern\",\n loadingMore: \"Weitere Einträge werden geladen\",\n \"noItems.heading\": \"Keine Einträge vorhanden\",\n \"noItems.text\":\n \"Sobald Einträge vorhanden sind, werden sie hier angezeigt.\",\n \"noResult.heading\": \"Keine Suchergebnisse gefunden\",\n \"noResult.text\":\n \"Deine Suche ergab keine Ergebnisse. Bitte passe die Suchanfrage oder deine Filter an.\",\n options: \"Optionen\",\n paginationInfo:\n \"{visibleItemsCount} von insgesamt {totalItemsCount} angezeigt\",\n reset: \"Zurücksetzen\",\n \"results.show.one\": \"{totalItemCount} Ergebnis anzeigen\",\n \"results.show.other\": \"{totalItemCount} Ergebnisse anzeigen\",\n settings: \"Einstellungen\",\n \"settings.viewMode\": \"Ansicht\",\n \"settings.viewMode.list\": \"Liste\",\n \"settings.viewMode.table\": \"Tabelle\",\n \"settings.viewMode.tiles\": \"Raster\",\n showMore: \"Mehr anzeigen\",\n sorting: \"Sortierung\",\n \"toggleExpandButton.collapse\": \"Weniger anzeigen\",\n \"toggleExpandButton.expand\": \"Mehr anzeigen\",\n },\n} as const;\n\nexport type ListTextKey = keyof (typeof texts)[\"en-US\"];\n\nexport type ListTextFormatter = (\n key: ListTextKey,\n values?: Record<string, string | number>,\n) => string;\n\n/**\n * The list's texts in the host's language.\n *\n * Only `{name}` placeholders, not ICU: the two strings that interpolate count\n * items, and neither pluralizes. A string that needed a plural rule would need\n * a formatter, and the honest fix then is `@flr-generate` on the List rather\n * than an ICU parser in a binding.\n */\nexport const useListTexts = (): ComputedRef<ListTextFormatter> => {\n const language = useLanguage();\n\n return computed(() => {\n const table = language.value?.startsWith(\"de\")\n ? texts[\"de-DE\"]\n : texts[\"en-US\"];\n\n return (key, values = {}) =>\n table[key].replace(/\\{(\\w+)\\}/g, (placeholder, name: string) =>\n name in values ? String(values[name]) : placeholder,\n );\n });\n};\n"],"mappings":";;;AAYA,IAAa,QAAQ;CACnB,SAAS;EACP,WAAW;EACX,SAAS;EACT,eAAe;EACf,iBAAiB;EACjB,0BAA0B;EAC1B,uBAAuB;EACvB,iBAAiB;EACjB,qBAAqB;EACrB,iBAAiB;EACjB,aAAa;EACb,mBAAmB;EACnB,gBACE;EACF,oBAAoB;EACpB,iBACE;EACF,SAAS;EACT,gBAAgB;EAChB,OAAO;EAMP,oBAAoB;EACpB,sBAAsB;EACtB,UAAU;EACV,qBAAqB;EACrB,0BAA0B;EAC1B,2BAA2B;EAC3B,2BAA2B;EAC3B,UAAU;EACV,SAAS;EACT,+BAA+B;EAC/B,6BAA6B;CAC/B;CACA,SAAS;EACP,WAAW;EACX,SAAS;EACT,eAAe;EACf,iBAAiB;EACjB,0BAA0B;EAC1B,uBAAuB;EACvB,iBAAiB;EACjB,qBAAqB;EACrB,iBAAiB;EACjB,aAAa;EACb,mBAAmB;EACnB,gBACE;EACF,oBAAoB;EACpB,iBACE;EACF,SAAS;EACT,gBACE;EACF,OAAO;EACP,oBAAoB;EACpB,sBAAsB;EACtB,UAAU;EACV,qBAAqB;EACrB,0BAA0B;EAC1B,2BAA2B;EAC3B,2BAA2B;EAC3B,UAAU;EACV,SAAS;EACT,+BAA+B;EAC/B,6BAA6B;CAC/B;AACF;;;;;;;;;AAiBA,IAAa,qBAAqD;CAChE,MAAM,WAAW,YAAY;CAE7B,OAAO,eAAe;EACpB,MAAM,QAAQ,SAAS,OAAO,WAAW,IAAI,IACzC,MAAM,WACN,MAAM;EAEV,QAAQ,KAAK,SAAS,CAAC,MACrB,MAAM,IAAI,CAAC,QAAQ,eAAe,aAAa,SAC7C,QAAQ,SAAS,OAAO,OAAO,KAAK,IAAI,WAC1C;CACJ,CAAC;AACH"}
1
+ {"version":3,"file":"locales.mjs","names":[],"sources":["../../../../../src/list/locales.ts"],"sourcesContent":["import { useLanguage } from \"@/composables/remoteContext\";\nimport { computed, type ComputedRef } from \"vue\";\n\n/*\n * Copied from `packages/components/src/components/List/locales/*.locale.json`.\n *\n * Flow's strings are compiled into the React bundle by a locale plugin and are\n * not importable from a published package, so a Vue binding has to carry its\n * own — the same trade as the overlays' strings (`src/overlays/locales.ts`), at\n * a larger count. A rewording on the Flow side fails\n * `src/tests/CopiedTexts.test.ts`.\n */\nexport const texts = {\n \"en-US\": {\n dateRange: \"Date range\",\n \"dateRange.endBeforeStart\": \"The end must not be before the start.\",\n \"dateRange.endDate\": \"End date\",\n \"dateRange.endTime\": \"End time\",\n \"dateRange.from\": \"from {date}\",\n \"dateRange.startDate\": \"Start date\",\n \"dateRange.startTime\": \"Start time\",\n \"dateRange.until\": \"until {date}\",\n filters: \"Filters\",\n \"filters.all\": \"All filters\",\n \"filters.clear\": \"Clear filters\",\n \"filters.clearSelection\": \"Clear selection\",\n \"filters.deselectAll\": \"Deselect all\",\n \"filters.reset\": \"Reset filters\",\n \"filters.selectAll\": \"Select all\",\n \"filters.store\": \"Store filters\",\n loadingMore: \"Loading more items\",\n \"noItems.heading\": \"No items available\",\n \"noItems.text\":\n \"Once there are items available, they will be displayed here.\",\n \"noResult.heading\": \"No search results found\",\n \"noResult.text\":\n \"Your search did not return any results. Please adjust the search query or your filters.\",\n options: \"Options\",\n paginationInfo: \"Showing {visibleItemsCount} of {totalItemsCount}\",\n reset: \"Reset\",\n /*\n * One key per branch, because Flow's is ICU (`{n, select, 1 {…} other {…}}`)\n * and this binding carries a `{name}` formatter rather than an ICU parser.\n * The two branches are picked in code — see `AllFiltersModal`.\n */\n \"results.show.one\": \"Show {totalItemCount} result\",\n \"results.show.other\": \"Show {totalItemCount} Results\",\n settings: \"Settings\",\n \"settings.viewMode\": \"View\",\n \"settings.viewMode.list\": \"List\",\n \"settings.viewMode.table\": \"Table\",\n \"settings.viewMode.tiles\": \"Tiles\",\n showMore: \"Show more\",\n sorting: \"Sorting\",\n \"toggleExpandButton.collapse\": \"Show less\",\n \"toggleExpandButton.expand\": \"Show more\",\n },\n \"de-DE\": {\n dateRange: \"Zeitraum\",\n \"dateRange.endBeforeStart\": \"Das Ende darf nicht vor dem Start liegen.\",\n \"dateRange.endDate\": \"Enddatum\",\n \"dateRange.endTime\": \"Endzeit\",\n \"dateRange.from\": \"ab {date}\",\n \"dateRange.startDate\": \"Startdatum\",\n \"dateRange.startTime\": \"Startzeit\",\n \"dateRange.until\": \"bis {date}\",\n filters: \"Filter\",\n \"filters.all\": \"Alle Filter\",\n \"filters.clear\": \"Filter entfernen\",\n \"filters.clearSelection\": \"Auswahl aufheben\",\n \"filters.deselectAll\": \"Alle abwählen\",\n \"filters.reset\": \"Filter zurücksetzen\",\n \"filters.selectAll\": \"Alle auswählen\",\n \"filters.store\": \"Filter speichern\",\n loadingMore: \"Weitere Einträge werden geladen\",\n \"noItems.heading\": \"Keine Einträge vorhanden\",\n \"noItems.text\":\n \"Sobald Einträge vorhanden sind, werden sie hier angezeigt.\",\n \"noResult.heading\": \"Keine Suchergebnisse gefunden\",\n \"noResult.text\":\n \"Deine Suche ergab keine Ergebnisse. Bitte passe die Suchanfrage oder deine Filter an.\",\n options: \"Optionen\",\n paginationInfo:\n \"{visibleItemsCount} von insgesamt {totalItemsCount} angezeigt\",\n reset: \"Zurücksetzen\",\n \"results.show.one\": \"{totalItemCount} Ergebnis anzeigen\",\n \"results.show.other\": \"{totalItemCount} Ergebnisse anzeigen\",\n settings: \"Einstellungen\",\n \"settings.viewMode\": \"Ansicht\",\n \"settings.viewMode.list\": \"Liste\",\n \"settings.viewMode.table\": \"Tabelle\",\n \"settings.viewMode.tiles\": \"Raster\",\n showMore: \"Mehr anzeigen\",\n sorting: \"Sortierung\",\n \"toggleExpandButton.collapse\": \"Weniger anzeigen\",\n \"toggleExpandButton.expand\": \"Mehr anzeigen\",\n },\n} as const;\n\nexport type ListTextKey = keyof (typeof texts)[\"en-US\"];\n\nexport type ListTextFormatter = (\n key: ListTextKey,\n values?: Record<string, string | number>,\n) => string;\n\n/**\n * The list's texts in the host's language.\n *\n * Only `{name}` placeholders, not ICU: the two strings that interpolate count\n * items, and neither pluralizes. A string that needed a plural rule would need\n * a formatter, and the honest fix then is `@flr-generate` on the List rather\n * than an ICU parser in a binding.\n */\nexport const useListTexts = (): ComputedRef<ListTextFormatter> => {\n const language = useLanguage();\n\n return computed(() => {\n const table = language.value?.startsWith(\"de\")\n ? texts[\"de-DE\"]\n : texts[\"en-US\"];\n\n return (key, values = {}) =>\n table[key].replace(/\\{(\\w+)\\}/g, (placeholder, name: string) =>\n name in values ? String(values[name]) : placeholder,\n );\n });\n};\n"],"mappings":";;;AAYA,IAAa,QAAQ;CACnB,SAAS;EACP,WAAW;EACX,4BAA4B;EAC5B,qBAAqB;EACrB,qBAAqB;EACrB,kBAAkB;EAClB,uBAAuB;EACvB,uBAAuB;EACvB,mBAAmB;EACnB,SAAS;EACT,eAAe;EACf,iBAAiB;EACjB,0BAA0B;EAC1B,uBAAuB;EACvB,iBAAiB;EACjB,qBAAqB;EACrB,iBAAiB;EACjB,aAAa;EACb,mBAAmB;EACnB,gBACE;EACF,oBAAoB;EACpB,iBACE;EACF,SAAS;EACT,gBAAgB;EAChB,OAAO;EAMP,oBAAoB;EACpB,sBAAsB;EACtB,UAAU;EACV,qBAAqB;EACrB,0BAA0B;EAC1B,2BAA2B;EAC3B,2BAA2B;EAC3B,UAAU;EACV,SAAS;EACT,+BAA+B;EAC/B,6BAA6B;CAC/B;CACA,SAAS;EACP,WAAW;EACX,4BAA4B;EAC5B,qBAAqB;EACrB,qBAAqB;EACrB,kBAAkB;EAClB,uBAAuB;EACvB,uBAAuB;EACvB,mBAAmB;EACnB,SAAS;EACT,eAAe;EACf,iBAAiB;EACjB,0BAA0B;EAC1B,uBAAuB;EACvB,iBAAiB;EACjB,qBAAqB;EACrB,iBAAiB;EACjB,aAAa;EACb,mBAAmB;EACnB,gBACE;EACF,oBAAoB;EACpB,iBACE;EACF,SAAS;EACT,gBACE;EACF,OAAO;EACP,oBAAoB;EACpB,sBAAsB;EACtB,UAAU;EACV,qBAAqB;EACrB,0BAA0B;EAC1B,2BAA2B;EAC3B,2BAA2B;EAC3B,UAAU;EACV,SAAS;EACT,+BAA+B;EAC/B,6BAA6B;CAC/B;AACF;;;;;;;;;AAiBA,IAAa,qBAAqD;CAChE,MAAM,WAAW,YAAY;CAE7B,OAAO,eAAe;EACpB,MAAM,QAAQ,SAAS,OAAO,WAAW,IAAI,IACzC,MAAM,WACN,MAAM;EAEV,QAAQ,KAAK,SAAS,CAAC,MACrB,MAAM,IAAI,CAAC,QAAQ,eAAe,aAAa,SAC7C,QAAQ,SAAS,OAAO,OAAO,KAAK,IAAI,WAC1C;CACJ,CAAC;AACH"}
@@ -20,6 +20,12 @@ var listStyles = {
20
20
  hideVisuallyActions: "flow--list--header--hide-visually-actions",
21
21
  selectAllCheckbox: "flow--list--header--all-filters-modal--select-all-checkbox"
22
22
  };
23
+ var dateTimeRangeStyles = {
24
+ calendar: "flow--list--header--filter-context-menu--calendar",
25
+ popover: "flow--list--header--filter-context-menu--date-time-range",
26
+ fields: "flow--list--header--date-time-range-fields",
27
+ rangeError: "flow--list--header--date-time-range-fields--range-error"
28
+ };
23
29
  /** The list item view's own classes, from `ListItemView.module.scss`. */
24
30
  var itemViewStyles = { action: "flow--list--list-item-view--action" };
25
31
  var className = (...parts) => {
@@ -27,6 +33,6 @@ var className = (...parts) => {
27
33
  return used.length > 0 ? used.join(" ") : void 0;
28
34
  };
29
35
  //#endregion
30
- export { className, itemViewStyles, listStyles };
36
+ export { className, dateTimeRangeStyles, itemViewStyles, listStyles };
31
37
 
32
38
  //# sourceMappingURL=styles.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.mjs","names":[],"sources":["../../../../../src/list/styles.ts"],"sourcesContent":["/*\n * Flow's own class names, from the List's CSS modules.\n *\n * Generated from each file's path (`flow--list--header--options` is\n * `Header.module.scss`'s `.options`), shipped in `@mittwald/flow-stylesheet`,\n * and not importable from a published package — so a Vue rebuild of a React\n * composition has to name them. The same trade `Modal` makes, and the same\n * argument for marking `List` `@flr-generate` instead.\n */\nexport const listStyles = {\n list: \"flow--list\",\n listWrapper: \"flow--list--list-wrapper\",\n hideVisuallyEmptyView: \"flow--list--hide-visually-empty-view\",\n items: \"flow--list--items\",\n itemsLoading: \"flow--list--items--is-loading\",\n itemsTiles: \"flow--list--items--tiles\",\n footer: \"flow--list--footer\",\n header: \"flow--list--header\",\n headerContent: \"flow--list--header--header-content\",\n headerOptions: \"flow--list--header--options\",\n headerWithSearch: \"flow--list--header--with-search\",\n headerActions: \"flow--list--header--actions\",\n headerAction: \"flow--list--header--action\",\n hideOnMobile: \"flow--list--header--hide-on-mobile\",\n hideOnDesktop: \"flow--list--header--hide-on-desktop\",\n activeFilters: \"flow--list--header--active-filters\",\n searchField: \"flow--list--header--search-field\",\n hideVisuallyActions: \"flow--list--header--hide-visually-actions\",\n selectAllCheckbox:\n \"flow--list--header--all-filters-modal--select-all-checkbox\",\n} as const;\n\n/** The list item view's own classes, from `ListItemView.module.scss`. */\nexport const itemViewStyles = {\n action: \"flow--list--list-item-view--action\",\n} as const;\n\nexport const className = (\n ...parts: (string | false | undefined)[]\n): string | undefined => {\n const used = parts.filter((p): p is string => !!p);\n return used.length > 0 ? used.join(\" \") : undefined;\n};\n"],"mappings":";AASA,IAAa,aAAa;CACxB,MAAM;CACN,aAAa;CACb,uBAAuB;CACvB,OAAO;CACP,cAAc;CACd,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,eAAe;CACf,eAAe;CACf,kBAAkB;CAClB,eAAe;CACf,cAAc;CACd,cAAc;CACd,eAAe;CACf,eAAe;CACf,aAAa;CACb,qBAAqB;CACrB,mBACE;AACJ;;AAGA,IAAa,iBAAiB,EAC5B,QAAQ,qCACV;AAEA,IAAa,aACX,GAAG,UACoB;CACvB,MAAM,OAAO,MAAM,QAAQ,MAAmB,CAAC,CAAC,CAAC;CACjD,OAAO,KAAK,SAAS,IAAI,KAAK,KAAK,GAAG,IAAI,KAAA;AAC5C"}
1
+ {"version":3,"file":"styles.mjs","names":[],"sources":["../../../../../src/list/styles.ts"],"sourcesContent":["/*\n * Flow's own class names, from the List's CSS modules.\n *\n * Generated from each file's path (`flow--list--header--options` is\n * `Header.module.scss`'s `.options`), shipped in `@mittwald/flow-stylesheet`,\n * and not importable from a published package — so a Vue rebuild of a React\n * composition has to name them. The same trade `Modal` makes, and the same\n * argument for marking `List` `@flr-generate` instead.\n */\nexport const listStyles = {\n list: \"flow--list\",\n listWrapper: \"flow--list--list-wrapper\",\n hideVisuallyEmptyView: \"flow--list--hide-visually-empty-view\",\n items: \"flow--list--items\",\n itemsLoading: \"flow--list--items--is-loading\",\n itemsTiles: \"flow--list--items--tiles\",\n footer: \"flow--list--footer\",\n header: \"flow--list--header\",\n headerContent: \"flow--list--header--header-content\",\n headerOptions: \"flow--list--header--options\",\n headerWithSearch: \"flow--list--header--with-search\",\n headerActions: \"flow--list--header--actions\",\n headerAction: \"flow--list--header--action\",\n hideOnMobile: \"flow--list--header--hide-on-mobile\",\n hideOnDesktop: \"flow--list--header--hide-on-desktop\",\n activeFilters: \"flow--list--header--active-filters\",\n searchField: \"flow--list--header--search-field\",\n hideVisuallyActions: \"flow--list--header--hide-visually-actions\",\n selectAllCheckbox:\n \"flow--list--header--all-filters-modal--select-all-checkbox\",\n} as const;\n\n/*\n * The date-range filter's classes, from `FilterContextMenus.module.scss` and\n * `DateTimeRangeFields.module.scss`.\n */\nexport const dateTimeRangeStyles = {\n calendar: \"flow--list--header--filter-context-menu--calendar\",\n popover: \"flow--list--header--filter-context-menu--date-time-range\",\n fields: \"flow--list--header--date-time-range-fields\",\n rangeError: \"flow--list--header--date-time-range-fields--range-error\",\n} as const;\n\n/** The list item view's own classes, from `ListItemView.module.scss`. */\nexport const itemViewStyles = {\n action: \"flow--list--list-item-view--action\",\n} as const;\n\nexport const className = (\n ...parts: (string | false | undefined)[]\n): string | undefined => {\n const used = parts.filter((p): p is string => !!p);\n return used.length > 0 ? used.join(\" \") : undefined;\n};\n"],"mappings":";AASA,IAAa,aAAa;CACxB,MAAM;CACN,aAAa;CACb,uBAAuB;CACvB,OAAO;CACP,cAAc;CACd,YAAY;CACZ,QAAQ;CACR,QAAQ;CACR,eAAe;CACf,eAAe;CACf,kBAAkB;CAClB,eAAe;CACf,cAAc;CACd,cAAc;CACd,eAAe;CACf,eAAe;CACf,aAAa;CACb,qBAAqB;CACrB,mBACE;AACJ;AAMA,IAAa,sBAAsB;CACjC,UAAU;CACV,SAAS;CACT,QAAQ;CACR,YAAY;AACd;;AAGA,IAAa,iBAAiB,EAC5B,QAAQ,qCACV;AAEA,IAAa,aACX,GAAG,UACoB;CACvB,MAAM,OAAO,MAAM,QAAQ,MAAmB,CAAC,CAAC,CAAC;CACjD,OAAO,KAAK,SAAS,IAAI,KAAK,KAAK,GAAG,IAAI,KAAA;AAC5C"}
@@ -16,10 +16,10 @@ import { Section } from "../auto-generated/Section.mjs";
16
16
  import { Text } from "../auto-generated/Text.mjs";
17
17
  import { IconClose } from "../icons/components/IconClose.mjs";
18
18
  import { applyChildRules, dynamic, withSlotContent } from "./childProps.mjs";
19
- import { createOverlayControllerFor, isOverlayController, provideOverlayContext, useOverlayHandlers, useOwnController } from "./overlayController.mjs";
19
+ import { createOverlayController, isOverlayController, provideOverlayContext, useConfirmOnCloseSource, useOverlayHandlers, useOwnController } from "./overlayController.mjs";
20
20
  import { Action } from "../components/Action.mjs";
21
21
  import { confirmCloseTexts } from "./locales.mjs";
22
- import { defineComponent, h, onBeforeUnmount, onMounted, useId, watch, watchEffect } from "vue";
22
+ import { defineComponent, h, onMounted, useId, watch } from "vue";
23
23
  //#region src/overlays/Modal.ts
24
24
  var styles = {
25
25
  overlay: "flow--overlay",
@@ -83,11 +83,11 @@ var nestedHeadingRules = (child) => child.type === Heading ? { props: { level: 3
83
83
  children: (grandChild) => grandChild.type === Header ? { children: headingLevel3 } : headingLevel3(grandChild)
84
84
  } : child.type === Header ? { children: headingLevel3 } : void 0;
85
85
  /**
86
- * Asks before a `<Modal confirm-on-close>` closes.
86
+ * Asks before a modal that requires confirmation closes.
87
87
  *
88
- * Bound to the parent's `isConfirmingClose` rather than holding state of its
89
- * own: a dismiss of this modal is then the same event as answering "keep
90
- * editing", and there is one place that decides whether the parent closes.
88
+ * Flow's `useCloseOverlayConfirmationController`: a controller of its own,
89
+ * opened while the parent asks. A dismiss of this modal answers "keep editing",
90
+ * and an answer from anywhere closes it again.
91
91
  *
92
92
  * Annotated rather than inferred — it renders a `Modal` and the `Modal` renders
93
93
  * it, and without an annotation TypeScript cannot break that cycle (TS7022).
@@ -100,7 +100,11 @@ var ConfirmCloseModal = defineComponent({
100
100
  } },
101
101
  setup(props) {
102
102
  const language = useLanguage();
103
- const controller = createOverlayControllerFor(props.parent.isConfirmingClose);
103
+ const controller = createOverlayController();
104
+ watch(() => props.parent.isConfirmingClose.value, (isConfirming) => isConfirming ? controller.open() : controller.close(), { immediate: true });
105
+ controller.addOnClose(() => {
106
+ if (props.parent.isConfirmingClose.value) props.parent.cancelConfirmation();
107
+ });
104
108
  return () => {
105
109
  const texts = language.value?.startsWith("de") ? confirmCloseTexts["de-DE"] : confirmCloseTexts["en-US"];
106
110
  return h(Modal, { controller }, () => [
@@ -152,7 +156,7 @@ var Modal = defineComponent({
152
156
  */
153
157
  confirmOnClose: {
154
158
  type: Boolean,
155
- default: false
159
+ default: void 0
156
160
  },
157
161
  /** A controller to open and close the modal from anywhere. */
158
162
  controller: {
@@ -202,15 +206,7 @@ var Modal = defineComponent({
202
206
  onClose: () => props.onClose,
203
207
  onOpenChange: () => props.onOpenChange
204
208
  });
205
- watchEffect(() => {
206
- controller.value.confirmOnClose.value = props.confirmOnClose;
207
- });
208
- const release = (released) => {
209
- released.confirmOnClose.value = false;
210
- released.isConfirmingClose.value = false;
211
- };
212
- watch(controller, (next, previous) => release(previous));
213
- onBeforeUnmount(() => release(controller.value));
209
+ useConfirmOnCloseSource(() => controller.value, () => props.confirmOnClose);
214
210
  const childRules = (child) => {
215
211
  if (child.type === Heading) return { props: {
216
212
  class: styles.header,
@@ -253,7 +249,7 @@ var Modal = defineComponent({
253
249
  ].filter(Boolean).join(" ");
254
250
  const texts = language.value?.startsWith("de") ? confirmCloseTexts["de-DE"] : confirmCloseTexts["en-US"];
255
251
  const children = applyChildRules(slots.default?.(), childRules).map((child) => child.type === Heading ? withHeaderChrome(child, texts.close, props.showCloseButton) : child);
256
- if (props.confirmOnClose) children.push(h(ConfirmCloseModal, { parent: controller.value }));
252
+ if (controller.value.confirmOnClose.value) children.push(h(ConfirmCloseModal, { parent: controller.value }));
257
253
  return h(ClearPropsContext, null, () => h(OverlayContent, {
258
254
  class: className,
259
255
  isOpen: props.isOpen ?? controller.value.isOpen.value,
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.mjs","names":[],"sources":["../../../../../src/overlays/Modal.ts"],"sourcesContent":["import {\n AccentBox,\n ActionGroup,\n Button,\n ClearPropsContext,\n ColumnLayout,\n Content,\n Div,\n Header,\n Heading,\n OverlayContent,\n Section,\n Text,\n} from \"@/auto-generated\";\nimport { IconClose } from \"@/icons\";\nimport Action from \"@/components/Action\";\nimport { useLanguage } from \"@/composables/remoteContext\";\nimport { confirmCloseTexts } from \"@/overlays/locales\";\nimport {\n applyChildRules,\n dynamic,\n withSlotContent,\n type ChildRules,\n} from \"@/overlays/childProps\";\nimport { readProp } from \"@/lib/propKeys\";\nimport {\n createOverlayControllerFor,\n isOverlayController,\n provideOverlayContext,\n useOwnController,\n useOverlayHandlers,\n type OverlayCloseHandler,\n type OverlayController,\n type OverlayOpenHandler,\n type OverlayOpenStateHandler,\n} from \"@/overlays/overlayController\";\nimport type { AnyRecord } from \"@/lib/types\";\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n useId,\n watch,\n watchEffect,\n type Component,\n type PropType,\n type VNode,\n} from \"vue\";\nimport { composition } from \"@/lib/composition\";\nimport { useComponentUsage } from \"@/composables/useComponentUsage\";\n\nexport type ModalSize = \"s\" | \"m\" | \"l\";\n\n/*\n * Flow's `Modal` is a React composition, not a remote element: it renders an\n * `OverlayContent` and configures the components inside it through a props\n * context — the header, the content padding, the footer spacing. Both halves\n * are rebuilt here, so a Vue app writes `Modal` and not the overlay plumbing.\n *\n * The class names are Flow's own, taken from `Modal.module.scss` by way of the\n * generated `flow--…` names. They are internal, and repeating them is the price\n * of a composition that lives in React: the alternative — marking `Modal`\n * `@flr-generate`, so the host materialises the whole thing from one element —\n * would make this file unnecessary.\n */\nconst styles = {\n overlay: \"flow--overlay\",\n modal: \"flow--modal\",\n offCanvas: \"flow--modal--off-canvas\",\n left: \"flow--modal--left\",\n size: (size: ModalSize) => `flow--modal--size-${size}`,\n header: \"flow--modal--header\",\n headerTitle: \"flow--modal--header-title\",\n closeButton: \"flow--modal--close-button\",\n alwaysVisible: \"flow--modal--always-visible\",\n alwaysHidden: \"flow--modal--always-hidden\",\n content: \"flow--modal--content\",\n columnLayout: \"flow--modal--column-layout\",\n accentBox: \"flow--modal--accent-box\",\n actionGroup: \"flow--modal--action-group\",\n};\n\n/**\n * The chrome Flow puts around a modal's heading: the title in its own\n * container, and the close button beside it.\n *\n * Not props on the heading but a rebuild of what it was handed — the reason\n * `withSlotContent` exists. The close button clears the props context around\n * it, the way Flow's does, so the modal's own rules for `Button` do not reach\n * it, and it closes without asking again: this button _is_ the deliberate way\n * out.\n */\nconst withHeaderChrome = (\n heading: VNode,\n closeLabel: string,\n showCloseButton: boolean | undefined,\n): VNode =>\n withSlotContent(heading, (title) => [\n h(Div, { class: styles.headerTitle }, () => title),\n h(ClearPropsContext, null, () =>\n h(Action, { closeModal: { bypassConfirmation: true } }, () =>\n h(\n Button,\n {\n variant: \"plain\",\n color: \"secondary\",\n \"aria-label\": closeLabel,\n class: [\n styles.closeButton,\n showCloseButton === true\n ? styles.alwaysVisible\n : showCloseButton === false\n ? styles.alwaysHidden\n : undefined,\n ]\n .filter(Boolean)\n .join(\" \"),\n },\n () => h(IconClose),\n ),\n ),\n ),\n ]);\n\n/**\n * Lets an `Action` in the modal's footer close without asking again.\n *\n * Only where the action already closes something: Flow's props context rewrites\n * an existing `closeModal`/`closeOverlay` and adds none, and an `Action` that\n * merely runs something must not be turned into a close button. An explicit\n * `bypassConfirmation` in the object form wins, as in Flow.\n */\nconst withBypassedConfirmation = (child: VNode): AnyRecord | undefined => {\n if (child.type !== Action) {\n return undefined;\n }\n\n const bypassed: AnyRecord = {};\n\n for (const name of [\"closeModal\", \"closeOverlay\"]) {\n const value = readProp(child.props, name);\n\n if (value === undefined || value === null || value === false) {\n continue;\n }\n\n /*\n * A controller names the overlay, like a type name does — spread, it\n * would lose its identity and the action would close the modal instead.\n */\n bypassed[name] = dynamic(\n isOverlayController(value) || (typeof value === \"string\" && value !== \"\")\n ? { bypassConfirmation: true, overlay: value }\n : typeof value === \"object\"\n ? { bypassConfirmation: true, ...value }\n : { bypassConfirmation: true },\n );\n }\n\n return Object.keys(bypassed).length > 0 ? bypassed : undefined;\n};\n\n/*\n * Flow's `nestedHeadingProps`: inside the content, headings are one level\n * down, and a section drops its separator.\n */\nconst headingLevel3: ChildRules = (child) =>\n child.type === Heading ? { props: { level: 3 } } : undefined;\n\nconst nestedHeadingRules: ChildRules = (child) =>\n child.type === Heading\n ? { props: { level: 3 } }\n : child.type === Section\n ? {\n props: { hideSeparator: true },\n children: (grandChild) =>\n grandChild.type === Header\n ? { children: headingLevel3 }\n : headingLevel3(grandChild),\n }\n : child.type === Header\n ? { children: headingLevel3 }\n : undefined;\n\n/**\n * Asks before a `<Modal confirm-on-close>` closes.\n *\n * Bound to the parent's `isConfirmingClose` rather than holding state of its\n * own: a dismiss of this modal is then the same event as answering \"keep\n * editing\", and there is one place that decides whether the parent closes.\n *\n * Annotated rather than inferred — it renders a `Modal` and the `Modal` renders\n * it, and without an annotation TypeScript cannot break that cycle (TS7022).\n */\nconst ConfirmCloseModal: Component = defineComponent({\n name: \"ConfirmCloseModal\",\n\n props: {\n parent: {\n type: Object as PropType<OverlayController>,\n required: true,\n },\n },\n\n setup(props) {\n const language = useLanguage();\n const controller = createOverlayControllerFor(\n props.parent.isConfirmingClose,\n );\n\n return () => {\n const texts = language.value?.startsWith(\"de\")\n ? confirmCloseTexts[\"de-DE\"]\n : confirmCloseTexts[\"en-US\"];\n\n return h(Modal, { controller }, () => [\n h(Heading, null, () => texts.heading),\n h(Content, null, () => h(Text, null, () => texts.text)),\n h(ActionGroup, null, () => [\n h(Action, { onAction: props.parent.confirmClose }, () =>\n h(Button, { color: \"danger\" }, () => texts.close),\n ),\n h(Action, { onAction: props.parent.cancelClose }, () =>\n h(\n Button,\n { color: \"secondary\", variant: \"soft\" },\n () => texts.keepOpen,\n ),\n ),\n ]),\n ]);\n };\n },\n});\n\nexport const Modal = defineComponent({\n name: \"Modal\",\n\n /* Like Flow's, a modal passes on only the props it knows. */\n inheritAttrs: false,\n\n props: {\n /** The size of the modal. @default \"s\" */\n size: { type: String as PropType<ModalSize>, default: \"s\" },\n /** Whether the modal is displayed as an off canvas. */\n offCanvas: { type: Boolean, default: false },\n /** Which side the off canvas comes from. @default \"right\" */\n offCanvasOrientation: {\n type: String as PropType<\"left\" | \"right\">,\n default: \"right\",\n },\n /** Whether a click outside closes the modal. @default true */\n isDismissable: { type: Boolean, default: true },\n /**\n * Whether the close button is always visible (`true`) or always hidden\n * (`false`). By default Flow decides by screen size.\n */\n showCloseButton: { type: Boolean, default: undefined },\n /**\n * Whether closing the modal has to be confirmed — use it to protect unsaved\n * changes.\n */\n confirmOnClose: { type: Boolean, default: false },\n /** A controller to open and close the modal from anywhere. */\n controller: {\n type: Object as PropType<OverlayController>,\n default: undefined,\n },\n /** Whether the modal is open. Use it to control the modal state. */\n isOpen: { type: Boolean, default: undefined },\n /**\n * Whether the modal is open initially, when it has a controller of its own\n * — not one from a trigger or the `controller` prop. @default false\n */\n isDefaultOpen: { type: Boolean, default: undefined },\n /** Called when the modal opens. Returning `false` keeps it closed. */\n onOpen: {\n type: Function as PropType<OverlayOpenHandler>,\n default: undefined,\n },\n /** Called when the modal closes. Returning `false` keeps it open. */\n onClose: {\n type: Function as PropType<OverlayCloseHandler>,\n default: undefined,\n },\n /**\n * Called with the new state whenever the modal opens or closes. Returning\n * `false` aborts the change.\n */\n onOpenChange: {\n type: Function as PropType<OverlayOpenStateHandler>,\n default: undefined,\n },\n },\n\n setup(props, { slots, attrs }) {\n /* Flow's React `Modal` is a `flowComponent` and reports itself. */\n onMounted(useComponentUsage(\"Modal\"));\n\n const language = useLanguage();\n /*\n * The dialog is labelled by its own heading, so the two need an id they\n * agree on. Flow generates one with `useId`; `useId` exists in Vue too,\n * and both sides end up with an id the host rewrites anyway — what has to\n * match is that the heading carries one at all.\n */\n const headingId = useId();\n /*\n * Three ways to own the state, in Flow's order of precedence: a\n * controller the app passes, the controller of a surrounding trigger, or\n * one of its own.\n */\n const controller = useOwnController(\n () => props.controller,\n \"Modal\",\n () => ({ isDefaultOpen: props.isDefaultOpen }),\n );\n\n // So an `Action` inside finds it.\n provideOverlayContext(\"Modal\", () => controller.value);\n\n useOverlayHandlers(() => controller.value, {\n onOpen: () => props.onOpen,\n onClose: () => props.onClose,\n onOpenChange: () => props.onOpenChange,\n });\n\n /*\n * The requirement lives on the controller, not on this component: what\n * asks for the confirmation is a close, and a close arrives at the\n * controller — from an `Action` inside, from the host's dismiss, or from\n * an app holding the controller itself.\n */\n watchEffect(() => {\n controller.value.confirmOnClose.value = props.confirmOnClose;\n });\n\n /*\n * Taken back, because the controller usually outlives the modal: a\n * trigger keeps it, and the next modal it opens would inherit a\n * requirement it never asked for. The same goes for a controller the\n * app swapped for another.\n */\n const release = (released: OverlayController) => {\n released.confirmOnClose.value = false;\n released.isConfirmingClose.value = false;\n };\n watch(controller, (next, previous) => release(previous));\n onBeforeUnmount(() => release(controller.value));\n\n /* Flow's props context for the modal's children, rule for rule. */\n const childRules: ChildRules = (child) => {\n if (child.type === Heading) {\n return { props: { class: styles.header, level: 2, id: headingId } };\n }\n if (child.type === Content) {\n return {\n props: { class: styles.content },\n children: nestedHeadingRules,\n };\n }\n if (child.type === ColumnLayout) {\n return {\n props: { class: styles.columnLayout, l: [2, 1], m: [1] },\n children: (grandChild) =>\n grandChild.type === AccentBox\n ? {\n props: {\n class: styles.accentBox,\n backgroundColor: \"neutral\",\n },\n }\n : nestedHeadingRules(grandChild),\n };\n }\n if (child.type === ActionGroup) {\n /*\n * The footer is the deliberate way out, so its actions close\n * without asking again — the rule Flow's `Modal` writes for\n * `ActionGroup > Action`. An `Action` anywhere else in the modal is\n * an incidental close and is confirmed.\n */\n return {\n props: { class: styles.actionGroup, spacing: \"m\" },\n children: (grandChild) => {\n const props = withBypassedConfirmation(grandChild);\n return props ? { props } : undefined;\n },\n };\n }\n return undefined;\n };\n\n return () => {\n const className = [\n styles.overlay,\n props.offCanvas ? styles.offCanvas : styles.modal,\n styles.size(props.size),\n props.offCanvas && props.offCanvasOrientation === \"left\"\n ? styles.left\n : undefined,\n attrs.class,\n ]\n .filter(Boolean)\n .join(\" \");\n\n const texts = language.value?.startsWith(\"de\")\n ? confirmCloseTexts[\"de-DE\"]\n : confirmCloseTexts[\"en-US\"];\n\n const children: VNode[] = applyChildRules(\n slots.default?.(),\n childRules,\n ).map((child) =>\n child.type === Heading\n ? withHeaderChrome(child, texts.close, props.showCloseButton)\n : child,\n );\n\n if (props.confirmOnClose) {\n children.push(h(ConfirmCloseModal, { parent: controller.value }));\n }\n\n /* A UI component: Flow clears the host's props context around it. */\n return h(ClearPropsContext, null, () =>\n h(\n OverlayContent,\n {\n class: className,\n isOpen: props.isOpen ?? controller.value.isOpen.value,\n isDismissable: props.isDismissable,\n \"aria-labelledby\": headingId,\n onOpenChange: controller.value.setOpen,\n },\n () => children,\n ),\n );\n };\n },\n});\n\ncomposition(ConfirmCloseModal);\ncomposition(Modal);\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAM,SAAS;CACb,SAAS;CACT,OAAO;CACP,WAAW;CACX,MAAM;CACN,OAAO,SAAoB,qBAAqB;CAChD,QAAQ;CACR,aAAa;CACb,aAAa;CACb,eAAe;CACf,cAAc;CACd,SAAS;CACT,cAAc;CACd,WAAW;CACX,aAAa;AACf;;;;;;;;;;;AAYA,IAAM,oBACJ,SACA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O;KAAE,OAAO,OAAO;KAAa,SAAS;IAAI;IACjD,WAAW,eAAe;KACxB,MAAM,QAAQ,yBAAyB,UAAU;KACjD,OAAO,QAAQ,EAAE,MAAM,IAAI,KAAA;IAC7B;GACF;EAGJ;EAEA,aAAa;GACX,MAAM,YAAY;IAChB,OAAO;IACP,MAAM,YAAY,OAAO,YAAY,OAAO;IAC5C,OAAO,KAAK,MAAM,IAAI;IACtB,MAAM,aAAa,MAAM,yBAAyB,SAC9C,OAAO,OACP,KAAA;IACJ,MAAM;GACR,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;GAEX,MAAM,QAAQ,SAAS,OAAO,WAAW,IAAI,IACzC,kBAAkB,WAClB,kBAAkB;GAEtB,MAAM,WAAoB,gBACxB,MAAM,UAAU,GAChB,UACF,CAAC,CAAC,KAAK,UACL,MAAM,SAAS,UACX,iBAAiB,OAAO,MAAM,OAAO,MAAM,eAAe,IAC1D,KACN;GAEA,IAAI,MAAM,gBACR,SAAS,KAAK,EAAE,mBAAmB,EAAE,QAAQ,WAAW,MAAM,CAAC,CAAC;GAIlE,OAAO,EAAE,mBAAmB,YAC1B,EACE,gBACA;IACE,OAAO;IACP,QAAQ,MAAM,UAAU,WAAW,MAAM,OAAO;IAChD,eAAe,MAAM;IACrB,mBAAmB;IACnB,cAAc,WAAW,MAAM;GACjC,SACM,QACR,CACF;EACF;CACF;AACF,CAAC;AAED,YAAY,iBAAiB;AAC7B,YAAY,KAAK"}
1
+ {"version":3,"file":"Modal.mjs","names":[],"sources":["../../../../../src/overlays/Modal.ts"],"sourcesContent":["import {\n AccentBox,\n ActionGroup,\n Button,\n ClearPropsContext,\n ColumnLayout,\n Content,\n Div,\n Header,\n Heading,\n OverlayContent,\n Section,\n Text,\n} from \"@/auto-generated\";\nimport { IconClose } from \"@/icons\";\nimport Action from \"@/components/Action\";\nimport { useLanguage } from \"@/composables/remoteContext\";\nimport { confirmCloseTexts } from \"@/overlays/locales\";\nimport {\n applyChildRules,\n dynamic,\n withSlotContent,\n type ChildRules,\n} from \"@/overlays/childProps\";\nimport { readProp } from \"@/lib/propKeys\";\nimport {\n createOverlayController,\n isOverlayController,\n provideOverlayContext,\n useConfirmOnCloseSource,\n useOwnController,\n useOverlayHandlers,\n type OverlayCloseHandler,\n type OverlayController,\n type OverlayOpenHandler,\n type OverlayOpenStateHandler,\n} from \"@/overlays/overlayController\";\nimport type { AnyRecord } from \"@/lib/types\";\nimport {\n defineComponent,\n h,\n onMounted,\n useId,\n watch,\n type Component,\n type PropType,\n type VNode,\n} from \"vue\";\nimport { composition } from \"@/lib/composition\";\nimport { useComponentUsage } from \"@/composables/useComponentUsage\";\n\nexport type ModalSize = \"s\" | \"m\" | \"l\";\n\n/*\n * Flow's `Modal` is a React composition, not a remote element: it renders an\n * `OverlayContent` and configures the components inside it through a props\n * context — the header, the content padding, the footer spacing. Both halves\n * are rebuilt here, so a Vue app writes `Modal` and not the overlay plumbing.\n *\n * The class names are Flow's own, taken from `Modal.module.scss` by way of the\n * generated `flow--…` names. They are internal, and repeating them is the price\n * of a composition that lives in React: the alternative — marking `Modal`\n * `@flr-generate`, so the host materialises the whole thing from one element —\n * would make this file unnecessary.\n */\nconst styles = {\n overlay: \"flow--overlay\",\n modal: \"flow--modal\",\n offCanvas: \"flow--modal--off-canvas\",\n left: \"flow--modal--left\",\n size: (size: ModalSize) => `flow--modal--size-${size}`,\n header: \"flow--modal--header\",\n headerTitle: \"flow--modal--header-title\",\n closeButton: \"flow--modal--close-button\",\n alwaysVisible: \"flow--modal--always-visible\",\n alwaysHidden: \"flow--modal--always-hidden\",\n content: \"flow--modal--content\",\n columnLayout: \"flow--modal--column-layout\",\n accentBox: \"flow--modal--accent-box\",\n actionGroup: \"flow--modal--action-group\",\n};\n\n/**\n * The chrome Flow puts around a modal's heading: the title in its own\n * container, and the close button beside it.\n *\n * Not props on the heading but a rebuild of what it was handed — the reason\n * `withSlotContent` exists. The close button clears the props context around\n * it, the way Flow's does, so the modal's own rules for `Button` do not reach\n * it, and it closes without asking again: this button _is_ the deliberate way\n * out.\n */\nconst withHeaderChrome = (\n heading: VNode,\n closeLabel: string,\n showCloseButton: boolean | undefined,\n): VNode =>\n withSlotContent(heading, (title) => [\n h(Div, { class: styles.headerTitle }, () => title),\n h(ClearPropsContext, null, () =>\n h(Action, { closeModal: { bypassConfirmation: true } }, () =>\n h(\n Button,\n {\n variant: \"plain\",\n color: \"secondary\",\n \"aria-label\": closeLabel,\n class: [\n styles.closeButton,\n showCloseButton === true\n ? styles.alwaysVisible\n : showCloseButton === false\n ? styles.alwaysHidden\n : undefined,\n ]\n .filter(Boolean)\n .join(\" \"),\n },\n () => h(IconClose),\n ),\n ),\n ),\n ]);\n\n/**\n * Lets an `Action` in the modal's footer close without asking again.\n *\n * Only where the action already closes something: Flow's props context rewrites\n * an existing `closeModal`/`closeOverlay` and adds none, and an `Action` that\n * merely runs something must not be turned into a close button. An explicit\n * `bypassConfirmation` in the object form wins, as in Flow.\n */\nconst withBypassedConfirmation = (child: VNode): AnyRecord | undefined => {\n if (child.type !== Action) {\n return undefined;\n }\n\n const bypassed: AnyRecord = {};\n\n for (const name of [\"closeModal\", \"closeOverlay\"]) {\n const value = readProp(child.props, name);\n\n if (value === undefined || value === null || value === false) {\n continue;\n }\n\n /*\n * A controller names the overlay, like a type name does — spread, it\n * would lose its identity and the action would close the modal instead.\n */\n bypassed[name] = dynamic(\n isOverlayController(value) || (typeof value === \"string\" && value !== \"\")\n ? { bypassConfirmation: true, overlay: value }\n : typeof value === \"object\"\n ? { bypassConfirmation: true, ...value }\n : { bypassConfirmation: true },\n );\n }\n\n return Object.keys(bypassed).length > 0 ? bypassed : undefined;\n};\n\n/*\n * Flow's `nestedHeadingProps`: inside the content, headings are one level\n * down, and a section drops its separator.\n */\nconst headingLevel3: ChildRules = (child) =>\n child.type === Heading ? { props: { level: 3 } } : undefined;\n\nconst nestedHeadingRules: ChildRules = (child) =>\n child.type === Heading\n ? { props: { level: 3 } }\n : child.type === Section\n ? {\n props: { hideSeparator: true },\n children: (grandChild) =>\n grandChild.type === Header\n ? { children: headingLevel3 }\n : headingLevel3(grandChild),\n }\n : child.type === Header\n ? { children: headingLevel3 }\n : undefined;\n\n/**\n * Asks before a modal that requires confirmation closes.\n *\n * Flow's `useCloseOverlayConfirmationController`: a controller of its own,\n * opened while the parent asks. A dismiss of this modal answers \"keep editing\",\n * and an answer from anywhere closes it again.\n *\n * Annotated rather than inferred — it renders a `Modal` and the `Modal` renders\n * it, and without an annotation TypeScript cannot break that cycle (TS7022).\n */\nconst ConfirmCloseModal: Component = defineComponent({\n name: \"ConfirmCloseModal\",\n\n props: {\n parent: {\n type: Object as PropType<OverlayController>,\n required: true,\n },\n },\n\n setup(props) {\n const language = useLanguage();\n const controller = createOverlayController();\n\n watch(\n () => props.parent.isConfirmingClose.value,\n (isConfirming) => (isConfirming ? controller.open() : controller.close()),\n { immediate: true },\n );\n\n controller.addOnClose(() => {\n if (props.parent.isConfirmingClose.value) {\n props.parent.cancelConfirmation();\n }\n });\n\n return () => {\n const texts = language.value?.startsWith(\"de\")\n ? confirmCloseTexts[\"de-DE\"]\n : confirmCloseTexts[\"en-US\"];\n\n return h(Modal, { controller }, () => [\n h(Heading, null, () => texts.heading),\n h(Content, null, () => h(Text, null, () => texts.text)),\n h(ActionGroup, null, () => [\n h(Action, { onAction: props.parent.confirmClose }, () =>\n h(Button, { color: \"danger\" }, () => texts.close),\n ),\n h(Action, { onAction: props.parent.cancelClose }, () =>\n h(\n Button,\n { color: \"secondary\", variant: \"soft\" },\n () => texts.keepOpen,\n ),\n ),\n ]),\n ]);\n };\n },\n});\n\nexport const Modal = defineComponent({\n name: \"Modal\",\n\n /* Like Flow's, a modal passes on only the props it knows. */\n inheritAttrs: false,\n\n props: {\n /** The size of the modal. @default \"s\" */\n size: { type: String as PropType<ModalSize>, default: \"s\" },\n /** Whether the modal is displayed as an off canvas. */\n offCanvas: { type: Boolean, default: false },\n /** Which side the off canvas comes from. @default \"right\" */\n offCanvasOrientation: {\n type: String as PropType<\"left\" | \"right\">,\n default: \"right\",\n },\n /** Whether a click outside closes the modal. @default true */\n isDismissable: { type: Boolean, default: true },\n /**\n * Whether the close button is always visible (`true`) or always hidden\n * (`false`). By default Flow decides by screen size.\n */\n showCloseButton: { type: Boolean, default: undefined },\n /**\n * Whether closing the modal has to be confirmed — use it to protect unsaved\n * changes.\n */\n confirmOnClose: { type: Boolean, default: undefined },\n /** A controller to open and close the modal from anywhere. */\n controller: {\n type: Object as PropType<OverlayController>,\n default: undefined,\n },\n /** Whether the modal is open. Use it to control the modal state. */\n isOpen: { type: Boolean, default: undefined },\n /**\n * Whether the modal is open initially, when it has a controller of its own\n * — not one from a trigger or the `controller` prop. @default false\n */\n isDefaultOpen: { type: Boolean, default: undefined },\n /** Called when the modal opens. Returning `false` keeps it closed. */\n onOpen: {\n type: Function as PropType<OverlayOpenHandler>,\n default: undefined,\n },\n /** Called when the modal closes. Returning `false` keeps it open. */\n onClose: {\n type: Function as PropType<OverlayCloseHandler>,\n default: undefined,\n },\n /**\n * Called with the new state whenever the modal opens or closes. Returning\n * `false` aborts the change.\n */\n onOpenChange: {\n type: Function as PropType<OverlayOpenStateHandler>,\n default: undefined,\n },\n },\n\n setup(props, { slots, attrs }) {\n /* Flow's React `Modal` is a `flowComponent` and reports itself. */\n onMounted(useComponentUsage(\"Modal\"));\n\n const language = useLanguage();\n /*\n * The dialog is labelled by its own heading, so the two need an id they\n * agree on. Flow generates one with `useId`; `useId` exists in Vue too,\n * and both sides end up with an id the host rewrites anyway — what has to\n * match is that the heading carries one at all.\n */\n const headingId = useId();\n /*\n * Three ways to own the state, in Flow's order of precedence: a\n * controller the app passes, the controller of a surrounding trigger, or\n * one of its own.\n */\n const controller = useOwnController(\n () => props.controller,\n \"Modal\",\n () => ({ isDefaultOpen: props.isDefaultOpen }),\n );\n\n // So an `Action` inside finds it.\n provideOverlayContext(\"Modal\", () => controller.value);\n\n useOverlayHandlers(() => controller.value, {\n onOpen: () => props.onOpen,\n onClose: () => props.onClose,\n onOpenChange: () => props.onOpenChange,\n });\n\n /*\n * The requirement lives on the controller, not on this component: what\n * asks for the confirmation is a close, and a close arrives at the\n * controller — from an `Action` inside, from the host's dismiss, or from\n * an app holding the controller itself. It is one source among others,\n * withdrawn when the modal unmounts or its controller changes, because\n * the controller usually outlives the modal.\n */\n useConfirmOnCloseSource(\n () => controller.value,\n () => props.confirmOnClose,\n );\n\n /* Flow's props context for the modal's children, rule for rule. */\n const childRules: ChildRules = (child) => {\n if (child.type === Heading) {\n return { props: { class: styles.header, level: 2, id: headingId } };\n }\n if (child.type === Content) {\n return {\n props: { class: styles.content },\n children: nestedHeadingRules,\n };\n }\n if (child.type === ColumnLayout) {\n return {\n props: { class: styles.columnLayout, l: [2, 1], m: [1] },\n children: (grandChild) =>\n grandChild.type === AccentBox\n ? {\n props: {\n class: styles.accentBox,\n backgroundColor: \"neutral\",\n },\n }\n : nestedHeadingRules(grandChild),\n };\n }\n if (child.type === ActionGroup) {\n /*\n * The footer is the deliberate way out, so its actions close\n * without asking again — the rule Flow's `Modal` writes for\n * `ActionGroup > Action`. An `Action` anywhere else in the modal is\n * an incidental close and is confirmed.\n */\n return {\n props: { class: styles.actionGroup, spacing: \"m\" },\n children: (grandChild) => {\n const props = withBypassedConfirmation(grandChild);\n return props ? { props } : undefined;\n },\n };\n }\n return undefined;\n };\n\n return () => {\n const className = [\n styles.overlay,\n props.offCanvas ? styles.offCanvas : styles.modal,\n styles.size(props.size),\n props.offCanvas && props.offCanvasOrientation === \"left\"\n ? styles.left\n : undefined,\n attrs.class,\n ]\n .filter(Boolean)\n .join(\" \");\n\n const texts = language.value?.startsWith(\"de\")\n ? confirmCloseTexts[\"de-DE\"]\n : confirmCloseTexts[\"en-US\"];\n\n const children: VNode[] = applyChildRules(\n slots.default?.(),\n childRules,\n ).map((child) =>\n child.type === Heading\n ? withHeaderChrome(child, texts.close, props.showCloseButton)\n : child,\n );\n\n if (controller.value.confirmOnClose.value) {\n children.push(h(ConfirmCloseModal, { parent: controller.value }));\n }\n\n /* A UI component: Flow clears the host's props context around it. */\n return h(ClearPropsContext, null, () =>\n h(\n OverlayContent,\n {\n class: className,\n isOpen: props.isOpen ?? controller.value.isOpen.value,\n isDismissable: props.isDismissable,\n \"aria-labelledby\": headingId,\n onOpenChange: controller.value.setOpen,\n },\n () => children,\n ),\n );\n };\n },\n});\n\ncomposition(ConfirmCloseModal);\ncomposition(Modal);\n\nexport default Modal;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiEA,IAAM,SAAS;CACb,SAAS;CACT,OAAO;CACP,WAAW;CACX,MAAM;CACN,OAAO,SAAoB,qBAAqB;CAChD,QAAQ;CACR,aAAa;CACb,aAAa;CACb,eAAe;CACf,cAAc;CACd,SAAS;CACT,cAAc;CACd,WAAW;CACX,aAAa;AACf;;;;;;;;;;;AAYA,IAAM,oBACJ,SACA,YACA,oBAEA,gBAAgB,UAAU,UAAU,CAClC,EAAE,KAAK,EAAE,OAAO,OAAO,YAAY,SAAS,KAAK,GACjD,EAAE,mBAAmB,YACnB,EAAE,QAAQ,EAAE,YAAY,EAAE,oBAAoB,KAAK,EAAE,SACnD,EACE,QACA;CACE,SAAS;CACT,OAAO;CACP,cAAc;CACd,OAAO,CACL,OAAO,aACP,oBAAoB,OAChB,OAAO,gBACP,oBAAoB,QAClB,OAAO,eACP,KAAA,CACR,CAAC,CACE,OAAO,OAAO,CAAC,CACf,KAAK,GAAG;AACb,SACM,EAAE,SAAS,CACnB,CACF,CACF,CACF,CAAC;;;;;;;;;AAUH,IAAM,4BAA4B,UAAwC;CACxE,IAAI,MAAM,SAAS,QACjB;CAGF,MAAM,WAAsB,CAAC;CAE7B,KAAK,MAAM,QAAQ,CAAC,cAAc,cAAc,GAAG;EACjD,MAAM,QAAQ,SAAS,MAAM,OAAO,IAAI;EAExC,IAAI,UAAU,KAAA,KAAa,UAAU,QAAQ,UAAU,OACrD;EAOF,SAAS,QAAQ,QACf,oBA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AAM,CAAC,CAAC;GAIlE,OAAO,EAAE,mBAAmB,YAC1B,EACE,gBACA;IACE,OAAO;IACP,QAAQ,MAAM,UAAU,WAAW,MAAM,OAAO;IAChD,eAAe,MAAM;IACrB,mBAAmB;IACnB,cAAc,WAAW,MAAM;GACjC,SACM,QACR,CACF;EACF;CACF;AACF,CAAC;AAED,YAAY,iBAAiB;AAC7B,YAAY,KAAK"}
@@ -1,72 +1,67 @@
1
- import { computed, inject, markRaw, provide, ref, watchEffect } from "vue";
1
+ import { OverlayState } from "../../../components-base/src/overlay/OverlayState.mjs";
2
+ import "../../../components-base/src/index.mjs";
3
+ import { computed, customRef, inject, markRaw, provide, watchEffect } from "vue";
4
+ import { reaction, runInAction } from "mobx";
2
5
  //#region src/overlays/overlayController.ts
3
- var controllers = /* @__PURE__ */ new WeakSet();
6
+ var states = /* @__PURE__ */ new WeakMap();
4
7
  /** Whether a value is a controller, rather than options naming one. */
5
- var isOverlayController = (value) => typeof value === "object" && value !== null && controllers.has(value);
6
- var addTo = (handlers) => (handler) => {
7
- handlers.add(handler);
8
- return () => handlers.delete(handler);
9
- };
10
- /**
11
- * Builds a controller around an existing `isOpen`, so a second controller can
12
- * drive the same state — which is how the confirmation modal is bound to its
13
- * parent's `isConfirmingClose`.
14
- */
15
- var createOverlayControllerFor = (isOpen) => {
16
- const confirmOnClose = ref(false);
17
- const isConfirmingClose = ref(false);
18
- const onOpenHandlers = /* @__PURE__ */ new Set();
19
- const onCloseHandlers = /* @__PURE__ */ new Set();
20
- const onOpenChangeHandlers = /* @__PURE__ */ new Set();
21
- let inFlight;
22
- const apply = (toOpen) => {
23
- if (isOpen.value === toOpen || inFlight === toOpen) return;
24
- inFlight = toOpen;
25
- try {
26
- const run = (handlers) => [...handlers].map((handler) => handler(toOpen)).includes(false);
27
- if (!(run(toOpen ? onOpenHandlers : onCloseHandlers) || run(onOpenChangeHandlers))) isOpen.value = toOpen;
28
- } finally {
29
- inFlight = void 0;
30
- }
31
- };
32
- const open = () => {
33
- isConfirmingClose.value = false;
34
- apply(true);
35
- };
36
- const closeNow = () => {
37
- isConfirmingClose.value = false;
38
- apply(false);
39
- };
40
- const close = (options = {}) => {
41
- if (!options.bypassConfirmation && confirmOnClose.value && isOpen.value) {
42
- isConfirmingClose.value = true;
43
- return;
44
- }
45
- closeNow();
8
+ var isOverlayController = (value) => typeof value === "object" && value !== null && states.has(value);
9
+ var stateRef = (read, write) => customRef((track, trigger) => {
10
+ reaction(read, trigger);
11
+ return {
12
+ get: () => {
13
+ track();
14
+ return read();
15
+ },
16
+ set: write
46
17
  };
18
+ });
19
+ var createOverlayController = (options = {}) => {
20
+ const state = new OverlayState({ isDefaultOpen: options.isDefaultOpen });
21
+ const ownSource = {};
47
22
  const controller = {
48
- isOpen,
49
- confirmOnClose,
50
- isConfirmingClose,
51
- open,
52
- close,
53
- toggle: () => isOpen.value ? close() : open(),
54
- setOpen: (nextIsOpen, options) => nextIsOpen ? open() : close(options),
55
- syncOpen: (nextIsOpen) => {
56
- isOpen.value = nextIsOpen;
57
- },
58
- requestClose: () => close(),
59
- confirmClose: closeNow,
60
- cancelClose: () => isConfirmingClose.value = false,
61
- cancelConfirmation: () => isConfirmingClose.value = false,
62
- addOnOpen: addTo(onOpenHandlers),
63
- addOnClose: addTo(onCloseHandlers),
64
- addOnOpenChange: addTo(onOpenChangeHandlers)
23
+ isOpen: stateRef(() => state.isOpen, state.syncOpen),
24
+ confirmOnClose: stateRef(() => state.confirmOnCloseEnabled, (confirmOnClose) => confirmOnClose ? state.setConfirmOnCloseSource(ownSource, true) : state.removeConfirmOnCloseSource(ownSource)),
25
+ isConfirmingClose: stateRef(() => state.showConfirmationModal, (isConfirming) => {
26
+ if (!isConfirming) state.cancelConfirmation();
27
+ }),
28
+ isContentSuspended: stateRef(() => state.isContentSuspended, state.setIsContentSuspended),
29
+ open: state.open,
30
+ close: state.close,
31
+ toggle: state.toggle,
32
+ setOpen: state.setOpen,
33
+ syncOpen: state.syncOpen,
34
+ requestClose: () => state.close(),
35
+ confirmClose: () => runInAction(() => {
36
+ state.confirmClose();
37
+ state.close();
38
+ }),
39
+ cancelClose: state.cancelConfirmation,
40
+ cancelConfirmation: state.cancelConfirmation,
41
+ grantCloseWithoutConfirmation: () => state.grantCloseWithoutConfirmation(),
42
+ addOnOpen: (handler) => state.addOnOpen(handler),
43
+ addOnClose: (handler) => state.addOnClose(handler),
44
+ addOnOpenChange: (handler) => state.addOnOpenChange(handler)
65
45
  };
66
- controllers.add(markRaw(controller));
46
+ states.set(markRaw(controller), state);
67
47
  return controller;
68
48
  };
69
49
  /**
50
+ * Registers a component's opinion on close confirmation for as long as it is
51
+ * mounted — Flow's `useConfirmOnCloseSource`. `undefined` contributes nothing,
52
+ * so the other sources decide.
53
+ */
54
+ var useConfirmOnCloseSource = (controller, confirmOnClose) => {
55
+ const source = {};
56
+ watchEffect((onCleanup) => {
57
+ const state = states.get(controller());
58
+ const value = confirmOnClose();
59
+ if (!state || value === void 0) return;
60
+ state.setConfirmOnCloseSource(source, value);
61
+ onCleanup(() => state.removeConfirmOnCloseSource(source));
62
+ });
63
+ };
64
+ /**
70
65
  * Registers an overlay's `onOpen`/`onClose`/`onOpenChange` props on its
71
66
  * controller for as long as it is mounted — Flow's `useUpdateOptions`.
72
67
  */
@@ -84,7 +79,6 @@ var useOverlayHandlers = (controller, handlers) => {
84
79
  onCleanup(() => disposers.forEach((dispose) => dispose?.()));
85
80
  });
86
81
  };
87
- var createOverlayController = (options = {}) => createOverlayControllerFor(ref(options.isDefaultOpen ?? false));
88
82
  function useOverlayController(typeOrOptions, options = {}) {
89
83
  if (typeof typeOrOptions !== "string") return createOverlayController(typeOrOptions);
90
84
  const { reuseControllerFromContext = true } = options;
@@ -137,6 +131,6 @@ var injectOverlayController = (type) => {
137
131
  return type ? context.byType[type] : context.nearest;
138
132
  };
139
133
  //#endregion
140
- export { createOverlayController, createOverlayControllerFor, injectOverlayContext, injectOverlayController, isOverlayController, provideOverlayContext, useModalController, useOverlayController, useOverlayHandlers, useOwnController };
134
+ export { createOverlayController, injectOverlayContext, injectOverlayController, isOverlayController, provideOverlayContext, useConfirmOnCloseSource, useModalController, useOverlayController, useOverlayHandlers, useOwnController };
141
135
 
142
136
  //# sourceMappingURL=overlayController.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"overlayController.mjs","names":[],"sources":["../../../../../src/overlays/overlayController.ts"],"sourcesContent":["import {\n computed,\n inject,\n markRaw,\n provide,\n ref,\n watchEffect,\n type ComputedRef,\n type InjectionKey,\n type Raw,\n type Ref,\n} from \"vue\";\n\n/**\n * The Vue counterpart of Flow's `OverlayController`.\n *\n * Flow's version is a MobX model shared through React context; here the state\n * is a `ref` and the sharing is `provide`/`inject`. Same contract: a trigger\n * opens it, the overlay reads it, and anything inside can close it.\n */\nexport type OverlayOpenHandler = () => unknown;\nexport type OverlayCloseHandler = () => unknown;\nexport type OverlayOpenStateHandler = (isOpen: boolean) => unknown;\n\nexport interface OverlayCloseOptions {\n /** Close without asking, even when the overlay requires confirmation. */\n bypassConfirmation?: boolean;\n}\n\n/*\n * `Raw`, as `markRaw` makes it: reactive state keeps the controller as it is,\n * and its type says so too.\n */\nexport interface OverlayController extends Raw<Record<never, never>> {\n isOpen: Ref<boolean>;\n /**\n * Whether closing has to be confirmed first. Set by a `<Modal\n * confirm-on-close>`, not by the app.\n */\n confirmOnClose: Ref<boolean>;\n /** Whether the confirmation is on screen right now. */\n isConfirmingClose: Ref<boolean>;\n open: () => void;\n /**\n * Closes — or asks first, when the overlay requires confirmation and\n * `bypassConfirmation` is not set. Flow's `close(options)`.\n */\n close: (options?: OverlayCloseOptions) => void;\n toggle: () => void;\n setOpen: (isOpen: boolean, options?: OverlayCloseOptions) => void;\n /**\n * Sets the state without running a handler — to mirror a controlled `isOpen`,\n * whose change came from the app.\n */\n syncOpen: (isOpen: boolean) => void;\n /** `close()` without options: asks first, when the overlay requires it. */\n requestClose: () => void;\n /** Answers a pending confirmation with yes: the overlay closes. */\n confirmClose: () => void;\n /** Answers a pending confirmation with no: the overlay stays open. */\n cancelClose: () => void;\n /** Flow's name for `cancelClose`. */\n cancelConfirmation: () => void;\n /*\n * As in Flow: a handler returning `false` aborts the change. Each returns\n * its disposer.\n */\n addOnOpen: (handler: OverlayOpenHandler) => () => void;\n addOnClose: (handler: OverlayCloseHandler) => () => void;\n addOnOpenChange: (handler: OverlayOpenStateHandler) => () => void;\n}\n\nexport interface CreateOverlayControllerOptions {\n /** Whether the overlay starts open. @default false */\n isDefaultOpen?: boolean;\n}\n\nexport interface UseOverlayControllerOptions extends CreateOverlayControllerOptions {\n /**\n * Hand back the controller of the surrounding overlay of the requested type,\n * when there is one, instead of a new one — as in Flow. @default true\n */\n reuseControllerFromContext?: boolean;\n}\n\nconst controllers = new WeakSet<object>();\n\n/** Whether a value is a controller, rather than options naming one. */\nexport const isOverlayController = (\n value: unknown,\n): value is OverlayController =>\n typeof value === \"object\" && value !== null && controllers.has(value);\n\nconst addTo =\n <T>(handlers: Set<T>) =>\n (handler: T): (() => void) => {\n handlers.add(handler);\n return () => handlers.delete(handler);\n };\n\n/**\n * Builds a controller around an existing `isOpen`, so a second controller can\n * drive the same state — which is how the confirmation modal is bound to its\n * parent's `isConfirmingClose`.\n */\nexport const createOverlayControllerFor = (\n isOpen: Ref<boolean>,\n): OverlayController => {\n const confirmOnClose = ref(false);\n const isConfirmingClose = ref(false);\n const onOpenHandlers = new Set<OverlayOpenHandler>();\n const onCloseHandlers = new Set<OverlayCloseHandler>();\n const onOpenChangeHandlers = new Set<OverlayOpenStateHandler>();\n /* Flow's `openStateInFlight`: a handler setting the state again is a no-op. */\n let inFlight: boolean | undefined;\n\n /* Flow's `applyOpenState`, after the confirmation. */\n const apply = (toOpen: boolean): void => {\n if (isOpen.value === toOpen || inFlight === toOpen) {\n return;\n }\n inFlight = toOpen;\n try {\n const run = (handlers: Set<(isOpen: boolean) => unknown>) =>\n [...handlers].map((handler) => handler(toOpen)).includes(false);\n const aborted =\n run(toOpen ? onOpenHandlers : onCloseHandlers) ||\n run(onOpenChangeHandlers);\n if (!aborted) {\n isOpen.value = toOpen;\n }\n } finally {\n inFlight = undefined;\n }\n };\n\n const open = () => {\n isConfirmingClose.value = false;\n apply(true);\n };\n\n const closeNow = () => {\n isConfirmingClose.value = false;\n apply(false);\n };\n\n /*\n * Every close an app or the host can ask for goes through here, so a dismiss\n * — Escape, a click outside — is confirmed just like a button. The host\n * reports that dismiss as `openChange(false)`, and leaving `isOpen` alone is\n * what puts the overlay back: it is a controlled prop on the host's side.\n */\n const close = (options: OverlayCloseOptions = {}) => {\n if (!options.bypassConfirmation && confirmOnClose.value && isOpen.value) {\n isConfirmingClose.value = true;\n return;\n }\n closeNow();\n };\n\n const controller: OverlayController = {\n isOpen,\n confirmOnClose,\n isConfirmingClose,\n open,\n close,\n toggle: () => (isOpen.value ? close() : open()),\n setOpen: (nextIsOpen: boolean, options?: OverlayCloseOptions) =>\n nextIsOpen ? open() : close(options),\n syncOpen: (nextIsOpen: boolean) => {\n isOpen.value = nextIsOpen;\n },\n requestClose: () => close(),\n confirmClose: closeNow,\n cancelClose: () => (isConfirmingClose.value = false),\n cancelConfirmation: () => (isConfirmingClose.value = false),\n addOnOpen: addTo(onOpenHandlers),\n addOnClose: addTo(onCloseHandlers),\n addOnOpenChange: addTo(onOpenChangeHandlers),\n };\n /*\n * Raw, so `reactive()`, `ref()` or a store hold the controller itself: a\n * proxy would unwrap its refs and miss the `controllers` set.\n */\n controllers.add(markRaw(controller));\n return controller;\n};\n\n/**\n * Registers an overlay's `onOpen`/`onClose`/`onOpenChange` props on its\n * controller for as long as it is mounted — Flow's `useUpdateOptions`.\n */\nexport const useOverlayHandlers = (\n controller: () => OverlayController,\n handlers: {\n onOpen?: () => OverlayOpenHandler | undefined;\n onClose?: () => OverlayCloseHandler | undefined;\n onOpenChange?: () => OverlayOpenStateHandler | undefined;\n },\n): void => {\n watchEffect((onCleanup) => {\n const target = controller();\n const onOpen = handlers.onOpen?.();\n const onClose = handlers.onClose?.();\n const onOpenChange = handlers.onOpenChange?.();\n const disposers = [\n onOpen && target.addOnOpen(onOpen),\n onClose && target.addOnClose(onClose),\n onOpenChange && target.addOnOpenChange(onOpenChange),\n ];\n onCleanup(() => disposers.forEach((dispose) => dispose?.()));\n });\n};\n\nexport const createOverlayController = (\n options: CreateOverlayControllerOptions = {},\n): OverlayController =>\n createOverlayControllerFor(ref(options.isDefaultOpen ?? false));\n\n/**\n * A controller an app can hold itself, to open an overlay from anywhere —\n * Flow's `useOverlayController(type, options)`. Given a type, it hands back the\n * surrounding overlay's controller of that type when there is one, as Flow\n * does; `reuseControllerFromContext: false` asks for a new one regardless.\n *\n * Also takes the options alone, for a controller that belongs to no type. Call\n * it in `setup()`: the surrounding overlay is found through `inject`.\n */\nexport function useOverlayController(\n type: OverlayType,\n options?: UseOverlayControllerOptions,\n): OverlayController;\nexport function useOverlayController(\n options?: CreateOverlayControllerOptions,\n): OverlayController;\nexport function useOverlayController(\n typeOrOptions?: OverlayType | CreateOverlayControllerOptions,\n options: UseOverlayControllerOptions = {},\n): OverlayController {\n if (typeof typeOrOptions !== \"string\") {\n return createOverlayController(typeOrOptions);\n }\n const { reuseControllerFromContext = true } = options;\n const fromContext = reuseControllerFromContext\n ? injectOverlayController(typeOrOptions)\n : undefined;\n return fromContext ?? createOverlayController(options);\n}\n\n/**\n * Flow's `useModalController(options)`: `useOverlayController(\"Modal\",\n * options)`.\n */\nexport const useModalController = (\n options?: UseOverlayControllerOptions,\n): OverlayController => useOverlayController(\"Modal\", options);\n\n/** The overlays a controller can be registered for, by Flow component name. */\nexport type OverlayType = \"Modal\" | \"Popover\" | \"LightBox\";\n\n/**\n * Flow's `OverlayContext`: the surrounding overlays' controllers by component\n * name, and the one whose content this subtree is. A trigger registers its\n * controller by name only — its button is not inside the overlay it opens.\n */\nexport interface OverlayContext {\n byType: Partial<Record<OverlayType, OverlayController>>;\n nearest?: OverlayController;\n}\n\nconst overlayContextKey: InjectionKey<OverlayContext> =\n Symbol(\"flowOverlayContext\");\n\nexport const injectOverlayContext = (): OverlayContext =>\n inject(overlayContextKey, { byType: {} });\n\n/**\n * Provides the context for a subtree. The controller may be a getter: an\n * overlay whose `controller` prop changes hands its subtree the new one, and\n * the context reads it when it is asked rather than when it was provided.\n */\nexport const provideOverlayContext = (\n type: OverlayType,\n controller: OverlayController | (() => OverlayController),\n options: { isOverlayContent?: boolean } = {},\n): void => {\n const { isOverlayContent = true } = options;\n const parent = injectOverlayContext();\n const current =\n typeof controller === \"function\" ? controller : () => controller;\n\n provide(overlayContextKey, {\n get byType() {\n return { ...parent.byType, [type]: current() };\n },\n get nearest() {\n return isOverlayContent ? current() : parent.nearest;\n },\n });\n};\n\n/**\n * The controller an overlay or trigger drives, in Flow's order of precedence:\n * the one the app passes, the one of a surrounding trigger of that type, or one\n * of its own. It follows the prop — Flow reads it on every render.\n */\nexport const useOwnController = (\n fromProp: () => OverlayController | undefined,\n inheritFrom: OverlayType | undefined,\n options: () => CreateOverlayControllerOptions = () => ({}),\n): ComputedRef<OverlayController> => {\n const context = injectOverlayContext();\n let own: OverlayController | undefined;\n\n return computed(\n () =>\n fromProp() ??\n (inheritFrom ? context.byType[inheritFrom] : undefined) ??\n (own ??= createOverlayController(options())),\n );\n};\n\n/**\n * The controller of the surrounding overlay of that type — or, without a type,\n * of the overlay this component is inside.\n */\nexport const injectOverlayController = (\n type?: OverlayType,\n): OverlayController | undefined => {\n const context = injectOverlayContext();\n return type ? context.byType[type] : context.nearest;\n};\n"],"mappings":";;AAqFA,IAAM,8BAAc,IAAI,QAAgB;;AAGxC,IAAa,uBACX,UAEA,OAAO,UAAU,YAAY,UAAU,QAAQ,YAAY,IAAI,KAAK;AAEtE,IAAM,SACA,cACH,YAA6B;CAC5B,SAAS,IAAI,OAAO;CACpB,aAAa,SAAS,OAAO,OAAO;AACtC;;;;;;AAOF,IAAa,8BACX,WACsB;CACtB,MAAM,iBAAiB,IAAI,KAAK;CAChC,MAAM,oBAAoB,IAAI,KAA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C;AACF;;;;;AAMA,IAAa,2BACX,SACkC;CAClC,MAAM,UAAU,qBAAqB;CACrC,OAAO,OAAO,QAAQ,OAAO,QAAQ,QAAQ;AAC/C"}
1
+ {"version":3,"file":"overlayController.mjs","names":[],"sources":["../../../../../src/overlays/overlayController.ts"],"sourcesContent":["import {\n OverlayState,\n type OverlayCloseHandler,\n type OverlayCloseOptions,\n type OverlayOpenHandler,\n type OverlayOpenStateHandler,\n} from \"@mittwald/flow-components-base\";\nimport { reaction, runInAction } from \"mobx\";\nimport {\n computed,\n customRef,\n inject,\n markRaw,\n provide,\n watchEffect,\n type ComputedRef,\n type InjectionKey,\n type Raw,\n type Ref,\n} from \"vue\";\n\nexport type {\n OverlayCloseHandler,\n OverlayCloseOptions,\n OverlayOpenHandler,\n OverlayOpenStateHandler,\n} from \"@mittwald/flow-components-base\";\n\n/**\n * The Vue counterpart of Flow's `OverlayController`.\n *\n * The state is `OverlayState` from `@mittwald/flow-components-base`, the one\n * React's controller runs on; this wraps it in refs and shares it through\n * `provide`/`inject`. Same contract: a trigger opens it, the overlay reads it,\n * and anything inside can close it.\n *\n * `Raw`, as `markRaw` makes it: reactive state keeps the controller as it is,\n * and its type says so too.\n */\nexport interface OverlayController extends Raw<Record<never, never>> {\n /** Writing it sets the state without running a handler, like `syncOpen`. */\n isOpen: Ref<boolean>;\n /**\n * Whether closing has to be confirmed first — combined from every source: a\n * `<Modal confirm-on-close>` and what the app writes here.\n */\n confirmOnClose: Ref<boolean>;\n /**\n * Whether the confirmation is on screen right now. Writing `false` dismisses\n * it; only a close shows it.\n */\n isConfirmingClose: Ref<boolean>;\n /** Whether the overlay's content is suspended. Not used by this binding yet. */\n isContentSuspended: Ref<boolean>;\n open: () => void;\n /**\n * Closes — or asks first, when the overlay requires confirmation and\n * `bypassConfirmation` is not set. Flow's `close(options)`.\n */\n close: (options?: OverlayCloseOptions) => void;\n toggle: () => void;\n setOpen: (isOpen: boolean, options?: OverlayCloseOptions) => void;\n /**\n * Sets the state without running a handler — to mirror a controlled `isOpen`,\n * whose change came from the app.\n */\n syncOpen: (isOpen: boolean) => void;\n /** `close()` without options: asks first, when the overlay requires it. */\n requestClose: () => void;\n /** Answers a pending confirmation with yes: the overlay closes. */\n confirmClose: () => void;\n /** Answers a pending confirmation with no: the overlay stays open. */\n cancelClose: () => void;\n /** Flow's name for `cancelClose`. */\n cancelConfirmation: () => void;\n /**\n * Closes without a confirmation until the returned disposer is called — as in\n * Flow, around an operation that closes the overlay deliberately.\n */\n grantCloseWithoutConfirmation: () => () => void;\n /*\n * As in Flow: a handler returning `false` aborts the change. Each returns\n * its disposer.\n */\n addOnOpen: (handler: OverlayOpenHandler) => () => void;\n addOnClose: (handler: OverlayCloseHandler) => () => void;\n addOnOpenChange: (handler: OverlayOpenStateHandler) => () => void;\n}\n\nexport interface CreateOverlayControllerOptions {\n /** Whether the overlay starts open. @default false */\n isDefaultOpen?: boolean;\n}\n\nexport interface UseOverlayControllerOptions extends CreateOverlayControllerOptions {\n /**\n * Hand back the controller of the surrounding overlay of the requested type,\n * when there is one, instead of a new one — as in Flow. @default true\n */\n reuseControllerFromContext?: boolean;\n}\n\n/* Each controller's state, which is also how a controller is recognized. */\nconst states = new WeakMap<object, OverlayState>();\n\n/** Whether a value is a controller, rather than options naming one. */\nexport const isOverlayController = (\n value: unknown,\n): value is OverlayController =>\n typeof value === \"object\" && value !== null && states.has(value);\n\n/*\n * A ref over one value of the state: a read subscribes through MobX, a write\n * goes to the state. The reaction lives as long as the controller does — it\n * is held by nothing but the state it observes.\n */\nconst stateRef = <T>(read: () => T, write: (value: T) => void): Ref<T> =>\n customRef((track, trigger) => {\n reaction(read, trigger);\n return {\n get: () => {\n track();\n return read();\n },\n set: write,\n };\n });\n\nexport const createOverlayController = (\n options: CreateOverlayControllerOptions = {},\n): OverlayController => {\n const state = new OverlayState({ isDefaultOpen: options.isDefaultOpen });\n /* The source an app sets through `confirmOnClose.value`. */\n const ownSource = {};\n\n const controller: OverlayController = {\n isOpen: stateRef(() => state.isOpen, state.syncOpen),\n confirmOnClose: stateRef(\n () => state.confirmOnCloseEnabled,\n (confirmOnClose) =>\n confirmOnClose\n ? state.setConfirmOnCloseSource(ownSource, true)\n : state.removeConfirmOnCloseSource(ownSource),\n ),\n isConfirmingClose: stateRef(\n () => state.showConfirmationModal,\n (isConfirming) => {\n if (!isConfirming) {\n state.cancelConfirmation();\n }\n },\n ),\n isContentSuspended: stateRef(\n () => state.isContentSuspended,\n state.setIsContentSuspended,\n ),\n open: state.open,\n close: state.close,\n toggle: state.toggle,\n setOpen: state.setOpen,\n syncOpen: state.syncOpen,\n requestClose: () => state.close(),\n /*\n * React's `useCloseOverlayConfirmationController` confirms the same way.\n * One action, so no observer sees the confirmation gone and the overlay\n * still open.\n */\n confirmClose: () =>\n runInAction(() => {\n state.confirmClose();\n state.close();\n }),\n cancelClose: state.cancelConfirmation,\n cancelConfirmation: state.cancelConfirmation,\n grantCloseWithoutConfirmation: () => state.grantCloseWithoutConfirmation(),\n addOnOpen: (handler) => state.addOnOpen(handler),\n addOnClose: (handler) => state.addOnClose(handler),\n addOnOpenChange: (handler) => state.addOnOpenChange(handler),\n };\n /*\n * Raw, so `reactive()`, `ref()` or a store hold the controller itself: a\n * proxy would unwrap its refs and miss the `states` map.\n */\n states.set(markRaw(controller), state);\n return controller;\n};\n\n/**\n * Registers a component's opinion on close confirmation for as long as it is\n * mounted — Flow's `useConfirmOnCloseSource`. `undefined` contributes nothing,\n * so the other sources decide.\n */\nexport const useConfirmOnCloseSource = (\n controller: () => OverlayController,\n confirmOnClose: () => boolean | undefined,\n): void => {\n const source = {};\n\n watchEffect((onCleanup) => {\n const state = states.get(controller());\n const value = confirmOnClose();\n if (!state || value === undefined) {\n return;\n }\n state.setConfirmOnCloseSource(source, value);\n onCleanup(() => state.removeConfirmOnCloseSource(source));\n });\n};\n\n/**\n * Registers an overlay's `onOpen`/`onClose`/`onOpenChange` props on its\n * controller for as long as it is mounted — Flow's `useUpdateOptions`.\n */\nexport const useOverlayHandlers = (\n controller: () => OverlayController,\n handlers: {\n onOpen?: () => OverlayOpenHandler | undefined;\n onClose?: () => OverlayCloseHandler | undefined;\n onOpenChange?: () => OverlayOpenStateHandler | undefined;\n },\n): void => {\n watchEffect((onCleanup) => {\n const target = controller();\n const onOpen = handlers.onOpen?.();\n const onClose = handlers.onClose?.();\n const onOpenChange = handlers.onOpenChange?.();\n const disposers = [\n onOpen && target.addOnOpen(onOpen),\n onClose && target.addOnClose(onClose),\n onOpenChange && target.addOnOpenChange(onOpenChange),\n ];\n onCleanup(() => disposers.forEach((dispose) => dispose?.()));\n });\n};\n\n/**\n * A controller an app can hold itself, to open an overlay from anywhere —\n * Flow's `useOverlayController(type, options)`. Given a type, it hands back the\n * surrounding overlay's controller of that type when there is one, as Flow\n * does; `reuseControllerFromContext: false` asks for a new one regardless.\n *\n * Also takes the options alone, for a controller that belongs to no type. Call\n * it in `setup()`: the surrounding overlay is found through `inject`.\n */\nexport function useOverlayController(\n type: OverlayType,\n options?: UseOverlayControllerOptions,\n): OverlayController;\nexport function useOverlayController(\n options?: CreateOverlayControllerOptions,\n): OverlayController;\nexport function useOverlayController(\n typeOrOptions?: OverlayType | CreateOverlayControllerOptions,\n options: UseOverlayControllerOptions = {},\n): OverlayController {\n if (typeof typeOrOptions !== \"string\") {\n return createOverlayController(typeOrOptions);\n }\n const { reuseControllerFromContext = true } = options;\n const fromContext = reuseControllerFromContext\n ? injectOverlayController(typeOrOptions)\n : undefined;\n return fromContext ?? createOverlayController(options);\n}\n\n/**\n * Flow's `useModalController(options)`: `useOverlayController(\"Modal\",\n * options)`.\n */\nexport const useModalController = (\n options?: UseOverlayControllerOptions,\n): OverlayController => useOverlayController(\"Modal\", options);\n\n/** The overlays a controller can be registered for, by Flow component name. */\nexport type OverlayType = \"Modal\" | \"Popover\" | \"LightBox\";\n\n/**\n * Flow's `OverlayContext`: the surrounding overlays' controllers by component\n * name, and the one whose content this subtree is. A trigger registers its\n * controller by name only — its button is not inside the overlay it opens.\n */\nexport interface OverlayContext {\n byType: Partial<Record<OverlayType, OverlayController>>;\n nearest?: OverlayController;\n}\n\nconst overlayContextKey: InjectionKey<OverlayContext> =\n Symbol(\"flowOverlayContext\");\n\nexport const injectOverlayContext = (): OverlayContext =>\n inject(overlayContextKey, { byType: {} });\n\n/**\n * Provides the context for a subtree. The controller may be a getter: an\n * overlay whose `controller` prop changes hands its subtree the new one, and\n * the context reads it when it is asked rather than when it was provided.\n */\nexport const provideOverlayContext = (\n type: OverlayType,\n controller: OverlayController | (() => OverlayController),\n options: { isOverlayContent?: boolean } = {},\n): void => {\n const { isOverlayContent = true } = options;\n const parent = injectOverlayContext();\n const current =\n typeof controller === \"function\" ? controller : () => controller;\n\n provide(overlayContextKey, {\n get byType() {\n return { ...parent.byType, [type]: current() };\n },\n get nearest() {\n return isOverlayContent ? current() : parent.nearest;\n },\n });\n};\n\n/**\n * The controller an overlay or trigger drives, in Flow's order of precedence:\n * the one the app passes, the one of a surrounding trigger of that type, or one\n * of its own. It follows the prop — Flow reads it on every render.\n */\nexport const useOwnController = (\n fromProp: () => OverlayController | undefined,\n inheritFrom: OverlayType | undefined,\n options: () => CreateOverlayControllerOptions = () => ({}),\n): ComputedRef<OverlayController> => {\n const context = injectOverlayContext();\n let own: OverlayController | undefined;\n\n return computed(\n () =>\n fromProp() ??\n (inheritFrom ? context.byType[inheritFrom] : undefined) ??\n (own ??= createOverlayController(options())),\n );\n};\n\n/**\n * The controller of the surrounding overlay of that type — or, without a type,\n * of the overlay this component is inside.\n */\nexport const injectOverlayController = (\n type?: OverlayType,\n): OverlayController | undefined => {\n const context = injectOverlayContext();\n return type ? context.byType[type] : context.nearest;\n};\n"],"mappings":";;;;;AAuGA,IAAM,yBAAS,IAAI,QAA8B;;AAGjD,IAAa,uBACX,UAEA,OAAO,UAAU,YAAY,UAAU,QAAQ,OAAO,IAAI,KAAK;AAOjE,IAAM,YAAe,MAAe,UAClC,WAAW,OAAO,YAAY;CAC5B,SAAS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,CAAC,EAC9C;AACF;;;;;AAMA,IAAa,2BACX,SACkC;CAClC,MAAM,UAAU,qBAAqB;CACrC,OAAO,OAAO,QAAQ,OAAO,QAAQ,QAAQ;AAC/C"}
@@ -1,7 +1,7 @@
1
1
  import { Version } from "@mittwald/flow-remote-core";
2
2
  //#region src/version.ts
3
3
  var communicationVersion = Version.v5;
4
- var packageVersion = "1.6.0-next.4";
4
+ var packageVersion = "1.6.0-next.41";
5
5
  var version = communicationVersion;
6
6
  //#endregion
7
7
  export { communicationVersion, packageVersion, version };
@@ -2,7 +2,9 @@ export { ActionState, actionStateDurations, type ActionStateValue, } from "./act
2
2
  export { toArray, type ItemType } from "./lib/array";
3
3
  export { ListFilter } from "./list/filter/ListFilter";
4
4
  export { ListDateRangeFilter } from "./list/filter/ListDateRangeFilter";
5
- export { applyDateRangeColumnDef, dateRangeFilterFn, isListDateRange, type ListDateParts, type ListDateRange, } from "./list/filter/dateRange";
5
+ export { applyDateRangeColumnDef, dateRangeFilterFn, isListDateRange, listDateToDateTime, resolveListDateRange, type ListDateParts, type ListDateRange, } from "./list/filter/dateRange";
6
+ export { formatListDateRange, type ListDateRangeTextFormat, } from "./list/filter/formatDateRange";
7
+ export { getListDateTimeRangeUpdate, isListDateTimeRangeEndBeforeStart, isListDateValid, listDateTimeRangeFieldsFromValue, toListCalendarDate, toListTime, type ListDateTimeRange, type ListDateTimeRangeFields, type ListDateTimeRangeLimits, } from "./list/filter/dateTimeRangeFields";
6
8
  export { ListFilterValue } from "./list/filter/ListFilterValue";
7
9
  export type { FilterMatcher, FilterMode, FilterUpdatedCallback, ListFilterShape, } from "./list/filter/types";
8
10
  export { getListColumn, type ListModelContext } from "./list/ListModelContext";
@@ -21,3 +23,4 @@ export type { ListSortingShape, SortingDefaultMode, SortingFn, } from "./list/so
21
23
  export { ListViewMode } from "./list/viewMode/ListViewMode";
22
24
  export type { ListViewModeOptions, ListViewModeValue, } from "./list/viewMode/types";
23
25
  export { customPropertyPrefix, type CustomPropertyName, type PropertyName, type PropertyValue, type PropertyValueRenderMethod, } from "./list/types";
26
+ export { OverlayState, type AnyOverlayOpenStateHandler, type DisposerFn, type OverlayCloseHandler, type OverlayCloseOptions, type OverlayOpenHandler, type OverlayOpenStateHandler, type OverlayStateOptions, } from "./overlay/OverlayState";
@@ -83,6 +83,8 @@ export declare class ListFilter<T = never, TProp extends PropertyName<T> = never
83
83
  isActive(): boolean;
84
84
  deactivateValue(value: ListFilterValue<TRendered>): void;
85
85
  private callOnChangedHandlers;
86
+ /** Tells the listeners — the list resetting its batches among them. */
87
+ protected notifyFilterUpdated(values: unknown[]): void;
86
88
  hasChanges(): boolean;
87
89
  isStoringAvailable(): boolean;
88
90
  resetValues(): void;
@@ -1,9 +1,16 @@
1
1
  import type { ColumnDef, Row } from "@tanstack/table-core";
2
- /** A calendar date, in whichever shape it reached the filter. */
2
+ import { DateTime } from "luxon";
3
+ /**
4
+ * A calendar date, in whichever shape it reached the filter — with a time of
5
+ * day when the filter narrows down by minute.
6
+ */
3
7
  export interface ListDateParts {
4
8
  readonly year: number;
5
9
  readonly month: number;
6
10
  readonly day: number;
11
+ readonly hour?: number;
12
+ readonly minute?: number;
13
+ readonly second?: number;
7
14
  }
8
15
  export interface ListDateRange {
9
16
  readonly start?: ListDateParts;
@@ -11,6 +18,22 @@ export interface ListDateRange {
11
18
  }
12
19
  /** A range needs both ends present to be one, even if either may be unset. */
13
20
  export declare const isListDateRange: (value: unknown) => value is ListDateRange;
21
+ /**
22
+ * The date as a local point in time. A `ZonedDateTime` is the instant it names;
23
+ * anything else is read field by field, since after crossing the remote
24
+ * boundary a `CalendarDate` is a plain object.
25
+ */
26
+ export declare const listDateToDateTime: (date: ListDateParts) => DateTime;
27
+ /**
28
+ * Resolves a range to the instants it spans, for filtering on the server side.
29
+ * Both bounds are inclusive: a date covers its whole day and a date with time
30
+ * its whole minute, in the user's local time zone. A missing side has no
31
+ * bound.
32
+ */
33
+ export declare const resolveListDateRange: (range: ListDateRange) => {
34
+ start?: Date;
35
+ end?: Date;
36
+ };
14
37
  /**
15
38
  * Whether a row's date falls inside the selected range.
16
39
  *