Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
## 6.3.0

### Layout

- `ListViewProperties.layout`: `stack` layers a list's items in its box,
each placed at its item node's bound `x`/`y`, for diagrams drawn from
data.

### Actions and triggers

- `TriggerType.dragEnd` and `TriggerType.keyDown` (with `TriggerModel.key`);
drag and pointer triggers on frames, rectangles, icons and text.
- `DialogPresentation.popover`: a menu anchored to the node that ran the
action.
- `ShowDialogAction.fullHeight` for a bottom sheet whose layout scrolls its
own content.
- `CopyToClipboardAction` (`ActionType.copyToClipboard`) copies a text, with
variables and formulas.

### Data

- A variable's `extra` is kept by `withCanvas` and counts toward equality.
- `SpacerNode` takes a box lock, positioning mode and reactions.

## 6.2.0

### Layout
Expand Down
9 changes: 8 additions & 1 deletion lib/src/api/models/action/action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ enum ActionType {
cloudData,

/// Write several cloud documents together.
cloudBatch;
cloudBatch,

/// Copy a text to the clipboard.
copyToClipboard;

/// Displayable string representation of the [ActionType].
String get prettify {
Expand Down Expand Up @@ -111,6 +114,8 @@ enum ActionType {
return 'Cloud Data';
case ActionType.cloudBatch:
return 'Cloud Batch';
case ActionType.copyToClipboard:
return 'Copy to Clipboard';
}
}
}
Expand Down Expand Up @@ -202,6 +207,8 @@ abstract class ActionModel with SerializableMixin {
return CloudDataAction.fromJson(json);
case ActionType.cloudBatch:
return CloudBatchAction.fromJson(json);
case ActionType.copyToClipboard:
return CopyToClipboardAction.fromJson(json);
}
}

Expand Down
1 change: 1 addition & 0 deletions lib/src/api/models/action/api_call_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/auth_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/call_function_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/cloud_data_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/cloud_files_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/conditional_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/confirm_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions lib/src/api/models/action/copy_to_clipboard_action.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';

import '../../mixins.dart';
import '../models.dart';

part 'copy_to_clipboard_action.g.dart';

/// Copies a text to the clipboard, e.g. a link to share. Pair it with a
/// toast to say so.
@JsonSerializable()
class CopyToClipboardAction extends ActionModel
with Equatable, SerializableMixin {
/// The text to copy. Supports variables and formulas, e.g.
/// `https://nook.homes/homes/${route.homeId}`.
final String text;

/// Creates a [CopyToClipboardAction].
CopyToClipboardAction({this.text = '', super.nonBlocking, super.enabled})
: super(type: ActionType.copyToClipboard);

/// Duplicates this action with the given values replaced.
CopyToClipboardAction copyWith({String? text}) => CopyToClipboardAction(
text: text ?? this.text,
nonBlocking: nonBlocking,
enabled: enabled,
);

@override
List<Object?> get props => [text];

/// Creates an instance from a JSON object.
factory CopyToClipboardAction.fromJson(Map json) =>
_$CopyToClipboardActionFromJson(json);

@override
Map toJson() => _$CopyToClipboardActionOmitDefaults(
this,
_$CopyToClipboardActionToJson(this),
);

@override
R? accept<R>(ActionVisitor<R> visitor) =>
visitor.visitCopyToClipboardAction(this);
}
62 changes: 62 additions & 0 deletions lib/src/api/models/action/copy_to_clipboard_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/delay_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/for_each_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/link_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/navigation_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/set_cloud_storage_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/set_storage_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/set_value_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/set_variable_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/set_variant_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions lib/src/api/models/action/show_dialog_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ class ShowDialogAction extends ActionModel with Equatable, SerializableMixin {
/// default. Bottom sheets always sit at the bottom.
final AlignmentModel alignment;

/// For a bottom sheet: whether it is as tall as it can be (90% of the
/// screen) with the canvas filling it, so the canvas scrolls its own
/// content (a fixed header over a scrolling list). Otherwise the sheet is
/// as tall as the canvas, up to 90% of the screen, and scrolls as one.
final bool fullHeight;

/// Creates a new [ShowDialogAction].
ShowDialogAction({
required this.destinationId,
Expand All @@ -42,6 +48,7 @@ class ShowDialogAction extends ActionModel with Equatable, SerializableMixin {
this.showCloseButton = false,
this.presentation = DialogPresentation.dialog,
this.alignment = AlignmentModel.center,
this.fullHeight = false,
super.nonBlocking,
super.enabled,
}) : params = {...params ?? {}},
Expand All @@ -56,6 +63,7 @@ class ShowDialogAction extends ActionModel with Equatable, SerializableMixin {
showCloseButton,
presentation,
alignment,
fullHeight,
];

/// Duplicates this [ShowDialogAction] with given data overrides.
Expand All @@ -67,6 +75,7 @@ class ShowDialogAction extends ActionModel with Equatable, SerializableMixin {
bool? showCloseButton,
DialogPresentation? presentation,
AlignmentModel? alignment,
bool? fullHeight,
}) => ShowDialogAction(
destinationId: destinationId ?? this.destinationId,
params: {...this.params, ...params ?? {}},
Expand All @@ -75,6 +84,7 @@ class ShowDialogAction extends ActionModel with Equatable, SerializableMixin {
showCloseButton: showCloseButton ?? this.showCloseButton,
presentation: presentation ?? this.presentation,
alignment: alignment ?? this.alignment,
fullHeight: fullHeight ?? this.fullHeight,
);

/// Creates a new [ShowDialogAction] instance from a JSON data.
Expand All @@ -99,4 +109,9 @@ enum DialogPresentation {

/// A bottom sheet on phones (narrower than 600 px), a dialog otherwise.
adaptive,

/// A menu anchored to the node that ran the action: just below it,
/// left-aligned with it (right-aligned when it would run off the screen),
/// or above it when there is no room below. Tapping outside closes it.
popover,
}
5 changes: 5 additions & 0 deletions lib/src/api/models/action/show_dialog_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/show_toast_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/api/models/action/submit_action.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/src/api/models/condition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,9 @@ abstract interface class ActionVisitor<R> {
/// Evaluates the action and returns the result.
R? visitDelayAction(DelayAction action);

/// Visits a [CopyToClipboardAction].
R? visitCopyToClipboardAction(CopyToClipboardAction action);

/// Visits a [CloudDataAction].
R? visitCloudDataAction(CloudDataAction action);

Expand Down
Loading
Loading