npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@agility/web-studio-sdk

v1.0.22

Published

Standard Development Kit used to enable Web Studio features in Agility CMS

Downloads

2,356

Readme

Web Studio SDK

This is the official JavaScript/TypeScript SDK for Agility CMS's Web Studio.

Don't have an Agility CMS instance? Sign up for Free Trial today!

Features

  • Enable your website/app to use the new Web Studio features.
  • Add the ability to collaborate and comment directly on your website/app.
  • Empower your editors to preview content changes in real-time.

Getting Started

You'll need to have an Agility CMS instance to use this SDK. If you don't have one, you can sign up for a Free Trial today!

Once you have an Agility CMS Instance you will need to install the sdk from npm and add a script tag in your website.

<script src="https://unpkg.com/@agility/web-studio-sdk@latest/dist/index.js"></script>

You can stop there if you'd like. But to get the most of the SDK, you'll need to decorate your components, fields, and pages with the data-agility-* attributes. This will allow the SDK to interact with your website/app, and enable real-time editing. You'll also need to add your guid as a data-agility-guid attribute to the root element of your website/app.

<!DOCTYPE html>
<html lang="en" data-agility-guid="YOUR_GUID">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div data-agility-page="YOUR_PAGE_ID">
      <header data-agility-component="YOUR_CONTENT_ID">
        <h1 data-agility-field="title">{{fields.title}}</h1>
        <p data-agility-field="content">{{field.content}}</p>
      </header>
    </div>
  </body>
</html>

Decorating Your Code

The SDK uses the data-agility-\* attributes to interact with your website/app. Here are the attributes you can use:

  • data-agility-guid: This is the guid of your website/app. You can find this in the settings of your website in Agility CMS. The SDK uses this to know which instance your website/app is associated with.

    • Example:
    <html lang="en" data-agility-guid="YOUR_GUID"></html>
  • data-agility-previewbar: This is a boolean attribute that tells the SDK this is the preview bar element, and allows us to hide it using tailwind class. The SDK uses this to know that element should be hidden.

    • Example:
    <div
      className="bg-agility relative px-8 text-gray-200"
      data-agility-previewbar
    >
      // your preview bar content
    </div>
  • data-agility-page: This is the id of the page in Agility CMS. The SDK uses this to know which page is being interacted with, so we can track navigations and other page-specific events in Web Studio.

    • Example:
    <body>
      <main data-agility-page="YOUR_PAGE_ID"></main>
    </body>
  • data-agility-dynamic-content: This is the content id of the dynamic content in Agility CMS. The SDK uses this to know which dynamic content is being interacted with, so we can track dynamic-content specific events in Web Studio, allowing us to keep navigation and other information in sync.

    • Example:
    <div data-agility-dynamic-content="YOUR_DYNAMIC_CONTENT_ID"></div>
  • data-agility-component: This is the id of the component in Agility CMS. The SDK uses this to know which component is being interacted with, so we can track component-specific events in Web Studio and enable real-time editing.

    • Example:
    <header data-agility-component="YOUR_COMPONENT_ID"></header>
  • data-agility-field: This is the name of the field in Agility CMS. The SDK uses this to know which field is being interacted with, so we can track field-specific events in Web Studio and enable real-time editing of their content.

    • Example:
    <h1 data-agility-field="title">{{fields.title}}</h1>
  • data-agility-html: This is a boolean attribute that tells the SDK to treat the element as an HTML field. The SDK uses this to know that the field is an HTML field, so we can enable rich-text editing in Web Studio.

    • Example:
    <div data-agility-field="blog-content" data-agility-html>
      {{fields.blog-content}}
    </div>

Installation

npm

npm install @agility/web-studio-sdk

yarn

yarn add @agility/web-studio-sdk

Running This Project Locally

You will need to have an Agility CMS instance and a website that you can also run locally. In the root of your site, add the following script tag

<script src="http://127.0.0.1:8080/index.js"></script>
  1. Clone this repository

  2. Run npm install

  3. Run npm run dev

  4. On the Sitemaps page in Agility CMS, add a preview deployment that points at where your website is running locally, usually http://localhost:3000.

  5. Go to the Pages module in Agility CMS and click on the "Preview" button to see Web Studio in action.

Also here is a handy Regex that's useful for debugging frame events in the chrome dev tools console:

/^Web Studio (SDK|CMS)/

Resources

For docs & help around Agility CMS, please see Agility CMS Documentation

Tutorials

Contributing

If you would like to contribute to this SDK, you can fork the repository and submit a pull request. We'd love to include your updates.