@fasterfixes/widget

中文文档
1.4.0发布于 2026/11/12MITTypeScriptES Module构建来源已验证近 30 天下载 7006

The FasterFixes feedback widget for any website, with no framework required. Reviewers annotate elements and submit visual feedback.

原始使用文档
文档目录10 节
  1. Script tag
  2. Attributes
  3. Manual initialization
  4. npm
  5. Visibility
  6. Options
  7. Instance
  8. Labels
  9. Theming
  10. License

@fasterfixes/widget

Documentation · Website

The FasterFixes feedback Widget for any website, with no framework required. Reviewers annotate elements on the page and submit visual feedback to your Project. It works on WordPress, Webflow, static HTML and apps built with any framework. React, Vue, Angular and Svelte applications can also use @fasterfixes/react, @fasterfixes/vue, @fasterfixes/angular and @fasterfixes/svelte.

The Widget ships no framework runtime and renders inside an open Shadow DOM, so your site's CSS does not affect it.

Script tag

Paste one tag into your site, replacing the Project ID with your own:

<script
  src="https://cdn.jsdelivr.net/npm/@fasterfixes/widget@1/dist/widget.iife.js"
  data-project-id="proj_your_project_id"
  defer
></script>

The tag works in the <head> with defer, at the end of the <body>, or injected after the page has loaded. The @1 channel serves every 1.x release: fixes arrive without editing the snippet, and a breaking change only ships under a new major version.

Attributes

AttributeRequiredDescription
data-project-idYesYour Project ID. Without it, the script loads but does not initialize the Widget.
data-api-originNoOrigin of the FasterFixes API. Defaults to https://www.faster-fixes.com.
data-colorNoAccent color. Accepts any CSS color value. Defaults to #02527E.
data-positionNoFloating button placement. Defaults to bottom-right.
data-capture-diagnosticsNoSet to "false" to disable the Diagnostic Trail. Enabled by default.
data-capture-recordingNoSet to "false" to disable the Recording. Enabled by default.

labels cannot be set through attributes. To set them, or to pass the full option object, see Manual initialization below.

Manual initialization

Leave out data-project-id to load the script without mounting the Widget, then call window.FasterFixes.init yourself, for example from a framework's mount hook:

<script src="https://cdn.jsdelivr.net/npm/@fasterfixes/widget@1/dist/widget.iife.js"></script>
<script>
  window.FasterFixes.init({
    projectId: "proj_your_project_id",
    labels: { submitButton: "Send" },
  });
</script>

Calling init while a Widget is mounted destroys the previous instance first, so the Widget never mounts twice. After initialization, window.FasterFixes.instance holds the current instance.

npm

With a bundler, install the package and import init. The package ships an ESM entry with TypeScript types.

npm install @fasterfixes/widget
import { init } from "@fasterfixes/widget";

const widget = init({ projectId: "proj_your_project_id" });

window.FasterFixes is only defined by the script tag.

Visibility

The Widget mounts only for Reviewers: a Reviewer token must be present (from the ff_token URL parameter, then local storage) and the Project must have the Widget enabled. Public visitors see nothing, and no config request is sent without a token.

Options

init accepts one option object:

OptionTypeDefaultDescription
projectIdstringrequiredYour Project public ID, proj_....
apiOriginstringhttps://www.faster-fixes.comOrigin of the FasterFixes API.
colorstring#02527EAccent color.
positionWidgetPositionbottom-rightOne of bottom-right, bottom-left, top-right, top-left, middle-right, middle-left.
labelsPartial<Labels>English defaultsReplaces any visible or announced string. Omitted keys keep their default.
captureDiagnosticsbooleantrueRecords the console and network history leading to a report.
captureRecordingbooleantrueKeeps a Recording of the last minute on the page with each Feedback. See Recording.
customMetadataCustomMetadata | (() => CustomMetadata)noneKey/value pairs sent with every Feedback. See below.

An unknown position, a projectId that is not a non-empty string, a labels value that is not an object or a customMetadata value that is neither an object nor a function prevents the Widget from mounting. Development builds log a console error naming the option.

customMetadata is shown to your team, in the agent API and in mirrored Issues, never to Reviewers. Pass an object, or a synchronous function called at each submission so a value such as a signed-in user ID stays current. Values are strings, numbers, booleans or null. At most 50 keys are kept, keys are truncated to 40 characters and values to 500, with a console warning in development. A function that throws never blocks a submission: the Feedback is sent without Custom metadata. It is sent whether or not captureDiagnostics or captureRecording is on.

Instance

init returns a Widget. Its members match the useFeedback hook of @fasterfixes/react, the useFeedback composable of @fasterfixes/vue, injectFeedback of @fasterfixes/angular and getFeedback of @fasterfixes/svelte:

MemberDescription
show()Shows the Widget after hide().
hide()Removes the Widget from the page until show().
isVisibletrue while the Widget is on the page.
startAnnotation()Shows the Widget and enters annotation mode.
feedbackItemsThe Feedback items of the Project loaded so far.
togglePins()Hides or shows every pin on the page.
showPinstrue while pins are shown.
subscribe(listener)Calls listener after isVisible, feedbackItems or showPins changes. Returns a function that removes the listener.
destroy()Removes the Widget, stops the Diagnostic Trail and restores console and fetch.
<button type="button" onclick="window.FasterFixes.instance?.startAnnotation()">
  Report an issue
</button>

subscribe lets your own UI follow the Widget state without polling. The listener receives no arguments: read the values from the instance. destroy() removes every listener.

const widget = init({ projectId: "proj_your_project_id" });
const unsubscribe = widget.subscribe(() => {
  counter.textContent = String(widget.feedbackItems.length);
});

Labels

Every string the Widget displays or announces to screen readers comes from labels. Pass partial overrides; omitted keys keep their English default. pinAriaLabel is a function that receives an excerpt of the Feedback comment:

window.FasterFixes.init({
  projectId: "proj_your_project_id",
  labels: {
    submitButton: "Envoyer",
    cancelButton: "Annuler",
    textareaPlaceholder: "Décrivez le problème...",
    pinAriaLabel: (comment) => `Retour : ${comment}`,
  },
});

The full list of keys and defaults is in the Customization docs.

Theming

Theme the Widget with CSS custom properties on its [data-ff-widget] host:

[data-ff-widget] {
  --ff-background: #ffffff;
  --ff-foreground: #18181b;
}
PropertyDefault
--ff-accentthe color option
--ff-background#1c1c1c
--ff-foreground#e4e4e7
--ff-radius8px
--ff-font-family-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif
--ff-z-index2147483647

--ff-accent is set inline from the color option, so prefer color to change it. Reach deeper elements with ::part(): button, overlay, popover, textarea, pin, list and list-item.

[data-ff-widget]::part(button) {
  box-shadow: none;
}

License

MIT

版本与发布记录

@fasterfixes/widget 共发布 6 个版本,首次发布于 2026/09/27;过去 12 个月发布了 6 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.4.0latest2026/11/122 天前
1.3.12026/10/2916 天前
1.3.02026/10/2718 天前
1.2.02026/09/301 个月前
1.1.02026/09/271 个月前
1.0.02026/09/271 个月前

关于 @fasterfixes/widget 的常见问题

@fasterfixes/widget 是什么?

The FasterFixes feedback widget for any website, with no framework required. Reviewers annotate elements and submit visual feedback.

如何安装 @fasterfixes/widget?

在项目目录运行 npm install @fasterfixes/widget,或使用 pnpm add / yarn add / bun add。

@fasterfixes/widget 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fasterfixes/widget 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@fasterfixes/widget 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@fasterfixes/widget 可以商用吗?

@fasterfixes/widget 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@fasterfixes/widget 的下载量有多少?

根据 npm 官方下载统计,@fasterfixes/widget 在 2026/10/15 – 2026/11/13 这 30 天内被下载 7,006 次,日均约 234 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fasterfixes/widget 还在维护吗?

最新版本 1.4.0 发布于 2026/11/12(2 天前);至今共发布 6 个版本,其中过去 12 个月发布了 6 个;首次发布于 2026/09/27。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。