Changelog
Kontakt 8.2.1
Fixed
UI Module
- Fixed an issue where Popover was not displayed when its
visible
property was initially set totrue
. - Fixed an issue where Popover was not following its anchor.
- Resolved a crash that occurred when the UI was reloaded and a Popover was present.
Kontakt 8.2
New Features
Language
-
Angle: Helps dealing with degrees and radians conversion
The components and modifiers that take angles as arguments now use the Angle global class instead of
Float
type. This affects Rotation, Arc, and the Canvas methods draw_arc, draw_pie, and rotate. -
Maps: A new associative container to store key-value pairs.
-
Unicode code points allowed in string literals
-
Named arguments can be listed in arbitrary order now
-
enumerated() was added to Array to iterate over elements with their index.
-
nil
can now be used as result of a ternay branch:var x: Int? = 0 > 1 ? 4 : nil
-
clamped(min:max) added to Float.
-
Range utility to express ranges and iterate over them
-
Type deduction for templates and function expressions
You can now omit the parameter type annotation when using templates and function expressions. In the case of function expressions the return type can also be omitted. Examples:
old syntaxvar fun_expr: (Int) -> (Int) =
fun (x: Int) -> (Int) {
return x + 1
}new syntaxvar fun_expr: (Int) -> (Int) =
fun (x) {
return x + 1
}old syntaximport { VStack, Text } from ui
component MyList {
@property item: Template(String)
VStack {
for i in Range(3) {
self.item("\{i}")
}
}
}
export var main: Component = MyList(
item: template (text: String) {
Text(text)
}
)new syntaximport { VStack, Text } from ui
component MyList {
@property item: Template(String)
VStack {
for i in Range(3) {
self.item("\{i}")
}
}
}
export var main: Component = MyList(
item: template (text) {
Text(text)
}
)
UI Module
- Text modifiers: Affect the default style of text:
Kontakt Controls Package
- XYPad component to display the values of the active cursor of a KSP
ui_xy
- Stepper component to display the value of a KSP
ui_value_edit
Breaking Changes
Komplete UI Setup In Kontakt
The load_komplete_ui()
KSP command was removed. To load the main Komplete UI module you can now select the module file in the Instrument Options dialog. Find a step-by-step guide in Get Started
Language
-
count
parameter ofArray.subsequence
was renamed tolength
-
Array.filter
was renamed tofiltered(by)
old syntaxvar res = ([1, 2, 3]).filter(fun (value: Int) -> (Bool) {
return value > 2
})new syntaxvar res = ([1, 2, 3]).filtered(by: fun (value: Int) -> (Bool) {
return value > 2
}) -
String.index(of)
no longer returns 0 when searching for an empty string -
String.replace_all
renamed toreplacing_all
-
String.removing
was removedYou can achieve the same by using
removing_subrange
andindex
:var example = "some words that I know"
var remove = "that "
var result = example.removing_subrange(
from: example.index(of: remove)!,
length: remove.length
) -
String methods providing an offset didn't accept from to be after the last character
This includes
substring
,index(of)
andremoving_subrange
. -
Exported types can not refer to un-exported types anymore
old syntaxexport var main = Main()
new syntaxexport var main: Component = Main()
-
if-else expression syntax updated to ternary conditional expression
The syntax for using an if-else conditional expression to produce a value was updated to
a ? b : c
. Here is an example:old syntaxvar x = if 0 < 1 {"Hello"} else {"World"}
new syntaxvar x = 0 < 1 ? "Hello" : "World"
Note that this applies to any place that accepts an expression. Here is an example of a conditional expression used within a component:
import { Hover, Text } from ui
component HoverText {
hovered: Bool = false
Text( self.hovered ? "Hovered" : "Not Hovered" ) with {
Hover(self.$hovered)
}
}clamp
Int method renamed toclamped
The naming is now aligned with the Float
clamped
method.
UI Module
-
Ring renamed to Arc
-
Text component font size changed to Int
This was a bug and we never supported rendering in between pixel values. Migrate your code to use integers only for font sizes.
-
FontFamily renamed to FontFamilyName
Simply replace all occurences of
FontFamily
withFontFamilyName
. This was done so we can use the name for the newFontFamily
modifier (see below). -
TapGesture
cancel
andup
trigger changesCancel is only triggered when another gesture takes over. This means it is no longer triggered when the pointer left the component, or when the pointer moved too far from the "down" location.
Up is triggered even if the gesture completes outside of the component, unless cancel was triggered before.
Math Module
-
degrees_to_radians
andradians_to_degrees
removed in favor of the new Angle class. -
clamp
andclampf
methods removed in favor of Int.clamped and Float.clamped
Kontakt Controls Package
TogglePolicy
was renamed to TriggerPolicy
Fixed
Language
-
Parameter names sometimes not included in error messages
-
Bitwise operations inside a string interpolation caused a runtime error
-
Float.to_int
didn't raise an error on over-/underflow -
String.substring(from:length)
didn't validate from for empty strings -
String.index(of)
raised an error when used on an empty string -
String literals allowed trailing line breaks
String literals cannot contain unescaped line breaks. The trailing line breaks where also not part of the actual string value.
-
String.split
couldn't handle a trailing separator -
String.split
would hang when separator was an empty string -
For loop body inside property getter interpreted as declarative block
-
Escaped newline in string causes runtime error
-
Constructor delegation argument with optional ternary doesn't type check
-
Parsing error when the unwrap (!) operator is followed by an equality (==) operator, e.g.
x! == 5
-
Assigning a lambda to a variable of optional function type erroneously produced a type error
var f: () -> ()? = fun () {} // typecheck error occured
-
Templates have now a proper string interpolation
var t = template () {}
var s = "\{t}" // == "template(x)", where x is some memory addressAlso templates are now properly "printed" when they are part of another aggregate, like a class.
-
Referencing variables which start with nil, true or false
var nil_index: Int? = nil
var x = nil_index // invalid parser error was generated here -
Fixed several string methods not treating different unicode normalization forms the same way
The same unicode character using different normalization forms should be treated as the same. Example: The letter Å can exist in composed form, i.e.
"\u{00c5}"
, or in decomposed form, i.e."\u{0041}\u{030A}"
(A◌̊).Methods affected by this fix:
String.index
,String.has_prefix
,String.has_suffix
,String.removing_all
andString.replacing_all
.
UI Module
Padding
didn't validate it's propertiesText
didn't validate itsline_limit
andfont_weight
propertiesOpacity
didn't validate it's propertiesFrame
didn't validate it's propertiesText
gets truncated instead of wrapped on Windows in some casesTapGesture
accepts right mouse button when left is pressed- Calling
load_font
with empty list causes an error - ZStack layout didn't take into account the priority of its children
Kontakt Controls Package
- Slider dragging doesn't match mouse movement 1:1
Kontakt 8.1 (Komplete UI Beta)
New Features
Kontakt Module
KSPTextEdit
to connect to aui_text_edit
in KSPKSPLabel
to connect to aui_label
in KSP
Kontakt 8 (Komplete UI Beta)
Introduction of Komplete UI public beta. Creating a resource container will now create a new folder called komplete_scripts
.
A Komplete Script file has the file extension .kscript
and can be loaded from KSP with load_komplete_ui("module_name")
.
Have a look at Get Started for more details.