Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

Commit

Permalink
Integrate VDOM system into widget-core (#728)
Browse files Browse the repository at this point in the history
* dumped Maquette into widget-core and formatted

* progress

* more progress for vdom

* clean up for vdom

* add caching back in for WidgetBase

* filter null/undfined and convert strings to HNode for v

* Update interfaces for VirtualDomProperties

* updated interfaces

* pass through projector instance

* extra typing goodness

* Update DomWrapper

* Small tweaks

* recurse until find a domNode for insert before if an old child exists

* Initial unit tests for non widget vdom paths

* Cast projector instance to WidgetBase

* Make HNode children optional and filter/map HNodes in single loop

* Make invalidate public and project against undefined children

* Deal with registry labels and pass parent instance through until a new WNode is hit

* Remove projector rendered event

* Remove projector rendered event

* Updates based on testing with widgets and benchmarks

* remove widgetbase debugging code

* Use internal interdaces in vdom for HNode and WNode

* Update vdom unit tests

* Updated unit tests for NodeHandler

* clean __render__ call

* Remove setDomNodes functionality that will be done in vdom

* Add widget-created/widget-updated event for projector and decorate all projector nodes

* createTestWidget no longer works

* Fix the unit tests

* Remove references to vnode

* update typo on interface name

* Remove Maquette as a dependency

* vdom fixup

* more clean up

* more unit tests

* create dom for new registry items and remove unrequired if check

* vdom unit tests for widgets

* remove properties checks

* remove insertBefore in vdom

* extra vdom tests for embedded WNodes and replacing widgets

* remove maquette references

* support merging DNodes onto HTML

* Updated package-lock.json

* more unit tests and fixes

* small fixups

* final fixes

* remove final references to Maquette

* Failing unit test for returning render result with classes

* check the previous rendered exists before updating, otherwise create

* Set properties even when the render has always been scheduled

* use projector options for merge flag

* initial request idle for after render callbacks

* add resolve request idle callback to unit tests

* clean up after render callbacks

* Support skipping unknown / non matching nodes when merging the render output onto existing HTML

* Add resolving util for rAF and rIC which falls back to stubbing setTimeout when requestIdleCallback isn't supported

* fixup unit test

* support using zero as a key value

* else on newline

* Use listener map and type the event

* Properties cannot be null or undefined
  • Loading branch information
agubler authored Oct 26, 2017
1 parent 6268ad3 commit 7dbf15f
Show file tree
Hide file tree
Showing 38 changed files with 3,454 additions and 2,318 deletions.
11 changes: 0 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
},
"dependencies": {
"intersection-observer": "^0.4.2",
"maquette": "~2.5.1",
"pepjs": "^0.4.2"
}
}
12 changes: 3 additions & 9 deletions src/NodeHandler.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Evented } from '@dojo/core/Evented';
import { VNodeProperties } from '@dojo/interfaces/vdom';
import Map from '@dojo/shim/Map';
import { NodeHandlerInterface } from './interfaces';

/**
* Enum to identify the type of event.
* Listening to 'Projector' will notify when projector is created or updated
* Listening to 'Widget' will notifiy when widget root is created or updated
* Listening to 'Widget' will notify when widget root is created or updated
*/
export enum NodeEventType {
Projector = 'Projector',
Expand All @@ -25,17 +24,12 @@ export class NodeHandler extends Evented implements NodeHandlerInterface {
return this._nodeMap.has(key);
}

public add(element: HTMLElement, properties: VNodeProperties): void {
const key = String(properties.key);
public add(element: HTMLElement, key: string): void {
this._nodeMap.set(key, element);
this.emit({ type: key });
}

public addRoot(element: HTMLElement, properties: VNodeProperties): void {
if (properties && properties.key) {
this.add(element, properties);
}

public addRoot(element: HTMLElement, key?: string): void {
this.emit({ type: NodeEventType.Widget });
}

Expand Down
Loading

0 comments on commit 7dbf15f

Please sign in to comment.