Skip to content

Releases: discoveryjs/discovery

1.0.0-beta.99

19 Aug 12:26

Choose a tag to compare

  • Updated JSONXL:
    • Fixed an edge case for signed numbers in the range ±[MAX_SAFE_INTEGER/2 … MAX_SAFE_INTEGER].
    • Removed the limitation that could trigger when the total encoded string length exceeded the maximum string length (~500 MB in V8)

1.0.0-beta.98

02 Jul 23:52

Choose a tag to compare

Highlights

Enhanced computation graph on the Discovery page:

image

Preview for image-like content strings in the struct view, with new Jora methods and assertions to work with such values:

Preview for image-like content strings in the `struct` view

New Jora methods for JSON, and first-class support for errors:

New Jora methods for JSON, and first-class support for errors

First-in-class diff view – text-diff:

First-in-class diff view: text-diff

All the changes

  • Bumped jora to 1.0.0-beta.15
  • Added addQueryMethods() and addQueryAssertions() methods for setup and prepare API
  • Deprecated addQueryHelpers(), use addQueryMethods() instead
  • Enhancements for value types:
    • JSON:
      • Added jsonSafeParse() and jsonSafeStringify() utility functions, which behave like JSON.parse() and JSON.stringify() but return an error instead of throwing an exception
      • Added experimental Jora query methods: jsonParse(), jsonStringify(), and jsonInfo() (the latter based on stringifyInfo() from json-ext)
    • Errors:
      • Added isError() utility function, serving as an alias for Error.isError() with a fallback if unavailable
      • Added error Jora assertion, based on isError(), enabling support for expr is error in queries
      • Added support for displaying error values (where isError() returns true) in struct view
    • Images:
      • Added utility functions:
        • isImageContent() returns true if value is image-like content strings, e.g. base64-encoded raw content (JPEG, PNG, SVG, GIF or ICO) or SVG-like string, which can be prefixed with image/* or data:image/*
        • getImageContent() returns { type, content } for image-like content strings, or null
        • isImageDataUri() returns true if value is a string starting with data:image/*,
        • getImageDataUri() produces an image data URI string from a image-like content strings if possible, or returns undefined otherwise
        • isImageSrc() return true if value is a path or an URL, including image data URI
        • getImageSrc() returns value itself if it's already an image-like src, or attempts produce a data URI from image-like content strings, or return undefined otherwise
      • Added utility functions:
        • isImageContent() returns true if the value is an image-like content string, e.g. base64-encoded raw content (JPEG, PNG, SVG, GIF, ICO) or an SVG-like string, optionally prefixed with image/* or data:image/*
        • getImageContent() returns { type, content } for image-like content strings, or null if not applicable
        • isImageDataUri() returns true if the value is a string starting with data:image/*,
        • getImageDataUri() produces an image data URI string from image-like content strings if possible, or returns undefined otherwise
        • isImageSrc() returns true if the value is a path or URL, including an image data URI
        • getImageSrc() returns the value itself if it is already an image-like src, or attempts to produce a data URI from image-like content strings; returns undefined otherwise
      • Added Jora query assertions based on utilities above: imagecontent, imagedatauri and imagesrc, e.g. expr is imagedatauri
      • Added Jora query methods: imagecontent(), imagedatauri() and imagesrc()
      • Changed image view:
        • When src is not explicitly specified in the config and the input data is a string, the data value is processed through imagesrc() and used as the src
        • Config entries with a value of undefined are ignored
      • Added a default image-like content string detection annotation in the struct view: when a string value is identified as image-like content, a badge image is displayed before the string, showing an image preview on hover
  • Added text-diff view
  • Added support for diff syntax in source view
  • Added hideOnTriggerClick option for popup and tooltip views
  • Reworked the computation graph on the discovery page and related features:
    • Enhanced the look and feel of the graph
    • Improved layout handling for complex graphs
    • Added labels to graph nodes, showing a fragment of the node's query or the content of a comment on the first line if it starts with //!
    • Added a "new root query" button
    • Removed the graph path query stack view above the query editor
    • Changed the "clone" and "stash" current query actions to insert a new node immediately after the current node
    • Fixed overriding of the parent node’s view config on graph node deletion
    • Fixed premature cancellation of a computing node when switching the current node during path computation if the node is part of the new extended path
    • Fixed "Copy page as JSON" action to include the graph
    • Various minor improvements and fixes
  • Changed table view to hide footer if no footer cells contain any content
  • Fixed table view footer rendering when cell rendering is disabled using the when option
  • Fixed table view to render the footer after the body. Although this change does not affect the visual presentation, it ensures proper selection of table content
  • Fixed an exception in source view when prefix or postfix is neither undefined nor a string
  • Fixed expand view to ensure expanded property is boolean
  • Fixed tooltip display with delayed showing by preventing it from appearing if the trigger element has been removed from the document

1.0.0-beta.97

27 Apr 23:47

Choose a tag to compare

  • Updates for table view:
    • Added table-header and table-footer views
    • Added table-header-cell view
    • Updates for cols option:
      • Added align option for cells and footer
      • Extended header to accept a config object beside a string as a header cell text, including a query string, i.e. header: '=expr ? "foo" : "bar"'
      • Removed headerClassName option, use header: { className } instead
  • Added a second parameter to onToggle callback calls in expand view, providing an object { el, finish, data, context }
  • Extended limit option for supported web views to accept an object with optional properties: { start, startTolerance, base, tolerance }
  • Fixed blockquote kind detection in markdown view

1.0.0-beta.96

21 Apr 11:50

Choose a tag to compare

  • Fixed the "Show the rest" button on lists to correctly render all remaining elements, instead of just the next N. This regression was introduced in v1.0.0-beta.95
  • Added ViewModel#view.renderError(container, reason, config) method to render an error badge
  • Added headerWhen and footerWhen options for table view to conditionally disable the rendering of the header and footer, respectively
  • Improved table view footer rendering to handle and display errors that occur during cell rendering, instead of silently failing with no output
  • Added footer option for cols in text-based table view
  • Added headerWhen and footerWhen options for text-based table view
  • Improved performace for long list rendering with ViewModel#view.renderList() method
  • Updated the ViewModel#view.renderList() method to accept the limit as a separate argument outside of the options object:
    renderList(container, itemConfig, data, context, offset, limit, options)

1.0.0-beta.95 Introducing gzip/deflate support for input data

16 Apr 13:45

Choose a tag to compare

  • Added built-in support for loading gzip and deflate encoded data. Encoding is detected by inspecting the payload header, enabling automatic decoding prior to standard data decoding or parsing.
  • Added compression field in DatasetResource object
  • Added useAcceptForFilePicker option to upload extension, defaulting to false. Discovery.js supports a wide range of data formats and encodings, relying on file content rather than extensions. Since many supported files have extensions not effectively handled by the accept attribute (due to its limited flexibility and inability to inspect file content) using accept often causes more issues than it solves, and is now disabled by default.
  • Added support for footer option in cols definition of table view (see Setup footer cell display)
  • Fixed displaying object values in the value column of table view, it was unexpandable (no details) since refactoring in 1.0.0-beta.85
  • Fixed sidebar re-rendering on page state changes
  • Added debouce option for content-filter view (#108)
  • Extended ViewModel#view.renderList() method to take options renderList(container, itemConfig, data, context, offset, options), options is:
    type RenderListOptions = {
        limit: number | false;
        moreContainer: HTMLElement;
        onSliceRender: (restCount: number, offset: number, limit: number, totalCount: number) => void
    }

1.0.0-beta.94 Introducing text rendering

21 Mar 03:48

Choose a tag to compare

Introducing text rendering

  • Implemented experimental text-based rendering
    • Added Model#textView dictionary which works the same way as ViewModel#view, but manage text views
    • Added initial set of text views, including various blocks, lists, table and source
    • Added text-render view, which renders text content defined by content option
    • Added textViews export, which provides a list of default text views
    • Added Text render button into view presets of view editor on Discovery page
    • Added a section for demostration of text views on Views showcase page
  • Added blockquote view with a kind option supporting note, tip, important, warning, and caution.
  • Added support for alerts (a GitHub's Markdown extension based on the blockquote syntax) in markdown view
  • Added Model#getContext() method
  • Changed views to no longer treat some properties as a query:
    • checked in checkbox view
    • expanded in expand view
    • disabled in tab view
    • tabs in tabs view
  • Changed views to normalize props for render: checkbox, expand, tabs and tab
  • Fixed an issue in the button view with href in embed mode, ensuring clicks are correctly intercepted so the app state updates as expected
  • Removed ViewModel#queryToConfig() method

1.0.0-beta.93

06 Feb 22:37

Choose a tag to compare

  • Added navbuttons.uploadFromClipboard button
  • Added marks option for source view, which allows injecting visual or text marks at specific points in the source text
  • Renamed the refs option in the source view to ranges
  • Updated the type field of entries in the ranges option (previously refs) to be optional. If the href field is specified, the type value defaults to link; otherwise, it defaults to span instead of spotlight. The spotlight type is now replaced by span
  • Fixed default copy text button action in source view
  • Changed struct view to avoid auto expading numeric arrays

1.0.0-beta.92

19 Dec 01:57

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

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

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