Skip to content

Commit b4c703d

Browse files
chore: update core to 7.0.0-beta.1
1 parent 4d06329 commit b4c703d

File tree

3 files changed

+33
-28
lines changed

3 files changed

+33
-28
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"module": "lib-esm/index.js",
7676
"typings": "lib/index.d.ts",
7777
"dependencies": {
78-
"@uirouter/core": "6.0.6"
78+
"@uirouter/core": "v7beta"
7979
},
8080
"peerDependencies": {
8181
"angular": ">=1.2.0"

src/directives/viewDirective.ts

+28-23
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
Transition,
2222
TransitionService,
2323
TypedMap,
24+
UIViewPortalRenderCommand,
2425
unnestR,
2526
ViewService,
2627
} from '@uirouter/core';
@@ -213,7 +214,6 @@ uiView = [
213214
};
214215

215216
const directive = {
216-
count: 0,
217217
restrict: 'ECA',
218218
terminal: true,
219219
priority: 400,
@@ -228,44 +228,49 @@ uiView = [
228228

229229
let previousEl: JQuery, currentEl: JQuery, currentScope: IScope, viewConfig: Ng1ViewConfig;
230230

231+
const uiViewId = $view.registerView('ng1', inherited.$uiView.id, name, renderContentIntoUIViewPortal);
232+
233+
scope.$on('$destroy', function () {
234+
trace.traceUIViewEvent('Destroying/Unregistering', activeUIView);
235+
$view.deregisterView(uiViewId);
236+
});
237+
231238
const activeUIView: ActiveUIView = {
232239
$type: 'ng1',
233-
id: directive.count++, // Global sequential ID for ui-view tags added to DOM
240+
id: uiViewId, // filled in later
234241
name: name, // ui-view name (<div ui-view="name"></div>
235242
fqn: inherited.$uiView.fqn ? inherited.$uiView.fqn + '.' + name : name, // fully qualified name, describes location in DOM
236243
config: null, // The ViewConfig loaded (from a state.views definition)
237-
configUpdated: configUpdatedCallback, // Called when the matching ViewConfig changes
238-
get creationContext() {
239-
// The context in which this ui-view "tag" was created
240-
const fromParentTagConfig = parse('$cfg.viewDecl.$context')(inherited);
241-
// Allow <ui-view name="foo"><ui-view name="bar"></ui-view></ui-view>
242-
// See https://github.com/angular-ui/ui-router/issues/3355
243-
const fromParentTag = parse('$uiView.creationContext')(inherited);
244-
return fromParentTagConfig || fromParentTag;
245-
},
244+
configUpdated: undefined, // unused in core
245+
creationContext: undefined, // unused in core
246+
// configUpdated: configUpdatedCallback, // Called when the matching ViewConfig changes
247+
// get creationContext() {
248+
// The context in which this ui-view "tag" was created
249+
// const fromParentTagConfig = parse('$cfg.viewDecl.$context')(inherited);
250+
// Allow <ui-view name="foo"><ui-view name="bar"></ui-view></ui-view>
251+
// See https://github.com/angular-ui/ui-router/issues/3355
252+
// const fromParentTag = parse('$uiView.creationContext')(inherited);
253+
// return fromParentTagConfig || fromParentTag;
254+
// },
246255
};
247256

248257
trace.traceUIViewEvent('Linking', activeUIView);
249258

250-
function configUpdatedCallback(config?: Ng1ViewConfig) {
251-
if (config && !(config instanceof Ng1ViewConfig)) return;
252-
if (configsEqual(viewConfig, config)) return;
253-
trace.traceUIViewConfigUpdated(activeUIView, config && config.viewDecl && config.viewDecl.$context);
259+
function renderContentIntoUIViewPortal(renderCommand: UIViewPortalRenderCommand) {
260+
if (renderCommand.command === 'RENDER_DEFAULT_CONTENT') {
261+
viewConfig = undefined;
262+
} else if (renderCommand.command === 'RENDER_ROUTED_VIEW') {
263+
viewConfig = renderCommand.routedViewConfig as Ng1ViewConfig;
264+
} else if (renderCommand.command === 'RENDER_INTEROP_DIV') {
265+
}
254266

255-
viewConfig = config;
256-
updateView(config);
267+
updateView(viewConfig);
257268
}
258269

259270
$element.data('$uiView', { $uiView: activeUIView });
260271

261272
updateView();
262273

263-
const unregister = $view.registerUIView(activeUIView);
264-
scope.$on('$destroy', function () {
265-
trace.traceUIViewEvent('Destroying/Unregistering', activeUIView);
266-
unregister();
267-
});
268-
269274
function cleanupLastView() {
270275
if (previousEl) {
271276
trace.traceUIViewEvent('Removing (previous) el', previousEl.data('$uiView'));

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -735,10 +735,10 @@
735735
dependencies:
736736
eslint-visitor-keys "^1.1.0"
737737

738-
"@uirouter/core@6.0.6":
739-
version "6.0.6"
740-
resolved "https://registry.yarnpkg.com/@uirouter/core/-/core-6.0.6.tgz#4bea0ca88790a939d8e84ba05a31b96f50d9abe8"
741-
integrity sha512-+i1iNaPQRp1JoEnxi4EsTX30bSvkWtPEenENWdvdIzX615Q3WCWwnbW9DtrwX9gSD5qmWEaQEtGMU0uF3qJ+1g==
738+
"@uirouter/core@v7beta":
739+
version "7.0.0-beta.1"
740+
resolved "https://registry.yarnpkg.com/@uirouter/core/-/core-7.0.0-beta.1.tgz#294c9a9f82f203ca396763b470093daeef3a8d52"
741+
integrity sha512-jdRQscId7iHWnuSw9xvWNnTDM8QORqP1J5ovtDPtKEW3m0+SfCcKJqQWV6AyXXBFhUIzF+0JmQ8YOoVxDFSBPw==
742742

743743
"@uirouter/[email protected]":
744744
version "2.5.3"

0 commit comments

Comments
 (0)