UNPKG

46.6 kBMarkdownView Raw
1# Changelog
2
3## 2.0.0-alpha.225
4
5* Automatically prefix certaib css properties for better browser compatibility.
6
7* When errors are thrown inside event handlers - a subsequent `@error` event will be triggered from the element of the throwing handler.
8
9* All new `imba create` command (by @familyfriendlymikey)
10
11
12## 2.0.0-alpha.224
13
14* Fixed parsing of nested template literal strings.
15
16* Enable sourcemapping by default when running scripts.
17
18* Added `imba.awaits`
19
20* Make sure automatic `import {...} from 'imba'` is inserted at the very top.
21
22* Make empty catch block return the error
23
24 Useful to be able to handle things like error handling for asynchronous promises in a more compact manner:
25
26 ```imba
27 # will just swallow potential errors like before
28 let res = try await some-function
29 # ending with catch will return the error instead of the result
30 let res = try await some-function catch
31 if res isa Error
32 ...
33 ```
34
35* Various fixes
36
37## 2.0.0-alpha.223
38
39* Include safari15 as a target when compiling for web.
40
41 We recently started using class static initialization blocks to simplify
42 some internals, and this is not yet supported in safari.
43
44* Allow two parameters in `ja`/`justify-align` property to set justify/align independently.
45
46## 2.0.0-alpha.222
47
48* Enable `x` and `y` shorthands for all border properties.
49
50* Add `s` shorthand for `size`.
51
52* Deprecate `j` and `a` shorthands.
53
54* Streamlined more css shorthands and added more tests for styling
55
56
57## 2.0.0-alpha.221
58
59* Add shorthands for `outline-*` css properties.
60
61* Unify `ease` and `transition` css properties.
62
63 This is a breaking change. Going forward it is recommended to use the `ease` properties for all transitioning. See [documentation](https://imba.io/docs/css/easing).
64
65* Add support for custom colors in predefined box-shadows.
66
67 See [documentation](https://imba.io/docs/css/properties/box-shadow) for details.
68
69* Improvements to the router.
70
71* Rely more on esbuild to generate simpler code (ie using static blocks in classes).
72
73* Add `inherited` hook for classes.
74
75 Whenever a class is extended, the `inherited` method on the parent class will be called, with the subclass as the only argument, if one is defined.
76
77 ```imba
78 class Model
79 static def inherited subclass
80 console.log subclass,'inherited from',self
81
82 class Item < Model
83 ```
84
85
86## 2.0.0-alpha.219
87
88* Add import handler for `?serviceworker` suffix.
89
90 These assets are built without hashes in filename and to the root of the public folder, as is required for serviceworkers.
91
92* Deprecate `shadow` shorthand for `box-shadow` - use `bxs` instead.
93
94* Deprecate `ts` shorthand for `text-shadow` - use `txs` instead.
95
96* Support two parameters in css property `gap`
97
98## 2.0.0-alpha.216
99
100Last version (with new features) before `beta.1`. This release contains breaking changes in the bundler that need to be tested thoroughly before beta.
101
102* Use the latest version of esbuild
103
104 We are finally using the latest version of esbuild. All of our custom logic
105 for hashing, resolving and chunking is now done by esbuild instead.
106
107* Support path aliases from `[js|ts]config.json`
108
109 Now that we are using the latest version of esbuild we finally support [path aliases](https://www.typescriptlang.org/docs/handbook/module-resolution.html#path-mapping) declared in `[js|ts]config.json` files. This also works with assets, ie. declaring `"icons/*": ["assets/svg/*","assets/codicons/*]` in your tsconfig would allow `<svg src="icons/some-icon.svg">` to work anywhere in your project.
110
111* Remove support for path aliases in `imbaconfig.json`
112
113 If you had declared path aliases in an `imbaconfig.json` these should be moved into a `[js|ts]config.json` instead.
114
115* Remove backwards compatible transforms from compiler itself.
116
117 Previously we included a bunch of logic for transforming conditional assignments like `??=`,`&&=`, and `||=` to support older browsers and node versions. Now we compile these statements as is and rely on esbuild to transform when needed.
118
119* Remove support for `?=` operator - use `??=` instead.
120
121* Drop commonjs target from compiler
122
123 The imba compiler will now always compile import/export statements natively
124 to import/export in javascript, and instead rely on esbuild to convert the output to cjs when needed.
125
126* Simplify output from `imba build`
127
128 The output of imba build is now possible to run directly through node (and soon Bun). We
129
130* Allow running html file directly with `imba some-entry.html`
131
132 This will spawn a dev-server for this html file and its referenced scripts and stylesheets.
133
134* Allow testing client-side scripts with `imba --web some-entry.imba`
135
136 This will spawn a dev-server, a html entrypoint and all that is needed to run a script in the browser.
137
138* Copy static assets over from `public` when building
139
140 If you have a `public` directory in your project, files from this will be copied over to the public folder of your output dir (default `dist`) when building.
141
142* Allow prefixing asset paths via `--base` option
143
144 Ie, when building for github pages you would run `imba build --base /my-repo-name -o docs index.html` to build your files and assets with the correct prefix, into the `docs/` folder of your project to adhere to github pages convetions.
145
146* Support loading workers following vite conventions
147
148 ```
149 import MyWorker from './some/script?worker'
150 import MySharedWorker from './some/script?sharedworker'
151 import url from './some/script?worker&url'
152 ```
153
154* Set node14.13.0 as the default minimum target when building for node.
155
156 This can be overridden by supplying your version of node through the `--node.target` option. Ie `imba build --node.target node12 my/script.imba`
157
158* Fixed regression in router that caused routed elements inside the root component to fail.
159
160## 2.0.0-alpha.214
161
162* Treat routes ending with `/` as exact routes.
163
164 The `<div route='/'>` would previously match any path. You could define exact routes by including a `$` at the end of the route. This lead to a lot
165 of confusion. Now, any route that ends with a `/` will only match the exact path. Use `*` to bypass
166
167 ```imba
168 <div route='/'> # matches / _only_
169 <div route='/*'> # matches any path
170
171 <div route='/items'> # matches /items, /items/1 etc
172 <div route='/items/'> # matches /items only
173 ```
174
175* Only show first matching element if multiple siblings match a route.
176
177 ```imba
178 <div>
179 <div route='/items/new'>
180 <div route='/items/:id'> # if /items/new matched - this will not show
181 <div route='/'> # matches if url is exactly '/'
182 <div route='*'> # matches if none of the above matches
183 ```
184
185## 2.0.0-alpha.213
186
187* Make `@event.emit('...')` on `<global/teleport>` dispath event inside their literal parent (fixes #693)
188
189## 2.0.0-alpha.210
190
191* Add number units for `minutes`, `hours`, and `days`
192
193* Fixed issue where identical nested selectors were incorrectly optimized away
194
195* Support `silent: true` option for `imba.autorun` to not call imba.commit
196
197* Fixed issue where @autorun methods threw error when element was re-mounted (#684)
198
199## 2.0.0-alpha.209
200
201* Fixed bug with observables not unsubscribing correctly in certain cases
202
203* Expose `imba.reportObserved`, `imba.reportChanged` and `imba.createAtom` (still experimental)
204
205* Add `imba.hotkeys.addKeycodes(...)` (#677)
206
207* Made `@touch.hold(dur)=handler` trigger handler after duration without waiting for additioanl events (#664)
208
209## 2.0.0-alpha.207
210
211* Don't try to implicitly return debugger statement
212
213* Improve compilation of `extend` statements for tooling
214
215## 2.0.0-alpha.206
216
217* Disallow iterating over falsy values using `for in`
218
219* Compile literal bigints correctly
220
221* Minor improvements to type definitions
222
223## 2.0.0-alpha.205
224
225* Support `for await ... of` syntax
226
227* Support tagged templates
228
229 Works like in plain js, but `{}` is still used for interpolation instead of `${}`.
230
231 ```imba
232 import md from 'tag-markdown'
233 const html = md`## Welcome to {name}`
234 ```
235
236* Add internal `#__patch__(props)` method for class instances to update fields
237
238* Stop shimming top-level await (delegates responsibility to esbuild)
239
240
241## 2.0.0-alpha.204
242
243* Fixed operator precedence for ternary expressions
244
245* Revert automatic `calc` wrapping for css values introduced in alpha 200
246
247 Introduced a lot of bugs and challenges related to `/` being a valid part of css values. `calc` will still be automatically be added around top-level parenthesis in css values, so `width:(100vw - 20px)` will still compile as `calc(100vw - 20px)`, but properties like `grid-column: 1 / 3` will now compile without calc again.
248
249## 2.0.0-alpha.203
250
251* Fixed regression with negated breakpoint modifiers like `display@!600:none`
252
253## 2.0.0-alpha.202
254
255* Fixed performance regression for tag trees introduced in alpha 191
256
257* Fixed compilation of css properties wrapped in parenthesis
258
259* Make unresolved decorators resolve to `imba.@decorator`
260
261 ```imba
262 class Order
263 @lazy get lines
264 ...
265 ```
266
267 If `@lazy` is not found in the file above, the compiler will essentially include
268 `import {@lazy} from 'imba` when compiling.
269
270* Introduced experimental state management decorators
271
272 A minimal set of decorators heavily inspired by MobX that allows you to mark classes
273 and objects as observable, and run code upon changes. This feature will be kept under
274 wraps until it has been battle-tested.
275
276## 2.0.0-alpha.201
277
278* Fixed regression where css colors `rgb(0 0 0 / alpha)` would compile incorrectly
279
280## 2.0.0-alpha.200
281
282* Allow `@hotkey('*')` to listen to all hotkey events
283
284 This is perfect for disabling all other hotkeys in certain contexts.
285
286 ```imba
287 tag ConfirmDialog
288 # when this dialog is mounted - all hotkey handlers preceding
289 # it in the dom tree will be blocked by the `*` listener
290 <self @hotkey('*').global>
291 <button @hotkey('esc')> "Cancel"
292 <button @hotkey('enter')> "Ok"
293 ```
294
295* Automatically wrap style expressions in `calc()`
296
297 ```imba
298 css div width: calc(100vw - 40px)
299 # can now be written as
300 css div width: 100vw - 40px
301 ```
302
303* Make bind=data.property work for textarea when value is `undefined`
304
305* Allow nested parentheticals in css calc
306
307* Fixed issue where removing class names using `el.flags.remove` would not work
308
309* Made `@touch.flag` support selector in second argument to match `@event.flag`
310
311* Allow second argument to `el.flags.incr(flag, dur = 0)`
312
313 With this argument you can automatically decrement the flag after a certain duration.
314
315* Allow negated style modifiers
316
317 ```imba
318 css div
319 @!hover o:0.5 # div:not(:hover) { opacity: 0.5 }
320 @!md d:none # @media (max-width: 767px) { div { display:none } }
321 # also works for classes
322 css div
323 @.!disabled o:0.5 # div:not(.disabled){ opacity:0.5 }
324 ```
325
326## 2.0.0-alpha.199
327
328* Fix regression where content of `<teleport>` and `<global>` was not rendered (#643)
329
330## 2.0.0-alpha.198
331
332* Change how css specificity is forced in generated selectors
333
334 Older browsers do not support complex selectors within `:not()`, so the style `:not(#_#_#_)` which is used for "inline" styles would not work in these browsers. We have now reverted to using multiple not selectors like `:not(#_):not(#_):not(#_)`. This is more verbose but the size is negligible, especially with compression. Debugging styles in the browser is a bit more clumsy.
335
336* Change css specificity for component rules
337
338 Selectors inside tag declarations are now compiled with a higher specificity than global selectors.
339
340 ```imba
341 tag App
342 # scoped selectors have higher precedence than global styles
343 css .selector d:block
344 ```
345
346* Fixed case where a generated class-name is added multiple times on elements
347
348## 2.0.0-alpha.197
349
350* Fixed issue with bracketless multiline object and certain operators
351
352 ```imba
353 let x = null
354 x ||=
355 one: 1
356 two: 2
357 # would previously compile incorrectly to x ||= {one: 1}
358 ```
359
360## 2.0.0-alpha.196
361
362* Introduced `@event.closest(sel)` modifier
363
364 Works like `@event.sel(selector)`, but checks for `target.closest(...)` instead of `target.matches(...)`.
365 In the cases where you want to just handle clicks that do _not_ match a selector you can negate the modifier using `.!closest(...)`.
366
367 ```imba
368 tag App
369 <self>
370 # all clicks outside of button tags
371 <div @click.!closest('button')>
372 <button> <span> "Click"
373 <p> "blabla"
374 ```
375
376## 2.0.0-alpha.195
377
378* Fixed compilation issue for functional tags without arguments
379
380* Throw error when trying to use bind on functional tags
381
382## 2.0.0-alpha.194
383
384* Improved syntax for functional tags
385
386 If you supply `()` after a tag name, Imba will now treat it as a functional tag. Ie, `<some-name(1,2)>` is equal to `<( some-name(1,2) )>`. The old syntax may be phased out before final release.
387
388 ```imba
389 def List items
390 return if items.length == 0
391
392 <section>
393 <slot>
394 <ul> for item in items
395 <li> item.title
396
397 tag App
398 def head
399 <header> <slot> <h2> "Welcome"
400
401 <self>
402 <head()>
403 <List(data.newest)> <h2> "Newest posts"
404 <List(data.all).large> <h2> "All posts"
405 ```
406
407## 2.0.0-alpha.193
408
409* Fix issue where parts of runtime was incorrectly tree-shaked
410
411* Always resolve `node:*` imports as external
412
413* Include changelog.md in npm package
414
415## 2.0.0-alpha.191
416
417There will likely be a few more alpha releases fixing regressions and issues related to the new features in alpha 191, but after these potential issues have been resolved we're moving to beta 🥳! This release does contain a few breaking changes, both in relation to styles and memoization. We'll update the docs at imba.io and publish a screencast going over the changes to make it easier to transition to this new version. Changes;
418
419* Rename $key to key
420
421 To give elements a stable identity (usually inside lists) you should now use `<el key=value>` instead of `<el $key=value>`. `$key` is deprecated and will be removed in `beta.1`.
422
423* Allow using any object as `<element key=...>` value
424
425 Keyed elements now use a `Map` instead of a plain object to keep track of unique elements. This means that any value (both objects and primitive values) may be used as keys.
426
427 ```imba
428 const items = [{title: "One"},{title: "Two"}]
429
430 tag App
431 <self> for item in items
432 # objects themselves can be used as keys now
433 <AppItem key=item data=item>
434 ```
435
436* New (improved) syntax for rendering functional components / tag trees
437
438 This was the main change holding us back from reaching beta, as it is a breaking change for most users. When you want to include external live dom elements from getters or methods outside of the render-tree, wrap the expression in `<(expression)>`.
439
440 Besides simplifying the way memoization works it also allows you to add classes and styles to these external fragments, making it vastly more flexible than before.
441
442 ```imba
443 tag App
444 get body
445 <div> "This is body"
446
447 def list title, items
448 <section>
449 <h2> title
450 <ul> for item in items
451 <li> item.title
452
453 <self>
454 <( body )>
455 <( list 'Top', data.popular ).large [mt:2]>
456 <( list 'New', data.posts.slice(0,10) )>
457 ```
458
459* Log warnings to console when building/running without minification
460
461 Added runtime checks that notify about erroneous behaviour when building/running w/o minification. Initially it will only warn about non-memoized elements being created during rendering. Eventually we'll use these conventions to add much more elobrate checks and readable error messages for the most common issues users can run into.
462
463* Allow instantiating elements w/o memoization using `new`
464
465 Imba will automagically allow any element (literal tag) in any method to be memoized.
466
467 ```imba
468 def wrap text
469 let div = <div.item> text
470 return div
471
472 imba.mount do <section>
473 <( wrap "One" )>
474 <( wrap "Two" )>
475 ```
476
477 If you call a method or access a getter that returns an element (like `def wrap`) it will look up a memoization context and just reuse/update the div for that particular context. If you call it directly without being in a context, Imba will warn you. There are however some situations where you actually just want to create new elements. In this case, use `new` in front of the element. If the root is not memoized, the children won't either, so you only need to add `new` in front of the top element.
478
479 ```imba
480 def wrap text
481 let div = new <div.item> text
482 return div
483 ```
484
485* Allow non-global tag types in dynamic tag names
486
487 Local tag types are now allowed in `<{tag-type} ...>` syntax. Previously it would only work when `tag-type` evaluated to a string, and there was a globally defined web component or native tag with that name. Now it works with classes as well.
488
489 ```imba
490 import {PostView,ArticleView} from './views'
491
492 const items = [
493 { type: Post, title: "My post"}
494 { type: Article, title: "My article"}
495 ]
496
497 tag App
498 <self>
499 for item in items
500 <{item.type} data=item>
501 ```
502
503* Only allow named elements inside `<self>`
504
505 Using named elements (`<div$myname>`) outside of self would previously introduce subtle bugs and conflicts. They are now only allowed inside of `<self>`.
506
507* Changed css specificity
508
509 Styles declared in tag declaration body now has lower specificity than class selectors.
510
511 ```imba
512 css .warn hue:red
513 css .large p:4 fs:lg
514
515 tag Button
516 css p:2 fs:sm hue:blue
517
518 # styles from classes take precedence
519 <Button.warn.large>
520 ```
521
522* Scoped selectors no longer applies to self
523
524 Now, selectors like `.warn` declared in tag declaration body only applies to elements _inside_ `Button`, not the button itself. To target the button itself, use `&` in the selector.
525
526 ```imba
527 tag Button
528 css bg:blue2
529 css .warn bg:red2
530 css &.large fs:lg
531
532 <self.warn.large> "Still blue bg - but large"
533 ```
534
535* Add `declare` keyword for declaring fields (with type annotations) without generating any code for that field
536
537 ```imba
538 class Foo
539 declare a\number
540 ```
541
542* Allow multiline conditionals when lines start with `and`,`or`,`||`, or `&&`
543
544 This is a temporary solution for a larger challenge. It simply ignores new-lines whenever your line starts with these operators.
545
546 ```imba
547 if condition
548 and test
549 or force
550 return ...
551 ```
552
553* Allow third argument in `for in` loops referencing length
554
555 If you need to know the length of a collection you are iterating over, you can now access the total length of the collection by supplying a third argument. This is not available in `for of`, only `for in`.
556
557 ```imba
558 for member,index,len in list
559 # len refers to the length of the iterable list
560 if index == len - 1
561 yes # this is the last element
562 ```
563
564* Exposed `imba.hotkeys.humanize` for converting hotkey combos to readable shortcuts
565
566* Exposed `imba.hotkeys.htmlify` for converting hotkey combos to readable shortcuts as html
567
568
569## 2.0.0-alpha.190
570
571* Fixed regression related to implicit parenthesis in tag trees
572
573* Renamed `@hotkey.capture` to `@hotkey.force`
574
575## 2.0.0-alpha.189
576
577* Introduced `@hotkey.repeat` modifier
578
579 When a user presses a key and then keeps holding it, keydown/keypress
580 events will be generated every n milliseconds. For hotkeys you usually
581 only want to trigger once when the user press the combination.
582
583 If you want the handler to keep firing while user holds down the keys
584 you can now use the `.repeat` modifier:
585
586 ```imba
587 # will only toggle when pressing space, no matter how long you
588 # keep it pressed.
589 <div @hotkey('space')=togglePlayback>
590 # holding the right arrow will call fastForward repeatedly
591 <div @hotkey('right').repeat=fastForward>
592 ```
593
594* Changed rules for implicit parenthes / calling in tag trees
595
596 Indented code under a tag-tree will no longer be compiled as an invocation.
597
598 ```imba
599 <div> data.name
600 "something"
601 if data.name
602 "something"
603 ```
604
605 The code above would previously compile to div `data.name("something")`. Now
606 indentation in tag trees will behave like they do in statements like if/for/while etc.
607 This fixes #630, so you can now add css blocks like this:
608
609 ```imba
610 <div> data.name
611 css d:block # style for the div
612 ```
613
614* Added `@first-child` and `@last-child` css modifiers
615
616 We already have `@first` and `@last` as shorter aliases, but since all other standard pseudo-selectors exist it makes sense to include the longer versions of these as well.
617
618* Fixed issue with nested loops in tag trees
619
620 It is now possible to use nested loops without wrapping the inner loops in a fragment.
621
622 ```imba
623 <div>
624 for item in data.items
625 for label in item.labels
626 <div> label
627 ```
628
629* Allow declaring variables and global tags with the same name
630
631 Global web components should not be registered as regular variables.
632 Previously the compiler would throw an error if `tag app` and `let app = ...`
633 were declared in the same file.
634
635* Allow optional chaining with dynamic keys - #638
636
637 ```imba
638 user..[key]
639 ```
640
641* Mark imported SVGs as @__PURE__
642
643 This allows efficient tree-shaking so that one can include all icons from a collection
644 and only bundle the ones that are used.
645
646 ```imba
647 import * as icons from 'imba-codicons'
648
649 <svg src=icons.volume-up>
650 # you get completions and previews for all icons, but only volume-up
651 # will be bundled in your code now
652 ```
653
654* Don't round x,y in `@touch.reframe` and `@touch.fit` by default (#639)
655
656## 2.0.0-alpha.187
657
658* Call `dehydrate` on compononents when rendering components from the server.
659
660* Updated type declarations.
661
662## 2.0.0-alpha.186
663
664* Don't add html class name for named elements
665
666 Previously when naming an element like `<div$title> ...`, imba would automatically
667 add a `title` class name to the element. This can lead to confusing issues. If you
668 have used this undocumented behaviour previously you just need to add the class
669 yourself, like `<div$title.title>`.
670
671* Introduced `@mouse.mod` modifier
672
673 Since Mac and Windows/Linux use different keyboard modifiers for most standard actions
674 (ctrl+c,ctrl+s,ctrl+click) vs (⌘c,⌘s,⌘+click) etc, it makes sense to have an event
675 modifier that takes care of checking the platform. `@mouse.mod` will return true of
676 ⌘ is pressed on mac, and Ctrl is pressed on all other platforms.
677
678 ```imba
679 <div @click.mod.stop=openInNewWindow @click=openHere>
680 ```
681
682* Fixed bug in `@event.throttle` modifier
683
684## 2.0.0-alpha.183
685
686- Remove unneeded class names on tags when building
687
688## 2.0.0-alpha.182
689
690- Fixed issues with using event modifiers with external imba library
691
692## 2.0.0-alpha.177
693
694- Added type declarations into typings/
695
696## 2.0.0-alpha.176
697
698- Deprecated `@touch.moved-dir`
699
700 The direction of the `@touch.moved` modifier can now be specified in the second argument of `@touch.moved` instead of as 6 separate modifiers. These are not used that often and it seems natural to keep inside a single modifier instead.
701
702 ```imba
703 <div @touch.moved-left(4px)> # before
704 <div @touch.moved(4px,'left')> # after
705 ```
706
707- Renamed style property `tint` to `hue`
708
709 Hue is a better name for the newly introduced `tint` style property.
710
711 ```imba
712 # hue can be set to any named color from the imba color palette
713 <div[hue:orange]>
714 <h1[color:hue7]> # refer to a shade/tint of the aliased color
715 ```
716
717- Refactored event modifiers
718
719 Foundations to allow defining custom event modifiers down the road. Complex modifiers have access to the context in which it was called, including a state-object that is persisted across events etc. Documentation fo this will be in place before 2.0 final. As an example, a tiny `@keydown.f1` modifier for only passing through F1 can be defined like this:
720
721 ```imba
722 extend class KeyboardEvent
723
724 def @f1
725 return keyCode == 112
726 ```
727
728- Changed behavior of `@event.throttle` modifier
729
730 `throttle` would previously fire once and suppress subsequent events for a certain duration (default 250ms). Now it will re-fire at the end of the throttling if there were any suppressed events during the initial throttle. For events like `@resize` and `@scroll` where you just want to limit how often they fire, the new behavior is much more useful.
731
732 ```imba
733 # handler will be called immediately upon scrolling and keep emitting
734 # every 100ms until there are no more scroll events.
735 <div @scroll.throttle(100ms)=handler>
736
737 # So, clicking this button twice will trigger once immediately,
738 # and then again after 1 second. Previously the second click would
739 # never trigger.
740 <div @click.throttle(1s)=handler>
741 ```
742
743- Introduced `@event.cooldown` modifier
744
745 The old `throttle` was renamed to `cooldown`. Ie, if you want subsequent button clicks to be suppressed for `n` time (250ms default) you should now use `cooldown` instead of `throttle`.
746
747 ```imba
748 # So, clicking this button twice will trigger once immediately, and
749 # the next click will be ignored as long as it happens less than a second later
750 <div @click.cooldown(1s)=handler>
751 ```
752
753- Allow negated event modifiers
754
755 Certain event modifiers are called guards, like `@keydown.enter`, `@click.self` etc. These are modifiers that essentially evaluate to true/false and decides whether to continue handling an event or not. `@click.self` would only trigger if the target of the event is the same as the element to which the `@click` is bound. Now you can include a `!` in front of any such event handler to only continue if the guard is false.
756
757 Ie. `<div @click.!shift=...>` would only trigger if shiftKey is _not_ pressed.
758
759 ```imba
760 # Only call handler if shiftKey is NOT pressed
761 <div @click.!shift=handler>
762
763 # Only call handler if target does NOT match the selector
764 <div @click.!sel('.active')=handler>
765 ```
766
767- Introduced `@mouse.left`, `@mouse.middle`, and `@mouse.right` modifiers
768
769 Only trigger if the left,middle, or right mouse button is pressed. Works for all mouse and pointer events, as well as the custom `@touch` event.
770
771 ```imba
772 # Only call handler if the middle mouse button was pressed
773 <div @click.middle=handler>
774
775 # Only start touch handling if the right mouse button was pressed
776 <div @touch.right=handler>
777 ```
778
779- Introduced `@intersect.flag` modifier
780
781 The `flag` modifier now works differently for `@intersect` event. It will add a css class to the element when it is intersecting and remove it whenever it is not intersecting.
782
783 ```imba
784 # the html class showing will be present on div
785 # whenever it is intersecting with the viewport
786 <div @intersect.flag('showing')>
787 ```
788
789- Introduced `@touch.end` modifier
790
791 The `end` guard breaks unless the touch is in its ending state.
792
793 ```imba
794 # handler is only called at the end of the touch
795 <div @touch.end=handler>
796 # handler is only called at the end of the touch if pointer moved
797 <div @touch.moved.end=handler>
798 ```
799
800- Introduced `@touch.hold(dur=1000ms)` modifier
801
802 The `hold` modifier allows you to require an element to be pressed for some time (default 1000ms) until it starts allow events to come through.
803
804 ```imba
805 # handler is only called once the touch has been held for 1000ms
806 <div @touch.hold=handler>
807 # handler only called if ctrl was pressed and touch held for 250ms
808 <div @touch.ctrl.hold(250ms)=handler>
809 ```
810
811
812- Introduced `@touch.apply(target,xprop='x',yprop='y')` modifier
813
814 Like `@touch.sync` but just setting the x,y values on an object directly instead of adding to the previous values.
815
816 ```imba
817 const obj = {}
818 # apply is essentially shorthand for setting properties:
819 <div @touch.apply(obj)>
820 <div @touch=(obj.x = e.x, obj.y = e.y)>
821 ```
822
823
824- Added `@event.key(keyOrCode)` modifier for keyboard events
825
826 KeyboardEvent.keyCode is deprecated but still useful in many cases. If you supply a number to the modifier it will stop handling if `keyCode` does not match this number.
827
828 ```imba
829 # Only trigger if F1 is pressed (event.keyCode==112)
830 <div @keydown.key(112)=handler>
831 ```
832
833 If you supply a string it will compare it against KeyboardEvent.key.
834
835 ```imba
836 # Only trigger if PrintScreen is pressed (event.key=='PrintScreen')
837 <div @keydown.key('PrintScreen')=handler>
838 ```
839
840- Changed behavior of `@touch.moved` modifier
841
842 Now, if you add a `moved-left(threshold = 4px)` modifier, the event handling will be cancelled if the touch has moved more in any other direction (in this case up,down, or right) _before_ moving 4px left.
843
844 ```imba
845 # If user moves more than 10px up/down before left/right
846 # the touch will not be handled
847 <div @touch.moved-x(10px)=draghandle>
848 ```
849
850- Improved behaviour of `@touch` and `@click` events
851
852 `@click` events on nested children of an element with a `@touch` handler would previously be prevented. This made `@touch` pretty challenging to use for things like dragging elements with buttons etc.
853
854 Now `@click` events will be triggered unless the `@touch` handler has a `prevent` modifier, a `moved(-x|y|up|down)` modifier that has activated, or a `hold` modifier that has activated.
855
856 ```imba
857 # button click is triggered onless touch is held more than 500ms
858 <li @touch.hold(500ms)=draghandle> <button @click=handle>
859 ```
860
861- Improved behaviour of `@touch` and scrolling on touch devices
862 Previously, scrolling (and clicking) would be disabled for any element with a `@touch` handler on iOS. Ie. if you added `@touch` to a custom slider, scrolling would not work if the user happened to touch down on the slider while flicking down the page.
863
864 Scrolling is disabled by the `prevent` modifier, an activated `moved` modifier or activated `hold` modifier.
865
866 ```imba
867 # Scrolling will now work fine when touching the div and flicking up/down.
868 # Only if the user holds still on the element for 500ms will scrolling and
869 # default behavior be prevented.
870 <div @touch.hold(500ms)=draghandler>
871 ```
872
873- Add support for additional file extensions in bundler (webm, weba, avi, mp3, mp4, m4a, mpeg, wav, ogg, ogv, oga, opus, bmp)
874
875## 2.0.0-alpha.175
876- Fix: `@in` transitions for nested elements works
877- Experimental support for tweening from/to implicit width/height in transitions
878- Experimental `@resize.css` modifier to automatically enable size units
879- Allow variables in color opacity like `color:blue4/$alpha`
880- Experimental support for `tint:colorname` and using `tint0-9` colors in styles
881
882## 2.0.0-alpha.174
883- Named elements (`<div$myname>`) exist immediately in components
884- Fix: Spread operator works for any expression in objects
885- Fix: Make sure ::before/after comes last in selectors with other pseudo-classes>
886- Fix: Allow symbol keys in `prop/attr #my-sym-key`
887
888## 2.0.0-alpha.173
889
890- Fix: Allow binding tag properties to symbol identifiers
891- Report correct location for "Cannot redeclare variable" error (#114)
892- Experimental support for `@hotkey` events
893- Fix: Don't run `imba.commit` on unhandled events>
894- Added `@trusted` event guard
895- Added `@trap` event modifier
896
897## 2.0.0-alpha.172
898
899- Fix: Rendering list inside conditional
900- Support css blocks inside conditionals in tag trees
901- Warn about interpolated style values outside of tag trees
902- Improved specificity for nested css rules
903
904## 2.0.0-alpha.171
905
906- Fix: Make `<global @resize>` work correctly
907- Fix: Variable resolution for `let item = do ... item()`
908- Fix: Allow ternary in tag trees
909- Fix: Allow `condition && <tag>` in tag trees
910- Fix: Ternary parsing `cond ? <div> "a" : "b"`
911
912## 2.0.0-alpha.170
913
914- Added `@in` style modifier for specifying in-only transitions
915- Renamed transition hooks to `transition-(in|out)-(end|cancel)`
916- Using `<button bind=prop>` without a value acts like `<button bind=prop value=yes>`
917
918## 2.0.0-alpha.169
919
920- Fix: Various dom regressions in SSR
921- Updated default ease duration to 300ms
922
923## 2.0.0-alpha.168
924
925- Use setAttribute('class') under the hood for svg elements
926- Added `#afterVisit`, `#beforeReconcile`, `#afterReconcile` hooks
927- Added experimental easing via `<my-element ease>`, with element hooks
928 `#ease-enter`, `#ease-entered`, `#ease-enter-cancel`, and
929 `#ease-exit`, `#ease-exited`, `#ease-exit-cancel`
930- Added `ease/e`,`ease-opacity/eo`,`ease-transform/et` and `ease-colors/ec`
931 style properties for experimental easing feature
932- Fix: Passing slots into child components (#607)
933- Allow using setters on `#context`
934
935## 2.0.0-alpha.167
936
937- Add support for generic media selectors via `@media(some-media) ...`
938- Fix: Interpolated numeric value for `rotate:{val}` works i FF
939- Add @all and @speech style modifiers (for @media all/speech)
940- Fix: Allow empty css selectors
941- Fix: Rebuilt prebuilt imba.mjs for web
942
943## 2.0.0-alpha.166
944
945- Add experimental support for class decorators
946- Fix: Apply display:block to global tags without dashed name
947- Change: `inset:*` style shorthand sets `position:absolute`
948- Added `<teleport to=(sel/element)>` component (#606) by @haikyuu
949
950## 2.0.0-alpha.165
951
952- Reorganize prebuilt files for jspm support
953
954## 2.0.0-alpha.157
955
956- Add jspm configuration in package.json
957
958## 2.0.0-alpha.156
959
960- Add #**inited** hook for class instance initialization
961- All custom components defaults to display:block
962- Fix: Don't inject hmr.js script into html assets when building
963- Fix: Generate html files in public directory
964
965## 2.0.0-alpha.155
966
967- Allow `$envvar$` as first argument of implicit calls (#571)
968- Allow `super` in `extend class/tag`
969- Add experimental support for `extend someObject`
970- Variable / parameter named `self` used for implicit self in scope
971- Throw error for non-self tags in tag declaration body
972- Allow accessing array elements from end with literal numbers like `array[-1]`
973
974## 2.0.0-alpha.154
975
976- Include precompiled browser-version of library to make it work with jspm
977- Fix issue with html parser
978- Fix issue with `<input value=...>` not working in certain cases
979- Add optional static file serving for `imba serve`
980
981## 2.0.0-alpha.153
982
983- Fix issue with prop watchers not compiling correctly
984
985## 2.0.0-alpha.152
986
987- Correctly parse comments inside multi-line tag literals
988- Readable names for generated (internal) variables
989- Tag literals act as block scopes for variable declarations
990
991## 2.0.0-alpha.151
992
993- Fix interpolated style values in tag-tree selectors
994
995## 2.0.0-alpha.150
996
997- Remove charset:utf8 option from esbuild
998
999## 2.0.0-alpha.149
1000
1001- Fix regression with font-size presets (#569)
1002
1003## 2.0.0-alpha.148
1004
1005- Allow declaring return type via `def method\returntype arg1, ...`
1006- Fix crash when inlining sourcemaps on node 16+ (#567)
1007- Overhaul `extend class` code generation for better tooling support
1008- BREAKING: Compile predicate identifiers `name?` to unicode `nameΦ` and
1009 dashed identifiers `one-two-three` to `oneΞtwoΞthree` to avoid potential
1010 naming collisions and improve tooling support. If you previously relied on
1011 dashed identifiers converting to camelCase while interacting with an
1012 external library - this will no longer work. Ie `window.add-event-listener`
1013 will not work since `window` does not have an `addΞeventΞlistener` property.
1014 See [#568](https://github.com/imba/imba/pull/568) for more info.
1015
1016## 2.0.0-alpha.147
1017
1018- Fix regression resulting in nested assets being rebuilt in incorrect folder
1019
1020## 2.0.0-alpha.146
1021
1022- Added `--asset-names` and `--html-names` build options for controlling the generated paths
1023- Tweaked format of generated manifest
1024- Fixed issue with generated stylesheets being blank
1025- Automatically include Link preload headers when serving through imba
1026- Allow all valid RegExp flags in literal regexes
1027- Generate class augmentations (`extend class/tag`) in tsc mode
1028- Use setAttribute for non-idl element attributes
1029
1030## 2.0.0-alpha.145
1031
1032- Fix bundler crash when parsing html entrypoints with doctype
1033- Fix regression where imba `-w` would not detect changes in unhashed outputs
1034
1035## 2.0.0-alpha.144
1036
1037- Experimental `<global>` slot to add global listeners from inside tags
1038- `@event.outside` modifier that works in conjunction with `<global>` slot
1039
1040## 2.0.0-alpha.143
1041
1042- Remove use of String#replaceAll (unsupported before node 15.0.0)
1043
1044## 2.0.0-alpha.142
1045
1046- Don't crash when loading tags with `@intersect` listener on server
1047- Fix svg parsing issue for large svg files (#543)
1048- Fix incorrect dehydration when creating custom element on client directly via document.createElement
1049- Inject asset imports in correct order relative to regular imports
1050- Add support for `.eot` font file reference in stylesheets
1051- Auto-generate combined stylesheet for server and client accessible via `<style src='*'>`
1052- Stop auto-injecting styles for referenced assets when rendering `<html>` on server
1053
1054## 2.0.0-alpha.141
1055
1056- Support webp,avif,apng,gif images in bundler
1057- Fixed missing first character in non-minified css output
1058- Expose imba.commit++ on globalThis
1059- Fix compilation issue with `if false` inside tag tree
1060- Respect custom palettes in imbaconfig.json when building
1061- Allow aliasing palettes in imbaconfig.json
1062- Support inlined svg elements on server
1063
1064## 2.0.0-alpha.140
1065
1066- Improve output from `imba create`
1067
1068## 2.0.0-alpha.139
1069
1070- Stop bundler from crashing when generating worker
1071
1072## 2.0.0-alpha.138
1073
1074- Fix incorrect sourcemap paths with esbuild 0.9.7
1075- Let server fail gracefully when accessing invalid asset urls
1076
1077## 2.0.0-alpha.137
1078
1079- Fix relative path for mac/linux
1080
1081## 2.0.0-alpha.136
1082
1083- Raise default browser-target from `edge16` to `edge18` due to esbuild warning
1084- Make `imba create` executable on mac (#550)
1085- Set default esbuild target to es2019 to transpile optional chaining++
1086- Avoid using `-ad` in generated class-names due to adblockers (#531)
1087
1088## 2.0.0-alpha.135
1089
1090- Minor improvements to sourcemapping
1091- Fixed `import type default` compilation
1092
1093## 2.0.0-alpha.133
1094
1095- Improved sourcemapping
1096- Improved support for type annotations
1097- Fixed crash in bundler
1098
1099## 2.0.0-alpha.132
1100
1101- Improve windows compatibility for bundler and `imba create`
1102
1103## 2.0.0-alpha.131
1104
1105- Serve hashed (cacheable) assets with `Cache-Control: max-age=31536000`
1106- Remove `?v=xxxxxx` suffix from asset references generated with `--no-hashing`
1107- Allow `"external":["builtins",...]` to externalize builtin node modules for other platforms than `node`
1108- Add `-H` alias for the `--no-hashing` option
1109
1110## 2.0.0-alpha.130
1111
1112- Upgraded esbuild to v0.9.2
1113- Automatically polyfill built-in node modules like buffer,stream,crypto etc when compiling for browser. Still experimental.
1114
1115## 2.0.0-alpha.129
1116
1117- Prevent `touchstart` event on iPad Pro in `@touch.prevent`
1118- Fixed text in svg `<text>` elements (#482)
1119
1120## 2.0.0-alpha.128
1121
1122- Fixed image asset urls in SSR
1123- Make bundler work with client entrypoint without any styles
1124- Dispatch bubbling `resized` event from ResizeObserver
1125
1126## 2.0.0-alpha.127
1127
1128- Overhauled `@touch` to work be more consistent on touch devices
1129- Add `@touch.round` event modifier
1130
1131## 2.0.0-alpha.126
1132
1133- Prevent `touchstart` event on iOS in `@touch.prevent`
1134
1135## 2.0.0-alpha.125
1136
1137- Make custom events cancelable by default
1138- Make `@-webkit-scrollbar-*` style selectors work
1139- Make core event modifiers work for `@touch` event
1140- Fix issue where text selection did not work after `@touch`
1141- Make `@touch.prevent` prevent scrolling via `touch-action:none`
1142- Add `@important` style modifier
1143
1144## 2.0.0-alpha.124
1145
1146- Update built-in colors to follow Tailwind 2.0
1147- Allow interpolating colors in runtime `<div[c:{mycolor}]>`
1148- Fix deep selector `>>>` with multiple nested children
1149
1150## 2.0.0-alpha.123
1151
1152- Fix router crashing when event-related runtime code is tree-shaken
1153
1154## 2.0.0-alpha.122
1155
1156- Fix issue with type inferencing tags in certain cases
1157- Add `suspend`, `unsuspend` component lifecycle methods
1158- Improved router interface & internals
1159
1160## 2.0.0-alpha.121
1161
1162- Added `imba.serve` to `index.d.ts`
1163- Fix serious regression in router causing crash
1164
1165## 2.0.0-alpha.120
1166
1167- Parse `fn await something` correctly
1168- Improved router internals
1169- Add internal `Node#attachToParent` and `Node#detachFromParent` methods
1170- Preserve signed zero in output (Fixes #497)
1171- Make hmr reloading work with raw html assets
1172- Make `--no-hashing` cli option actually work
1173- Build html entrypoints in correct dist folder
1174- Add `imba create` command for creating project from template
1175
1176## 2.0.0-alpha.119
1177
1178- Add support for object spread syntax `{a:1, ...obj}`
1179- Fix regression causing crash when generating css
1180
1181## 2.0.0-alpha.118
1182
1183- Only call imba.commit when events are actually handled
1184
1185## 2.0.0-alpha.117
1186
1187- Alias `tabindex` to `tabIndex` in tag attributes.
1188- Fix scoping issue with css in tag trees
1189- Add experimental router aliases/redirects support
1190- Include preflight.css at root level of package
1191
1192## 2.0.0-alpha.116
1193
1194- Convert durations (`1s`, `150ms`, `60fps` etc) to ms-based numbers on compile-time
1195
1196## 2.0.0-alpha.115
1197
1198- Add `debounce` event modifier
1199
1200## 2.0.0-alpha.114
1201
1202- Add `no-minify` option to cli
1203- Always compile `html` namespaced attributes to raw `setAttribute`
1204
1205## 2.0.0-alpha.113
1206
1207- Add `__realname` as an unaltered alias for `__filename`
1208- Add support for selectors in tag tree - see [#490](https://github.com/imba/imba/issues/490)
1209
1210## 2.0.0-alpha.112
1211
1212- Show full version (including alpha number) in cli `imba --version`
1213
1214## 2.0.0-alpha.110
1215
1216- Add experimental `<tag autorender=interval>` inteface
1217- Add `?v=hash` to asset urls when filename hashing is turned off
1218- Add experimental support for `.html` entrypoints to `imba serve` and `imba build`
1219- Add `abs` and `rel` shorthands for `position` style property
1220- Fix memory leak when using `imba --watch`
1221
1222## 2.0.0-alpha.109
1223
1224- Support extending native tags `tag Purchase < form`
1225- Allow defining global tags without dash in name
1226
1227## 2.0.0-alpha.108
1228
1229- Fix issue with `@nth-of-type`, `@nth-child` selectors
1230- Improve internals of intersect event handling
1231
1232## 2.0.0-alpha.107
1233
1234- Add `asset.body` property for accessing raw content of assets
1235
1236## 2.0.0-alpha.106
1237
1238- Allow passing `rootMargin` options to intersect event
1239- Fix issue in router related to hash links
1240
1241## 2.0.0-alpha.105
1242
1243- Fix issue with css property order
1244
1245## 2.0.0-alpha.102
1246
1247- changelog and docs coming soon. see imba.io
1248
1249## 2.0.0-alpha.60
1250
1251- Add `route-to.exact` modifier to router
1252
1253## 2.0.0-alpha.59
1254
1255- Add support for numeric separator `100_000`
1256- Fix multiline regex parsing issues
1257
1258## 2.0.0-alpha.58
1259
1260- Allow setting innerHTML in SSR
1261
1262## 2.0.0-alpha.57
1263
1264- Update instantiation syntax in tests++
1265
1266## 2.0.0-alpha.56
1267
1268- Add `new Foo` instantiation syntax
1269- Deprecate `Foo.new` instantiation syntax
1270
1271## 2.0.0-alpha.55
1272
1273- Allow local/exportable tags (uppercased tag declarations)
1274- Allow interpolated tags inside strings in tag trees
1275
1276## 2.0.0-alpha.54
1277
1278- Allow getters and setters in object literals
1279
1280## 2.0.0-alpha.53
1281
1282- Allow media breakpoints in style selectors
1283- Added max-width breakpoints
1284
1285## 2.0.0-alpha.52
1286
1287- Fix issue with nested `$reference` selectors
1288- Allow router to work for regular links
1289- Add route-to.replace modifier
1290- Add route-to.sticky modifier
1291
1292## 2.0.0-alpha.51
1293
1294- No longer inheriting from CustomEvent as it is not supported in Safari
1295- Fix input data binding issue
1296- Added `before` and `after` style property modifiers
1297- Added `prefix` as alias for `before.content`
1298- Added `suffix` as alias for `after.content`
1299
1300## 2.0.0-alpha.50
1301
1302- Fix nested selector bug
1303- Fix focus-within modifier
1304- Add `:local` pseudo-class for only styling local children of component
1305- Support `$reference` in selectors for targeting local referenced elements
1306- Change `display` style property to accept multiple layout aliases
1307- Add 1-digit color aliases (blue900 -> blue9 etc)
1308
1309## 2.0.0-alpha.49
1310
1311- Allow border and border-(top|right|bottom|left) to accept a single color value
1312- Accept rgb/hsl/hex colors in text and border properties
1313
1314## 2.0.0-alpha.48
1315
1316- Added multi-purpose `text` style property for describing font-family, font-size, font-style, font-weight, text-decoration, text-transform, line-height, letter-spacing and color in a single property
1317- Added shorthand style aliases for border-_ and flex-_
1318
1319## 2.0.0-alpha.47
1320
1321- Added x, y, z, rotate, scale, scale-x, scale-y, skew-x, skew-y custom style properties
1322- Extended transition property to accept colors, styles, sizes as properties and custom easings
1323
1324## 2.0.0-alpha.46
1325
1326- Added experimental syntax for css/styling. See [#334](https://github.com/imba/imba/pull/362)
1327- Broke scoped css comment blocks until further notice
1328
1329## 2.0.0-alpha.45
1330
1331- Fix conditional rendering bug (#334)
1332- Changed event syntax from `<div :click.stop.{method()}>` to `<div @click.stop=method()>`
1333- Allow comments inside multiline tags
1334- Include left/right event key modifiers
1335- Improve resize and intersect events
1336- Always bind data when using `<tag[my-data]>` syntax
1337
1338## 2.0.0-alpha.44
1339
1340- Improved lifecycle methods for components
1341- Fix sourcemapping for env-flags
1342
1343## 2.0.0-alpha.43
1344
1345- Add syntax for element references `<div$reference>`
1346- Fix problem with missing ResizeObserver in safari
1347
1348## 2.0.0-alpha.42
1349
1350- Fixed webpack imba/loader issues with scoped css
1351- Add event wrapper for ResizeObserver
1352- Add experimental router code
1353- Add basic support for setting dom classes outside of templates
1354- Allow calling imba.mount with a function
1355- Rename #context api to $context
1356- Rename parentContext to $parent
1357
1358## 2.0.0-alpha.40
1359
1360- Introduce decorators with `@decorator` syntax. See [#334](https://github.com/imba/imba/pull/334)
1361- Allow declaring tag attributes. See [#335](https://github.com/imba/imba/pull/335)
1362- Shorthand `!` for invoking parenless methods (`object.mymethod!`)
1363- Implicit self is back (for good)
1364
1365## 2.0.0-alpha.0
1366
1367See [#263](https://github.com/imba/imba/issues/263) for an overview of changes