-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
48 changed files
with
1,856 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
packages: | ||
- path: packages/nm_delta | ||
test: | ||
steps: | ||
- run: dart test --coverage=coverage | ||
- run: format_coverage --in=coverage --packages=.packages --report-on=lib --lcov --out=coverage.lcov | ||
- path: packages/nm_delta_notus | ||
test: | ||
steps: | ||
- run: dart test --coverage=coverage | ||
- run: format_coverage --in=coverage --packages=.packages --report-on=lib --lcov --out=coverage.lcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
find packages -name coverage.lcov | while read filename ; do | ||
sed -e 's/^SF:.*\/packages\//SF:packages\//' < "${filename}" > "${filename}.relative" | ||
done | ||
find packages -name coverage.lcov.relative -exec echo -a {} \; | xargs lcov -o dart-coverage.lcov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Note Maps: Data Model | ||
|
||
A **note map** is a a collection of *notes*. | ||
|
||
A **note** has the following properties. | ||
|
||
* **ID**: a string that uniquely identifies this note within its note map. | ||
* `si`: **subject identifiers**: a sequence of IRIs that globally uniquely | ||
identify the subject of this note. | ||
* `c`: **content IDs**: a sequence of note IDs for notes that together are | ||
the *content* of this note. | ||
* `t`: **type IDs**: a sequence of note IDs for notes that describe the | ||
*type* of the subject of this note. | ||
* `v`: **value**: an optional string, any valid Unicode string, required if | ||
*value type ID* is present. | ||
* `vt`: **value type ID**: an optional note ID for a note that describes the | ||
data type of the *value* string. | ||
* `a`: **association ID**: an optional note ID for a note that describes an | ||
association between subjects, required if **player ID** is present. | ||
* `ap`: **player ID**: an optional note ID for a note that describes a | ||
subject that plays a role in an association, required if **association ID** | ||
is present. | ||
|
||
Additional constraints: | ||
|
||
* In some cases, it may be more convenient to embed whole notes instead of | ||
note IDs. | ||
* When creating new notes, it may be easier sometimes to leave IDs | ||
unspecified. | ||
* For any note that has both an *association ID* and a *role ID*, that note's | ||
*ID* should be present in the *content IDs* of the corresponding | ||
association and role notes. | ||
|
||
Example, in JSON: | ||
|
||
```json | ||
{ | ||
"id": "111" | ||
"si": ["https://git-scm.com"], | ||
"c": [ | ||
{ | ||
"t": ["name"], | ||
"v": "git" | ||
}, | ||
{ | ||
"v": "A distributed version-control system." | ||
}, | ||
{ | ||
"ap": "111", | ||
"a": { | ||
"c": [ | ||
{ | ||
"t": ["name"], | ||
"v": "software" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
The example above could hypothetically be rendered as: | ||
|
||
> ### git | ||
> | ||
> A distributed version-control system. | ||
> | ||
> *example..type:* **software** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright 2020 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import 'dart:convert'; | ||
import 'dart:io'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:nm_delta/nm_delta.dart'; | ||
import 'package:nm_delta_notus/nm_delta_notus.dart'; | ||
import 'package:quill_delta/quill_delta.dart'; | ||
import 'package:zefyr/zefyr.dart'; | ||
|
||
class EditorPage extends StatefulWidget { | ||
@override | ||
EditorPageState createState() => EditorPageState(); | ||
} | ||
|
||
class EditorPageState extends State<EditorPage> { | ||
ZefyrController _controller; | ||
FocusNode _focusNode; | ||
NoteMapNotusDocument _noteMapNotusDocument; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
_focusNode = FocusNode(); | ||
_noteMapNotusDocument = NoteMapNotusDocument('prototype-root-node-id'); | ||
_controller = ZefyrController(_noteMapNotusDocument.notusDocument); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final body = (_controller == null) | ||
? Center(child: CircularProgressIndicator()) | ||
: ZefyrScaffold( | ||
child: ZefyrEditor( | ||
padding: EdgeInsets.all(16), | ||
controller: _controller, | ||
focusNode: _focusNode, | ||
), | ||
); | ||
|
||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('Note Maps'), | ||
actions: <Widget>[ | ||
Builder( | ||
builder: (context) => IconButton( | ||
icon: Icon(Icons.save), | ||
onPressed: () => _saveDocument(context), | ||
), | ||
) | ||
], | ||
), | ||
body: body, | ||
); | ||
} | ||
|
||
void _saveDocument(BuildContext context) { | ||
// Notus documents can be easily serialized to JSON by passing to | ||
// `jsonEncode` directly: | ||
final contents = jsonEncode(_controller.document); | ||
// For this example we save our document to a temporary file. | ||
final file = File(Directory.systemTemp.path + '/quick_start.json'); | ||
// And show a snack bar on success. | ||
file.writeAsString(contents).then((_) { | ||
Scaffold.of(context).showSnackBar(SnackBar(content: Text('Saved.'))); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
list(APPEND FLUTTER_PLUGIN_LIST | ||
nm_gql_go_link | ||
url_launcher_linux | ||
) | ||
|
||
set(PLUGIN_BUNDLED_LIBRARIES) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.