@tak-ps/cloudtak 13.97.0 → 13.97.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.
@@ -31,6 +31,11 @@ export declare const MILSYM_ICON: RegExp;
31
31
  * `usericon` iconsetpath
32
32
  */
33
33
  export declare function renderedIcon(properties: Feature["properties"]): string | undefined;
34
+ /**
35
+ * The style image id the map's icon layer requests for a Feature. Must agree
36
+ * with the `icon-image` expression in utils/styles.ts (cot-icon.spec.ts asserts it).
37
+ */
38
+ export declare function renderedIconImage(properties: Feature["properties"]): string | undefined;
34
39
  export default class COT {
35
40
  id: string;
36
41
  instance: string;
@@ -1,10 +1,13 @@
1
- import { type DBIcon } from '../database.ts';
1
+ import { type DBIcon, type DBIconset } from '../database.ts';
2
+ import type { Iconset } from '../types.ts';
2
3
  export interface IconHydrateResult {
3
4
  added: string[];
4
5
  /** Iconsets refetched because the remote `version`/`updated` differs. */
5
6
  updated: string[];
6
7
  /** Iconsets that were removed locally because they no longer exist remotely. */
7
8
  removed: string[];
9
+ /** Iconsets whose icon fetch failed; they are retried on the next hydrate. */
10
+ failed: string[];
8
11
  }
9
12
  export default class Icon {
10
13
  static has(icon: string): Promise<boolean>;
@@ -17,6 +20,11 @@ export default class Icon {
17
20
  * Return all icons belonging to a given iconset uid, ordered by path.
18
21
  */
19
22
  static list(iconsetUid: string): Promise<DBIcon[]>;
23
+ /**
24
+ * True when the icons cached for an iconset don't match `remote`
25
+ * (defaults to the cached metadata itself).
26
+ */
27
+ static stale(cached: DBIconset | undefined, remote?: Pick<Iconset, 'version' | 'updated'> | undefined): boolean;
20
28
  /**
21
29
  * Diff the server iconset list against Dexie and refetch icons for any
22
30
  * iconsets that are new or whose `version`/`updated` differs. Concurrent
@@ -32,6 +32,8 @@ export default class IconsetManager extends BaseInterface {
32
32
  } ? Iconset_Page : DBIconset[]>;
33
33
  static from(uid: string, opts?: BaseInterface_FromOptions): Promise<DBIconset | undefined>;
34
34
  static liveFrom(uid: string): Observable<DBIconset | undefined>;
35
+ /** Write a server row, keeping the icon sync marker set by base/icon.ts */
36
+ static put(remote: Iconset): Promise<void>;
35
37
  static get(uid: string): Promise<Iconset>;
36
38
  static generate(body: paths['/api/iconset']['post']['requestBody']['content']['application/json']): Promise<Iconset>;
37
39
  static update(uid: string, body: paths['/api/iconset/{:iconset}']['patch']['requestBody']['content']['application/json']): Promise<void>;
@@ -72,6 +72,9 @@ export interface DBIconset {
72
72
  default_neutral: string | null;
73
73
  default_unknown: string | null;
74
74
  skip_resize: boolean;
75
+ /** version/updated of the iconset whose icons are cached in db.icon */
76
+ icons_version?: number;
77
+ icons_updated?: string;
75
78
  }
76
79
  export type DBOverlay = ProfileOverlayList["items"][number];
77
80
  /** Profile asset metadata retained for files downloaded for offline use */
@@ -45,6 +45,11 @@ export default class IconManager {
45
45
  * and renders the feature without an icon).
46
46
  */
47
47
  resolve(id: string): Promise<void>;
48
+ /**
49
+ * Whether an image id is one this manager generates on demand, as opposed
50
+ * to a built-in spritesheet icon the style loads up front
51
+ */
52
+ resolvable(id: string): boolean;
48
53
  private resolveImage;
49
54
  /**
50
55
  * Resolve an `<iconsetUid>:<path>` image id from Dexie, falling back to
@@ -0,0 +1,16 @@
1
+ /**
2
+ * MIL-STD symbol generation shared by the map's Icon Manager and DOM previews
3
+ * so a symbol looks the same wherever it is drawn
4
+ */
5
+ /** Render size (px) of a generated symbol */
6
+ export declare const SYMBOL_SIZE = 24;
7
+ export declare function isMilsymIcon(id: string): boolean;
8
+ /** @param id A bare SIDC or a `2525<Variant>:<SIDC>` icon id */
9
+ export declare function symbolCanvas(id: string): HTMLCanvasElement;
10
+ /**
11
+ * Cached per SIDC and size so a list of Features sharing a symbol renders it
12
+ * once rather than once per instance
13
+ *
14
+ * @param id A bare SIDC or a `2525<Variant>:<SIDC>` icon id
15
+ */
16
+ export declare function symbolDataURL(id: string, size?: number): string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tak-ps/cloudtak",
3
3
  "type": "module",
4
- "version": "13.97.0",
4
+ "version": "13.97.1",
5
5
  "types": "dist/types/plugin.d.ts",
6
6
  "files": [
7
7
  "dist/types"