Skip to content

Releases: pocka/figspec

v2.0.4

27 Feb 08:23
v2.0.4
59732e5
Compare
Choose a tag to compare

Changed

  • Documentation website is now hosted on GitHub Pages. No content changes.

v2.0.3

05 Jan 02:11
v2.0.3
d9dcd9a
Compare
Choose a tag to compare

Fixed

  • Set repository field in package.json. (#49)

v1.0.3

05 Jan 02:11
v1.0.3
9ad67a4
Compare
Choose a tag to compare

Fixed

  • Set repository field in package.json. (#49)

v2.0.2

12 Sep 13:16
v2.0.2
dbcf9fb
Compare
Choose a tag to compare

Fixed

v2.0.1

06 Sep 07:27
v2.0.1
c4d82cd
Compare
Choose a tag to compare

Fixed

  • FigspecFrameViewer does not have a link property.

v2.0.0

06 Sep 07:17
v2.0.0
af5cb99
Compare
Choose a tag to compare

Notable changes

The main focus of this release is rewrite to plain DOM architecture, to improve performance and make the package dependency-free. As a side-effect of the process, UI overhaul and CSS tidy-up has been made.

Efficient rendering

Prior to this version, Figspec has used Lit for rendering/state management. However, using Lit for this project became pain quickly performance-wise and architecture-wise.

The most painful point is the React-like "render the whole-tree every updates" approach. Even the updates to DOM is minimized, the cost of running render function is exceptionally high, especially large and/or complex files (#30).

Now, Figspec uses plain DOM operations (e.g. document.createElement, Node.prototype.insertBefore) for its UI and renderer, with a thin wrapper for element creation. For where reactive-update is necessary, Signal based update mechanism is used. Signal is essentially Observable but implicit and easier to use.

Although the performance is not good for large files due to browsers' SVG rendering capacity, I would say Figspec itself is sufficiently optimized. (I couldn't put performance measurement comparisons because I don't know how to reliably measure click-to-update performance. Duration for script running time is dramatically reduced as far as I could see)

Preferences is set by a user, not by a page author

Each components had been exposed panSpeed and zoomSpeed properties along with corresponding attributes. However, these are user preferences, not file/frame settings. Figspec v2 distinct preferences and settings.

  • Settings are set by a page author (who put <figspec-*-viewer> to the page).
  • Preferences are set by a user in UI inside Figspec.

Changes made to the preferences are notified via preferencesupdate events. It's the page author's responsibility to persist/restore user's preferences. Below is a sample code to persist user's preference to browser's local storage.

const figspec = document.getElementById("figspec_file");

const FIGSPEC_PREFERENCES_KEY = "figspec_preferences";

const savedPreferences = localStorage.getItem(FIGSPEC_PREFERENCES_KEY);
if (savedPreferences) {
  try {
    const pref = JSON.parse(savedPreferences);
    figspec.preferences = pref;
  } catch (error) {
    console.warn("Saved Figspec preference is not valid JSON data");
  }
}

figspec.addEventListener("preferencesupdate", ev => {
  localStorage.setItem(
    FIGSPEC_PREFERENCES_KEY,
    JSON.stringify(ev.detail.preferences)
  );
});

This version also brings additional preference field such as CSS length unit or color notation.

Customising / Theming

Whole CSS is rewritten to use CSS custom property extensibly. You can now customise almost all of UI colors and sizes via CSS custom properties. HTML docs also have new section listing available CSS custom properties.


CHANGELOG

Removed

  • nodes attribute and rendered-image attribute (<figspec-frame-viewer>).
  • document-node attribute and rendered-images attribute (<figspec-file-viewer>).
  • scalechange event and positionchange event.
  • panSpeed property and corresponding pan-speed attribute.
  • zoomSpeed property and corresponding zoom-speed attribute.
  • zoomMargin property and corresponding zoom-margin attribute.
  • CommonJS files. This package is now ESM only.

Changed

  • nodes property of FigspecFrameViewer has been renamed to apiResponse.
  • documentNode property of FigspecFileViewer has been renamed to apiResponse.
  • Footer link has been moved to info page.

Added

  • preferences property and preferencesupdate event.
  • Info page and preference page.
  • CSS code generation for text-transform, filter, and backdrop-filter properties.
  • Dark mode UI.
  • Display feedback UI when clipboard copy succeeded or failed.

Fixed

  • Inefficient rendering causes performance problems, notably on complex or large frames/files (#30 ).
  • TypeScript typing is now fully working without installing figma-js library.
  • Only the foreground color inherits value, causing the text unreadable when the page containing Figspec components set color to white or brighter color. Both foreground and background color is now explicitly set by Figspec components.
  • Some action UI elements (e.g. button) being not focusable. Every action UI elements are now focusable and :focus-visible style set.

v1.0.2

27 Jul 11:18
82bb7f4
Compare
Choose a tag to compare

Fixed

  • Guidelines are rendered at incorrect position (#31)
  • Guidelines are not rendered when hover over a node on Safari (#37)
  • Clicking a node does not open an inspector panel or select the node on Safari (#37)

react/v1.0.1

16 Apr 08:47
459b423
Compare
Choose a tag to compare

What's Changed

Full Changelog: react/v1.0.0...react/v1.0.1

components/v1.0.1

16 Apr 08:39
967c346
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: components/v1.0.0...components/v1.0.1

components/v0.1.9

26 May 20:06
6f276c5
Compare
Choose a tag to compare
components/v0.1.9 Pre-release
Pre-release

Fixed

  • Change the default background colour to the one of the Figma's (9547cdf, #24 )