Skip to content

Releases: discoveryjs/discovery

1.0.0-beta.92

19 Dec 01:57
Compare
Choose a tag to compare
  • Fixed missed render on unloadData event when modelfree extension is used
  • Added visual guide lines for expanded objects in signature view, similar to struct view
  • Added actionCopySource option to source 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 set target="_blank" for links when the href attribute contains an interpolated value
  • Added propagation of meaningful source view props into nested views rendering (action buttons, prelude, and postlude) through the context as sourceViewProps
  • Standardized monospace font size and line height in struct, signature and source 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 or Ctrl+Click in inspect mode to open hovered view page in view's showcase
  • Added computeClassName() and applyComputedClassName() 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 as pageAnchor. Previously, !anchor was included in pageParams, now it’s a separate value with its own property and event on the ViewModel instance
    • Updated pageStateChange event to no longer fire when !anchor in the page hash changes, meaning ViewModel will not initiate a render on !anchor hash parameter changes
    • Removed !anchor from ViewModel#pageParams
    • Added ViewModel#pageAnchor to store the page’s anchor value (!anchor) or null
    • Added pageAnchorChange event for ViewModel, which fires when pageAnchor changes
    • Changed Model#encodePageHash() to accept pageAnchor as the 4th parameter
    • Changed Model#decodePageHash() to return pageAnchor
    • Changed ViewModel#setPage() and ViewModel#setParams() to reset the anchor (pageAnchor) since pageParams can hold !anchor anymore
    • Added ViewModel#setPageHashState(pageState, replace) and ViewModel#setPageHashStateWithAnchor(pageStateWithAnchor, replace) methods
    • Added ViewModel#overridePageHashState(pageState, replace) and ViewModel#overridePageHashStateWithAnchor(pageStateWithAnchor, replace) methods
    • Added ViewModel#getPageHashState() and ViewModel#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 to null) 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 current pageAnchor to rendered page content
    • Updated the pageLink() jora query helper to accept a pageAnchor parameter
    • Embed API changes:
      • Added EmbedApp#setPageHashState() and EmbedApp#setPageHashStateWithAnchor() methods
      • Added EmbedApp#setPageAnchor() method
      • Added EmbedApp#pageAnchor observer
  • Changes in table view:
    • Added headerClassName option in col config which behaves the same way as className 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
  • Changes in input view:
    • Added htmlStep option
    • Added props normalization
    • Changed value option to no longer be interpreted as a query
  • Reworked color scheme API (darkmode) for simplicity and alignment with recent CSS updates and the Embed API:
    • Renamed DarkModeController class to ColorScheme
    • Renamed ViewModel options darkmode and darkmodePersistent to colorScheme and colorSchemePersistent (old options are still supported as fallbacks with a warning if the new options are not specified)
    • Renamed ViewModel#darkmode to ViewModel#colorScheme
    • Renamed navbuttons.darkmodeToggle to navbuttons.colorSchemeToggle
    • Changed ColorScheme#value from boolean to 'light' or 'dark'
    • Changed ColorScheme#mode values to 'auto', 'manual' and 'only'
    • Changed ColorScheme#persistent to store a boolean, indicating whether ColorScheme 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
  • Reworked persistent API:
    • Renamed localStorageEntry() to getLocalStorageEntry()
    • Renamed sessionStorageEntry() to getSessionStorageEntry()
    • Added getLocalStorageValue(key) and getSessionStorageValue(key) methods to read values directly from storage; these methods return null if no entry exists for the specified key or if the storage is unavailable
    • Changed storage entry to be an instance of PersistentStorageEntry class derived from Observer

1.0.0-beta.91

25 Nov 02:59
Compare
Choose a tag to compare
  • Changes related to Model#context:
    • Added context to Model 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 if replace is true
    • Added context event to Model, with prevContext and nextContext parameters, triggered when the context changes
    • Changed Model#context to be an accessor property, where the setter calls Model#setContext(value, true)
    • Changed ViewModel#setData() to no longer accept a context argument or change the context
    • Changed ViewModel#setDataProgress() to no longer change the context, despite accepting context argument
    • Updated ViewModel to trigger a render when the context event is fired
  • Added Model#legacyPrepare readonly property to indicate whether the legacy prepare method is used or the new setup() method
  • Updated struct view to define the setStructViewAnnotations action when using the new setup() method, allowing custom annotations to be specified across all struct views
  • Updated embed option of App 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 handling notification 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 use setTimeout() instead of Promise.resolve() to ensure proper processing of event loop tasks, eliminating unnecessary renders
  • Changed ViewModel initialization to minimize unnecessary renders
  • Marked ViewModel#renderPage(), ViewModel#renderSidebar(), and ViewModel#renderPage() as private methods, as they are not intended for direct invocation anymore
  • Fixed ViewModel#setPageParams() to normalize the hash by ensuring it starts with #, preventing unnecessary events; for example, passing #page and page into the method will now consistently result in #page being stored in ViewModel#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 a Logger instance
    • Removed Model#logLevel, use Model#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 of Model#log('level', ...args)
      • Use Model#logger[level].group(message, fn | array) or Model#logger[level].groupCollapsed(message, fn | array) instead of Model#logger({ level, message, collapsed: fn | array })

1.0.0-beta.90

15 Nov 04:43
Compare
Choose a tag to compare
  • Added @discoveryjs/discovery/embed export
  • Changed applyContainerStyles() to take a single darkmode 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 take source, syntax, lineNum, refs and maxSourceSizeToHighlight options. It attempts to derive these values from data when options are not explicitly provided for backward compatibility. The source can be derived from data as content (for backward compatibility) or source property
  • Removed mime, binary and size data options for source view
  • Bumped marked to ^14.1.4 (used in markdown view)
  • Added styles for <kbd> in markdown 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

04 Nov 17:49
Compare
Choose a tag to compare
  • Renamed Widget class into ViewModel
  • Added pageStateChange event to ViewModel, triggered when pageId, pageRef, or pageParams changes
  • Added query property to functions produced from a string (jora query), i.e. with Model#queryFn(query)
  • Added clipboard option to the upload extension for enabling loading data from the clipboard
  • Added support for uploading files from paste event
  • Added unloadData nav button
  • Renamed loadData nav button into uploadFile
  • Changed Model#unloadData() method to not reset context
  • Added app-header view
  • Model's info:
    • Added name, version, description, and icon options for Model, storing these values in the info property
    • Added model property to a render context (result of ViewModel#getRenderContext()) reflecting info value
    • Added --discovery-app-icon CSS custom property which contains value of model's icon
  • Added @discoveryjs/discovery/utils export
  • Changed the extension application order for App so that options.extensions are applied after implicit extensions
  • Changed nav-button view to align with button view (text, href and external as config options, disabled is no longer treated as query)
  • Modified PageRenderer#define() and ViewRenderer#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

24 Oct 21:40
Compare
Choose a tag to compare
  • Added context option for all views, which executes before data and replaces the input context value with its result
  • Added rows option for table view to specify data for rows, with data being used by default if rows is not specified
  • Added detailsWhen option for table cells to explicitly control the activation of details
  • Changed button view to take text, href and external options; it attempts to derive these values from data when options are not explicitly provided for backward compatibility
  • Changed button view so that disabled 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 due switch is reserved word and can't be an identifier

1.0.0-beta.87

16 Oct 03:06
Compare
Choose a tag to compare
  • 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 in initDom()
    • App:
      • Removed adding of .init class to the overlay during the initialization phase
    • 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
  • 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 return null for pageRef instead of undefined
  • Fixed Widget#setPageHash() to always emit hashChanged when hash changes, disregarding changes of pageId, pageRef and pageParams
  • 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 incorrect optional 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

28 Sep 02:21
Compare
Choose a tag to compare
  • Added setWorkTitle method to the prepare context API to display additional text on the progress bar:
    export function async prepare(input, { setWorkTitle }) {
        await setWorkTitle('phase 1');
        // ...
        await setWorkTitle('phase 2');
        // ...
    }
    When used, it could look like the following:
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 parameter step
    • Modified logic for await repainting
    • Added awaitRepaintPenaltyTime property to indicate time spending on awaiting for repaint
    • Changed onFinish callback to add awaitRepaintPenaltyTime to timings array
    • Added decoding stage
    • Renamed receive stage into receiving
    • Removed lastStage as it redundant, use value.stage instead
  • Changes in data loading:
    • Added decoding stage for load state
    • Renamed receive stage into receiving for load state
    • Added loadingTime and decodingTime into dataset timings
  • 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

15 Sep 20:23
Compare
Choose a tag to compare
  • 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 the struct's data (root value), then specific actions like querySubquery and queryAppend are checked for existence. If they exist, the relevant actions are added to the actions menu. These actions should take a path and struct view data and make relevant changes to the query that the current struct view instance is based on. The discovery page provides such actions in the context, so any struct 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 the discovery page a new node in the query graph with the selected path.
    • "Append path to current query" – calls the queryAppend action, which appends on the discovery page the selected path to the current query in the query editor.
  • 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 into valueCol
    • Tweaked styles to dim the display of true, false, null, NaN, and Infinity values to differentiate them from strings and numbers
    • Changed in the cols configuration:
      • Added the colWhen option (like when or whenData) for the table view to conditionally render columns based on the table's data
      • Added the contentWhen option (like when or whenData) for table-cell to conditionally render cell content based on the cell's data
      • Changed the when and whenData options to behave as regular options for the table-cell view:
        • Previously, when canceled column rendering; now colWhen should be used instead
        • Previously, whenData canceled cell content rendering; now contentWhen (the table-cell option) should be used instead

1.0.0-beta.84

05 Sep 14:47
Compare
Choose a tag to compare
  • Added TypeScript typings for core functionality
  • Introduced the Model class as a base for Widget and App:
    • 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 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 passed obj (#.props by default)
  • Changed getReadableStreamFromSource() util function to use a Blob to produce a ReadableStream from a value
  • Changed loadDataFrom*() functions to return { state, dataset } object instead of { state, result } (renamed result into dataset)
  • Modified the link, text, text-numeric and text-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 for badge views
  • Removed hint option for badge views, use tooltip option instead
  • Removed fallback methods for obtaining a ReadableStream from a Blob
  • 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

04 Apr 02:33
Compare
Choose a tag to compare
  • Added encodings option for App, Widget (has no effect for now), preloader (via loadDataOptions) and Loading Data API (see Encodings)