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

@progress/sitefinity-nextjs-sdk

v15.2.8400

Published

Provides OOB widgets developed using the Next.js framework, which includes an abstraction layer for Sitefinity communication. Additionally, it offers an expanded API, typings, and tools for further development and integration.

Downloads

1,366

Readme

Sitefinity Next.js SDK

Provides OOB widgets developed using the Next.js framework, which includes an abstraction layer for Sitefinity communication. Additionally, it offers an expanded API, typings, and tools for further development and integration.

Getting started

Install via npm:

npm i @progress/sitefinity-nextjs-sdk --save

Via yarn:

yarn add @progress/sitefinity-nextjs-sdk

You can get started using it with our starter template in the follwing NextJS samples repo. It provides the needed integration for communicating with a Sitefinity server, setup documentation, and the basic boiler plate for getting started.

Contents

Main

The root module contains mainly tooling and interfaces related to widget rendering, models, metadata, renderer contracts.

Custom widgets

Creating and declaring custom widgets should adhere to the following convention. Widgets should be registered in a WidgetRegistry by WidgetMetadata, which consists of:

  • componentType - reference to the component function
  • metadata, describing the properties of the widget:
  • editorMetadata? - implementing the interface EditorMetadata, providing information to the editor about widget category, name, and other visual and operational data
  • ssr? - indicating whether the widget should be server-side rendered or not
  • views? - Used to make custom views/detail views for a widget.

For more information and samples visit our NextJS samples repo.

Required html attributes

To ensure the WYSIWYG page and form editor functions correctly, it is necessary to include certain custom HTML attributes when viewing the markup in edit mode. The htmlAttributes is designed to address this requirement comprehensively. Additionally, the classNames helper is provided to facilitate the accumulation of custom CSS classes.

import { htmlAttributes, classNames } from '@progress/sitefinity-nextjs-sdk';

export function CustomWidget(props: WidgetContext<CustomWidgetEntity>) {
    const dataAttributes = htmlAttributes(props);
    const customCssClasses = classNames('someClassNames');
    dataAttributes['className'] = customCssClasses;

    return (
        <div {...dataAttributes}>
            custom widget content
        </div>
    );
}

Widget children content holder

To define an area in your custom widget template where children widgets could be added, to the HTML element that would hold them should have the data-sfcontainer attribute set.

The WYSIWYG editor will diplay on that spot the option to add a widget. If you want to have the ability to add widgets to your manually designated places and hide the default empty widget "add widget" placeholder, you can use the setHideEmptyVisual function to modify the dataAttributes.

import { htmlAttributes, setHideEmptyVisual } from '@progress/sitefinity-nextjs-sdk';

function CustomWidget(props: WidgetContext<CustomWidgetEntity>) {
    const dataAttributes = htmlAttributes(props);
    setHideEmptyVisual(dataAttributes, true); // this would hide the default empty visual

    return (
        <div {...dataAttributes}>
            ...
            <div id='childrenHolder' data-sfcontainer='containerId'>
            </div>
        </div>
    )
}

Rest SDK

import { RestClient } from '@progress/sitefinity-nextjs-sdk/rest-sdk';

Provides a way to communicate with Sitefinity's REST API for the majority of the necessary operations and data queries. The entry static class RestClient is part of the @progress/sitefinity-nextjs-sdk/rest-sdk module.

Widgets

import * from '@progress/sitefinity-nextjs-sdk/widgets';
import * from '@progress/sitefinity-nextjs-sdk/widgets/forms';

These modules contain the following OOB basic widgets:

  • Breadcrumb
  • Call to action
  • Classification
  • Content list
  • Content block
  • Document list
  • Forms
    • Form
    • Checkboxes
    • Content block
    • Dropdown
    • Dynamic list
    • File upload
    • Multiple choice
    • Paragraph
    • Section
    • Submit button
    • Text field
  • Image
  • Language selector
  • Navigation
  • Search
    • Search box
    • Search results
    • Search facets
  • Section
  • User management
    • Login form
    • Change password
    • Registration
    • Reset password
  • Language selector

Styling

import { StyleGenerator } from '@progress/sitefinity-nextjs-sdk/widgets/styling';

Provides styling helper methods and interfaces that we provide mainly in the StyleGenerator class.

Code reference

For the exact implementation of the widgets and tooling, plese refer to the public NextJS sdk read-only repo