Skip to content

v1.0.0

Choose a tag to compare

@electrikmilk electrikmilk released this 06 May 03:18
· 816 commits to main since this release

What's Changed

Highlights

Improvements to conditionals

Multiple conditions in #92

As you may or may not know, multiple conditions were recently implemented in Shortcuts. This is great news for the most part, as it's with the caveat of all OR or all ANY logical comparison, but it's better than not having multiple condition comparisons. I guess I agree that it's technically simpler this way.

You can now use typical multiple condition syntax, just with all the same logical operators.

if variable == "value" && otherVariable == 2 {
    // ...
}

Condition type checking

Shortcuts only allows some comparisons for certain value types. This implements type checking of the values being used for a conditional. This needed to be fixed for a while. I was always technically aware of this, and now it's finally fixed.

We now throw an error if the type of conditional (e.g. ==) you are using does not support the type of value you are comparing. If we didn't, and before this was fixed, this would just produce an invalid Shortcut, and we misled you that you were able to make that comparison.

Improvements to Decompilation

Fixes

  • Generally improves decompiling actions.
  • Generally improves handling of variables and constants.
  • Math actions are now decompiled into two-operand expressions.
  • Toggle/set actions.
  • Escaping strings.
  • Dictionary keys being wrapped in quotes.
  • runSelf() action decompilation.
  • Dictionary action arguments.
  • HTTP actions (e.g. downloadURL()).
  • Variable references within dictionaries now get mapped as variables for the Shortcut.
  • We will now decompile a getValue() action as dictionary['key'] if you are using it as a variable value.
  • Improves sanitizing variable names. Names with spaces will now be in Pascal case.
  • Inline variables in dictionary values.
  • Arrays within dictionaries.
  • Decompiling "Get As" or "Type" on action output references.

Changes

  • Adds spaces between arguments.
  • Support for multiple conditions.
  • Comments are now added in places where control flow output is being used to help find them.

Comment at Top of Shortcuts with Custom Actions

The first explicit comment action (e.g., comment('Hello')) in a Shortcut will now be added to the top of the final Shortcut if you are using a defined custom action.

This also comes with the benefit that we now don't add the custom actions header if you are not using any custom actions. We needed this at first to make sure we weren't adding the first comment to the top every time, and above any actions before it.

Action Output Types

This implements action output types properly. This has always kind of existed, but was skipped over in the compiler until now. Not all actions have output types defined, just the ones that have a definite type of output, like text or a number.

This also implements output types for custom actions. Custom actions go through the same type checks as normal actions, so I wanted to also allow custom actions to have their own custom output type to check their usage against.

Improved Preview

The preview used in the playground and documentation sites has been improved a lot in just the last release. A lot of bugs have been fixed, and it can now display the details and setup of a Shortcut, as well as how it handles no input. This means pretty much all of the Shortcut metadata is now in the preview.

Improved Docs

The docs are now better with a better preview. However, there is also now a preview for definitions like colors and glyphs, which we could have done before the update to the preview.

The other definition previews are mostly powered by those new updates, however. This also means we could add a preview for import questions now that we have a details modal with a setup tab.

Everything Else

  • General improvements and fixes to the codebase.
  • Adds setting quick actions like Finder and services menu.
  • Adds Get Network Detail actions.
  • Add Airplane Mode toggle and set actions.
  • Adds attachment to notification action.
  • Adds too many more actions to list.
  • Major fixes to import questions. Moving to the new Shortcut generation regressed this, apologies!
  • Fixes issues with escaping strings.
  • The custom actions header, where we handle custom actions, will now only be included if any custom actions are used. We already had something to only include custom actions that were used in the Shortcut, not sure how we overlooked if none are used at all! 🙃
  • Changed comment argument type back to string to allow for new lines.
  • Meta: Fixes detecting if Shortcut Input is being used.
  • Fixes splitText() and joinText() action definitions’ default argument of a new line (\n). This was printed out as an actual new line character when printing their definitions.
  • Concurrency: Adds concurrency to parsing, Shortcut generation, and decompilation. Each of them has preprocessing or mapping steps before the main work that are not dependent on or affected by each other. These now happen at the same time, where possible, and should speed up compiling or decompiling Shortcuts generally, but especially large Shortcuts.
  • Generally improves and fixes variable reference handling. This fixes some specific issues with getting as and type coercion in certain cases.
  • Fixes an extra space being at the end of output names in the final Shortcut without a delta at the end.

Full Changelog: v0.2.9-beta...v1.0.0