@wordpress/interactivity
Version:
Package that provides a standard and simple way to handle the frontend interactivity of Gutenberg blocks.
79 lines (78 loc) • 1.83 kB
JavaScript
// packages/interactivity/src/index.ts
import { h, cloneElement, render } from "preact";
import { batch } from "@preact/signals";
import registerDirectives, { routerRegions } from "./directives";
import { init, getRegionRootFragment, initialVdom } from "./init";
import { toVdom } from "./vdom";
import { directive } from "./hooks";
import { getNamespace } from "./namespaces";
import { parseServerData, populateServerData } from "./store";
import { proxifyState } from "./proxies";
import { deepReadOnly, navigationSignal } from "./utils";
import {
store,
getConfig,
getServerState
} from "./store";
import { getContext, getServerContext, getElement } from "./scopes";
import {
withScope,
useWatch,
useInit,
useEffect,
useLayoutEffect,
useCallback,
useMemo,
splitTask,
withSyncEvent
} from "./utils";
import { useState, useRef } from "preact/hooks";
if (globalThis.SCRIPT_DEBUG) {
await import("preact/debug");
}
var requiredConsent = "I acknowledge that using private APIs means my theme or plugin will inevitably break in the next version of WordPress.";
var privateApis = (lock) => {
if (lock === requiredConsent) {
return {
getRegionRootFragment,
initialVdom,
toVdom,
directive,
getNamespace,
h,
cloneElement,
render,
proxifyState,
parseServerData,
populateServerData,
batch,
routerRegions,
deepReadOnly,
navigationSignal
};
}
throw new Error("Forbidden access.");
};
registerDirectives();
init();
export {
getConfig,
getContext,
getElement,
getServerContext,
getServerState,
privateApis,
splitTask,
store,
useCallback,
useEffect,
useInit,
useLayoutEffect,
useMemo,
useRef,
useState,
useWatch,
withScope,
withSyncEvent
};
//# sourceMappingURL=index.js.map