@canonical/ds-types 0.43.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -57,4 +57,4 @@ const isValidSeverity = (value: string): value is ModifierFamily<"severity"> =>
57
57
 
58
58
  ## Design System Ontology
59
59
 
60
- The modifier families defined in this package derive from the [Design System Ontology](https://github.com/canonical/design-system). The ontology provides the authoritative specification for which modifiers exist and their semantic meaning. Changes to modifier families should originate in the ontology and propagate to this package to maintain consistency between design specifications and implementation.
60
+ The modifier families defined in this package derive from the [Design System Ontology](https://github.com/canonical/pragma-core/tree/main/packages/semantics/design-system). The ontology provides the authoritative specification for which modifiers exist and their semantic meaning. Changes to modifier families should originate in the ontology and propagate to this package to maintain consistency between design specifications and implementation.
package/dist/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from "./grid/index.js";
2
+ export * from "./location/index.js";
2
3
  export * from "./modifierFamilies/index.js";
3
4
  export * from "./navigation/index.js";
4
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/location/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * These types sit together because they describe the two sides of one seam:
3
+ * the URL's query as a component sees it and as a router provides it.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/location/types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -1,4 +1,5 @@
1
1
  export * from "./grid/index.js";
2
+ export * from "./location/index.js";
2
3
  export * from "./modifierFamilies/index.js";
3
4
  export * from "./navigation/index.js";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export type * from "./types.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/location/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAC"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * These types sit together because they describe the two sides of one seam:
3
+ * the URL's query as a component sees it and as a router provides it.
4
+ */
5
+ /**
6
+ * How a write enters history: `push` appends an entry the Back button returns
7
+ * to, `replace` overwrites the current one.
8
+ *
9
+ * @experimental Names may change until the first consumers adopt this surface.
10
+ */
11
+ export type HistoryBehavior = "push" | "replace";
12
+ /**
13
+ * Options for {@link LocationQuery.write}.
14
+ *
15
+ * @experimental Names may change until the first consumers adopt this surface.
16
+ */
17
+ export type LocationWriteOptions = {
18
+ /** How the write enters history. Defaults to `"replace"`. */
19
+ readonly history?: HistoryBehavior;
20
+ };
21
+ /**
22
+ * Options for {@link LocationAdapter.navigate}.
23
+ *
24
+ * @experimental Names may change until the first consumers adopt this surface.
25
+ */
26
+ export type LocationNavigateOptions = {
27
+ /** Replace the current history entry instead of appending one. */
28
+ readonly replace?: boolean;
29
+ };
30
+ /**
31
+ * The query string of the current URL, read and written as a whole.
32
+ *
33
+ * A component that keeps state in the URL reads and writes it through this
34
+ * port instead of `window.location` or a particular router. A router or host
35
+ * provides the {@link LocationAdapter} underneath. Repeated parameters
36
+ * (`status=failed&status=cancelled`) survive reads and writes.
37
+ *
38
+ * @experimental Names may change until the first consumers adopt this surface.
39
+ */
40
+ export type LocationQuery = {
41
+ /**
42
+ * The current query parameters, decoded, as a fresh `URLSearchParams` on
43
+ * every call. Callers may mutate the result.
44
+ */
45
+ readonly read: () => URLSearchParams;
46
+ /**
47
+ * Replace the whole query with `next`, keeping the path and the hash.
48
+ * `next` is serialised with `URLSearchParams.toString()`, which uses form
49
+ * encoding (spaces as `+`). `read()` decodes, so encoding differences do not
50
+ * reach consumers. Throws when the adapter cannot navigate.
51
+ *
52
+ * @note Impure: navigates the underlying adapter.
53
+ */
54
+ readonly write: (next: URLSearchParams, options?: LocationWriteOptions) => void;
55
+ /**
56
+ * Call `listener` with no arguments on every change of the URL, whatever
57
+ * caused it. Returns a function that unsubscribes. A listener's exception
58
+ * reaches the caller of `write` only when the adapter notifies
59
+ * synchronously. Otherwise it surfaces wherever the adapter dispatches, for
60
+ * example on Back or Forward.
61
+ */
62
+ readonly subscribe: (listener: () => void) => () => void;
63
+ };
64
+ /**
65
+ * The three functions a router or host provides so a {@link LocationQuery}
66
+ * can run over it. A router's own adapters may fit by shape. Another router
67
+ * fits by wrapping its location getter, navigate function and change
68
+ * listener.
69
+ *
70
+ * An implementation must:
71
+ *
72
+ * - notify at most once per write;
73
+ * - land writes in the order they were made;
74
+ * - never reorder or re-encode the parameters it is given;
75
+ * - never drop a write silently.
76
+ *
77
+ * A write that does not land either notifies the current location or throws.
78
+ * A write may land after `navigate` returns, as long as the notification
79
+ * follows it.
80
+ *
81
+ * @experimental Names may change until the first consumers adopt this surface.
82
+ */
83
+ export type LocationAdapter = {
84
+ /**
85
+ * The current location: an absolute URL, or a root-relative href starting
86
+ * with `/` such as `/machines?status=failed`. Any other relative value is
87
+ * resolved against `/`.
88
+ */
89
+ readonly getLocation: () => string | URL;
90
+ /**
91
+ * Navigate to `url`, a root-relative href. An adapter that cannot navigate
92
+ * throws.
93
+ */
94
+ readonly navigate: (url: string, options?: LocationNavigateOptions) => void;
95
+ /**
96
+ * Call `listener` on every change of the location, including Back, Forward
97
+ * and navigations made elsewhere. Returns a function that unsubscribes.
98
+ */
99
+ readonly subscribe: (listener: () => void) => () => void;
100
+ };
101
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/location/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,CAAC;AAEjD;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC;CACpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,kEAAkE;IAClE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,eAAe,CAAC;IACrC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,CACd,IAAI,EAAE,eAAe,EACrB,OAAO,CAAC,EAAE,oBAAoB,KAC3B,IAAI,CAAC;IACV;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;CAC1D,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,MAAM,GAAG,GAAG,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAC5E;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAC;CAC1D,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@canonical/ds-types",
3
3
  "description": "Types and related type utilities for Pragma.",
4
- "version": "0.43.0",
4
+ "version": "0.44.0",
5
5
  "type": "module",
6
6
  "main": "dist/esm/index.js",
7
7
  "module": "dist/esm/index.js",
@@ -51,5 +51,5 @@
51
51
  "@canonical/webarchitect": "0.43.0",
52
52
  "typescript": "^7.0.2"
53
53
  },
54
- "gitHead": "581682464ef71de3f77dc2dc8bbe2b7e493bb05e"
54
+ "gitHead": "c1f2abc7f04aa29a88f0e6036645469e82a5dd33"
55
55
  }