mirror of
https://github.com/PR0M3TH3AN/bitgate.git
synced 2026-10-27 08:31:00 +00:00
Widget styles now prefer --bitgate-* custom properties, falling back to the deprecated --gov-* names and then the existing defaults so current pages and overrides keep working. Browser bundles and ESM entry points expose VERSION (and window.bitgate.version) from package.json. Document allowlist on the widget policy preset list. Sync the lockfile so npm ci sees @bitgate/standalone. Co-authored-by: thePR0M3TH3AN <[email protected]>
103 lines
2.5 KiB
JavaScript
103 lines
2.5 KiB
JavaScript
// @bitgate/widget
|
|
//
|
|
// Custom elements built strictly on the published API. They render decisions
|
|
// and issue commands; they compute no policy. If an element here ever needs a
|
|
// threshold, that is a signal the policy definition is missing a profile —
|
|
// not that the widget needs a number.
|
|
//
|
|
// Elements receive a runtime rather than creating one, so a host application
|
|
// can share a single governance runtime across an entire page.
|
|
|
|
// The bundle is the browser distribution of BitGate as a whole, not only its
|
|
// elements: a static page has no package manager, so anything it might need
|
|
// has to be reachable from this one file.
|
|
export {
|
|
createBitGate,
|
|
createCommands,
|
|
createRelayTransport,
|
|
createMemoryTransport,
|
|
createMemoryStorage,
|
|
ERROR_CODES,
|
|
} from "@bitgate/runtime";
|
|
|
|
export {
|
|
VERSION,
|
|
SOCIAL_POLICY,
|
|
COMMERCE_POLICY,
|
|
ADMIN_ONLY_POLICY,
|
|
ALLOWLIST_POLICY,
|
|
POLICY_PRESETS,
|
|
getPolicyPreset,
|
|
createPolicyDefinition,
|
|
createApplicationAdapter,
|
|
evaluateObject,
|
|
collectTargets,
|
|
} from "@bitgate/core";
|
|
|
|
export {
|
|
LABEL_KIND,
|
|
decodeLabels,
|
|
labelsToContributions,
|
|
encodeLabel,
|
|
contributionToLabel,
|
|
} from "@bitgate/nostr";
|
|
|
|
export {
|
|
BASE_STYLES,
|
|
THEME_DEFAULTS,
|
|
GovernanceElement,
|
|
canRegisterElements,
|
|
defineElement,
|
|
escapeHtml,
|
|
requestContext,
|
|
shortenKey,
|
|
targetFromAttributes,
|
|
themeVar,
|
|
} from "./base.js";
|
|
|
|
export { exposeBitGateVersion } from "./expose-version.js";
|
|
|
|
export {
|
|
BitGateError,
|
|
BitGateProvider,
|
|
CONTEXT_REQUEST,
|
|
defineProviderElements,
|
|
} from "./provider.js";
|
|
|
|
export {
|
|
DEFAULT_REASON_TEXT,
|
|
GovernanceReport,
|
|
GovernanceStatus,
|
|
GovernanceVeil,
|
|
defineViewerElements,
|
|
describeReasons,
|
|
} from "./viewer.js";
|
|
|
|
export {
|
|
CAPABILITY_LABELS,
|
|
GovernanceAction,
|
|
GovernanceAdminPanel,
|
|
GovernanceCapabilities,
|
|
defineAdminElements,
|
|
} from "./admin.js";
|
|
|
|
import { defineAdminElements } from "./admin.js";
|
|
import { exposeBitGateVersion } from "./expose-version.js";
|
|
import { defineProviderElements } from "./provider.js";
|
|
import { defineViewerElements } from "./viewer.js";
|
|
|
|
exposeBitGateVersion();
|
|
|
|
/**
|
|
* Register every governance element.
|
|
*
|
|
* Safe to call more than once and safe to import in Node: registration is a
|
|
* no-op without a DOM, so a server-rendering host can import the helpers
|
|
* without guarding.
|
|
*
|
|
* @returns {string[]} Element names newly registered by this call
|
|
*/
|
|
export function defineBitGateElements() {
|
|
return [...defineProviderElements(), ...defineViewerElements(), ...defineAdminElements()];
|
|
}
|