yrby 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/y/text.rb ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Y
4
+ class Text
5
+ # The Yjs relative position of character `index`, the shape editors put
6
+ # in awareness as a caret. It keeps pointing at the same character as
7
+ # people edit around it; `index_at` says where that is now. `assoc:` is
8
+ # :after (default) or :before.
9
+ def relative_position(index, assoc: :after)
10
+ native_relative_position(index, assoc.to_s)
11
+ end
12
+ end
13
+ end
data/lib/y/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Y
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
data/lib/y/xml_text.rb ADDED
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Y
4
+ # Ruby-side conveniences over the native live handle.
5
+ class XmlText
6
+ # Insert a block with `attributes` before the `ordinal`-th embedded
7
+ # block and return a live handle to it. A negative `ordinal` counts from
8
+ # the end, so -1 adds it after the last. `content` is written into the
9
+ # block in the same transaction, so no one sees the block before what it
10
+ # holds. It is an Array of Strings (text), Hashes (embeds, such as the
11
+ # marker Lexical puts before a text node's characters), and
12
+ # `[attributes, content]` pairs (blocks of their own).
13
+ def insert_xml_text(ordinal, attributes, content = [])
14
+ native_insert_xml_text(ordinal, attributes, content)
15
+ end
16
+
17
+ # Append a block with `attributes` holding `content` (see
18
+ # `insert_xml_text`) and return a live handle to it.
19
+ def push_xml_text(attributes, content = [])
20
+ insert_xml_text(-1, attributes, content)
21
+ end
22
+
23
+ # The Yjs relative position of character `index`: the `{type, tname,
24
+ # item, assoc}` hash editors carry in awareness as `anchorPos`/`focusPos`.
25
+ # `assoc:` is `:after` (the default) or `:before`.
26
+ def relative_position(index, assoc: :after)
27
+ native_relative_position(index, assoc.to_s)
28
+ end
29
+
30
+ # This block's `Anchor`: a value that names the block itself, with the
31
+ # root's name, so the document can say where the block is later.
32
+ def anchor
33
+ Anchor.new(position: native_block_position, root: root_name)
34
+ end
35
+ end
36
+ end
data/lib/y.rb CHANGED
@@ -14,6 +14,12 @@ end
14
14
 
15
15
  require_relative "y/rendering"
16
16
  require_relative "y/lexxy"
17
+ require_relative "y/lexical_writer"
18
+ require_relative "y/lexical_markdown"
19
+ require_relative "y/anchor"
20
+ require_relative "y/xml_text"
21
+ require_relative "y/text"
22
+ require_relative "y/doc"
17
23
  require_relative "y/tiptap"
18
24
  require_relative "y/decoder"
19
25
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yrby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Camara
@@ -89,22 +89,33 @@ files:
89
89
  - ext/yrby/crates/prosemirror-html/Cargo.toml
90
90
  - ext/yrby/crates/prosemirror-html/src/lib.rs
91
91
  - ext/yrby/extconf.rb
92
+ - ext/yrby/src/array.rs
92
93
  - ext/yrby/src/lib.rs
94
+ - ext/yrby/src/map.rs
93
95
  - ext/yrby/src/protocol.rs
94
96
  - ext/yrby/src/read.rs
97
+ - ext/yrby/src/shared.rs
98
+ - ext/yrby/src/text.rs
99
+ - ext/yrby/src/xml_text.rs
95
100
  - lib/generators/yrby/install/install_generator.rb
96
101
  - lib/generators/yrby/install/templates/document_channel.rb
97
102
  - lib/generators/yrby/tables/tables_generator.rb
98
103
  - lib/generators/yrby/tables/templates/create_y_tables.rb
99
104
  - lib/y.rb
105
+ - lib/y/anchor.rb
100
106
  - lib/y/collaborative.rb
101
107
  - lib/y/collaborative/attribute.rb
102
108
  - lib/y/collaborative/helper.rb
103
109
  - lib/y/decoder.rb
110
+ - lib/y/doc.rb
111
+ - lib/y/lexical_markdown.rb
112
+ - lib/y/lexical_writer.rb
104
113
  - lib/y/lexxy.rb
105
114
  - lib/y/rendering.rb
115
+ - lib/y/text.rb
106
116
  - lib/y/tiptap.rb
107
117
  - lib/y/version.rb
118
+ - lib/y/xml_text.rb
108
119
  - lib/yrby.rb
109
120
  homepage: https://github.com/jpcamara/yrby
110
121
  licenses: