Releases: discoveryjs/discovery
Releases · discoveryjs/discovery
1.0.0-beta.92
- Fixed missed render on
unloadData
event whenmodelfree
extension is used - Added visual guide lines for expanded objects in
signature
view, similar tostruct
view - Added
actionCopySource
option tosource
view to customise behaviour of "copy to clipboard" button - Fixed rendering of "copy to clipboard" button in
source
view when a string is passed as data - Fixed
markdown
views to correctly settarget="_blank"
for links when thehref
attribute contains an interpolated value - Added propagation of meaningful
source
view props into nested views rendering (action buttons, prelude, and postlude) through the context assourceViewProps
- Standardized monospace font size and line height in
struct
,signature
andsource
views to relay on root settings - Added suggestions toggle in query editor on "discovery" page
- Added view editor visibility toggle when in "custom" mode on "discovery" page
- Added
Cmd+Click
orCtrl+Click
in inspect mode to open hovered view page in view's showcase - Added
computeClassName()
andapplyComputedClassName()
methods to view render context API - Added root CSS properties:
--discovery-monospace-font-size
and--discovery-monospace-line-height
- Changes in page hash state API:
- Changed processing of page parameters so
!anchor
is now treated aspageAnchor
. Previously,!anchor
was included inpageParams
, now it’s a separate value with its own property and event on theViewModel
instance - Updated
pageStateChange
event to no longer fire when!anchor
in the page hash changes, meaningViewModel
will not initiate a render on!anchor
hash parameter changes - Removed
!anchor
fromViewModel#pageParams
- Added
ViewModel#pageAnchor
to store the page’s anchor value (!anchor
) ornull
- Added
pageAnchorChange
event forViewModel
, which fires whenpageAnchor
changes - Changed
Model#encodePageHash()
to acceptpageAnchor
as the 4th parameter - Changed
Model#decodePageHash()
to returnpageAnchor
- Changed
ViewModel#setPage()
andViewModel#setParams()
to reset the anchor (pageAnchor
) sincepageParams
can hold!anchor
anymore - Added
ViewModel#setPageHashState(pageState, replace)
andViewModel#setPageHashStateWithAnchor(pageStateWithAnchor, replace)
methods - Added
ViewModel#overridePageHashState(pageState, replace)
andViewModel#overridePageHashStateWithAnchor(pageStateWithAnchor, replace)
methods - Added
ViewModel#getPageHashState()
andViewModel#getPageHashStateWithAnchor()
methods - Extended
ViewModel#setPageHash()
to transform hashes starting with#!
(e.g.#!{value}
) into#{current-hash}&!anchor={value}
. Note that a#!
hash will reset the anchor (set tonull
) but keep other values intact. This change doesn’t conflict with existing logic since a valid encoded anchor uses#&!anchor=...
- Added
ViewModel#applyPageAnchor()
method to apply currentpageAnchor
to rendered page content - Updated the
pageLink()
jora query helper to accept apageAnchor
parameter - Embed API changes:
- Added
EmbedApp#setPageHashState()
andEmbedApp#setPageHashStateWithAnchor()
methods - Added
EmbedApp#setPageAnchor()
method - Added
EmbedApp#pageAnchor
observer
- Added
- Changed processing of page parameters so
- Changes in
table
view:- Added
headerClassName
option in col config which behaves the same way asclassName
but applies to header cell - Added
view-table-header-cell
class to header cell elements - Fixed detail cells to toggle their state when clicked anywhere within the cell, including nested elements, unless the click event's propagation is stopped
- Added
- Changes in
input
view:- Added
htmlStep
option - Added props normalization
- Changed
value
option to no longer be interpreted as a query
- Added
- Reworked color scheme API (
darkmode
) for simplicity and alignment with recent CSS updates and the Embed API:- Renamed
DarkModeController
class toColorScheme
- Renamed
ViewModel
optionsdarkmode
anddarkmodePersistent
tocolorScheme
andcolorSchemePersistent
(old options are still supported as fallbacks with a warning if the new options are not specified) - Renamed
ViewModel#darkmode
toViewModel#colorScheme
- Renamed
navbuttons.darkmodeToggle
tonavbuttons.colorSchemeToggle
- Changed
ColorScheme#value
fromboolean
to'light'
or'dark'
- Changed
ColorScheme#mode
values to'auto'
,'manual'
and'only'
- Changed
ColorScheme#persistent
to store a boolean, indicating whetherColorScheme
is backed by a persistent store - Added
ColorScheme#state
with possible values:'auto'
,'light'
,'light-only'
,'dark'
and'dark-only'
- Changed change handler signature from
(value: boolean, mode: Mode) => void
to(value: ColorSchemeValue, mode: ColorSchemeState) => void
- Aligned Embed API with the changes
- Renamed
- Reworked persistent API:
- Renamed
localStorageEntry()
togetLocalStorageEntry()
- Renamed
sessionStorageEntry()
togetSessionStorageEntry()
- Added
getLocalStorageValue(key)
andgetSessionStorageValue(key)
methods to read values directly from storage; these methods returnnull
if no entry exists for the specifiedkey
or if the storage is unavailable - Changed storage entry to be an instance of
PersistentStorageEntry
class derived fromObserver
- Renamed
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)