Commit Graph

61 Commits

Author SHA1 Message Date
Neil Fraser
90b3f75d82 Remove @author tags (#5601)
Our files are up to a decade old, and have churned so much, that the initial author of the file no longer has much meaning.

Furthermore, this will encourage developers to post to the developer group, rather than emailing Googlers (usually me) directly.
2021-10-15 09:50:46 -07:00
Neil Fraser
c929b3015b chore: Convert == to === and != to !== where possible. (#5599) 2021-10-15 09:17:04 -07:00
Monica Kozbial
49bc2b1ae4 Replace namespace annotation with class annotation in files that define a class (#5566) 2021-09-28 15:57:09 -07:00
Monica Kozbial
d8fbe1b05b Add namespace and alias annotations to jsdoc (#5550)
* Add annotations to files under core/events

* Add annotations to files under core/interfaces

* Add annotations to files under core/keyboard_nav

* Add annotations to files under core/renderers

* Add annotations to files under core/serialization

* Add annotations to files under core/theme

* Add annotations to files under core/toolbox

* Add annotations to files under core/utils

* Add annotations to files under core
2021-09-27 14:42:54 -07:00
Aaron Dodson
ede7e8c18d chore: Remove declareLegacyNamespace() from field_* files 2021-09-23 14:29:56 -07:00
Beka Westberg
96935c2502 fix: cereal backwards compatibility (#5421)
* fix: remove duplicate serialization hook implementations

* feat: add backwards compatibility to field serialization

* feat: add support for serializing old mutator hooks

* fix: build

* fix: refactor field changes into helpers

* fix: typo

* fix: removing xmlns

* tests: add tests for serialization and deserialization of mutator hooks

* fix: switch to early returns
2021-09-20 13:08:35 -07:00
Beka Westberg
8faa360b74 feat: upgrade fields to use new JSO hooks (#5077)
* Upgrade field angle to use new serialization

* Upgrade field checkbox to use new serialization

* Upgrade field colour to use new serialization

* Upgrade field dropdown to use new serialization

* Upgrade serializable label field to use new serialization

* Upgrade field multiline input to use new serialization

* Upgrade field number to use new serialization

* Upgrade field text input to use new serialization

* Upgrade variable field to use new serialization

* Fix type casts

* Feedback from PR

* Switch to use getValue()
2021-09-20 13:08:35 -07:00
Monica Kozbial
bec82da358 Remove require destructuring (#5294) 2021-08-03 15:07:14 -07:00
Aaron Dodson
e15470bbd0 clang-format core/field_number.js 2021-07-21 08:32:09 -07:00
Aaron Dodson
25fc34925f Migrate core/field_number.js to named requires 2021-07-21 08:31:39 -07:00
Aaron Dodson
0a1311c9b5 Migrate core/field_number.js to goog.module 2021-07-21 08:26:41 -07:00
Aaron Dodson
94bdd18505 Migrate core/field_number.js to ES6 const/let 2021-07-21 08:23:17 -07:00
Neil Fraser
cba7a68207 Allow inheriting of fromJson in fields 2021-07-11 23:19:01 -07:00
Neil Fraser
5f7fe9096b Use String() over toLocaleString when possible
toLocaleString results in a 4.6% performance penalty when loading the Spaghetti test in Playground.
2021-06-08 06:08:12 -07:00
Neil Fraser
c5a7b481bc Code simplifications 2021-06-03 08:23:01 -07:00
Laura Harker
5ff76ae32d Stop overriding @protected methods with @private (#4760)
An upcoming change to emit private properties in Google's internal version of
https://github.com/angular/clutz will otherwise break any
TypeScript depending on these types. This is because TypeScript errors
on overriding protected with private (Closure Compiler does not).
2021-04-06 11:05:41 -07:00
mfallihee
254fb60481 Use toLocaleString to count decimal places consistently (#4124) 2020-08-10 10:47:14 -07:00
Monica Kozbial
4ac4332f5e Update logic for field default values. (#3953)
* Update logic for field default values.

* Fix bugs

* Use contant for default value.

* Fix FieldColour

* Update field number tests.

* Update field angle test.

* Minor update.

* Update field checkbox test.

* Undo enabling logging

* Remove only.

* Update field colour test.

* Update invalid test cases for field colour

* Update field label tests

* Update field textinput test.

* Minor cleanup

* Make lint happy.
2020-06-12 15:18:28 -07:00
Neil Fraser
4e2f8e6e02 Use SPDX licences.
This is a followup to #3127.
At the time, SPDX licenses were pending approval by Google.
2020-02-11 13:27:20 -08:00
Neil Fraser
013f2714a3 Cleanup aria usage. (#3261)
Use enums instead of arbitrary strings.
Delete unused Aria properties
Add missing requires.
Delete unused code.
2019-10-15 22:43:23 -07:00
zochris
fcfeb316e7 Make "Infinity" case-insensitive in number field (#3188) 2019-10-07 14:16:24 -07:00
RoboErikG
663809297d Set correct defaults for Fields (#3179)
null was being converted to 0 by Number() when it should cause the
default value to be set instead. This updates FieldNumber and
FieldAngle to handle nulls correctly. Also update jsdoc.

Fixes #3177
2019-10-07 11:38:32 -07:00
Sam El-Husseini
d0772ad496 Fix compiler warnings related to fields. (#3144)
* Fix compiler warnings related to fields.
2019-10-03 15:58:46 -07:00
Neil Fraser
b46a4fe286 Bring our license format up to date (#3127)
* Google changed from an Inc to an LLC.

This happened back in 2017 but we didn’t notice.  Officially we should update files from Inc to LLC when they are changed as part of regular edits, but this is a nightmare to remember for the next decade.

* Remove project description/titles from licenses

This is no longer part of Google’s header requirements.  Our existing descriptions were useless (“Visual Blocks Editor”) or grossly obselete (“Visual Blocks Language”).

* License no longer requires URL.

* Fix license regexps.
2019-10-02 14:46:56 -07:00
Sam El-Husseini
a57c7ffb13 Clean up fields by passing the right type in fromJson (#3095) 2019-09-26 12:03:17 -07:00
Beka Westberg
af81239c42 Number Field Configuration (#2985)
* Added number field configuration.
2019-09-16 09:52:08 -07:00
Sam El-Husseini
f3f3329355 Fix configure method (#2915)
* Fix configure method.
2019-09-12 17:01:03 -07:00
Sam El-Husseini
8ab51c8639 Remove closure base file dependency (#2976)
* Trim down closure's base dependency even further by removing the dependency on closure's base file.
2019-09-11 17:30:51 -07:00
Sam El-Husseini
c99734b8f9 Add valuemin and valuemax aria properties for number fields (#2850) 2019-08-16 18:41:05 -07:00
Beka Westberg
0872d022e1 Changed utils.fields -> fieldRegistry. Also removed useless tooltip requires. 2019-08-16 09:57:28 -07:00
Beka Westberg
cdc90f4059 Refactored field utilities. 2019-08-16 09:57:27 -07:00
Neil Fraser
e77a9b7e81 Change parseFloat() to Number()
Number() is a bit less forgiving than parseFloat() and is more likely to generate NaN rather than some random number.  An audit of each case shows nowhere that parseFloat()’s features are needed.
2019-08-01 11:36:58 -07:00
Neil Fraser
45e5fb4157 More JSDoc and lint corrections 2019-07-30 17:00:40 -07:00
Sam El-Husseini
c1b49a1da7 Fix some jsdoc types (#2701)
* Fix JSDoc regarding type inconsistencies. Make image field src required and update image field tests.
2019-07-25 12:24:36 -07:00
alschmiedt
8f880d55c3 Revert "Adds type to FieldNumber editor" 2019-07-18 13:02:53 -07:00
alschmiedt
45387faab7 Adds type to FieldNumber editor 2019-07-02 10:53:45 -07:00
Beka Westberg
9099ee8c14 Readded reevaluating values when constraints are set. (#2507) 2019-05-29 12:48:55 -07:00
Beka Westberg
f16c9c0beb Refactored field validation. 2019-05-24 14:23:42 -07:00
asunwoo98
aa4d885cba Validate newValue parameter in setValue (#2392)
* Validate newValue parameter in setValue

* bugfix

* alternate fix

* test

* cleanup
2019-04-22 16:00:37 -07:00
Beka Westberg
e8573bc0db Added isSerializable function and SERIALIZABLE property to fields. 2019-04-21 08:28:37 -07:00
Beka Westberg
f88c704d69 Fixed visible floating point errors in number fields. (#2384) 2019-04-15 13:26:20 -07:00
Neil Fraser
e9de083361 Fix @return JSDocs. 2019-03-29 15:24:37 -07:00
Neil Fraser
aa09ad9175 Line wrap at 80. 2018-10-16 11:34:10 -07:00
Neil Fraser
07d1d86283 Remove remaining goog.math 2018-07-11 12:20:02 -07:00
Rachel Fenichel
615c403b44 Use @nocompress annotation to fix advanced compilation. 2018-03-01 12:35:55 -08:00
Mark Gibson
54f0e06e21 Customising field types using a register of fields #1584 (#1594)
Implement #1584 - Fields now registered by their JSON type name, allowing new custom fields and overriding of the standard fields. Replaces the manual switch statement for loading fields from JSON block definitions.
2018-02-14 10:14:59 -08:00
Mark Gibson
2308ae8c22 Remove underscore from fromJson_ 2018-02-07 18:18:35 +00:00
Mark Gibson
d40ef474ae See issue #1486 - adds fromJson_ fn to every Blockly.Field, removing Block.newField*FromJson_ helpers 2018-02-07 12:22:26 +00:00
Neil Fraser
4262b09002 Resolve 106 warnings. 2017-10-24 14:06:29 -07:00
Rachel Fenichel
4152542c2f Fix some lint errors 2017-02-03 14:01:18 -08:00