Commit Graph

36 Commits

Author SHA1 Message Date
David Greenspan
ee3d306adc templates changes with Geoff (a couple fixes, a couple reverts, comments) 2012-04-03 22:30:54 -07:00
David Greenspan
89ce396ae5 Overhaul liveui & templating to support "smart patch" and rendering HTML (rebase-2) 2012-04-03 22:10:20 -07:00
Nick Martin
0187ee6db4 Temporary hack to allow templates as HTML. 2012-03-16 15:00:34 -07:00
Geoff Schmidt
76c57526f7 rework public API for defining tests 2012-03-02 05:22:40 -08:00
Geoff Schmidt
cab5afbb91 move test reporting functions out of globals 2012-03-02 03:57:30 -08:00
Geoff Schmidt
58a2d65126 Provide package 'meteor' to create the Meteor global
Fold old package 'core' into it
2012-02-23 02:21:10 -08:00
Geoff Schmidt
f31226e388 rename minimongo Collection => LocalCollection 2012-02-16 22:41:16 -08:00
David Greenspan
476db8cccb Meteor.Collection() -> new Collection() in tests 2012-02-07 12:06:51 -08:00
matt debergalis
6851bf66ae Make falsey and {_id: <falsey>} selectors match nothing.
In Livedata and Minimongo, make falsey selectors match no documents,
instead of all documents.  Same for {_id: undefined}.  This is a
departure from most MongoDB drivers, but offers a safety belt around
selectors that are rarely useful and easy to accidentally create
programmatically.

For remove(), also protect against accidentally destroying an entire
collection when passing no args.  To empty a collection, pass the
wildcard selector explicitly: foo.remove({});

For find(), keep the standard mongo behavior of returning all documents
when no selector is passed in by explicitly checking arguments.length.

This change also makes typical read cases cleaner, allowing:

 x = foo.findOne(Session.get('foo_id'));

instead of

 x = Session.get('foo_id') && foo.findOne(Session.get('foo_id'));
2012-02-02 16:46:43 -08:00
matt debergalis
5e7daaaff3 New Collection API
The new Collection API separates query handles from result sets.  It
allows template iterators to only redraw changed objects instead of
entire result sets.  This implementation also sets the stage for
minimongo indexes and better invalidation performance.

collection.find() now returns a Collection.Query handle.  To retrieve
results we provide these methods on Collection.Query:

Iterators (encouraged way to access results):

 * query.forEach(function (obj) { ... });
 * results = query.map(function (obj) { ... });

Cursor-based retrieval (iterators are built on fetch):

 * docs = query.fetch(maxlen); // return next [maxlen] (all) docs.
 * doc = query.get(skip);      // return next doc, skipping [skip] (0) docs.

Counter:

 * length = query.count(); // number of results in query.

Live queries (replaces findLive):

 * live_handle = query.observe({added: function (obj, idx) { ... },
                                removed: function (id, idx) { ... },
                                changed: function (obj, idx) { ... },
                                moved: function (obj, old_idx, new_idx) { ... }});

Convenience finders:

 * doc = collection.findOne({color: 'red'});
 * doc = collection.findOne(id_val);

On the client, calling forEach(), map(), fetch(), get(), or findOne()
inside an invalidation context will register a dependency on the entire
query result.  Any change to any objects invalidates the context.

Calling count() inside an invalidation context will register a
dependency that only triggers if objects enter or leave the result set.

Calling observe() does not register a dependency.
2012-01-27 20:59:08 -08:00
Geoff Schmidt
d1d5604976 Refactor bundler; new package API 2012-01-27 20:02:26 -08:00
Geoff Schmidt
e5eb42e55c Refactor package API/bundler 2012-01-27 20:02:24 -08:00
David Greenspan
2116a9c239 fixed my empty frag logic, changed liveui tests back to original 2012-01-27 20:02:24 -08:00
David Greenspan
140b809c90 safer tbody fix 2012-01-20 16:58:06 -08:00
David Greenspan
ad801a61ac add a TBODY in IE 2012-01-20 16:00:05 -08:00
David Greenspan
db3f8b3ebc jquery-like fragment creation, placeholder comments; still broken in IE 2012-01-20 16:00:05 -08:00
Geoff Schmidt
c3a5e2cafc merge rename from master, with fixups. unit tests pass. take two (this should be an actual merge commit) 2012-01-20 15:25:31 -08:00
Geoff Schmidt
32410dbb36 driver cleanups 2012-01-18 21:43:54 -08:00
Geoff Schmidt
3e1fbe0577 fix partial patching bug 2012-01-18 21:43:42 -08:00
Geoff Schmidt
618d6f71bc fix bug that happened when a template contained another template as its first child 2012-01-18 20:10:50 -08:00
Nick Martin
0e39cbe5be Replace new occurances of Skybreak with Meteor. 2012-01-18 17:53:21 -08:00
Nick Martin
0d413ac1db Take new master version of these files. Didn't happen quite right in the merge. 2012-01-18 17:45:07 -08:00
Nick Martin
459dac9cac Merge branch 'master' into meteor
conflicts hand resolved. deftemplate and liveui reverted to master, will re-do later.

Conflicts:
	admin/generate-dev-bundle.sh
	admin/install-s3.sh
	admin/manifest.json
	app/meteor/deploy.js
	app/meteor/meteor.js
	examples/leaderboard/leaderboard.js
	examples/unfinished/azrael/client/azrael.js
	examples/unfinished/azrael/model.js
	packages/liveui/liveui.js
	packages/templating/deftemplate.js
	packages/templating/html_scanner.js
	tests/minimongo/test.html
2012-01-18 16:14:54 -08:00
Nick Martin
3faff2de78 perl -pi -e 's/Sky/Meteor/g' **/* 2012-01-04 20:52:46 -08:00
Geoff Schmidt
f0df8212ee reimplement #each in terms of renderList
not tested yet
2011-12-19 17:03:26 -08:00
Geoff Schmidt
3e29700c82 todos works, and collects garbage 2011-12-19 17:03:26 -08:00
Geoff Schmidt
7cfdfcf0b9 DocumentFragment-based rendering, with GC, draft
leaderboard works
2011-12-19 17:03:26 -08:00
Geoff Schmidt
3ec06f7381 eliminate jquery dependency in template assembly 2011-12-09 20:45:11 -08:00
Geoff Schmidt
9a67524673 Sky.startup works on the client (DOM ready)
eliminates a jquery dependency
2011-12-08 21:39:45 -08:00
Geoff Schmidt
92b0be6e5f more consistent way to create Sky 2011-12-08 16:34:59 -08:00
Geoff Schmidt
24692a60f5 rationalize underscore usage slightly 2011-12-08 16:28:47 -08:00
Geoff Schmidt
ce565dcaea kill basics package 2011-12-07 22:28:43 -08:00
Geoff Schmidt
02ad969c8a print an error if two templates have the same name
(alas only at runtime for now)
2011-12-07 20:55:00 -08:00
matt debergalis
71494cf7e4 stop using genId() 2011-12-07 12:24:53 -08:00
Geoff Schmidt
f58e659095 Remove support for template setup functions
(1) Fix bug that prevented {{#each this}} from working if current context
was an array

(2) Remove disgusting obj_ptr hack
2011-11-25 23:47:32 -08:00
Nick Martin
d69c2d1f19 Initial import from old busted repo. 2011-11-17 18:35:20 -08:00