Polymer elements support bind, creation of new elements, overwrite with simple object, events

This commit is contained in:
DadaMonad
2014-12-26 13:36:45 +00:00
parent fd1128d456
commit 6790355232
84 changed files with 249 additions and 31221 deletions

View File

@@ -52,7 +52,7 @@ module.exports = (HB)->
for name,o of @map
if not o.isContentDeleted()
obj = o.val()
if obj instanceof types.ImmutableObject or obj instanceof MapManager
if obj instanceof types.ImmutableObject # or obj instanceof MapManager TODO: do you want deep json?
obj = obj.val()
result[name] = obj
result

View File

@@ -206,34 +206,34 @@ module.exports = (HB)->
word = @
textfield.value = @val()
@on "insert", (event, op)->
o_pos = op.getPosition()
fix = (cursor)->
if cursor <= o_pos
cursor
else
cursor += 1
cursor
left = fix textfield.selectionStart
right = fix textfield.selectionEnd
@observe (events)->
for event in events
if event.type is "insert"
o_pos = event.position
fix = (cursor)->
if cursor <= o_pos
cursor
else
cursor += 1
cursor
left = fix textfield.selectionStart
right = fix textfield.selectionEnd
textfield.value = word.val()
textfield.setSelectionRange left, right
textfield.value = word.val()
textfield.setSelectionRange left, right
else if event.type is "delete"
o_pos = event.position
fix = (cursor)->
if cursor < o_pos
cursor
else
cursor -= 1
cursor
left = fix textfield.selectionStart
right = fix textfield.selectionEnd
@on "delete", (event, op)->
o_pos = op.getPosition()
fix = (cursor)->
if cursor < o_pos
cursor
else
cursor -= 1
cursor
left = fix textfield.selectionStart
right = fix textfield.selectionEnd
textfield.value = word.val()
textfield.setSelectionRange left, right
textfield.value = word.val()
textfield.setSelectionRange left, right
# consume all text-insert changes.
textfield.onkeypress = (event)->

View File

@@ -1,41 +0,0 @@
json_types_uninitialized = require "./Types/JsonTypes"
HistoryBuffer = require "./HistoryBuffer"
Engine = require "./Engine"
adaptConnector = require "./ConnectorAdapter"
createYatta = (connector)->
user_id = connector.id # TODO: change to getUniqueId()
HB = new HistoryBuffer user_id
type_manager = json_types_uninitialized HB
types = type_manager.types
#
# Framework for Json data-structures.
# Known values that are supported:
# * String
# * Integer
# * Array
#
class Yatta extends types.JsonType
#
# @param {String} user_id Unique id of the peer.
# @param {Connector} Connector the connector class.
#
constructor: ()->
@connector = connector
@HB = HB
@types = types
@engine = new Engine @HB, type_manager.parser
adaptConnector @connector, @engine, @HB, type_manager.execution_listener
super
getConnector: ()->
@connector
return new Yatta(HB.getReservedUniqueIdentifier()).execute()
module.exports = createYatta
if window? and not window.Yatta?
window.Yatta = createYatta