lit-ui-router 1.1.2 → 1.2.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.
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { PathNode, StateObject, UIRouter, ViewConfig, _ViewDeclaration } from '@uirouter/core';
2
- import { RoutedLitElement, LitViewDeclaration, LitViewDeclarationTemplate, NormalizedLitViewDeclaration } from './interface.js';
2
+ import { RoutedLitElement, LitViewDeclaration, LitViewDeclarationTemplate, NormalizedLitViewDeclaration, LitViewDeclarationElement, DefaultResolvesType } from './interface.js';
3
3
  /**
4
4
  * Configuration for a Lit view instance.
5
5
  *
@@ -38,7 +38,7 @@ export declare class LitViewConfig implements ViewConfig {
38
38
  * @returns True if the config is a template function
39
39
  * @internal
40
40
  */
41
- export declare function isLitViewDeclarationTemplate(config: LitViewDeclaration): config is LitViewDeclarationTemplate;
41
+ export declare function isLitViewDeclarationTemplate<T extends DefaultResolvesType = DefaultResolvesType>(config: LitViewDeclaration<T>): config is LitViewDeclarationTemplate<T> | LitViewDeclarationElement<T>;
42
42
  /**
43
43
  * Type guard to check if a component is a RoutedLitElement class.
44
44
  *
@@ -46,7 +46,7 @@ export declare function isLitViewDeclarationTemplate(config: LitViewDeclaration)
46
46
  * @returns True if the component is a LitElement class
47
47
  * @internal
48
48
  */
49
- export declare function isRoutedLitElement(component?: unknown): component is RoutedLitElement;
49
+ export declare function isRoutedLitElement<T extends DefaultResolvesType = DefaultResolvesType>(component?: unknown): component is RoutedLitElement<T>;
50
50
  /**
51
51
  * State builder function for Lit views.
52
52
  *
@@ -60,7 +60,7 @@ export declare function isRoutedLitElement(component?: unknown): component is Ro
60
60
  * @returns The normalized views object
61
61
  * @internal
62
62
  */
63
- export declare function litViewsBuilder(state: StateObject): Record<string, NormalizedLitViewDeclaration>;
63
+ export declare function litViewsBuilder<T extends DefaultResolvesType = DefaultResolvesType>(state: StateObject): Record<string, NormalizedLitViewDeclaration<T>>;
64
64
  /**
65
65
  * The main router class for Lit applications.
66
66
  *
package/dist/core.js CHANGED
@@ -83,27 +83,33 @@ export function litViewsBuilder(state) {
83
83
  $default: pick(state, ['component']),
84
84
  };
85
85
  forEach(viewsObject, function (config, name) {
86
+ let normalizedConfig;
86
87
  name = name || '$default'; // Account for views: { "": { template... } }
87
- if (isLitViewDeclarationTemplate(config))
88
- config = { component: config };
89
- if (Object.keys(config || {}).length === 0)
88
+ if (isLitViewDeclarationTemplate(config)) {
89
+ normalizedConfig = { component: config };
90
+ }
91
+ else {
92
+ normalizedConfig = config;
93
+ }
94
+ if (Object.keys(normalizedConfig || {}).length === 0)
90
95
  return;
91
- config.$type = 'lit';
92
- config.$context = state;
93
- config.$name = name;
94
- const normalized = ViewService.normalizeUIViewTarget(config.$context, config.$name);
95
- config.$uiViewName = normalized.uiViewName;
96
- config.$uiViewContextAnchor = normalized.uiViewContextAnchor;
97
- if (isRoutedLitElement(config.component)) {
98
- const Component = config.component;
96
+ normalizedConfig.$type = 'lit';
97
+ normalizedConfig.$context = state;
98
+ normalizedConfig.$name = name;
99
+ const normalizedTarget = ViewService.normalizeUIViewTarget(normalizedConfig.$context, normalizedConfig.$name);
100
+ normalizedConfig.$uiViewName = normalizedTarget.uiViewName;
101
+ normalizedConfig.$uiViewContextAnchor =
102
+ normalizedTarget.uiViewContextAnchor;
103
+ if (isRoutedLitElement(normalizedConfig.component)) {
104
+ const Component = normalizedConfig.component;
99
105
  let component;
100
- config.component = (props) => {
106
+ normalizedConfig.component = (props) => {
101
107
  component = (Component.sticky && component) || new Component(props);
102
108
  component._uiViewProps = props;
103
109
  return html `${component}`;
104
110
  };
105
111
  }
106
- views[name] = viewsObject[name] = config;
112
+ views[name] = viewsObject[name] = normalizedConfig;
107
113
  });
108
114
  return views;
109
115
  }
package/dist/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,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C;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,OAAO,WAAY,SAAQ,QAAQ;IACvC;;;;;;;OAOG;IACH;QACE,KAAK,EAAE,CAAC;QAOV,0CAA0C;QAClC,YAAO,GAAG,KAAK,CAAC;QAPtB,IAAI,CAAC,MAAM,CAAiB,cAAc,CAAC,CAAC;QAC5C,kCAAkC;QAClC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;QACzE,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IACzD,CAAC;IAKD;;;;;;;;;;;;;;;OAeG;IACH,KAAK;QACH,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QACD,IAAI,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;QAC9B,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;CACF"}
@@ -98,17 +98,24 @@ export interface UiOnExit {
98
98
  */
99
99
  uiCanExit(newTransition?: Transition): HookResult;
100
100
  }
101
+ /**
102
+ * Default Resolves Types when not provided to Generic UIViewResolves
103
+ * @see [[UIViewResolves]]
104
+ * @category types
105
+ */
106
+ export type DefaultResolvesType = Record<string, any>;
101
107
  /**
102
108
  * Type alias for resolved values passed to routed components.
103
109
  *
104
110
  * @template T - The shape of the resolved values object
105
111
  *
106
112
  * @see [[UIViewInjectedProps]]
113
+ * @see [[DefaultResolvesType]]
107
114
  * @see [[StateDeclaration.resolve]]
108
115
  *
109
116
  * @category types
110
117
  */
111
- export type UIViewResolves<T = Record<string, any>> = T;
118
+ export type UIViewResolves<T extends DefaultResolvesType = DefaultResolvesType> = T;
112
119
  /**
113
120
  * Props injected into routed components by the `<ui-view>` element.
114
121
  *
@@ -148,11 +155,11 @@ export type UIViewResolves<T = Record<string, any>> = T;
148
155
  *
149
156
  * @category types
150
157
  */
151
- export interface UIViewInjectedProps<T = Record<string, any>> {
158
+ export interface UIViewInjectedProps<T extends DefaultResolvesType = DefaultResolvesType> {
152
159
  /** The current transition (if one is in progress) */
153
160
  transition?: Transition;
154
161
  /** Resolved data from state declarations */
155
- resolves?: UIViewResolves<T>;
162
+ resolves: UIViewResolves<T>;
156
163
  /** The UIRouter instance for programmatic navigation */
157
164
  router: UIRouter;
158
165
  }
@@ -178,12 +185,13 @@ export interface UIViewInjectedProps<T = Record<string, any>> {
178
185
  *
179
186
  * @category types
180
187
  */
181
- export type RoutedLitTemplate = ((props?: UIViewInjectedProps) => TemplateResult) | ((props: UIViewInjectedProps) => TemplateResult);
188
+ export type RoutedLitTemplate<T extends DefaultResolvesType = DefaultResolvesType> = ((props?: UIViewInjectedProps<T>) => TemplateResult) | ((props: UIViewInjectedProps<T>) => TemplateResult);
182
189
  /**
183
190
  * A template function that can be used as a view declaration.
184
191
  */
185
- export interface LitViewDeclarationTemplate extends _ViewDeclaration {
186
- (props?: UIViewInjectedProps): TemplateResult;
192
+ export interface LitViewDeclarationTemplate<T extends DefaultResolvesType = DefaultResolvesType> extends _ViewDeclaration {
193
+ (props: UIViewInjectedProps<T>): TemplateResult;
194
+ (props?: UIViewInjectedProps<T>): TemplateResult;
187
195
  }
188
196
  /**
189
197
  * A LitElement class constructor that can be used in state declarations.
@@ -195,9 +203,9 @@ export interface LitViewDeclarationTemplate extends _ViewDeclaration {
195
203
  * @example
196
204
  * ```ts
197
205
  * class UserList extends LitElement {
198
- * _uiViewProps?: UIViewInjectedProps;
206
+ * _uiViewProps: UIViewInjectedProps;
199
207
  *
200
- * constructor(props?: UIViewInjectedProps) {
208
+ * constructor(props: UIViewInjectedProps) {
201
209
  * super();
202
210
  * this._uiViewProps = props;
203
211
  * }
@@ -216,10 +224,10 @@ export interface LitViewDeclarationTemplate extends _ViewDeclaration {
216
224
  *
217
225
  * @category types
218
226
  */
219
- export interface RoutedLitElement {
220
- /** Constructor that accepts optional UIViewInjectedProps */
221
- new (props?: UIViewInjectedProps): LitElement & {
222
- _uiViewProps?: UIViewInjectedProps;
227
+ export interface RoutedLitElement<T extends DefaultResolvesType = DefaultResolvesType> {
228
+ /** Overloaded constructor that requires UIViewInjectedProps */
229
+ new (props: UIViewInjectedProps<T>): LitElement & {
230
+ _uiViewProps: UIViewInjectedProps<T>;
223
231
  };
224
232
  /** If true, the same component instance is reused across state transitions */
225
233
  sticky?: boolean;
@@ -233,17 +241,17 @@ export interface RoutedLitElement {
233
241
  *
234
242
  * @category types
235
243
  */
236
- export type RoutedLitComponent = RoutedLitTemplate | RoutedLitElement;
244
+ export type RoutedLitComponent<T extends DefaultResolvesType = DefaultResolvesType> = RoutedLitTemplate<T> | RoutedLitElement<T>;
237
245
  /**
238
246
  * A LitElement class used directly as a view declaration.
239
247
  */
240
- export interface LitViewDeclarationElement extends RoutedLitElement, _ViewDeclaration {
248
+ export interface LitViewDeclarationElement<T extends DefaultResolvesType = DefaultResolvesType> extends RoutedLitElement<T>, _ViewDeclaration {
241
249
  }
242
250
  /**
243
251
  * A view declaration object with an explicit component property.
244
252
  */
245
- export interface LitViewDeclarationObject extends _ViewDeclaration {
246
- component: RoutedLitComponent;
253
+ export interface LitViewDeclarationObject<T extends DefaultResolvesType = DefaultResolvesType> extends _ViewDeclaration {
254
+ component: RoutedLitComponent<T>;
247
255
  }
248
256
  /**
249
257
  * Union type for all valid view declaration formats.
@@ -253,7 +261,7 @@ export interface LitViewDeclarationObject extends _ViewDeclaration {
253
261
  * - A LitElement class directly ({@link LitViewDeclarationElement})
254
262
  * - A template function directly ({@link LitViewDeclarationTemplate})
255
263
  */
256
- export type LitViewDeclaration = LitViewDeclarationObject | LitViewDeclarationElement | LitViewDeclarationTemplate;
264
+ export type LitViewDeclaration<T extends DefaultResolvesType = DefaultResolvesType> = LitViewDeclarationObject<T> | LitViewDeclarationElement<T> | LitViewDeclarationTemplate<T>;
257
265
  /**
258
266
  * State declaration interface for Lit applications.
259
267
  *
@@ -293,15 +301,15 @@ export type LitViewDeclaration = LitViewDeclarationObject | LitViewDeclarationEl
293
301
  *
294
302
  * @category types
295
303
  */
296
- export interface LitStateDeclaration extends StateDeclaration {
304
+ export interface LitStateDeclaration<T extends DefaultResolvesType = DefaultResolvesType> extends StateDeclaration {
297
305
  /** The Lit component to render for this state */
298
- component?: LitViewDeclaration;
306
+ component?: LitViewDeclaration<T>;
299
307
  }
300
308
  /**
301
309
  * The `litViewsBuilder` registered in [[UIRouterLit.constructor]] normalizes config to this internal interface.
302
310
  *
303
311
  * @category types
304
312
  */
305
- export interface NormalizedLitViewDeclaration extends _ViewDeclaration {
306
- component: RoutedLitTemplate;
313
+ export interface NormalizedLitViewDeclaration<T extends DefaultResolvesType = DefaultResolvesType> extends _ViewDeclaration {
314
+ component: RoutedLitTemplate<T>;
307
315
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lit-ui-router",
3
- "version": "1.1.2",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "module": "./dist/index.js",
6
6
  "homepage": "https://lit-ui-router.dev",
@@ -26,7 +26,9 @@
26
26
  "format:check": "prettier --check \"**/*.{ts,js,json,md}\"",
27
27
  "lint": "eslint .",
28
28
  "build:custom-elements": "cem analyze --outdir ./dist",
29
- "docs:api": "rimraf ../../docs/api/reference && typedoc --defaultCategory other"
29
+ "docs:api": "rimraf ../../docs/api/reference && typedoc --defaultCategory other",
30
+ "changelog": "release-it --changelog --git.tagMatch=\"lit-ui-router@[0-9]*.[0-9]*.[0-9]*\"",
31
+ "commit:changelog": "echo \"Release \\${version}\n\n$(pnpm --silent changelog)\""
30
32
  },
31
33
  "customElements": "./dist/custom-elements.json",
32
34
  "dependencies": {