@antcde/vue-utils 0.2.32 → 0.2.33-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ /** The API's own message (first validation error, then `message`), else the fallback. */
2
+ export declare function apiErrorMessage(error: unknown, fallback: string): string;
@@ -0,0 +1,3 @@
1
+ import { DeviceType } from '@antcde/connect-ts';
2
+ /** The MDI icon for a paired device's type; unknown values get the generic one. */
3
+ export declare function deviceTypeIcon(type: DeviceType | string | null | undefined): string;
@@ -1,3 +1,5 @@
1
+ export { apiErrorMessage } from './apiErrorMessage';
2
+ export { deviceTypeIcon } from './deviceType';
1
3
  export { type DateFormatPreset, formatDate, type FormatDateOptions, formatDateRange, type FormatDateRangeOptions } from './formatDate';
2
4
  export { formatRefreshLabel, type RefreshTranslate } from './refreshLabel';
3
5
  export { browserZone, buildScheduleRule, defaultScheduleSpec, describeRefresh, parseScheduleRule, type RefreshDescription, SCHEDULE_DAYS, type ScheduleFreq, type ScheduleMonthly, type ScheduleNth, type ScheduleSpec, weekdayOf, } from './refreshSchedule';
@@ -9,7 +11,9 @@ export { useAppQueryParam, type UseAppQueryParamOptions } from './useAppQueryPar
9
11
  export { useAppTourMode } from './useAppTourMode';
10
12
  export { type UseCommsClient, useCommsClient } from './useCommsClient';
11
13
  export { type CommsHostArgs, type UseCommsHost, useCommsHost } from './useCommsHost';
14
+ export { DEVICE_BREAKPOINTS, type DeviceClass, useDeviceClass, type UseDeviceClassReturn } from './useDeviceClass';
12
15
  export { useFeature } from './useFeature';
16
+ export { useHostDevice, type UseHostDeviceReturn } from './useHostDevice';
13
17
  export { type UsePermissions, usePermissions } from './usePermissions';
14
18
  export { useTemplateVersioning, type UseTemplateVersioningReturn } from './useTemplateVersioning';
15
19
  export { useTriggerDispatch, type UseTriggerDispatchOptions, type UseTriggerDispatchReturn } from './useTriggerDispatch';
@@ -1,4 +1,4 @@
1
- import { AntConnect, AppManifest, FeatureFlags, LabelFilterState, License, Notepad, Notification, ProjectShort, SignalObserverFactory, SignalReceiver, SignalSender, Task, User } from '@antcde/connect-ts';
1
+ import { AntConnect, AppManifest, DeviceContext, FeatureFlags, LabelFilterState, License, Notepad, Notification, ProjectShort, SignalObserverFactory, SignalReceiver, SignalSender, Task, User } from '@antcde/connect-ts';
2
2
  import { SubscriptionLike } from 'rxjs';
3
3
  import { Ref } from 'vue';
4
4
  import { CommsToolbar } from './utils';
@@ -22,6 +22,8 @@ export interface CommsHostArgs {
22
22
  code: string;
23
23
  }>>;
24
24
  darkMode: Ref<Nullable<boolean>>;
25
+ /** Host device class; optional so an older host still type-checks. */
26
+ device?: Ref<Nullable<DeviceContext>>;
25
27
  selectedLabels: Ref<LabelFilterState>;
26
28
  features?: Ref<Nullable<FeatureFlags>>;
27
29
  };
@@ -0,0 +1,19 @@
1
+ import { ComputedRef, Ref } from 'vue';
2
+ export type DeviceClass = 'phone' | 'tablet' | 'desktop';
3
+ export declare const DEVICE_BREAKPOINTS: {
4
+ readonly handheld: 768;
5
+ readonly phone: 1105;
6
+ readonly tablet: 1280;
7
+ };
8
+ export interface UseDeviceClassReturn {
9
+ device: ComputedRef<DeviceClass>;
10
+ isPhone: ComputedRef<boolean>;
11
+ isTablet: ComputedRef<boolean>;
12
+ isDesktop: ComputedRef<boolean>;
13
+ /** Primary pointer is a finger. False on a touch laptop driven by its trackpad. */
14
+ isCoarsePointer: Ref<boolean>;
15
+ isPortrait: ComputedRef<boolean>;
16
+ width: Ref<number>;
17
+ height: Ref<number>;
18
+ }
19
+ export declare const useDeviceClass: () => UseDeviceClassReturn;
@@ -0,0 +1,17 @@
1
+ import { Context } from '@antcde/connect-ts';
2
+ import { ComputedRef, Ref } from 'vue';
3
+ import { DeviceClass } from './useDeviceClass';
4
+ export interface UseHostDeviceReturn {
5
+ device: ComputedRef<DeviceClass>;
6
+ isPhone: ComputedRef<boolean>;
7
+ isTablet: ComputedRef<boolean>;
8
+ isDesktop: ComputedRef<boolean>;
9
+ /** Primary pointer is a finger. */
10
+ isTouch: ComputedRef<boolean>;
11
+ }
12
+ /**
13
+ * The device class the OS shell runs on, read from the comms context. Use it for
14
+ * shell decisions (phone layout, touch targets), not for pane width: a split pane
15
+ * on desktop is narrow too. An older OS sends no device; the app's own frame decides then.
16
+ */
17
+ export declare function useHostDevice(context: Ref<Context>): UseHostDeviceReturn;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@antcde/vue-utils",
3
3
  "type": "module",
4
- "version": "0.2.32",
4
+ "version": "0.2.33-rc.1",
5
5
  "description": "Helper to use ANT Comms in Vue 3",
6
6
  "author": "CollaborAll",
7
7
  "exports": {
@@ -33,7 +33,7 @@
33
33
  "vue-i18n": "^11.1.12"
34
34
  },
35
35
  "dependencies": {
36
- "@antcde/connect-ts": "0.4.37",
36
+ "@antcde/connect-ts": "0.4.38-rc.1",
37
37
  "rrule": "^2.8.1"
38
38
  },
39
39
  "devDependencies": {