* Fix popup location for tables
This commit introduces the `popupAbsCoords` option to the $button widget
and implements an absolut coordinate format.
Coordinates for popups are stored in the format `(x,y,w,h)`. These
coordinates are relative to the offset parent of the element that
defines the popup.
This commits adds a second format `@(x,y,w,h)`. Coordinates specified in
this format a relative to the pages root element.
The `popupAbsCoords` option of the $button widget enables the use of
this coordinates.
* Unify the declaration of the RegEx for parsing the popup-position
The regular expression was declared in three locations with the same
content. This commit supplies a new function `parseCoordinates` in
`popup.js`. This function returns the parsed coordinates and understands
the classic/absolute coordinates.
This function is used in `reveal.js` and `action-popup.js` to parse the
coordinates.
* Add documentation for coordinate systems
* Consolidate creating coordinate strings
The Popup object now contains a `buildCoordinates` method that can be
used to build coordinate strings. It takes an "enum" for the coordinate-
system to use. This makes everything easily extensible and prevents the
use of magic values.
* Add tests for `parseCoordinates` and `buildCoordinates`
* Add `tv-popup-abs-coords` to `collectDOMVariables`
This will make the absolute coordinates available for the
`DraggableWidget` and the `EventCatcherWidget`.
* Add documentation for the `tv-popup-abs-coords`
... to the `DraggableWidget` and the `EventCatcherWidget`.
* Add tests for [is[variable]] and "faked" variables
See GH #6303
* Make is[variable] and variables[] operators resilient to fake widgets
Co-authored-by: jeremy@jermolene.com <jeremy@jermolene.com>
* add default settings for styled inline SPANs
* change color names in palettes and vanilla-base
* change parser behaviour if custom class is used
* tc-inline-style will only be set if no other custom setting is appliead
* Add tests for inline-styles
* add one more test
* remove space after if
* Fix bug with checkbox widget and `list` field
The `list` field is stored as a list and frozen against modifications,
and getFieldList() returns it directly without creating a copy. So
before we modify it, we need to make a copy so we're not modifying a
frozen list. This bug doesn't manifest with custom fields, which are
stored as strings, only with the built-in `list` field.
* Fix checkboxes referencing non-existent tiddlers
This fixes the "tiddler is undefined" error when a checkbox's listField
property references a tiddler that doesn't (yet) exist.
* Better logic for checkbox listField handling
If the field contains an array, then it's almost certainly referenced
elsewhere and needs a defensive copy made. If it contained a string,
then it's safe to modify without making a defensive copy.
* Implement insertafter operator (like insertbefore)
Currently, the behavior of insertafter if the target is not found is to
append the inserted tiddler to the end of the list, like insertbefore
does. In the next commit, we'll add a suffix to customize what both
insertafter and insertbefore do when the target is not found.
* Add failing tests for insertafter suffixes
Also includes tests for insertbefore suffixes (start/end), since we'll
be implementing both of those at the same time.
* Add start/end suffixes for insertafter/before
The tests that exercise the start/end suffixes now pass.
* Add `main` and `article` roles to stories and story.
* Support `role` and \aria-checked` in buttons, and integrate with sidebar tabs.
* Add `region` role to sidebar, and set caption as `aria-label`.
* Add accessibility roles and labels to static templates.
* Update test fixtures with new ARIA tab attributes.
* Documentation for indeterminate checkboxes
* Unit tests for indeterminate checkboxes
* Implement indeterminate checkboxes
* Simplify indeterminate checkbox example
* Slightly simplify refresh logic for indeterminate
That five-line if statement can be turned into a simple assignment.
* Use "yes" and "no" for checkbox indeterminate attr
This makes the "indeterminate" attribute of the checkbox widget work the
same way as other boolean attributes of other widgets.
* Fix bug with invertTag attribute
One place in the checkbox widget code was checking invertTag for
Javascript truthiness rather than the value "yes", which could have
produced incorrect results if anyone wrote invertTag="no". Fixed.
* fix: formatDateString with [UTC]xxx didn't use passed date
* test: for formatDateString UTC
* fix: not possible to test internal date without hijack
Expected '20220410073037515' to be '20220410073037516'.
* fix: hour
* Docs for CheckboxWidget list and filter modes
This documents the `listField` and `filter` attributes.
* Tests for checkbox widget list mode
* Implement checkbox list mode
* WIP on implementing filter attr for checkboxes
* Improve CheckboxWidget documentation
* Refactor checkbox tests: move function to top
The big findNodeOfType function belongs at the top of the describe
block, so that the checkbox tests are more compact and easy to read.
* Move checkbox widget tests to end of file
The checkbox widget tests are long and involved, so we'll move them to
the end of the file so they aren't a huge block of code you need to read
past to find the next test.
* Improve formatting of CheckboxWidget docs
The \define() calls that are short enough to fit on one line should be
put on one line, for readability. The ones that are quite long have been
kept on multiple lines, for readability.
* Added more passing tests for checkbox widget
* Add some failing tests for checkbox widget
The filter mode where neither checked nor unchecked is specified (in
which case an empty filter result means false and a non-empty result
means true) is not working yet.
* Make failing tests pass
* Uncomment (and improve) test for field mode
We're now ready to start working on making this test pass. (There was
also one small mistake in the test, which this commit corrects).
* All tests now passing
* No indeterminate checkboxes in simple modes
The simple checkbox modes (field and index) should not produce
indeterminate checkboxes. That should be reserved for the advanced modes
(list and filter).
* Minor improvement to unit tests
* Allow indeterminate checkboxes in list and filter modes
This change may require some tweaks to the unit tests to be able to test
it properly.
* Slightly easier to read tests
* Two more tests for list mode
* Greatly simplify unit test code
Turns out there's no need to jump through Object.getPrototypeOf hoops.
* Minor simplification of unit test
* Add tests for indeterminate in list & filter modes
With this, the set of tests is complete.
* More tests to specify list mode behavior
* Unfocus tests so all tests run
* Update docs to say "new in 5.2.3" insetad of 5.2.2
* Move checkbox widget tests into their own file
The test-widget.js file was getting too long with all the checkbox
tests added, so we'll move the checkbox tests into their own file.
* Add checkbox widget tests for index mode
This commit also adds tests for index list mode (with a listIndex
attribute that will parallel the listField attribute) but leaves them
commented out because they don't pass yet: the code that implements the
listIndex attribute hasn't been written yet).
* Add listIndex attribute to checkbox widget
* Remove code that lets checkboxes be indeterminate
This reverts commit 6afcb151be. We will
add this code back in a later PR.
* Remove indeterminate tests for checkbox widget
We're currently not allowing indeterminate checkboxes, so there's no
need for the tests that check for them.
* Document listIndex attribute of CheckboxWidget
* adds class tc-checkbox-checked when checked
* equivalent to #2182 (RadioWidget)
* also applies `tc-checkbox` to checkboxes by default, always
* Move macro definitions inside example text
Since the wikitext-example-without-html macro creates a new parsing
context, it's safe to have macro definitions inside it. That makes these
examples a lot easier to write, and to read.
* Remove all mention of indeterminate checkboxes
Also improve the documentation a little bit: mention what happens in
list mode if neither checked nor unchecked is specified.
* Move filter mode to bottom of checkbox docs
The `filter` attribute should be under both `listField` and `listIndex`
rather than being between them. The documentation for filter mode should
similarly be after the `listIndex` documentation.
* Improve docs for `class` attr of checkbox widget
This brings the wording of the `class` attribute more in line with how
it's worded in the RadioWidget docs.
* Fix bug with list tiddlers
If neither checked nor unchecked was specified, then the behavior should
be "empty = false, non-empty = true". But if *both* are specified yet
neither is found, then the checkbox should be unchecked (false). It had
been falling through to the "non-empty = true" behavior, which was wrong.
* Improve listIndex example of checkbox widgets
* Remove unused function from test-widget.js
Co-authored-by: Tobias Beer <beertobias@gmail.com>
* tabs activate v5.2.2 tests add whitespace trim
* tabs-macro -- add indentation and code preview
* tabs-macro -- replace substitutions with variables
* split tabs-macro macro into different elements
- tabs-button
- tabs-tab
- tabs-tab-list
- tabs-tab-body
- tabs ... main macro
* tabs: add cascade to button and reaveal widgets
This will allow users to create "default tab" configurations similar to the tiddler info tab handling.
* tabs-macro -- add code_body: yes
* adding trim: Last of the macros I think
* adding trim: EditTemplate and ItemSidebarIcon
* adding trim: control panel basics
* Another hidden space to guide the uglifier
* More consistent nested quoting
* Reconciling tests for \whitespace trim
* Support specifying insertbefore position title as parameter
Closes: #6133
* Update insertbefore calls with new variable parameter syntax
See-also: 96b52606a (Support specifying insertbefore position title as parameter, 2022-02-21)
* corrected [!is[draft]] to be a proper complement
* Ensuring [is[draft]] and [!is[draft]] are complements
* Made [is[draft]] more analogous to .isDraft()
* Support case insensitive matching in prefix/suffix operators
Support `caseinsensitive`/`caseinsensitive` suffixes in the following
filter operators:
* prefix
* suffix
* removeprefix
* removesuffix
The suffixes have the same behaviour as in the match operator.
Closes: #6407
* Do not filter titles if suffix/removesuffix operand is empty
Issue: #6407
* Failing test
* Fix underlying problem
* Less naive fix
Now we make sure we maintain the sort order of the titles array when adding a new tiddler
* Fix failing tests
* Refactor filter tests to repeat them with different store orderings
* Revert "Fix failing tests"
This reverts commit ee03ee57f5.
* Refine fix to retain stylesheet ordering
The order of tiddlers in the HTML file uses localeCompare(), and that determines the insertion order. So if we want to be compatible with older versions we have to use localeCompare() to order tiddlers, not a plain sort()
* Don't sort shadow tiddlers
Instead rely on the existing ordering
* Fix failing tests, take 2
I think that all of these changes are explained by the store no longer retaining insertion order, but now using localecompare ordering
* Fix tests from #6327
* Support macro params in filter run prefixes and support substitution for variables set by filter run prefixes
* feat: add support macro parameters and variable substitution for all filter run prefixes
* fix: rename options argument to opts for disambiguation
* feat: add support for macro params to cascade filterrun prefix
* Initial Commit
* Set currentTiddler and ..currentTiddler for filter evaulation
* Precompile the filters for performance
* Add explicit test for empty result when no filter passes
* Use the cascade filter run prefix to choose the view template body template
* Use the cascade mechanism to choose between the edit and view templates
* Simplify cascade filter
Thanks @saqimtiaz
* Add control panel UI for inspecting the template cascades
* Refactor import listing and plugin listing as alternate body templates
As suggested by @pmario
* Refer to $:/core/ui/{View|Edit}Template via their associated config tiddlers
* Fix typo in previous commit
* Add demo of custom story tiddler template
* Tweak control panel wording
* Standardise "Story Tiddler Template" nomenclature
* Add a cascade for the editor template body
* Add a cascade for the view template title
* Avoid unwanted whitespace
* Add a cascade for dynamically choosing tiddler icons
* $let widget added and tested
* Documentation for $let, doc improvements for $vars
* let properly avoids refreshing when possible
* $let Changes as recommended by others
* Removed superfluous super method call
Also improved $let test
* Extends :map filter run prefix to provide the variables index, revIndex and length to bring it into line with :reduce
* update :maps examples
* docs: fix formatting issue with documentation
* Extend HTML tag parser to maintain an ordered array of attribute names
* Add some tests for repeated attributes
* Record entire attribute in orderedAttributes array so that we can work with duplicated attributes
* Add support for JSON-formatted tiddler store, and make it the default
The change to `getTiddlersAsJson()` is to allow experimentation
* Move JSON tiddlers into their own store area, and fix support for encrypted tiddlers
Also add a dummy old-style store area for backwards compatibility
The current arrangement is that JSON tiddlers will always override old-style tiddlers.
* Use the deserialiser mechanism to decode the content
* Refactor $:/core/modules/deserializers.js before we start extending it
Cleaning up the helper function names and ordering
* Drop support for the "systemArea" div
It was only used in really old v5.0.x
* Update deserializer to support JSON store format and add some tests
* Life UI restrictions on characters in fieldnames
* Add another test case
* Correct mis-merge
* Remove toLowerCase() methods applied to fieldnames
* Insert line breaks in output of getTiddlersAsJson (#5786)
Rather than have the entire store on one line, insert a line break
after each tiddler.
* Refactor #5786 for backwards compatibility
* Only read .tiddlywiki-tiddler-store blocks from script tags
Prompted by @simonbaird's comment here: https://github.com/Jermolene/TiddlyWiki5/pull/5708#discussion_r648833367
* Clean up escaping of unsafe script characters
It seems that escaping `<` is sufficient
* Add docs from @saqimtiaz
Thanks @saqimtiaz
* Docs tweaks
* Remove excess whitespace
Thanks @simonbaird
* Fix templates for lazy loading
* Remove obsolete item from release note
* Clean up whitespace
* Docs for the jsontiddler widget
* Fix whitespace
Fixes#5840
* Comments
* Fix newlines in JSON store area
* Remove obsolete docs change
Co-authored-by: Simon Baird <simon.baird@gmail.com>
* Exploratory pass at adding support for macro params in filter operands
* whitspace correction
* rename varInfo to varTree for disambiguation
* Refactored parseMacroInvocation to be re-usable, performance improvements for variables with no params and tests
* Revised regular expression and removed spurious white space changes
* Revised regular expression and removed spurious white space changes
* More whitespace cleanup and added more tests for edge cases
* Added test for macro params with square brackets
* html-comment, that can be used in the pragma area
* add commentpragma test
* fix typo
* fix typo and change comments ab bit
* combine html-comment and pragma-comment and add some docs, how to use it
* Make docs simpler by removing caching info
* change h2 wording
* Transclude widget: only refresh when transcluded text reference has changed, includes tests
* Refactor wiki.parseTextReference so it is re-usable for getting the parser info
* Re-arrange methods in wiki.js to improve diff readability
* Add :sort filter run prefix, docs and tests. Also extended .utils.makeCompareFunction with a flag for caseSensitivity.
* Documentation updates
* Move case sensitivity handling entirely to utils method so it is reusable
* Make filter run prefixes extensible
* Make filter run prefixes extensible
* Support rich suffixes for filter runs
* merged conflicts
* Pass suffixes to filterrunprefix
* Replace css-escape-polyfill.js with escapecss.js utility module
* Add $tw.utils.escapeCSS() method and invoke that function within the
escapecss operator.
* Add test cases for the "escapecss" filter operator
* Fix $tw.boot.doesTaskMatchPlatform() so it works as expected if
a module's export.platforms contains more than one values
* Add missed files to the last commit
* wikirules now use better macrocall parser
Before, wikirules would use a deficient macrocall parser which couldn't
handle certain types of arguments. Now it uses the same one that the
widget parser uses. Less code!
* style changes and removing weird switch statement
That switch statement made more sense in an earlier iteration.
* comment improvements
* oops, wikirule macrocalls could do ONE thing better
* '=' wasn't allowed for widget macros, but why?
Now they're allowed for both widget macros and macrocall macros.
* Cleaned up jasmine test suite output
Also testing for expected log messages, instead of just letting them print
to the console every single time, constantly making you think there's some
warning you need to worry about, and making all those dots not line up nicely.
* switched single quotes to double in collectLogs
* Outlines of the mem efficient linked list
Need to stop for now. Found problem with $tw.utils.pushTop that I need
consultation for.
* Link list throws when given non-string vals
* Think I got rid of the last LinkList infinite loops
* LinkedList push better; fixed coding conventions
* Cleaning up LinkedList code and tests
* Ready to ship new mem efficient Linked List
* Switching to double quotes in LinkedList
Fixes#5246. Now the reduce operator and :reduce filter run prefix will
both return empty output when their input is empty, so that both can be
chained together with the else operator or :else prefix.
* made private methods limited to module scope
* moved private methods to file bottom
* changed tests to run comperable array functions in parallel
* added comments
* Changed the filterrunprefixes to use LinkedList
* Testing for Linked List
* Finishing touches to LinkedList
* Minor corrections to link-list coding style
* Corrected for sneaky bug in linkedList
* Extend toggle operator to support optional second operand to toggle a value pair
* Added tests for extended toggle filter
* Updated docs for toggle operator
* Firt pass at adding multiple operands to filter operators
* Optimized parsing of multiple operands and added more tests. Need more flexibility for interpreting multiple operands as variables/text references
* Add support for parsing text references and variables in multiple operands
* Added string-replace filter for testing multiple filter operands
* Added more tests for variables and text references in operands
* Removed string-replace operator and some whitespace corrections
* Removed string-replace operator and some whitespace corrections
* Added test with comma in operand
* Add suffix and parameter to trim operator
Fixes#4809
* Unit tests for new trim operator parameters
* Mention trim operator in 5.1.23 release notes
* Address review comments
* Move regex escaping into utils.js trim functions
This way the trimPrefix and trimSuffix functions from utils.js are safe
to call without regex-escaping their parameters, which should make them
easier to use from other parts of the Javascript code.
Most astral-plane text is emojis like U+1F4DA BOOKS (📚), but some
languages like Osage have their alphabet entirely in the supplementary
multilingual plane as well. For proper support of languages like Osage,
and newer emojis, the UTF-8 decode and encode functions need to properly
handle codepoints above U+FFFF, which are represented by a surrogate
pair in Javascript strings.
* The `!has[tags]` filter didn't work because "tags" is an array
The negated `has` filter only considered empty strings, but not empty
arrays (such as the `tags` field).
* Add tests for `has` filter operator with array-like fields (tags, list)
* Add tests for backlinks
* Add backlinks indexer
* Use backlinks indexer in getTiddlerBacklinks if available
* Extract link extraction into its own method
This way we can provide an arbitrary parse tree, rather than just a
title, which will allow us to compare lists of outgoing links between
versions of a single tiddler
* Use new extractLinks method in backlinks indexer
...rather than copy-pasting the implementation
* Remove ES6-isms
TiddlyWiki needs to work with browsers that only support ES5
* Fixes issue with #4504 and importvariable copying
ImportVariables widget was using $tw.utils.extend to copy the
variables from temporary set widgets into itself. However,
$tw.utils.extend does NOT behave like Object.assign. It not only
copies all self-owned variables over, but also all variables
in that object's prototype chain. This led to some redundant copying,
and a problem where some variables might show up more than once
(like transclusion).
Fixed now. importvariables widget does its own copying, since it
can't rely on $tw.utils.extend to do the right job, and it can't
count on Object.assign to be there.
* Added test to prevent reversion of #4504
* Slight corrections to new importvariables test
* add a new-line before the log text to increase readability of the test output
* make eslint, jslint happy
* make eslint happy
* add more listops tests
* new listops filter tests
* remove new-line
* make eslint happier.
* revert eslint settings
* Changed importVariable to store its ownvariables
Before, importVariables was creating a setWidget for every single variable it would find in its tiddlers, and it would create a long-ass call tree. Now, instead, it just accumulates the variables in itself.
* Can't use Object.assign
Learned the hardway while working on tw5-relink that Object.assign
doesn't exist in IE11. Using $tw.utils.extend instead.
* Retaining setWidget transclusion flexibility
* One more test to verify mixing sets and macros
add 3 new tiddlers, add 1 "enlist" test, fix all tests that failed, because 3 new tiddlers where added. stopped ESLint to complain about global vars, fix some mixed-tab-space indent typos.
* process.exit() only exist in a node.js environment
* updateInterval has been removed from upstream
From upstream commit:
b6eb9a4d5e
* Update Jasmine to 3.4.0
* Reuse the evalInContext helper
* Fix expected parse result to match the actual result
* 'describe' cannot be nested inside 'it' blocks
Jasmine started to explicitly raise an error in these cases since:
https://github.com/jasmine/jasmine/pull/1411
* Be consistent about how to refer to library files
* Update link to Jasmine's official website
I (Flibbles) changed it so that lists generated by stringifyList
would always be compatible with a filter parser, but since lists
are not, and never will be, a subset of filters, there isn't a
point.
More importantly, wrapping negative numbers like "-7" in brackets
would mess up some math stuff.
Fixes#4082
This version removes selective updating of the tag index, instead completely clearing the index on each update. I'm investigating restoring that optimisation.
The test rig previously used a simplified implementation of shadow tiddlers which broke with the new indexing engine. There was also a problem that made that even if indexers were disabled they were still initialised.
This PR fixes both problems, in preparation for fixing #4082
* First pass at modular wiki indexes
An exploratory experiment
* Fix tests
* Faster checking for existence of index methods
We don't really need to check the type
* Use the index for the has operator
* Fix typo
* Move iterator index methods into indexer modules
Now boot.js doesn't know the core indexers
* Fix up the other iterator index functions
* Fix crash with missing index branch
* Limit the field indexer to values less than 128 characters
* Fallback to the old manual scan if the index method returns null
* Sadly, we can no longe re-use the field indexer to accelerate the `has` operator, because the index now omits tiddlers that have field values longer than the limit
Still need to make the index configuration exposed somehow
* Rearrange tests so that we can test with and without indexers
We also need to expose the list of enabled indexers as a config option
* Test the field indexer with different length fields
So that we test the indexed and non-indexed codepaths
There are other ways we could add maths to TW5 (including @EvanBalster's awesome https://github.com/EvanBalster/TiddlyWikiFormula) but the approach here has the merit of simplicity because it reuses the existing filter evaluation mechanism. That means that it's not ordinary "2+2" maths, it's a unique list processing language...
Docs to come
Fixes#254
* Fix search method for search tokens spread across fields
Addresses GH #3636, which reports that if you're searching for "test
body", and "test" only appears in the title field, and "body" only appears
in the text field, 5.1.18's search method won't yield that tiddler as a
result, which appears to be a regression from the 5.1.17 behavior
* Add test for searching for multiple tokens across fields
Verifies GH #3636:
> If I create a tiddler in the empty edition with the title "Test tiddler" and content "Body content", searching the wiki for "test body" yields no results under either "title matches" or "all matches". Searching for either word individually turns up "Test tiddler", and repeating this in an empty wiki I created from the 5.1.17 tag causes "Test tiddler" to show up under "all matches".
* Added better handling for sortByList manual placements
If manual placement specifications show up in an inconvenient order,
sortByList, will go to the trouble of processing them in that order.
* Added tests to confirm solution to (#3296)
...That custom tag ordering will not choke when tiddlers get sorted after their dependencies have been placed around them
* Corrected list-after bug when referencing external titles
* Using more error-proof $tw.utils.hop in sortByList
* minor indentation correction in test-tags.js
They don’t get automatically decoded when the browser reads the
resulting HTML. So, instead, we’ll solve
1e9e1a1fdc by switching to double quotes
for attribute values.