Releases: discoveryjs/discovery
Releases · discoveryjs/discovery
1.0.0-beta.91
- Changes related to
Model#context
:- Added
context
toModel
options, allowing the model's context to be set and accessible from the beginning (available during setup and in extensions) - Added
Model#setContext(context, replace)
method, which extends the current context with the provided value or replaces it ifreplace
istrue
- Added
context
event toModel
, withprevContext
andnextContext
parameters, triggered when the context changes - Changed
Model#context
to be an accessor property, where the setter callsModel#setContext(value, true)
- Changed
ViewModel#setData()
to no longer accept acontext
argument or change the context - Changed
ViewModel#setDataProgress()
to no longer change the context, despite acceptingcontext
argument - Updated
ViewModel
to trigger a render when thecontext
event is fired
- Added
- Added
Model#legacyPrepare
readonly property to indicate whether the legacyprepare
method is used or the newsetup()
method - Updated
struct
view to define thesetStructViewAnnotations
action when using the newsetup()
method, allowing custom annotations to be specified across allstruct
views - Updated
embed
option ofApp
to accept a config - Added
EmbedApp#publicApi.notify(name, details)
method for sending notifications - Introduced
onNotify(name, details)
option in the embed extension to define a callback for handlingnotification
messages from the embed host - Added
EmbedApp#publicApi.setLocationSync()
method to simplify sync between the embed app and the host location, preventing potential pitfalls - Added
ViewModel#enforceScheduledRenders()
to immediately execute scheduled renders - Changed
ViewModel#scheduleRender()
to usesetTimeout()
instead ofPromise.resolve()
to ensure proper processing of event loop tasks, eliminating unnecessary renders - Changed
ViewModel
initialization to minimize unnecessary renders - Marked
ViewModel#renderPage()
,ViewModel#renderSidebar()
, andViewModel#renderPage()
as private methods, as they are not intended for direct invocation anymore - Fixed
ViewModel#setPageParams()
to normalize thehash
by ensuring it starts with#
, preventing unnecessary events; for example, passing#page
andpage
into the method will now consistently result in#page
being stored inViewModel#pageHash
- Redesigned logging API, the changes allow to see the correct loaction of logging method call instead of a location inside of the
Model#log()
method:- Added
Logger
class to utils - Changed
Model#logger
to hold aLogger
instance - Removed
Model#logLevel
, useModel#logger.logLevel
for getting or setting the log level - Deprecated
Model#log()
method, which do nothing but display an error:- Use
Model#logger[level](...args)
instead ofModel#log('level', ...args)
- Use
Model#logger[level].group(message, fn | array)
orModel#logger[level].groupCollapsed(message, fn | array)
instead ofModel#logger({ level, message, collapsed: fn | array })
- Use
- Added
1.0.0-beta.90
- Added
@discoveryjs/discovery/embed
export - Changed
applyContainerStyles()
to take a singledarkmode
value instead of "options", with supported values:true
,false
,'true'
,'false'
,'dark'
,'light'
and'auto'
- Changed
applyContainerStyles()
to avoid applying transition styles to the container, preventing unwanted flashes of opposite colors - Changed
source
view to takesource
,syntax
,lineNum
,refs
andmaxSourceSizeToHighlight
options. It attempts to derive these values fromdata
when options are not explicitly provided for backward compatibility. Thesource
can be derived fromdata
ascontent
(for backward compatibility) orsource
property - Removed
mime
,binary
andsize
data options forsource
view - Bumped
marked
to^14.1.4
(used inmarkdown
view) - Added styles for
<kbd>
inmarkdown
view - Improved string rendering in the values popup of
signature
view - Fixed optional values statistics in
signature
view - Fixed navigation history update on the query graph changes on
discovery
page - Fixed scrollbar color schema in darkmode mode
1.0.0-beta.89
- Renamed
Widget
class intoViewModel
- Added
pageStateChange
event toViewModel
, triggered whenpageId
,pageRef
, orpageParams
changes - Added
query
property to functions produced from a string (jora query), i.e. withModel#queryFn(query)
- Added
clipboard
option to theupload
extension for enabling loading data from the clipboard - Added support for uploading files from
paste
event - Added
unloadData
nav button - Renamed
loadData
nav button intouploadFile
- Changed
Model#unloadData()
method to not reset context - Added
app-header
view - Model's info:
- Added
name
,version
,description
, andicon
options forModel
, storing these values in theinfo
property - Added
model
property to a render context (result ofViewModel#getRenderContext()
) reflectinginfo
value - Added
--discovery-app-icon
CSS custom property which contains value of model'sicon
- Added
- Added
@discoveryjs/discovery/utils
export - Changed the extension application order for
App
so thatoptions.extensions
are applied after implicit extensions - Changed
nav-button
view to align withbutton
view (text
,href
andexternal
as config options,disabled
is no longer treated as query) - Modified
PageRenderer#define()
andViewRenderer#define()
to allow specifying all options with a single config parameter:// new signature discovery.page.define('example', { render: [/* ... */], ...restOptions }); // old signature remains compatible discovery.page.define('example', [/* ... */], { /* options */ });
- Removed
export default
in the core modules - Fixed
Model#pathToQuery()
method to correctly generate a query when part of the path contains a jora keyword - Fixed an edge case in the
table
view when rendering a single cell with an explicit column setup and row data containing non-object values
1.0.0-beta.88
- Added
context
option for all views, which executes beforedata
and replaces the input context value with its result - Added
rows
option fortable
view to specify data for rows, withdata
being used by default ifrows
is not specified - Added
detailsWhen
option fortable
cells to explicitly control the activation of details - Changed
button
view to taketext
,href
andexternal
options; it attempts to derive these values fromdata
when options are not explicitly provided for backward compatibility - Changed
button
view so thatdisabled
values are no longer treated as queries. To use a query for disabling a button, specify it explicitly like{ view: "button", disabled: "=query" }
- Improved the computation of estimated JSON size in the
struct
view actions popup, making it 2x faster - Fixed behavior of
tooltip
option to display a tooltip with a delay by default - Fixed TypeScript warning related to
switch
view export dueswitch
is reserved word and can't be an identifier
1.0.0-beta.87
- Enhanced style of errors on the loading data overlay
- Enhanced responsiveness and addressing issues with freezing during transition states for views related to the data loading state. Instead of setup of initial state via JavaScript, the new
@starting-style
at-rule is used:- Tweaked styles to improve the performance perception
- Widget:
- Removed adding of
.init
class to the main container ininitDom()
- Removed adding of
- App:
- Removed adding of
.init
class to the overlay during the initialization phase
- Removed adding of
- Progressbar:
- Added adding
.done
and.error
classes on the main container on progressbar finish - Removed
delay
option from the constructor - Removed
appearanceDelay
property - Removed adding
.init
class to the main container at the first stage change
- Added adding
- Changed
createLoadDataState()
to take a dataset factory function instead of a load data request, enhancing its reusability - Fixed re-rendering on data unload
- Fixed
Model#decodePageHash()
to returnnull
forpageRef
instead ofundefined
- Fixed
Widget#setPageHash()
to always emithashChanged
whenhash
changes, disregarding changes ofpageId
,pageRef
andpageParams
- Fixed preloader styles to ensure the data loading progressbar remains visible during the prepare stage
- Fixed value counting in the
signature
view when a property contains duplicated objects, which previously led to incorrectoptional
label - Fixed warning "Added non-passive event listener..." in Chrome caused by CodeMirror (codemirror/codemirror5#6735)
- Fixed missed error on progressbar's value when the progressbar finishes with error
1.0.0-beta.86
- Added
setWorkTitle
method to the prepare context API to display additional text on the progress bar:When used, it could look like the following:export function async prepare(input, { setWorkTitle }) { await setWorkTitle('phase 1'); // ... await setWorkTitle('phase 2'); // ... }
Screen.Recording.2024-09-28.at.04.16.48.mov
- Refactor
Progressbar
:- Added
setStateStep(step)
method to set a secondary text for the stage - Changed
setState()
method to take second optional parameterstep
- Modified logic for await repainting
- Added
awaitRepaintPenaltyTime
property to indicate time spending on awaiting for repaint - Changed
onFinish
callback to addawaitRepaintPenaltyTime
totimings
array - Added
decoding
stage - Renamed
receive
stage intoreceiving
- Removed
lastStage
as it redundant, usevalue.stage
instead
- Added
- Changes in data loading:
- Added
decoding
stage for load state - Renamed
receive
stage intoreceiving
for load state - Added
loadingTime
anddecodingTime
into dataset timings
- Added
- Fixed crashing the entire render tree on an exception in a view's
render
function; now, crashes are isolated to the affected view - Fixed unnecessary view rendering when returning to the discovery page
- Fixed hiding a popup with
hideOnResize: true
when scrolling outside of the popup element - Fixed load data timings section title in console
- Added TypeScript typings for
Popup
1.0.0-beta.85
- Changed
Widget#scheduleRender()
to schedule render for all subjects when no subject is specified (invoked without parameters) - Bumped jora to 1.0.0-beta.13
- Added display of tens marks in
struct
view - Added new actions for expanded values in the
struct
view:These actions activate when certain actions are available in the context. First, if the
queryAcceptChanges
action exists and returns a truthy value for thestruct
's data (root value), then specific actions likequerySubquery
andqueryAppend
are checked for existence. If they exist, the relevant actions are added to the actions menu. These actions should take apath
andstruct
view data and make relevant changes to the query that the currentstruct
view instance is based on. Thediscovery
page provides such actions in the context, so anystruct
view that takes query editor output as its input data provides these actions.- "Create a subquery from the path" – calls the
querySubquery
action from the context (i.e.,#.action.querySubquery
), which creates on thediscovery
page a new node in the query graph with the selected path. - "Append path to current query" – calls the
queryAppend
action, which appends on thediscovery
page the selected path to the current query in the query editor.
- "Create a subquery from the path" – calls the
- Changes for
table
view:- Changed rendering of arrays when it's a row value, to render as other non-object values using
struct
view - Renamed
scalarCol
option intovalueCol
- Tweaked styles to dim the display of
true
,false
,null
,NaN
, andInfinity
values to differentiate them from strings and numbers - Changed in the
cols
configuration:- Added the
colWhen
option (likewhen
orwhenData
) for thetable
view to conditionally render columns based on the table's data - Added the
contentWhen
option (likewhen
orwhenData
) fortable-cell
to conditionally render cell content based on the cell's data - Changed the
when
andwhenData
options to behave as regular options for thetable-cell
view:- Previously,
when
canceled column rendering; nowcolWhen
should be used instead - Previously,
whenData
canceled cell content rendering; nowcontentWhen
(thetable-cell
option) should be used instead
- Previously,
- Added the
- Changed rendering of arrays when it's a row value, to render as other non-object values using
1.0.0-beta.84
- Added TypeScript typings for core functionality
- Introduced the
Model
class as a base forWidget
andApp
:- Added a new
setup
option for configuring model-related aspects during initialization (immutable during the lifecycle), such as object markers, additional query methods, etc. - Implements
loadDataFrom*
methods, so all the classes able to load data now
- Added a new
- Added handling of empty payload on data loading (raise an error "Empty payload")
- Added
props
options for a view definition, a function (or a string as a jora query)(data, { props, context}) => any
which should return a normalized props - Added additional block into inspector popup to display normalized props when
view.options.props
is specified - Added
overrideProps(obj)
jora helper method which overrides object's values (current) with values from passedobj
(#.props
by default) - Changed
getReadableStreamFromSource()
util function to use aBlob
to produce aReadableStream
from a value - Changed
loadDataFrom*()
functions to return{ state, dataset }
object instead of{ state, result }
(renamedresult
intodataset
) - Modified the
link
,text
,text-numeric
andtext-match
views to allow all render props to be passed via config, in addition to data - Tweaked the
source
view to display tabs as 4 spaces (tab-size: 4
) - Added
onClick
option forbadge
views - Removed
hint
option forbadge
views, usetooltip
option instead - Removed fallback methods for obtaining a
ReadableStream
from aBlob
- Fixed resolving a value for main content for
badge
views - Fixed crashing the entire render tree on an exception in a
data
query; now, crashes are isolated to the affected view - Fixed discovery page main content styling
- Bumped jora to 1.0.0-beta.12
1.0.0-beta.83 Introducing encodings
- Added
encodings
option forApp
,Widget
(has no effect for now), preloader (vialoadDataOptions
) and Loading Data API (see Encodings)
1.0.0-beta.82
- Rebranded the "report page" as the "discovery page"
- Changed text on button
Make report
→Discover
- Changed page slug
report
→discovery
- Added redirect for locations
#report...
→#discovery...
, useWidget.options.intoreportToDiscoveryRedirect
to disable it Widget#reportPageId
→Widget#discoveryPageId
, with defaultdiscovery
instead ofreport
Widget.options.reportPageId
→Widget.options.discoveryPageId
navButtons.reportPage
→navButtons.discoveryPage
, button'sname
changed intodiscovery-page
- CSS classes:
.report-*
→.discovery-*
.discovery-editor
→.discovery-view-editor
- Changed text on button
- Added
positionMode
option forpopup
view. When set to "natural", the popup attempts to position itself at the bottom right side if dimensions allow, instead of positioning towards the larger available space by default (value "safe" for the option) - Added
pointerOffsetX
andpointerOffsetY
options forpopup
view andview.tooltip
- Enabled
positionMode: natural
for tooltips by default, can be changed via tooltip options - Exposed type checking helpers
isArray()
,isSet()
andisRegExp()
- Fixed
badge
view options when it receives an array as data - Fixed
struct
view annotation styling to avoid treatinghref
values as links when they are falsy - Fixed a sticky tooltip for "Enable view inspection" button on inspecting start
- Fixed the delayed popup display after calling the
hide()
method - Fixed positioning of popups with
position: pointer
- Fixed animation of the inspector's details popup when transitioning into full-screen mode