@hypothesis/frontend-shared
Version:
Shared components, styles and utilities for Hypothesis projects
51 lines (47 loc) • 1.59 kB
JavaScript
var _jsxFileName = "/home/runner/work/frontend-shared/frontend-shared/src/pattern-library/index.js";
// Entry point for extending the pattern library
import { render } from 'preact'; // Enable preact debug checks
import 'preact/debug';
import { registerIcons } from '../';
import iconSet from './icons';
import PlaygroundApp from './components/PlaygroundApp';
/**
* @typedef {import("./components/PlaygroundApp").PlaygroundRoute} PlaygroundRoute
*/
/**
* @typedef PatternLibraryAppOptions
* @prop {string} [baseURL] - The path relative to web root where the pattern
* library is served. Defaults to `/ui-playground`.
* @prop {PlaygroundRoute[]} [extraRoutes] - Local-/application-specific routes
* to add to this pattern library in addition to the shared/common routes
* @prop {Record<string, string>} [icons] - Icons, additional to default pattern-library icons,
* to register for use in patterns/components in the pattern library
*/
/**
* Render the pattern-library preact container
*
* @param {PatternLibraryAppOptions} options
*/
import { jsxDEV as _jsxDEV } from "preact/jsx-dev-runtime";
export function startApp({
baseURL = '',
extraRoutes = [],
icons = {}
} = {}) {
const allIcons = { ...iconSet,
...icons
};
registerIcons(allIcons);
const container = document.querySelector('#app');
render(_jsxDEV(PlaygroundApp, {
baseURL: baseURL,
extraRoutes: extraRoutes
}, void 0, false, {
fileName: _jsxFileName,
lineNumber: 35,
columnNumber: 5
}, this),
/** @type Element */
container);
}
//# sourceMappingURL=index.js.map