lit-ui-router 0.0.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,267 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement } from 'lit';
8
+ import { customElement, property, state } from 'lit/decorators.js';
9
+ import { ResolveContext, Transition, applyPairs, trace, isFunction, isString, unnestR, filter, } from '@uirouter/core';
10
+ import { LitViewConfig } from './core.js';
11
+ import { UIRouterLitElement } from './ui-router.js';
12
+ /** @internal */
13
+ let viewIdCounter = 0;
14
+ /**
15
+ * @summary
16
+ *
17
+ * This is the <code>&lt;ui-view&gt;</code> component.
18
+ *
19
+ * The <code>&lt;ui-view&gt;</code> component is a viewport for routed components.
20
+ * Routed components will be rendered inside the <code>&lt;ui-view&gt;</code> viewport.
21
+ *
22
+ * @event {CustomEvent} ui-router-context
23
+ *
24
+ * This event is fired to obtain the <code>uiRouter</code> instance,
25
+ * when not directly provided.
26
+ * Once obtained, the <code>&lt;ui-view&gt;</code> listens and
27
+ * provides the <code>uiRouter</code> to descendants.
28
+ *
29
+ * @event {CustomEvent} ui-view-context
30
+ *
31
+ * This event is fired to obtain the parent <code>&lt;ui-view&gt;</code>.
32
+ */
33
+ let UiView = class UiView extends LitElement {
34
+ constructor() {
35
+ super(...arguments);
36
+ this.name = '';
37
+ this.component = null;
38
+ this.inner = document.createDocumentFragment();
39
+ this.viewId = viewIdCounter++;
40
+ this.onUiViewContextEvent = (event) => {
41
+ // can't adopt self
42
+ if (event.target === this) {
43
+ return;
44
+ }
45
+ // handle event; provide self as parent
46
+ event.stopPropagation();
47
+ event.detail.parentView = this;
48
+ };
49
+ this.onUiRouterContextEvent = (event) => {
50
+ UIRouterLitElement.onUiRouterContextEvent(this.uiRouter)(event);
51
+ };
52
+ this.disconnectedHandlers = [];
53
+ }
54
+ /** @internal */
55
+ createRenderRoot() {
56
+ return this;
57
+ }
58
+ _viewConfigUpdated(config) {
59
+ if (!config) {
60
+ this.component = null;
61
+ this.requestUpdate();
62
+ return;
63
+ }
64
+ if (!(config instanceof LitViewConfig)) {
65
+ return;
66
+ }
67
+ // The "new" viewconfig is already applied, so exit early
68
+ if (this._uiViewData.config === config) {
69
+ return;
70
+ }
71
+ trace.traceUIViewConfigUpdated(this._uiViewData, config.viewDecl.$context);
72
+ this._applyUpdatedConfig(config);
73
+ }
74
+ async _applyUpdatedConfig(config) {
75
+ this._uiViewData.config = config;
76
+ if (!this.viewAddress) {
77
+ this.viewAddress = {
78
+ fqn: this._uiViewData.fqn,
79
+ context: config?.viewDecl?.$context,
80
+ };
81
+ }
82
+ this.resolveContext = new ResolveContext(config.path);
83
+ this.component = config.viewDecl.component;
84
+ this.requestUpdate();
85
+ }
86
+ connectedCallback() {
87
+ super.connectedCallback();
88
+ this.addEventListener(this.constructor.uiViewContextEventName, this.onUiViewContextEvent);
89
+ this.setupUiView();
90
+ this.captureContent();
91
+ }
92
+ static { this.uiViewContextEventName = 'ui-view-context'; }
93
+ static uiViewContextEvent() {
94
+ return new CustomEvent(this.uiViewContextEventName, {
95
+ bubbles: true,
96
+ composed: true,
97
+ detail: {
98
+ parentView: null,
99
+ },
100
+ });
101
+ }
102
+ /** @internal */
103
+ static seekParentView(candidate) {
104
+ const uiViewContextEvent = this.uiViewContextEvent();
105
+ candidate.dispatchEvent(uiViewContextEvent);
106
+ return uiViewContextEvent.detail.parentView;
107
+ }
108
+ seekParentView() {
109
+ this.parentView = this.constructor.seekParentView(this);
110
+ }
111
+ seekRouter() {
112
+ this.uiRouter = this.uiRouter || UIRouterLitElement.seekRouter(this);
113
+ this.addEventListener(UIRouterLitElement.uiRouterContextEventName, this.onUiRouterContextEvent);
114
+ }
115
+ captureContent() {
116
+ this.inner.append(...this.childNodes.values());
117
+ }
118
+ setupUiView() {
119
+ this.seekRouter();
120
+ this.seekParentView();
121
+ const { viewId, uiRouter: router, parentView } = this;
122
+ const name = this.name || '$default';
123
+ const parentFqn = parentView?._uiViewData?.fqn;
124
+ const creationContext = parentView?.viewContext || router.stateRegistry.root();
125
+ const fqn = parentFqn ? parentFqn + '.' + name : name;
126
+ this._uiViewData = {
127
+ $type: 'lit',
128
+ id: viewId,
129
+ name,
130
+ fqn,
131
+ creationContext,
132
+ configUpdated: this._viewConfigUpdated.bind(this),
133
+ config: undefined,
134
+ };
135
+ this.disconnectedHandlers.push(router.transitionService.onBefore({}, (trans) => {
136
+ return this._invokeUiCanExitHook(trans);
137
+ }));
138
+ this.disconnectedHandlers.push(router.transitionService.onSuccess({}, (trans) => this._invokeUiOnParamsChangedHook(trans)));
139
+ this.disconnectedHandlers.push(router.viewService.registerUIView(this._uiViewData));
140
+ }
141
+ disconnectedCallback() {
142
+ super.disconnectedCallback();
143
+ this.removeEventListener(this.constructor.uiViewContextEventName, this.onUiViewContextEvent);
144
+ while (this.disconnectedHandlers.length) {
145
+ const handler = this.disconnectedHandlers.shift();
146
+ handler?.();
147
+ }
148
+ }
149
+ /**
150
+ * For each transition, checks the component loaded in the ui-view for:
151
+ *
152
+ * - has a uiCanExit() component hook
153
+ * - is being exited
154
+ *
155
+ * If both are true, adds the uiCanExit component function as a hook to that singular Transition.
156
+ */
157
+ _invokeUiCanExitHook(trans) {
158
+ const instance = this.firstElementChild;
159
+ const uiCanExitFn = instance && instance.uiCanExit;
160
+ if (isFunction(uiCanExitFn)) {
161
+ const state = this.state;
162
+ if (trans.exiting().indexOf(state) !== -1) {
163
+ trans.onStart({}, function () {
164
+ return uiCanExitFn.call(instance, trans);
165
+ });
166
+ }
167
+ }
168
+ }
169
+ requestUpdate(...args) {
170
+ super.requestUpdate(...args);
171
+ const instance = this.firstElementChild;
172
+ if (isFunction(instance?.requestUpdate)) {
173
+ instance.requestUpdate();
174
+ }
175
+ }
176
+ /**
177
+ * For each transition, checks if any param values changed and notify component
178
+ */
179
+ _invokeUiOnParamsChangedHook($transition$) {
180
+ this.requestUpdate();
181
+ const instance = this.firstElementChild;
182
+ const uiOnParamsChanged = instance?.uiOnParamsChanged;
183
+ if (isFunction(uiOnParamsChanged)) {
184
+ const viewState = this.state;
185
+ const resolveContext = new ResolveContext(this._uiViewData.config.path);
186
+ const viewCreationTrans = resolveContext.getResolvable('$transition$').data;
187
+ // Exit early if the $transition$ is the same as the view was created within.
188
+ // Exit early if the $transition$ will exit the state the view is for.
189
+ if ($transition$ === viewCreationTrans ||
190
+ $transition$.exiting().indexOf(viewState) !== -1)
191
+ return;
192
+ const toParams = $transition$.params('to');
193
+ const fromParams = $transition$.params('from');
194
+ const getNodeSchema = (node) => node.paramSchema;
195
+ const toSchema = $transition$
196
+ .treeChanges('to')
197
+ .map(getNodeSchema)
198
+ .reduce(unnestR, []);
199
+ const fromSchema = $transition$
200
+ .treeChanges('from')
201
+ .map(getNodeSchema)
202
+ .reduce(unnestR, []);
203
+ // Find the to params that have different values than the from params
204
+ const changedToParams = toSchema.filter((param) => {
205
+ const idx = fromSchema.indexOf(param);
206
+ return (idx === -1 ||
207
+ !fromSchema[idx].type.equals(toParams[param.id], fromParams[param.id]));
208
+ });
209
+ // Only trigger callback if a to param has changed or is new
210
+ if (changedToParams.length) {
211
+ const changedKeys = changedToParams.map((x) => x.id);
212
+ // Filter the params to only changed/new to params. `$transition$.params()` may be used to get all params.
213
+ const newValues = filter(toParams, (_, key) => changedKeys.indexOf(key) !== -1);
214
+ instance.uiOnParamsChanged(newValues, $transition$);
215
+ }
216
+ }
217
+ }
218
+ /** @internal */
219
+ get viewContext() {
220
+ return this?._uiViewData?.config?.viewDecl.$context;
221
+ }
222
+ /** @internal */
223
+ get state() {
224
+ return this.viewContext.self;
225
+ }
226
+ render() {
227
+ if (!this.component || !this.viewAddress) {
228
+ return this.inner.cloneNode(true);
229
+ }
230
+ const { uiRouter: router } = this;
231
+ const injector = this.resolveContext.injector();
232
+ const resolvables = this.resolveContext
233
+ .getTokens()
234
+ .filter((token) => isString(token))
235
+ .map((token) => this.resolveContext.getResolvable(token))
236
+ .filter((r) => r.resolved);
237
+ const resolves = resolvables
238
+ .map(({ token }) => [token, injector.get(token)])
239
+ .reduce(applyPairs, {});
240
+ const transition = injector.get(Transition);
241
+ return this.component({
242
+ router,
243
+ resolves,
244
+ transition,
245
+ });
246
+ }
247
+ };
248
+ __decorate([
249
+ property()
250
+ ], UiView.prototype, "name", void 0);
251
+ __decorate([
252
+ property({ attribute: false })
253
+ ], UiView.prototype, "uiRouter", void 0);
254
+ __decorate([
255
+ state()
256
+ ], UiView.prototype, "viewAddress", void 0);
257
+ __decorate([
258
+ state()
259
+ ], UiView.prototype, "component", void 0);
260
+ __decorate([
261
+ state()
262
+ ], UiView.prototype, "parentView", void 0);
263
+ UiView = __decorate([
264
+ customElement('ui-view')
265
+ ], UiView);
266
+ export { UiView };
267
+ //# sourceMappingURL=ui-view.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui-view.js","sourceRoot":"","sources":["../src/ui-view.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAEL,cAAc,EACd,UAAU,EAEV,UAAU,EAGV,KAAK,EAEL,UAAU,EACV,QAAQ,EACR,OAAO,EAEP,MAAM,GAGP,MAAM,gBAAgB,CAAC;AAQxB,OAAO,EAAE,aAAa,EAAe,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAwB,MAAM,gBAAgB,CAAC;AAE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G5B;IADP,KAAK,EAAE;yCAC2C;AAqD3C;IADP,KAAK,EAAE;0CACoB;AApEjB,MAAM;IADlB,aAAa,CAAC,SAAS,CAAC;GACZ,MAAM,CAmTlB"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "lit-ui-router",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "module": "./dist/index.js",
6
+ "sideEffects": [
7
+ "**/ui-router.js",
8
+ "**/ui-view.js"
9
+ ],
10
+ "main": "./dist/index.js",
11
+ "types": "./dist/index.d.ts",
12
+ "files": [
13
+ "dist/**"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "test": "vitest run",
18
+ "format": "prettier --write \"**/*.{ts,json,md}\"",
19
+ "lint": "prettier --check \"**/*.{ts,json,md}\"",
20
+ "build:custom-elements": "cem analyze --outdir ./dist"
21
+ },
22
+ "customElements": "./dist/custom-elements.json",
23
+ "dependencies": {
24
+ "@uirouter/core": "^6.0.8",
25
+ "lit": "^2.0.0 || ^3.0.0"
26
+ },
27
+ "devDependencies": {
28
+ "@custom-elements-manifest/analyzer": "0.10.4",
29
+ "@vitest/browser": "^3.2.4",
30
+ "playwright": "1.54.1",
31
+ "prettier": "3.6.2",
32
+ "typescript": "5.8.3",
33
+ "vitest": "^3.2.4"
34
+ }
35
+ }