Rich Harris
e77988b195
Merge pull request #1247 from jacwright/behaviors
...
Adds actions to components
7 years ago
Rich-Harris
61d3ab0215
Merge branch 'preserve-comments-option' of https://github.com/zzolo/svelte into zzolo-preserve-comments-option
7 years ago
Rich-Harris
fb84d729d8
tidy up
7 years ago
Rich-Harris
4b2a01f2e9
all tests passing
7 years ago
Rich-Harris
a3e91eb267
holy shit i think i did it
7 years ago
Rich-Harris
7c953a6622
am close...
7 years ago
Alan Palazzolo
3c61655e93
Add option preserve comments in SSR rendering.
7 years ago
Jacob Wright
04f5d5c975
Adds actions to components
...
Actions add additional functionality to elements within your component's template that may be difficult to add with other mechanisms. Examples of functionality which actions makes trivial to attach are:
* tooltips
* image lazy loaders
* drag and drop functionality
Actions can be added to an element with the `use` directive.
```html
<img use:lazyload data-src="giant-photo.jpg>
```
Data may be passed to the action as an object literal (e.g. `use:b="{ setting: true }"`, a literal value (e.g. `use:b="'a string'"`), or a value or function from your component's state (e.g. `add:b="foo"` or `add:b="foo()"`).
Actions are defined in a "actions" property on your component definition.
```html
<script>
export default {
actions: {
b(node, data) {
// do something
return {
update(data) {},
destroy() {}
}
}
}
}
</script>
```
A action is a function which receives a reference to an element and optionally the data if it is added in the HTML. This function can then attach listeners or alter the element as needed. The action can optionally return an object with the methods `update(data)` and `destroy()`.
When data is added in the HTML and comes from state, the action's `update(data)` will be called if defined whenever the state is changed.
When the element is removed from the DOM `destroy()` will be called if provided, allowing for cleanup of event listeners, etc.
See https://github.com/sveltejs/svelte/issues/469 for discussion around this feature and more examples of how it could be used.
7 years ago
Rich Harris
5b2e810fc2
Merge branch 'master' into gh-1254
7 years ago
Rich Harris
35a7fc6d32
Merge pull request #1256 from sveltejs/each-keyed-helper
...
[WIP] move keyed each diffing into a shared helper
7 years ago
Rich Harris
4b5d465a97
prevent name collisions with each block index - fixes #1254
7 years ago
Rich Harris
4cb8effccd
failing test for #1254
7 years ago
Rich Harris
5b086df061
Merge pull request #1250 from UnwrittenFun/feat/warn-end-pos
...
Add end position to warnings and errors
7 years ago
Rich Harris
a2d09c2136
simplify updateKeyedEach
7 years ago
James Birtles
89024177fc
Fix named-export end position
7 years ago
Rich Harris
10600eb776
Merge pull request #1249 from btakita/issues/588
...
Speed up keyed swap rows benchmark by moving existing DOM elements instead of creating new elements
7 years ago
Rich Harris
86a151a7ea
Merge pull request #1243 from sveltejs/gh-1240
...
fix #1240
7 years ago
Brian Takita
66e4df11a7
Implement https://github.com/sveltejs/svelte/issues/588
...
* Performance Improvement with Keyed EachBlock
* All DOM nodes for existing data are reused between changes to state
* Speed up Keyed Swap Rows Benchmark
* https://github.com/krausest/js-framework-benchmark
* Fixed Build
* Introduced jsdom.VirtualConsole
7 years ago
mrkishi
9b80eee51a
Prioritize named over spread attributes
7 years ago
mrkishi
b5102f4f1b
Add spread -- rough idea
7 years ago
James Birtles
da6a74016f
add end position to errors
7 years ago
James Birtles
d07721cd50
add end position to warnings
7 years ago
Rich Harris
7c25eb32fa
skip missing property warning for computed/global properties
7 years ago
Rich Harris
ce607d5ab3
add local variable for list values - fixes #1240
7 years ago
Rich Harris
39694c31c3
nicer error messages
7 years ago
Rich Harris
f97036dd39
error if ref:foo has a value
7 years ago
Rich Harris
6f65554c93
failing test for #1240
7 years ago
Rich Harris
6f866bbb4c
Merge pull request #1242 from jacwright/directive-parsing-cleanup
...
Refactor directive parsing for code reuse
7 years ago
Jacob Wright
6d4f8d889a
Refactor directive parsing for code reuse
...
This removes the copy-pasta for directive parsing and removes the need for special if-else cases for each directive.
7 years ago
Rich Harris
26239463c5
Merge pull request #1237 from sveltejs/gh-1209
...
use setAttribute with inputs, for benefit of IE - fixes #1209
7 years ago
Rich Harris
d893eef513
Merge pull request #1239 from sveltejs/gh-1221
...
scale transition duration by delta
7 years ago
Rich Harris
38b34bbe1d
reenable all tests
7 years ago
Rich Harris
140e2271f7
scale transition duration by delta - fixes #1221
7 years ago
Rich Harris
4e99eb8d37
use setAttribute with inputs, for benefit of IE - fixes #1209
7 years ago
Rich Harris
01f6f9fa4d
alias listName to deconflict with shared helpers - fixes #1229
7 years ago
Rich Harris
eae98f952d
add CSS scoping classes when stringifying child nodes - fixes #1223
7 years ago
Rich Harris
9037e93934
set arbitrary compile options when calling SSR register function
7 years ago
Rich Harris
b763714222
allow SVG elements to have scoped CSS - fixes #1224
7 years ago
Rich Harris
d680356622
update test
7 years ago
Rich Harris
ddd67dd844
add each_value to contextProps - fixes #1206
7 years ago
Rich Harris
a8f94f0898
Merge branch 'test-1217' of https://github.com/aphitiel/svelte into aphitiel-test-1217
7 years ago
Rich Harris
3f7f237a9a
switch back to using svelte- instead of name-
7 years ago
Rich Harris
428784d570
Merge branch 'gh-1118' into gh-1118-base36
7 years ago
Rich Harris
2f01115a41
merge master -> gh-1118
7 years ago
Rich Harris
0c66e9e2f7
merge
7 years ago
pk
58d5c2040a
failing test for #1217
7 years ago
Rich Harris
91a04cfb88
Merge pull request #1200 from leereamsnyder/process-atsupports
...
process code in @supports queries with cascade: false
7 years ago
Rich Harris
fad5ccdf59
prevent context variables being called component or state - fixes #1213
7 years ago
ekhaled
f9d606a5c9
re-add Child.html
7 years ago
ekhaled
b8beb002a1
remove file
7 years ago
ekhaled
2e9cd4742c
fix snapshots for the actual mounting code
7 years ago
ekhaled
270be984ac
fix bundle snapshots
7 years ago
ekhaled
6792e77392
some case-sensitivity thing
7 years ago
ekhaled
ae86cf9f4b
clarify in test that its an intro test only
7 years ago
ekhaled
7b2246126e
fix tests on linux
7 years ago
ekhaled
7401004a66
add test for transitions on nested components
7 years ago
ekhaled
2e3724f7d3
fix snapshots
7 years ago
Rich Harris
94c76308a1
update deps to get tests to pass again
7 years ago
Rich Harris
7b4c486be9
only apply key to keyed each block, not its children - fixes #1202
7 years ago
Lee Reamsnyder
cbdbff54bf
process code in @supports queries with cascade: false
...
with the cascade: false compiler option, CSS in @supports blocks was getting removed
7 years ago
Conduitry
a2873df711
update js if-block-no-update test
7 years ago
Conduitry
ff6e104f92
add failing test for #1195
7 years ago
Rich Harris
e95a0b60a9
Merge branch 'master' into gh-1175
7 years ago
Rich Harris
a5cc451c9c
only use page[XY]Offset
7 years ago
Rich Harris
1ad28e6fe6
use base36 for style classes
7 years ago
Rich Harris
81743a2562
update more tests
7 years ago
Rich Harris
9971283671
update tests
7 years ago
Rich Harris
0131216a1a
Merge branch 'master' into gh-1144
7 years ago
Rich Harris
602f13ae6b
fix out of date test
7 years ago
Rich Harris
cb8071acd4
allow observing $foo in dev mode - #1181
7 years ago
Rich Harris
c2bb549901
wrap <slot> updates in conditional - fixes #1144
7 years ago
Rich Harris
805c72fefc
Merge pull request #1173 from sveltejs/gh-1122
...
[WIP] Simplify everything
7 years ago
Rich Harris
036277df64
update tests
7 years ago
Rich Harris
4ccc2ade2f
Merge pull request #1169 from sveltejs/gh-1166
...
use ["default"] instead of .default in legacy mode
7 years ago
Rich Harris
af5a73cc11
update tests
7 years ago
Rich Harris
fba8a9479b
Merge pull request #1178 from GarethOates/storeCancelScope
...
this._changeHandlers was undefined when calling cancel()
7 years ago
Rich Harris
fdd9adab4d
add test for #1179
7 years ago
Gareth Oates
389b5c9ff9
There was no test to determine if onchange cancel threw an error
7 years ago
Robert Hall
836cc36598
Using pageYOffset & pageXOffset
7 years ago
Rich Harris
d162ce9968
Merge branch 'master' into gh-1122
7 years ago
Rich Harris
1b599bd57b
put _differs on prototype, remove runtime option
7 years ago
Rich Harris
81b12e030e
Merge branch 'immutable-support' of https://github.com/jacwright/svelte into jacwright-immutable-support
7 years ago
Rich Harris
27f6d560b5
remove some unused code etc
7 years ago
Rich Harris
7baba8bf8c
all tests passing
7 years ago
Rich Harris
b94f63ed70
everything working except some destructuring stuff
7 years ago
Rich Harris
dd5e0f7358
Merge branch 'master' into gh-1122
7 years ago
Rich Harris
b3049a6fa0
Merge pull request #1158 from sveltejs/gh-1156
...
[WIP] Error on unclosed comments and blocks with no content
7 years ago
Rich Harris
c0292cbca1
update tests
7 years ago
Jacob Wright
cb446bca64
Adds some runtime tests for the immutable option
7 years ago
Jacob Wright
046a8000e6
Add another test
7 years ago
Jacob Wright
405c4f6371
Adding compiler option for immutable back in
...
This will keep existing code smaller and _mostly_ only add size when using the `immutable` compiler option.
7 years ago
Rich Harris
f77314f647
increase test coverage
7 years ago
Rich Harris
bc6ee3ef9f
increase test coverage, handle immediately-closed blocks
7 years ago
Rich Harris
dfff2957a0
increase test coverage
7 years ago
Jacob Wright
9e877d9da1
Makes immutable a component option rather than a compile option
...
This allows components to opt in (or out) of using immutable data checking for greater flexibility in app design. It also removes the compiler option.
7 years ago
Rich Harris
cccc3e4c41
failing test for second part of #1100
7 years ago
Jacob Wright
9a1d87494d
Removes date checks and simplifies NaN checks, adds tests
7 years ago
Rich Harris
38bf5b1d3f
use ["default"] instead of .default in legacy mode - fixes #1166
7 years ago
Rich Harris
198f132b28
doh
7 years ago
Rich Harris
ff67b137c4
empty blocks are a dev warning, not an error
7 years ago