@devbie/fewbie-cli 1.10.0 → 1.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +20 -2
  2. package/dist/registry/build.js +4 -2
  3. package/dist/registry/build.js.map +1 -1
  4. package/dist/registry/forgot-password/contract.json +49 -0
  5. package/dist/registry/forgot-password/fewbie.module.json +74 -0
  6. package/dist/registry/login-page/contract.json +50 -0
  7. package/dist/registry/login-page/fewbie.module.json +75 -0
  8. package/dist/registry/preferences-settings/contract.json +37 -0
  9. package/dist/registry/preferences-settings/fewbie.module.json +62 -0
  10. package/dist/registry/profile-settings/contract.json +30 -0
  11. package/dist/registry/profile-settings/fewbie.module.json +55 -0
  12. package/dist/registry/security-settings/contract.json +52 -0
  13. package/dist/registry/security-settings/fewbie.module.json +77 -0
  14. package/dist/registry/source.d.ts +2 -0
  15. package/dist/registry/source.js +24 -7
  16. package/dist/registry/source.js.map +1 -1
  17. package/dist/registry/store.d.ts +1 -1
  18. package/dist/registry/store.js +3 -2
  19. package/dist/registry/store.js.map +1 -1
  20. package/dist/registry/types.d.ts +1 -0
  21. package/dist/registry/types.js +2 -0
  22. package/dist/registry/types.js.map +1 -1
  23. package/package.json +3 -1
  24. /package/dist/registry/auth/{item.json → fewbie.module.json} +0 -0
  25. /package/dist/registry/data-table/{item.json → fewbie.module.json} +0 -0
  26. /package/dist/registry/frontend-monitor-sdk/{item.json → fewbie.module.json} +0 -0
  27. /package/dist/registry/login-form/{item.json → fewbie.module.json} +0 -0
  28. /package/dist/registry/password-checklist/{item.json → fewbie.module.json} +0 -0
  29. /package/dist/registry/query-client/{item.json → fewbie.module.json} +0 -0
  30. /package/dist/registry/settings-required-state/{item.json → fewbie.module.json} +0 -0
  31. /package/dist/registry/sse-stream/{item.json → fewbie.module.json} +0 -0
  32. /package/dist/registry/theme/{item.json → fewbie.module.json} +0 -0
package/README.md CHANGED
@@ -186,8 +186,21 @@ Print machine-readable project state as JSON (always JSON, no flag). Reports
186
186
 
187
187
  ## Registry items
188
188
 
189
- The built-in registry follows the shadcn item conventions
190
- (`registry:lib`, `registry:component`, `registry:block`):
189
+ The registry is authored in
190
+ [fewbie-modules](https://github.com/worldzhy/fewbie-modules); this package ships
191
+ a generated snapshot of it (`.snapshot.json` records the source commit), so a
192
+ host that declares `registry` and one that declares nothing see the same item
193
+ set (ADR-058). Never edit `registry/` by hand: change the item in
194
+ fewbie-modules, then run `npm run registry:sync -w @devbie/fewbie-cli`.
195
+ `npm run check:registry-snapshot -w @devbie/fewbie-cli` compares the snapshot
196
+ against the recorded commit and gates a release.
197
+
198
+ A registry checkout is resolved to its item directory: `packages/modules/`
199
+ wins, and a flat checkout with `<item>/fewbie.module.json` at its root stays supported
200
+ (ADR-059). `FEWBIE_REGISTRY_PATH` accepts either shape.
201
+
202
+ Items follow the shadcn conventions (`registry:lib`, `registry:component`,
203
+ `registry:block`):
191
204
 
192
205
  | Item | Type | Description |
193
206
  | ------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |
@@ -200,6 +213,11 @@ The built-in registry follows the shadcn item conventions
200
213
  | `sse-stream` | `lib` | POST-based SSE transport with frame decoding, keepalive handling and abort support. |
201
214
  | `theme` | `component` | `next-themes` ThemeProvider wrapper and a light/dark toggle button. |
202
215
  | `frontend-monitor-sdk` | `component` | Browser-side monitoring (PV/AJAX/resource/errors) via `@devbie/frontend-monitor-sdk`; scaffolds a client component for the root layout. |
216
+ | `login-page` | `block` | Page-level password/code login with inline TOTP and third-party provider entries. |
217
+ | `forgot-password` | `block` | Email plus verification code password reset with a live strength checklist. |
218
+ | `profile-settings` | `block` | Account profile card: names and display name, persisted by the host. |
219
+ | `security-settings` | `block` | Active sessions with per-row sign-out, and authenticator-app enrollment. |
220
+ | `preferences-settings` | `block` | Interface language, theme and timezone, with host-side cache and cookie updates. |
203
221
 
204
222
  Framework assets (`src/components/ui/**`, `src/framework/**`,
205
223
  `src/lib/api-client/**`, the root layout and i18n config) ship only through the
@@ -7,6 +7,7 @@ exports.buildRegistry = buildRegistry;
7
7
  const promises_1 = __importDefault(require("node:fs/promises"));
8
8
  const node_path_1 = __importDefault(require("node:path"));
9
9
  const contract_1 = require("./contract");
10
+ const types_1 = require("./types");
10
11
  const SHADCN_ITEM_SCHEMA = "https://ui.shadcn.com/r/registry-item.json";
11
12
  async function buildRegistry(sourceRoot, outputRoot) {
12
13
  const entries = await promises_1.default.readdir(sourceRoot, { withFileTypes: true });
@@ -15,7 +16,7 @@ async function buildRegistry(sourceRoot, outputRoot) {
15
16
  if (!entry.isDirectory())
16
17
  continue;
17
18
  const itemDir = node_path_1.default.join(sourceRoot, entry.name);
18
- const manifestPath = node_path_1.default.join(itemDir, "item.json");
19
+ const manifestPath = node_path_1.default.join(itemDir, types_1.REGISTRY_MANIFEST_FILE);
19
20
  const manifestExists = await promises_1.default
20
21
  .access(manifestPath)
21
22
  .then(() => true)
@@ -51,8 +52,9 @@ async function buildRegistry(sourceRoot, outputRoot) {
51
52
  files,
52
53
  };
53
54
  const outDir = node_path_1.default.join(outputRoot, entry.name);
55
+ await promises_1.default.rm(outDir, { recursive: true, force: true });
54
56
  await promises_1.default.mkdir(outDir, { recursive: true });
55
- await promises_1.default.writeFile(node_path_1.default.join(outDir, "item.json"), `${JSON.stringify(builtItem, null, 2)}\n`);
57
+ await promises_1.default.writeFile(node_path_1.default.join(outDir, types_1.REGISTRY_MANIFEST_FILE), `${JSON.stringify(builtItem, null, 2)}\n`);
56
58
  if (contract) {
57
59
  await promises_1.default.writeFile(node_path_1.default.join(outDir, "contract.json"), `${JSON.stringify(contract, null, 2)}\n`);
58
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/registry/build.ts"],"names":[],"mappings":";;;;;AAcA,sCAmEC;AAjFD,gEAAkC;AAClC,0DAA6B;AAE7B,yCAAsD;AAGtD,MAAM,kBAAkB,GAAG,4CAA4C,CAAC;AAQjE,KAA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,MAAM,kBAAE,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACtD,MAAM,kBAAE,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5C,MAAM,kBAAE,CAAC,SAAS,CAAC,mBAAI,CAAC,IAAI,CAAC,MAAM,EAAE,8BAAsB,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAGzG,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,kBAAE,CAAC,SAAS,CAAC,mBAAI,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QACnG,CAAC;aAAM,CAAC;YACN,MAAM,kBAAE,CAAC,EAAE,CAAC,mBAAI,CAAC,IAAI,CAAC,MAAM,EAAE,eAAe,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACnE,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,49 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "framework": "^1.7.0",
4
+ "entry": "src/modules/forgot-password/index.ts",
5
+ "labels": [
6
+ "title",
7
+ "description",
8
+ "emailLabel",
9
+ "codeLabel",
10
+ "newPasswordLabel",
11
+ "getCode",
12
+ "resetButton",
13
+ "back",
14
+ "clearEmail",
15
+ "clearCode",
16
+ "clearPassword",
17
+ "showPassword",
18
+ "hidePassword",
19
+ "invalidEmail",
20
+ "emailRequired",
21
+ "codeDigits",
22
+ "codeRequired",
23
+ "passwordRule",
24
+ "passwordRequired",
25
+ "requestFailed",
26
+ "resetFailed",
27
+ "passwordRequirements",
28
+ "passwordRuleLength",
29
+ "passwordRuleLowercase",
30
+ "passwordRuleUppercase",
31
+ "passwordRuleNumber",
32
+ "passwordRuleSymbol"
33
+ ],
34
+ "ports": [
35
+ "sendResetCode",
36
+ "resetPassword"
37
+ ],
38
+ "ui": [
39
+ "button",
40
+ "card",
41
+ "input",
42
+ "label"
43
+ ],
44
+ "states": [
45
+ "loading",
46
+ "error",
47
+ "ready"
48
+ ]
49
+ }
@@ -0,0 +1,74 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/r/registry-item.json",
3
+ "name": "forgot-password",
4
+ "type": "registry:block",
5
+ "title": "Forgot password page",
6
+ "description": "Page-level password reset block: email and verification code plus a new password with a live strength checklist. Transport and navigation come from the host through props.",
7
+ "postInstall": "Render <ForgotPasswordPage labels={...} port={...} /> inside your auth shell. The host supplies translated labels, a sendResetCode/resetPassword port, an optional initialEmail and navigates from onReset/onBack. Requires the shadcn ui primitives button, card, input and label.",
8
+ "x-fewbie.contract": {
9
+ "version": "1.0.0",
10
+ "framework": "^1.7.0",
11
+ "entry": "src/modules/forgot-password/index.ts",
12
+ "labels": [
13
+ "title",
14
+ "description",
15
+ "emailLabel",
16
+ "codeLabel",
17
+ "newPasswordLabel",
18
+ "getCode",
19
+ "resetButton",
20
+ "back",
21
+ "clearEmail",
22
+ "clearCode",
23
+ "clearPassword",
24
+ "showPassword",
25
+ "hidePassword",
26
+ "invalidEmail",
27
+ "emailRequired",
28
+ "codeDigits",
29
+ "codeRequired",
30
+ "passwordRule",
31
+ "passwordRequired",
32
+ "requestFailed",
33
+ "resetFailed",
34
+ "passwordRequirements",
35
+ "passwordRuleLength",
36
+ "passwordRuleLowercase",
37
+ "passwordRuleUppercase",
38
+ "passwordRuleNumber",
39
+ "passwordRuleSymbol"
40
+ ],
41
+ "ports": [
42
+ "sendResetCode",
43
+ "resetPassword"
44
+ ],
45
+ "ui": [
46
+ "button",
47
+ "card",
48
+ "input",
49
+ "label"
50
+ ],
51
+ "states": [
52
+ "loading",
53
+ "error",
54
+ "ready"
55
+ ]
56
+ },
57
+ "files": [
58
+ {
59
+ "path": "src/modules/forgot-password/index.ts",
60
+ "content": "export { ForgotPasswordPage } from \"./forgot-password\";\nexport type {\n ForgotPasswordLabels,\n ForgotPasswordPort,\n ForgotPasswordProps,\n ResetPasswordInput,\n SendResetCodeResult,\n} from \"./types\";\n",
61
+ "type": "registry:block"
62
+ },
63
+ {
64
+ "path": "src/modules/forgot-password/types.ts",
65
+ "content": "import type { ReactNode } from \"react\";\n\n/**\n * Every string the page renders. The host supplies translated copy; the module\n * owns no user-facing text of its own.\n */\nexport interface ForgotPasswordLabels {\n title: string;\n description: string;\n emailLabel: string;\n codeLabel: string;\n newPasswordLabel: string;\n getCode: string;\n resetButton: string;\n back: string;\n clearEmail: string;\n clearCode: string;\n clearPassword: string;\n showPassword: string;\n hidePassword: string;\n invalidEmail: string;\n emailRequired: string;\n codeDigits: string;\n codeRequired: string;\n passwordRule: string;\n passwordRequired: string;\n requestFailed: string;\n resetFailed: string;\n passwordRequirements: string;\n passwordRuleLength: string;\n passwordRuleLowercase: string;\n passwordRuleUppercase: string;\n passwordRuleNumber: string;\n passwordRuleSymbol: string;\n}\n\nexport interface ResetPasswordInput {\n email: string;\n verificationCode: string;\n newPassword: string;\n}\n\nexport interface SendResetCodeResult {\n /** Resend cooldown reported by the backend; defaults to 60 seconds. */\n secondsOfCountdown?: number;\n}\n\n/**\n * Host-owned transport. The module never calls fetch, a router or a toast\n * library: the host decides how to reach its backend and what to do after a\n * successful reset.\n */\nexport interface ForgotPasswordPort {\n sendResetCode(email: string): Promise<SendResetCodeResult>;\n resetPassword(input: ResetPasswordInput): Promise<void>;\n}\n\nexport interface ForgotPasswordProps {\n labels: ForgotPasswordLabels;\n port: ForgotPasswordPort;\n /** Email carried over from the sign-in page, used to seed the form. */\n initialEmail?: string;\n /** Persistent banners, host-styled. */\n notices?: ReactNode;\n /** Called after a verification code was sent; the host may toast. */\n onCodeSent?: () => void;\n /** Called after a successful reset; the host navigates. */\n onReset?: () => void;\n /** Renders the back link when provided; the host navigates. */\n onBack?: () => void;\n}\n",
66
+ "type": "registry:block"
67
+ },
68
+ {
69
+ "path": "src/modules/forgot-password/forgot-password.tsx",
70
+ "content": "\"use client\";\n\nimport { useEffect, useState, type FormEvent } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport type { ForgotPasswordLabels, ForgotPasswordProps } from \"./types\";\n\nconst EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nconst CODE_LENGTH = 6;\nconst DEFAULT_RESEND_SECONDS = 60;\nconst PASSWORD_PATTERN = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[^\\w\\s]).{8,}$/;\n\nfunction Spinner() {\n return (\n <span\n aria-hidden=\"true\"\n className=\"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent\"\n />\n );\n}\n\nfunction ClearIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n className=\"h-4 w-4\"\n >\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n );\n}\n\nfunction EyeIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <path d=\"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n );\n}\n\nfunction EyeOffIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <path d=\"M3 3l18 18\" />\n <path d=\"M10.6 10.6a3 3 0 0 0 4.2 4.2\" />\n <path d=\"M9.9 5.2A10.9 10.9 0 0 1 12 5c6.5 0 10 7 10 7a17.6 17.6 0 0 1-3.2 4.1\" />\n <path d=\"M6.2 6.2A17.4 17.4 0 0 0 2 12s3.5 7 10 7a10.6 10.6 0 0 0 4.2-.9\" />\n </svg>\n );\n}\n\nfunction CheckIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-3.5 w-3.5\"\n >\n <path d=\"M20 6 9 17l-5-5\" />\n </svg>\n );\n}\n\nfunction PasswordChecklist({ password, labels }: { password: string; labels: ForgotPasswordLabels }) {\n // Show nothing until the user starts typing, to keep the form calm.\n if (!password) return null;\n\n const rules = [\n { key: \"length\", label: labels.passwordRuleLength, met: password.length >= 8 },\n { key: \"lowercase\", label: labels.passwordRuleLowercase, met: /[a-z]/.test(password) },\n { key: \"uppercase\", label: labels.passwordRuleUppercase, met: /[A-Z]/.test(password) },\n { key: \"number\", label: labels.passwordRuleNumber, met: /\\d/.test(password) },\n { key: \"symbol\", label: labels.passwordRuleSymbol, met: /[^\\w\\s]/.test(password) },\n ];\n\n return (\n <ul className=\"space-y-1.5 rounded-md border bg-muted/40 p-3\" aria-label={labels.passwordRequirements}>\n {rules.map((rule) => (\n <li\n key={rule.key}\n className={`flex items-center gap-2 text-xs ${\n rule.met ? \"text-green-600 dark:text-green-500\" : \"text-muted-foreground\"\n }`}\n >\n {rule.met ? <CheckIcon /> : <ClearIcon />}\n {rule.label}\n </li>\n ))}\n </ul>\n );\n}\n\n/**\n * Page-level password reset module: email plus verification code plus a new\n * password, with a live strength checklist. Transport, navigation and toasts\n * belong to the host and enter through `port` and the `on*` callbacks.\n */\nexport function ForgotPasswordPage({\n labels,\n port,\n initialEmail = \"\",\n notices,\n onCodeSent,\n onReset,\n onBack,\n}: ForgotPasswordProps) {\n const [email, setEmail] = useState(initialEmail);\n const [code, setCode] = useState(\"\");\n const [newPassword, setNewPassword] = useState(\"\");\n const [showPassword, setShowPassword] = useState(false);\n // Seconds left before the user can request another verification code.\n const [secondsLeft, setSecondsLeft] = useState(0);\n const [sendPending, setSendPending] = useState(false);\n const [resetPending, setResetPending] = useState(false);\n const [errors, setErrors] = useState<{ email?: string; code?: string; newPassword?: string }>({});\n const [error, setError] = useState<string | null>(null);\n\n const isCountingDown = secondsLeft > 0;\n\n // Countdown timer for resending the verification code.\n useEffect(() => {\n if (!isCountingDown) return;\n const timer = setInterval(() => setSecondsLeft((prev) => Math.max(0, prev - 1)), 1000);\n return () => clearInterval(timer);\n }, [isCountingDown]);\n\n function validateEmail(value: string): string | undefined {\n if (!value.trim()) return labels.emailRequired;\n if (!EMAIL_PATTERN.test(value)) return labels.invalidEmail;\n return undefined;\n }\n\n async function handleGetCode(): Promise<void> {\n if (secondsLeft > 0 || sendPending) return;\n const emailError = validateEmail(email);\n setErrors((prev) => ({ ...prev, email: emailError }));\n if (emailError) return;\n\n setSendPending(true);\n setError(null);\n try {\n const result = await port.sendResetCode(email);\n // Follow the resend cooldown returned by the backend.\n setSecondsLeft(result.secondsOfCountdown ?? DEFAULT_RESEND_SECONDS);\n onCodeSent?.();\n } catch {\n setError(labels.requestFailed);\n } finally {\n setSendPending(false);\n }\n }\n\n async function handleSubmit(event: FormEvent<HTMLFormElement>): Promise<void> {\n event.preventDefault();\n if (resetPending) return;\n\n const nextErrors = {\n email: validateEmail(email),\n code: !code ? labels.codeRequired : code.length !== CODE_LENGTH ? labels.codeDigits : undefined,\n newPassword: !newPassword\n ? labels.passwordRequired\n : PASSWORD_PATTERN.test(newPassword)\n ? undefined\n : labels.passwordRule,\n };\n setErrors(nextErrors);\n if (nextErrors.email || nextErrors.code || nextErrors.newPassword) return;\n\n setResetPending(true);\n setError(null);\n try {\n await port.resetPassword({ email, verificationCode: code, newPassword });\n onReset?.();\n } catch {\n setError(labels.resetFailed);\n } finally {\n setResetPending(false);\n }\n }\n\n return (\n <Card className=\"w-full shadow-sm\">\n <CardHeader>\n <CardTitle className=\"text-xl\">{labels.title}</CardTitle>\n <CardDescription>{labels.description}</CardDescription>\n </CardHeader>\n <CardContent>\n {notices}\n\n {/* method=\"post\" keeps a native submit (before hydration) from\n serializing the new password into the query string. */}\n <form method=\"post\" onSubmit={(event) => void handleSubmit(event)} noValidate className=\"space-y-5\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"forgot-password-email\">{labels.emailLabel}</Label>\n <div className=\"relative\">\n <Input\n id=\"forgot-password-email\"\n autoComplete=\"email\"\n value={email}\n onChange={(event) => setEmail(event.target.value)}\n className=\"pr-10\"\n />\n {email && (\n <button\n type=\"button\"\n onClick={() => setEmail(\"\")}\n className=\"absolute top-1/2 right-2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n aria-label={labels.clearEmail}\n >\n <ClearIcon />\n </button>\n )}\n </div>\n {errors.email && <p className=\"text-sm text-destructive\">{errors.email}</p>}\n </div>\n\n <div className=\"space-y-2\">\n <Label htmlFor=\"forgot-password-code\">{labels.codeLabel}</Label>\n <div className=\"relative\">\n <Input\n id=\"forgot-password-code\"\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n value={code}\n onChange={(event) => setCode(event.target.value.replace(/\\D/g, \"\").slice(0, CODE_LENGTH))}\n className=\"pr-32\"\n />\n <div className=\"absolute top-1/2 right-2 flex -translate-y-1/2 items-center gap-2\">\n {code && (\n <button\n type=\"button\"\n onClick={() => setCode(\"\")}\n className=\"text-muted-foreground hover:text-foreground\"\n aria-label={labels.clearCode}\n >\n <ClearIcon />\n </button>\n )}\n <Button\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n className=\"h-auto p-0 text-xs font-normal\"\n onClick={() => void handleGetCode()}\n disabled={secondsLeft > 0 || sendPending}\n >\n {sendPending ? <Spinner /> : secondsLeft > 0 ? `${secondsLeft}s` : labels.getCode}\n </Button>\n </div>\n </div>\n {errors.code && <p className=\"text-sm text-destructive\">{errors.code}</p>}\n </div>\n\n <div className=\"space-y-2\">\n <Label htmlFor=\"forgot-password-new-password\">{labels.newPasswordLabel}</Label>\n <div className=\"relative\">\n <Input\n id=\"forgot-password-new-password\"\n type={showPassword ? \"text\" : \"password\"}\n autoComplete=\"new-password\"\n value={newPassword}\n onChange={(event) => setNewPassword(event.target.value)}\n className=\"pr-20\"\n />\n <div className=\"absolute top-1/2 right-2 flex -translate-y-1/2 items-center gap-1\">\n {newPassword && (\n <button\n type=\"button\"\n onClick={() => setNewPassword(\"\")}\n className=\"text-muted-foreground hover:text-foreground\"\n aria-label={labels.clearPassword}\n >\n <ClearIcon />\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => setShowPassword((prev) => !prev)}\n className=\"text-muted-foreground hover:text-foreground\"\n aria-label={showPassword ? labels.hidePassword : labels.showPassword}\n >\n {showPassword ? <EyeOffIcon /> : <EyeIcon />}\n </button>\n </div>\n </div>\n <PasswordChecklist password={newPassword} labels={labels} />\n {errors.newPassword && <p className=\"text-sm text-destructive\">{errors.newPassword}</p>}\n </div>\n\n {error && <p className=\"text-sm text-destructive\">{error}</p>}\n\n {onBack && (\n <div className=\"flex justify-end\">\n <Button\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n className=\"h-auto p-0 text-xs font-normal\"\n onClick={onBack}\n >\n {labels.back}\n </Button>\n </div>\n )}\n\n <Button type=\"submit\" className=\"w-full\" disabled={resetPending}>\n {resetPending ? <Spinner /> : labels.resetButton}\n </Button>\n </form>\n </CardContent>\n </Card>\n );\n}\n",
71
+ "type": "registry:block"
72
+ }
73
+ ]
74
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "framework": "^1.7.0",
4
+ "entry": "src/modules/login-page/index.ts",
5
+ "labels": [
6
+ "title",
7
+ "description",
8
+ "tabPassword",
9
+ "tabVerificationCode",
10
+ "email",
11
+ "password",
12
+ "submit",
13
+ "verificationCode",
14
+ "getCode",
15
+ "orContinueWith",
16
+ "back",
17
+ "clearEmail",
18
+ "clearPassword",
19
+ "hidePassword",
20
+ "showPassword",
21
+ "clearCode",
22
+ "invalidEmail",
23
+ "emailRequired",
24
+ "passwordMin",
25
+ "passwordRequired",
26
+ "codeDigits",
27
+ "codeRequired",
28
+ "invalidCredentials",
29
+ "loginFailed",
30
+ "totpLabel",
31
+ "totpHint",
32
+ "totpSubmit"
33
+ ],
34
+ "ports": [
35
+ "signIn",
36
+ "sendVerificationCode"
37
+ ],
38
+ "ui": [
39
+ "button",
40
+ "card",
41
+ "input",
42
+ "label",
43
+ "tabs"
44
+ ],
45
+ "states": [
46
+ "loading",
47
+ "error",
48
+ "ready"
49
+ ]
50
+ }
@@ -0,0 +1,75 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/r/registry-item.json",
3
+ "name": "login-page",
4
+ "type": "registry:block",
5
+ "title": "Login page",
6
+ "description": "Page-level login block: password and verification-code tabs, inline TOTP challenge and third-party provider entries. Transport, navigation and copy come from the host through props.",
7
+ "postInstall": "Render <LoginPage labels={...} port={...} /> inside your auth shell. The host supplies translated labels, a signIn/sendVerificationCode port, optional notices and oauthProviders, and navigates from onSignedIn. Requires the shadcn ui primitives button, card, input, label and tabs.",
8
+ "x-fewbie.contract": {
9
+ "version": "1.0.0",
10
+ "framework": "^1.7.0",
11
+ "entry": "src/modules/login-page/index.ts",
12
+ "labels": [
13
+ "title",
14
+ "description",
15
+ "tabPassword",
16
+ "tabVerificationCode",
17
+ "email",
18
+ "password",
19
+ "submit",
20
+ "verificationCode",
21
+ "getCode",
22
+ "orContinueWith",
23
+ "back",
24
+ "clearEmail",
25
+ "clearPassword",
26
+ "hidePassword",
27
+ "showPassword",
28
+ "clearCode",
29
+ "invalidEmail",
30
+ "emailRequired",
31
+ "passwordMin",
32
+ "passwordRequired",
33
+ "codeDigits",
34
+ "codeRequired",
35
+ "invalidCredentials",
36
+ "loginFailed",
37
+ "totpLabel",
38
+ "totpHint",
39
+ "totpSubmit"
40
+ ],
41
+ "ports": [
42
+ "signIn",
43
+ "sendVerificationCode"
44
+ ],
45
+ "ui": [
46
+ "button",
47
+ "card",
48
+ "input",
49
+ "label",
50
+ "tabs"
51
+ ],
52
+ "states": [
53
+ "loading",
54
+ "error",
55
+ "ready"
56
+ ]
57
+ },
58
+ "files": [
59
+ {
60
+ "path": "src/modules/login-page/index.ts",
61
+ "content": "export { LoginPage } from \"./login-page\";\nexport type {\n LoginCredentials,\n LoginLabels,\n LoginOAuthProvider,\n LoginPageProps,\n LoginPort,\n LoginResult,\n LoginTotpChallenge,\n LoginVerificationCode,\n VerificationCodeResult,\n} from \"./types\";\n",
62
+ "type": "registry:block"
63
+ },
64
+ {
65
+ "path": "src/modules/login-page/types.ts",
66
+ "content": "import type { ReactNode } from \"react\";\n\n/**\n * Every string the page renders. The host supplies translated copy; the module\n * owns no user-facing text of its own, so a host that follows the fewbie\n * i18n rule (display copy lives in the host message files) stays compliant.\n */\nexport interface LoginLabels {\n title: string;\n description: string;\n tabPassword: string;\n tabVerificationCode: string;\n email: string;\n password: string;\n submit: string;\n verificationCode: string;\n getCode: string;\n orContinueWith: string;\n back: string;\n clearEmail: string;\n clearPassword: string;\n hidePassword: string;\n showPassword: string;\n clearCode: string;\n invalidEmail: string;\n emailRequired: string;\n passwordMin: string;\n passwordRequired: string;\n codeDigits: string;\n codeRequired: string;\n invalidCredentials: string;\n loginFailed: string;\n totpLabel: string;\n totpHint: string;\n totpSubmit: string;\n}\n\n/** One third-party sign-in entry; the host owns the URL and the brand mark. */\nexport interface LoginOAuthProvider {\n /** Stable key for React, e.g. \"google\". */\n id: string;\n label: string;\n /** Absolute URL of the provider's backend entry point. */\n href: string;\n icon?: ReactNode;\n}\n\nexport interface LoginCredentials {\n account: string;\n password: string;\n}\n\nexport interface LoginVerificationCode {\n account: string;\n verificationCode: string;\n}\n\n/** Second factor for a sign-in the backend already accepted. */\nexport interface LoginTotpChallenge {\n totpToken: string;\n code: string;\n}\n\nexport interface LoginResult {\n /** True only when a session was established. */\n ok: boolean;\n /** The backend rejected the credentials (as opposed to a transport error). */\n invalidCredentials?: boolean;\n /** A second factor is still required; the page renders the authenticator form. */\n multiFactorRequired?: boolean;\n totpToken?: string;\n}\n\nexport interface VerificationCodeResult {\n ok: boolean;\n /** Resend cooldown reported by the backend; defaults to 60 seconds. */\n secondsOfCountdown?: number;\n}\n\n/**\n * Host-owned transport and side effects. The module never calls fetch or the\n * router: the host decides how to reach its backend and where to navigate.\n */\nexport interface LoginPort {\n signIn(input: LoginCredentials | LoginVerificationCode | LoginTotpChallenge): Promise<LoginResult>;\n sendVerificationCode(email: string): Promise<VerificationCodeResult>;\n}\n\nexport interface LoginPageProps {\n labels: LoginLabels;\n port: LoginPort;\n /** Persistent banners (pending approval, disabled account, ...), host-styled. */\n notices?: ReactNode;\n /** Third-party providers; the divider is hidden when empty. */\n oauthProviders?: LoginOAuthProvider[];\n /** Called after a successful sign-in; the host navigates. */\n onSignedIn?: () => void;\n /** Called after a verification code was sent; the host may toast. */\n onCodeSent?: () => void;\n}\n",
67
+ "type": "registry:block"
68
+ },
69
+ {
70
+ "path": "src/modules/login-page/login-page.tsx",
71
+ "content": "\"use client\";\n\nimport { useEffect, useState, type FormEvent } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { Tabs, TabsList, TabsTrigger } from \"@/components/ui/tabs\";\nimport type { LoginLabels, LoginPageProps, LoginResult } from \"./types\";\n\ntype LoginMode = \"password\" | \"code\";\n\nconst EMAIL_PATTERN = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\nconst CODE_LENGTH = 6;\nconst DEFAULT_RESEND_SECONDS = 60;\n\nfunction Spinner() {\n return (\n <span\n aria-hidden=\"true\"\n className=\"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent\"\n />\n );\n}\n\nfunction ClearIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n className=\"h-4 w-4\"\n >\n <path d=\"M18 6 6 18M6 6l12 12\" />\n </svg>\n );\n}\n\nfunction EyeIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <path d=\"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12Z\" />\n <circle cx=\"12\" cy=\"12\" r=\"3\" />\n </svg>\n );\n}\n\nfunction EyeOffIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <path d=\"M3 3l18 18\" />\n <path d=\"M10.6 10.6a3 3 0 0 0 4.2 4.2\" />\n <path d=\"M9.9 5.2A10.9 10.9 0 0 1 12 5c6.5 0 10 7 10 7a17.6 17.6 0 0 1-3.2 4.1\" />\n <path d=\"M6.2 6.2A17.4 17.4 0 0 0 2 12s3.5 7 10 7a10.6 10.6 0 0 0 4.2-.9\" />\n </svg>\n );\n}\n\n/**\n * Page-level login module: password and verification-code tabs, an inline TOTP\n * challenge, and third-party entries. Transport, navigation, toasts and brand\n * shell belong to the host and enter through `port`, `oauthProviders` and the\n * `onSignedIn`/`onCodeSent` callbacks.\n */\nexport function LoginPage({ labels, port, notices, oauthProviders, onSignedIn, onCodeSent }: LoginPageProps) {\n const [mode, setMode] = useState<LoginMode>(\"password\");\n const [showPassword, setShowPassword] = useState(false);\n // Seconds left before the user can request another verification code.\n const [secondsLeft, setSecondsLeft] = useState(0);\n // When set, the primary factor was accepted and the user must finish login\n // with a TOTP code from their authenticator app.\n const [mfaToken, setMfaToken] = useState<string | null>(null);\n const [error, setError] = useState<string | null>(null);\n\n const [passwordEmail, setPasswordEmail] = useState(\"\");\n const [password, setPasswordValue] = useState(\"\");\n const [passwordErrors, setPasswordErrors] = useState<{ email?: string; password?: string }>({});\n\n const [codeEmail, setCodeEmail] = useState(\"\");\n const [code, setCode] = useState(\"\");\n const [codeErrors, setCodeErrors] = useState<{ email?: string; code?: string }>({});\n\n const [pending, setPending] = useState(false);\n const [sendPending, setSendPending] = useState(false);\n\n const isCountingDown = secondsLeft > 0;\n\n // Countdown timer for resending the verification code.\n useEffect(() => {\n if (!isCountingDown) return;\n const timer = setInterval(() => setSecondsLeft((prev) => Math.max(0, prev - 1)), 1000);\n return () => clearInterval(timer);\n }, [isCountingDown]);\n\n function complete(result: LoginResult): void {\n if (result.multiFactorRequired && result.totpToken) {\n setMfaToken(result.totpToken);\n return;\n }\n if (!result.ok) {\n setError(result.invalidCredentials ? labels.invalidCredentials : labels.loginFailed);\n return;\n }\n onSignedIn?.();\n }\n\n async function submit(input: Parameters<LoginPageProps[\"port\"][\"signIn\"]>[0]): Promise<void> {\n setPending(true);\n setError(null);\n try {\n complete(await port.signIn(input));\n } catch {\n setError(labels.loginFailed);\n } finally {\n setPending(false);\n }\n }\n\n function validateEmail(value: string): string | undefined {\n if (!value.trim()) return labels.emailRequired;\n if (!EMAIL_PATTERN.test(value)) return labels.invalidEmail;\n return undefined;\n }\n\n function onPasswordSubmit(event: FormEvent<HTMLFormElement>): void {\n event.preventDefault();\n const nextErrors = {\n email: validateEmail(passwordEmail),\n password: !password ? labels.passwordRequired : password.length < 8 ? labels.passwordMin : undefined,\n };\n setPasswordErrors(nextErrors);\n if (nextErrors.email || nextErrors.password) return;\n void submit({ account: passwordEmail, password });\n }\n\n function onCodeSubmit(event: FormEvent<HTMLFormElement>): void {\n event.preventDefault();\n const nextErrors = {\n email: validateEmail(codeEmail),\n code: !code ? labels.codeRequired : code.length !== CODE_LENGTH ? labels.codeDigits : undefined,\n };\n setCodeErrors(nextErrors);\n if (nextErrors.email || nextErrors.code) return;\n void submit({ account: codeEmail, verificationCode: code });\n }\n\n async function handleSendCode(): Promise<void> {\n if (secondsLeft > 0 || sendPending) return;\n const emailError = validateEmail(codeEmail);\n setCodeErrors((prev) => ({ ...prev, email: emailError }));\n if (emailError) return;\n\n setSendPending(true);\n try {\n const result = await port.sendVerificationCode(codeEmail);\n if (!result.ok) {\n setError(labels.loginFailed);\n return;\n }\n // Follow the resend cooldown returned by the backend.\n setSecondsLeft(result.secondsOfCountdown ?? DEFAULT_RESEND_SECONDS);\n onCodeSent?.();\n } catch {\n setError(labels.loginFailed);\n } finally {\n setSendPending(false);\n }\n }\n\n // Switch login mode while carrying the typed email between the two forms.\n function handleModeChange(value: LoginMode): void {\n if (value === \"code\") {\n if (passwordEmail) setCodeEmail(passwordEmail);\n } else if (codeEmail) {\n setPasswordEmail(codeEmail);\n }\n setError(null);\n setMode(value);\n }\n\n const showOAuth = (oauthProviders?.length ?? 0) > 0;\n\n return (\n <Card className=\"w-full shadow-sm\">\n <CardHeader>\n <CardTitle className=\"text-xl\">{labels.title}</CardTitle>\n <CardDescription>{labels.description}</CardDescription>\n </CardHeader>\n <CardContent>\n {notices}\n\n <Tabs value={mode} onValueChange={(value) => handleModeChange(value as LoginMode)} className=\"mb-6\">\n <TabsList className=\"w-full\">\n <TabsTrigger value=\"password\">{labels.tabPassword}</TabsTrigger>\n <TabsTrigger value=\"code\">{labels.tabVerificationCode}</TabsTrigger>\n </TabsList>\n </Tabs>\n\n {/* MFA challenge — primary factor accepted, TOTP code still required */}\n {mfaToken && (\n <TotpChallenge\n labels={labels}\n isPending={pending}\n onSubmit={(totpCode) => void submit({ totpToken: mfaToken, code: totpCode })}\n onBack={() => {\n setError(null);\n setMfaToken(null);\n }}\n />\n )}\n\n {/* Password login form. method=\"post\" keeps a native submit (before\n hydration) from serializing credentials into the query string. */}\n {mode === \"password\" && !mfaToken && (\n <form method=\"post\" onSubmit={onPasswordSubmit} noValidate className=\"space-y-5\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"login-page-email\">{labels.email}</Label>\n <div className=\"relative\">\n <Input\n id=\"login-page-email\"\n autoComplete=\"email\"\n value={passwordEmail}\n onChange={(event) => setPasswordEmail(event.target.value)}\n className=\"pr-10\"\n />\n {passwordEmail && (\n <button\n type=\"button\"\n onClick={() => setPasswordEmail(\"\")}\n className=\"absolute top-1/2 right-2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n aria-label={labels.clearEmail}\n >\n <ClearIcon />\n </button>\n )}\n </div>\n {passwordErrors.email && <p className=\"text-sm text-destructive\">{passwordErrors.email}</p>}\n </div>\n\n <div className=\"space-y-2\">\n <Label htmlFor=\"login-page-password\">{labels.password}</Label>\n <div className=\"relative\">\n <Input\n id=\"login-page-password\"\n type={showPassword ? \"text\" : \"password\"}\n autoComplete=\"current-password\"\n value={password}\n onChange={(event) => setPasswordValue(event.target.value)}\n className=\"pr-20\"\n />\n <div className=\"absolute top-1/2 right-2 flex -translate-y-1/2 items-center gap-1\">\n {password && (\n <button\n type=\"button\"\n onClick={() => setPasswordValue(\"\")}\n className=\"text-muted-foreground hover:text-foreground\"\n aria-label={labels.clearPassword}\n >\n <ClearIcon />\n </button>\n )}\n <button\n type=\"button\"\n onClick={() => setShowPassword((prev) => !prev)}\n className=\"text-muted-foreground hover:text-foreground\"\n aria-label={showPassword ? labels.hidePassword : labels.showPassword}\n >\n {showPassword ? <EyeOffIcon /> : <EyeIcon />}\n </button>\n </div>\n </div>\n {passwordErrors.password && <p className=\"text-sm text-destructive\">{passwordErrors.password}</p>}\n </div>\n\n {error && <p className=\"text-sm text-destructive\">{error}</p>}\n\n <Button type=\"submit\" className=\"w-full\" disabled={pending}>\n {pending ? <Spinner /> : labels.submit}\n </Button>\n </form>\n )}\n\n {/* Verification code login form */}\n {mode === \"code\" && !mfaToken && (\n <form method=\"post\" onSubmit={onCodeSubmit} noValidate className=\"space-y-5\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"login-page-code-email\">{labels.email}</Label>\n <div className=\"relative\">\n <Input\n id=\"login-page-code-email\"\n autoComplete=\"email\"\n value={codeEmail}\n onChange={(event) => setCodeEmail(event.target.value)}\n className=\"pr-10\"\n />\n {codeEmail && (\n <button\n type=\"button\"\n onClick={() => setCodeEmail(\"\")}\n className=\"absolute top-1/2 right-2 -translate-y-1/2 text-muted-foreground hover:text-foreground\"\n aria-label={labels.clearEmail}\n >\n <ClearIcon />\n </button>\n )}\n </div>\n {codeErrors.email && <p className=\"text-sm text-destructive\">{codeErrors.email}</p>}\n </div>\n\n <div className=\"space-y-2\">\n <Label htmlFor=\"login-page-code\">{labels.verificationCode}</Label>\n <div className=\"relative\">\n <Input\n id=\"login-page-code\"\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n value={code}\n onChange={(event) => setCode(event.target.value.replace(/\\D/g, \"\").slice(0, CODE_LENGTH))}\n className=\"pr-32\"\n />\n <div className=\"absolute top-1/2 right-2 flex -translate-y-1/2 items-center gap-2\">\n {code && (\n <button\n type=\"button\"\n onClick={() => setCode(\"\")}\n className=\"text-muted-foreground hover:text-foreground\"\n aria-label={labels.clearCode}\n >\n <ClearIcon />\n </button>\n )}\n <Button\n type=\"button\"\n variant=\"link\"\n size=\"sm\"\n className=\"h-auto p-0 text-xs font-normal\"\n onClick={() => void handleSendCode()}\n disabled={secondsLeft > 0 || sendPending}\n >\n {sendPending ? <Spinner /> : secondsLeft > 0 ? `${secondsLeft}s` : labels.getCode}\n </Button>\n </div>\n </div>\n {codeErrors.code && <p className=\"text-sm text-destructive\">{codeErrors.code}</p>}\n </div>\n\n {error && <p className=\"text-sm text-destructive\">{error}</p>}\n\n <Button type=\"submit\" className=\"w-full\" disabled={pending}>\n {pending ? <Spinner /> : labels.submit}\n </Button>\n </form>\n )}\n\n {/* Third-party entries */}\n {showOAuth && (\n <div className=\"mt-6\">\n <div className=\"relative mb-4\">\n <div className=\"absolute inset-0 flex items-center\">\n <span className=\"w-full border-t\" />\n </div>\n <div className=\"relative flex justify-center text-xs uppercase\">\n <span className=\"bg-card px-2 text-muted-foreground\">{labels.orContinueWith}</span>\n </div>\n </div>\n {oauthProviders?.map((provider, index) => (\n <Button key={provider.id} asChild variant=\"outline\" className={index === 0 ? \"w-full\" : \"mt-3 w-full\"}>\n <a href={provider.href}>\n {provider.icon && <span className=\"mr-2 inline-flex items-center\">{provider.icon}</span>}\n {provider.label}\n </a>\n </Button>\n ))}\n </div>\n )}\n </CardContent>\n </Card>\n );\n}\n\ninterface TotpChallengeProps {\n labels: LoginLabels;\n isPending: boolean;\n onSubmit: (code: string) => void;\n onBack: () => void;\n}\n\nfunction TotpChallenge({ labels, isPending, onSubmit, onBack }: TotpChallengeProps) {\n const [totpCode, setTotpCode] = useState(\"\");\n\n return (\n <form\n method=\"post\"\n onSubmit={(event) => {\n event.preventDefault();\n if (totpCode.length === CODE_LENGTH) onSubmit(totpCode);\n }}\n noValidate\n className=\"space-y-5\"\n >\n <div className=\"space-y-2\">\n <Label htmlFor=\"login-page-totp\">{labels.totpLabel}</Label>\n <Input\n id=\"login-page-totp\"\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n value={totpCode}\n onChange={(event) => setTotpCode(event.target.value.replace(/\\D/g, \"\").slice(0, CODE_LENGTH))}\n placeholder=\"123456\"\n autoFocus\n />\n <p className=\"text-xs text-muted-foreground\">{labels.totpHint}</p>\n </div>\n\n <Button type=\"submit\" className=\"w-full\" disabled={isPending || totpCode.length !== CODE_LENGTH}>\n {isPending ? <Spinner /> : labels.totpSubmit}\n </Button>\n <Button type=\"button\" variant=\"link\" size=\"sm\" className=\"w-full\" onClick={onBack}>\n {labels.back}\n </Button>\n </form>\n );\n}\n",
72
+ "type": "registry:block"
73
+ }
74
+ ]
75
+ }
@@ -0,0 +1,37 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "framework": "^1.7.0",
4
+ "entry": "src/modules/preferences-settings/index.ts",
5
+ "labels": [
6
+ "languageTitle",
7
+ "languageDesc",
8
+ "themeTitle",
9
+ "themeDesc",
10
+ "themeLight",
11
+ "themeDark",
12
+ "themeSystem",
13
+ "timezoneTitle",
14
+ "timezoneDesc",
15
+ "timezonePlaceholder",
16
+ "useBrowserTimezone",
17
+ "saveTimezone",
18
+ "updateFailed"
19
+ ],
20
+ "ports": [
21
+ "saveLanguage",
22
+ "saveTheme",
23
+ "saveTimezone"
24
+ ],
25
+ "ui": [
26
+ "button",
27
+ "card",
28
+ "input",
29
+ "label",
30
+ "select"
31
+ ],
32
+ "states": [
33
+ "loading",
34
+ "error",
35
+ "ready"
36
+ ]
37
+ }
@@ -0,0 +1,62 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/r/registry-item.json",
3
+ "name": "preferences-settings",
4
+ "type": "registry:block",
5
+ "title": "Preferences settings cards",
6
+ "description": "Account display preferences: interface language, theme and timezone. Persistence and the side effects of each change (locale cookie, theme class, cache refresh) stay in the host.",
7
+ "postInstall": "Render <PreferencesSettings labels={...} values={...} languages={...} port={...} /> inside your settings shell. The host supplies translated labels and language options, a saveLanguage/saveTheme/saveTimezone port, and applies the changed preference from the on* callbacks. Requires the shadcn ui primitives button, card, input, label and select.",
8
+ "x-fewbie.contract": {
9
+ "version": "1.0.0",
10
+ "framework": "^1.7.0",
11
+ "entry": "src/modules/preferences-settings/index.ts",
12
+ "labels": [
13
+ "languageTitle",
14
+ "languageDesc",
15
+ "themeTitle",
16
+ "themeDesc",
17
+ "themeLight",
18
+ "themeDark",
19
+ "themeSystem",
20
+ "timezoneTitle",
21
+ "timezoneDesc",
22
+ "timezonePlaceholder",
23
+ "useBrowserTimezone",
24
+ "saveTimezone",
25
+ "updateFailed"
26
+ ],
27
+ "ports": [
28
+ "saveLanguage",
29
+ "saveTheme",
30
+ "saveTimezone"
31
+ ],
32
+ "ui": [
33
+ "button",
34
+ "card",
35
+ "input",
36
+ "label",
37
+ "select"
38
+ ],
39
+ "states": [
40
+ "loading",
41
+ "error",
42
+ "ready"
43
+ ]
44
+ },
45
+ "files": [
46
+ {
47
+ "path": "src/modules/preferences-settings/index.ts",
48
+ "content": "export { PreferencesSettings } from \"./preferences-settings\";\nexport type {\n PreferencesLanguageOption,\n PreferencesSettingsLabels,\n PreferencesSettingsPort,\n PreferencesSettingsProps,\n PreferencesSettingsValues,\n ThemePreferenceValue,\n} from \"./types\";\n",
49
+ "type": "registry:block"
50
+ },
51
+ {
52
+ "path": "src/modules/preferences-settings/types.ts",
53
+ "content": "export type ThemePreferenceValue = \"LIGHT\" | \"DARK\" | \"SYSTEM\";\n\nexport interface PreferencesLanguageOption {\n value: string;\n label: string;\n}\n\n/**\n * Every string the cards render. The host supplies translated copy, including\n * the labels of the language options it passes in.\n */\nexport interface PreferencesSettingsLabels {\n languageTitle: string;\n languageDesc: string;\n themeTitle: string;\n themeDesc: string;\n themeLight: string;\n themeDark: string;\n themeSystem: string;\n timezoneTitle: string;\n timezoneDesc: string;\n timezonePlaceholder: string;\n useBrowserTimezone: string;\n saveTimezone: string;\n updateFailed: string;\n}\n\nexport interface PreferencesSettingsValues {\n language: string;\n theme: ThemePreferenceValue;\n timezone: string;\n}\n\n/**\n * Host-owned write path. The module never calls fetch, a router or a toast\n * library: the host persists each preference and decides how to apply it.\n */\nexport interface PreferencesSettingsPort {\n saveLanguage(language: string): Promise<void>;\n saveTheme(theme: ThemePreferenceValue): Promise<void>;\n saveTimezone(timezone: string): Promise<void>;\n}\n\nexport interface PreferencesSettingsProps {\n labels: PreferencesSettingsLabels;\n values: PreferencesSettingsValues;\n /** Languages the host ships dictionaries for. */\n languages: PreferencesLanguageOption[];\n port: PreferencesSettingsPort;\n /** Called after a language was saved; the host refreshes its locale. */\n onLanguageChanged?: (language: string) => void;\n /** Called after a theme was saved; the host applies it locally. */\n onThemeChanged?: (theme: ThemePreferenceValue) => void;\n /** Called after a timezone was saved; the host refreshes its cache. */\n onTimezoneChanged?: (timezone: string) => void;\n}\n",
54
+ "type": "registry:block"
55
+ },
56
+ {
57
+ "path": "src/modules/preferences-settings/preferences-settings.tsx",
58
+ "content": "\"use client\";\n\nimport { useState } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from \"@/components/ui/select\";\nimport type { PreferencesSettingsProps, ThemePreferenceValue } from \"./types\";\n\nfunction Spinner() {\n return (\n <span\n aria-hidden=\"true\"\n className=\"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent\"\n />\n );\n}\n\nfunction SunIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"4\" />\n <path d=\"M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4\" />\n </svg>\n );\n}\n\nfunction MoonIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <path d=\"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8Z\" />\n </svg>\n );\n}\n\nfunction MonitorIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <rect x=\"2\" y=\"3\" width=\"20\" height=\"14\" rx=\"2\" />\n <path d=\"M8 21h8M12 17v4\" />\n </svg>\n );\n}\n\nfunction SaveIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <path d=\"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2Z\" />\n <path d=\"M17 21v-8H7v8M7 3v5h8\" />\n </svg>\n );\n}\n\n/**\n * Account display preferences: interface language, theme and timezone. The\n * host owns transport and the side effects of each change (locale cookie,\n * theme class, caching), which enter through `port` and the `on*` callbacks.\n */\nexport function PreferencesSettings({\n labels,\n values,\n languages,\n port,\n onLanguageChanged,\n onThemeChanged,\n onTimezoneChanged,\n}: PreferencesSettingsProps) {\n const [timezone, setTimezone] = useState(values.timezone);\n // Re-seed when the host supplies a different account, comparing values (not\n // object identity) so a parent re-render never overwrites in-progress edits.\n const [seedTimezone, setSeedTimezone] = useState(values.timezone);\n if (values.timezone !== seedTimezone) {\n setSeedTimezone(values.timezone);\n setTimezone(values.timezone);\n }\n\n const [languagePending, setLanguagePending] = useState(false);\n const [themePending, setThemePending] = useState(false);\n const [timezonePending, setTimezonePending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n async function handleLanguage(value: string): Promise<void> {\n if (languagePending) return;\n setLanguagePending(true);\n setError(null);\n try {\n await port.saveLanguage(value);\n onLanguageChanged?.(value);\n } catch {\n setError(labels.updateFailed);\n } finally {\n setLanguagePending(false);\n }\n }\n\n async function handleTheme(value: ThemePreferenceValue): Promise<void> {\n if (themePending) return;\n setThemePending(true);\n setError(null);\n try {\n await port.saveTheme(value);\n onThemeChanged?.(value);\n } catch {\n setError(labels.updateFailed);\n } finally {\n setThemePending(false);\n }\n }\n\n async function handleTimezone(): Promise<void> {\n if (timezonePending) return;\n setTimezonePending(true);\n setError(null);\n try {\n await port.saveTimezone(timezone.trim());\n onTimezoneChanged?.(timezone.trim());\n } catch {\n setError(labels.updateFailed);\n } finally {\n setTimezonePending(false);\n }\n }\n\n // Read the browser zone only inside the click handler: resolving it during\n // render would differ between the server and the browser.\n function useBrowserTimezone(): void {\n setTimezone(Intl.DateTimeFormat().resolvedOptions().timeZone);\n }\n\n const themeOptions: { value: ThemePreferenceValue; label: string; icon: React.ReactNode }[] = [\n { value: \"LIGHT\", label: labels.themeLight, icon: <SunIcon /> },\n { value: \"DARK\", label: labels.themeDark, icon: <MoonIcon /> },\n { value: \"SYSTEM\", label: labels.themeSystem, icon: <MonitorIcon /> },\n ];\n\n return (\n <div className=\"grid max-w-3xl gap-6\">\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">{labels.languageTitle}</CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-3\">\n <p className=\"text-sm text-muted-foreground\">{labels.languageDesc}</p>\n <Select\n value={values.language}\n onValueChange={(value) => void handleLanguage(value)}\n disabled={languagePending}\n >\n <SelectTrigger id=\"preferences-settings-language\" aria-label={labels.languageTitle} className=\"w-60\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n {languages.map((option) => (\n <SelectItem key={option.value} value={option.value}>\n {option.label}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">{labels.themeTitle}</CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-3\">\n <p className=\"text-sm text-muted-foreground\">{labels.themeDesc}</p>\n <div className=\"flex flex-wrap gap-2\">\n {themeOptions.map((option) => {\n const active = values.theme === option.value;\n return (\n <Button\n key={option.value}\n type=\"button\"\n variant={active ? \"default\" : \"outline\"}\n aria-pressed={active}\n disabled={themePending}\n onClick={() => void handleTheme(option.value)}\n >\n {option.icon}\n {option.label}\n </Button>\n );\n })}\n </div>\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">{labels.timezoneTitle}</CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">{labels.timezoneDesc}</p>\n <div className=\"space-y-2\">\n <Label htmlFor=\"preferences-settings-timezone\">{labels.timezoneTitle}</Label>\n <div className=\"flex flex-wrap items-center gap-2\">\n <Input\n id=\"preferences-settings-timezone\"\n value={timezone}\n onChange={(event) => setTimezone(event.target.value)}\n placeholder={labels.timezonePlaceholder}\n className=\"w-72\"\n disabled={timezonePending}\n />\n <Button\n type=\"button\"\n onClick={() => void handleTimezone()}\n disabled={timezonePending || timezone.trim() === \"\"}\n >\n {timezonePending ? <Spinner /> : <SaveIcon />}\n {labels.saveTimezone}\n </Button>\n <Button type=\"button\" variant=\"outline\" onClick={useBrowserTimezone} disabled={timezonePending}>\n {labels.useBrowserTimezone}\n </Button>\n </div>\n </div>\n </CardContent>\n </Card>\n\n {error && <p className=\"text-sm text-destructive\">{error}</p>}\n </div>\n );\n}\n",
59
+ "type": "registry:block"
60
+ }
61
+ ]
62
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "framework": "^1.7.0",
4
+ "entry": "src/modules/profile-settings/index.ts",
5
+ "labels": [
6
+ "personalInfo",
7
+ "firstName",
8
+ "middleName",
9
+ "lastName",
10
+ "displayName",
11
+ "displayNamePlaceholder",
12
+ "saveChanges",
13
+ "email",
14
+ "saveFailed"
15
+ ],
16
+ "ports": [
17
+ "onSave"
18
+ ],
19
+ "ui": [
20
+ "button",
21
+ "card",
22
+ "input",
23
+ "label"
24
+ ],
25
+ "states": [
26
+ "loading",
27
+ "error",
28
+ "ready"
29
+ ]
30
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/r/registry-item.json",
3
+ "name": "profile-settings",
4
+ "type": "registry:block",
5
+ "title": "Profile settings card",
6
+ "description": "Account profile card: first, middle and last name plus the display name, with a host-owned save port. Data loading, persistence and toasts stay in the host.",
7
+ "postInstall": "Render <ProfileSettings labels={...} profile={...} onSave={...} /> inside your settings shell. The host supplies translated labels, the current account values and a save function that persists them and toasts. Requires the shadcn ui primitives button, card, input and label.",
8
+ "x-fewbie.contract": {
9
+ "version": "1.0.0",
10
+ "framework": "^1.7.0",
11
+ "entry": "src/modules/profile-settings/index.ts",
12
+ "labels": [
13
+ "personalInfo",
14
+ "firstName",
15
+ "middleName",
16
+ "lastName",
17
+ "displayName",
18
+ "displayNamePlaceholder",
19
+ "saveChanges",
20
+ "email",
21
+ "saveFailed"
22
+ ],
23
+ "ports": [
24
+ "onSave"
25
+ ],
26
+ "ui": [
27
+ "button",
28
+ "card",
29
+ "input",
30
+ "label"
31
+ ],
32
+ "states": [
33
+ "loading",
34
+ "error",
35
+ "ready"
36
+ ]
37
+ },
38
+ "files": [
39
+ {
40
+ "path": "src/modules/profile-settings/index.ts",
41
+ "content": "export { ProfileSettings } from \"./profile-settings\";\nexport type { ProfileSettingsLabels, ProfileSettingsProps, ProfileSettingsValues } from \"./types\";\n",
42
+ "type": "registry:block"
43
+ },
44
+ {
45
+ "path": "src/modules/profile-settings/types.ts",
46
+ "content": "/**\n * Every string the card renders. The host supplies translated copy.\n */\nexport interface ProfileSettingsLabels {\n personalInfo: string;\n firstName: string;\n middleName: string;\n lastName: string;\n displayName: string;\n displayNamePlaceholder: string;\n saveChanges: string;\n email: string;\n saveFailed: string;\n}\n\nexport interface ProfileSettingsValues {\n name: string;\n firstName: string;\n middleName: string;\n lastName: string;\n email?: string;\n}\n\n/**\n * Host-owned write path. The module never calls fetch or a toast library: the\n * host persists the values and decides how to report the outcome.\n */\nexport interface ProfileSettingsProps {\n labels: ProfileSettingsLabels;\n /** Current account values; the form re-seeds when these change. */\n profile: ProfileSettingsValues;\n /** Persist the edited values; the host toasts and refreshes its cache. */\n onSave(values: ProfileSettingsValues): Promise<void>;\n}\n",
47
+ "type": "registry:block"
48
+ },
49
+ {
50
+ "path": "src/modules/profile-settings/profile-settings.tsx",
51
+ "content": "\"use client\";\n\nimport { useState } from \"react\";\n\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport type { ProfileSettingsProps, ProfileSettingsValues } from \"./types\";\n\nfunction Spinner() {\n return (\n <span\n aria-hidden=\"true\"\n className=\"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent\"\n />\n );\n}\n\nfunction SaveIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <path d=\"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2Z\" />\n <path d=\"M17 21v-8H7v8M7 3v5h8\" />\n </svg>\n );\n}\n\nfunction sameValues(left: ProfileSettingsValues, right: ProfileSettingsValues): boolean {\n return (\n left.name === right.name &&\n left.firstName === right.firstName &&\n left.middleName === right.middleName &&\n left.lastName === right.lastName &&\n left.email === right.email\n );\n}\n\n/**\n * Account profile card: first/middle/last name plus the display name. The host\n * owns data loading, persistence and toasts; the module only edits the values.\n */\nexport function ProfileSettings({ labels, profile, onSave }: ProfileSettingsProps) {\n const [form, setForm] = useState<ProfileSettingsValues>(profile);\n // Re-seed when the host supplies a different account, comparing values (not\n // object identity) so a parent re-render never overwrites in-progress edits.\n const [seed, setSeed] = useState<ProfileSettingsValues>(profile);\n if (!sameValues(profile, seed)) {\n setSeed(profile);\n setForm(profile);\n }\n\n const [pending, setPending] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n function updateField(field: keyof ProfileSettingsValues, value: string): void {\n setForm((prev) => ({ ...prev, [field]: value }));\n }\n\n async function handleSave(): Promise<void> {\n if (pending) return;\n setPending(true);\n setError(null);\n try {\n await onSave(form);\n } catch {\n setError(labels.saveFailed);\n } finally {\n setPending(false);\n }\n }\n\n return (\n <Card>\n <CardHeader>\n <CardTitle className=\"text-base\">{labels.personalInfo}</CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n <div className=\"grid gap-4 sm:grid-cols-3\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"profile-settings-first-name\">{labels.firstName}</Label>\n <Input\n id=\"profile-settings-first-name\"\n value={form.firstName}\n onChange={(event) => updateField(\"firstName\", event.target.value)}\n placeholder={labels.firstName}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"profile-settings-middle-name\">{labels.middleName}</Label>\n <Input\n id=\"profile-settings-middle-name\"\n value={form.middleName}\n onChange={(event) => updateField(\"middleName\", event.target.value)}\n placeholder={labels.middleName}\n />\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"profile-settings-last-name\">{labels.lastName}</Label>\n <Input\n id=\"profile-settings-last-name\"\n value={form.lastName}\n onChange={(event) => updateField(\"lastName\", event.target.value)}\n placeholder={labels.lastName}\n />\n </div>\n </div>\n\n <div className=\"space-y-2\">\n <Label htmlFor=\"profile-settings-name\">{labels.displayName}</Label>\n <Input\n id=\"profile-settings-name\"\n value={form.name}\n onChange={(event) => updateField(\"name\", event.target.value)}\n placeholder={labels.displayNamePlaceholder}\n />\n </div>\n\n {error && <p className=\"text-sm text-destructive\">{error}</p>}\n\n <div className=\"flex items-center gap-3 border-t pt-4\">\n <Button type=\"button\" onClick={() => void handleSave()} disabled={pending}>\n {pending ? <Spinner /> : <SaveIcon />}\n {labels.saveChanges}\n </Button>\n <p className=\"text-xs text-muted-foreground\">\n {labels.email}: {profile.email ?? \"—\"}\n </p>\n </div>\n </CardContent>\n </Card>\n );\n}\n",
52
+ "type": "registry:block"
53
+ }
54
+ ]
55
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "framework": "^1.7.0",
4
+ "entry": "src/modules/security-settings/index.ts",
5
+ "labels": [
6
+ "activeSessions",
7
+ "loadingSessions",
8
+ "loadSessionsFailed",
9
+ "noSessions",
10
+ "unknownDevice",
11
+ "thisDevice",
12
+ "signOutSession",
13
+ "twoFactorTitle",
14
+ "statusEnabled",
15
+ "statusDisabled",
16
+ "twoFactorDesc",
17
+ "qrAlt",
18
+ "scanQr",
19
+ "enterCode",
20
+ "confirmEnable",
21
+ "currentPassword",
22
+ "passwordPlaceholder",
23
+ "or",
24
+ "authenticatorCode",
25
+ "disable",
26
+ "disableTwoFactor",
27
+ "setupWithApp",
28
+ "cancel",
29
+ "retry",
30
+ "actionFailed"
31
+ ],
32
+ "ports": [
33
+ "listSessions",
34
+ "revokeSession",
35
+ "setupTwoFactor",
36
+ "enableTwoFactor",
37
+ "disableTwoFactor"
38
+ ],
39
+ "ui": [
40
+ "badge",
41
+ "button",
42
+ "card",
43
+ "input",
44
+ "label"
45
+ ],
46
+ "states": [
47
+ "loading",
48
+ "error",
49
+ "empty",
50
+ "ready"
51
+ ]
52
+ }
@@ -0,0 +1,77 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/r/registry-item.json",
3
+ "name": "security-settings",
4
+ "type": "registry:block",
5
+ "title": "Security settings cards",
6
+ "description": "Account security cards: active sessions with per-row sign-out, and authenticator-app enrollment with a QR code and enable/disable flows. Transport and cache invalidation stay in the host.",
7
+ "postInstall": "Render <SecuritySettings labels={...} twoFactorEnabled={...} port={...} /> inside your settings shell. The host supplies translated labels, a sessions/two-factor port and an optional formatDateTime; onSessionsChanged/onTwoFactorChanged let it refresh its cache. Requires the shadcn ui primitives badge, button, card, input and label.",
8
+ "x-fewbie.contract": {
9
+ "version": "1.0.0",
10
+ "framework": "^1.7.0",
11
+ "entry": "src/modules/security-settings/index.ts",
12
+ "labels": [
13
+ "activeSessions",
14
+ "loadingSessions",
15
+ "loadSessionsFailed",
16
+ "noSessions",
17
+ "unknownDevice",
18
+ "thisDevice",
19
+ "signOutSession",
20
+ "twoFactorTitle",
21
+ "statusEnabled",
22
+ "statusDisabled",
23
+ "twoFactorDesc",
24
+ "qrAlt",
25
+ "scanQr",
26
+ "enterCode",
27
+ "confirmEnable",
28
+ "currentPassword",
29
+ "passwordPlaceholder",
30
+ "or",
31
+ "authenticatorCode",
32
+ "disable",
33
+ "disableTwoFactor",
34
+ "setupWithApp",
35
+ "cancel",
36
+ "retry",
37
+ "actionFailed"
38
+ ],
39
+ "ports": [
40
+ "listSessions",
41
+ "revokeSession",
42
+ "setupTwoFactor",
43
+ "enableTwoFactor",
44
+ "disableTwoFactor"
45
+ ],
46
+ "ui": [
47
+ "badge",
48
+ "button",
49
+ "card",
50
+ "input",
51
+ "label"
52
+ ],
53
+ "states": [
54
+ "loading",
55
+ "error",
56
+ "empty",
57
+ "ready"
58
+ ]
59
+ },
60
+ "files": [
61
+ {
62
+ "path": "src/modules/security-settings/index.ts",
63
+ "content": "export { SecuritySettings } from \"./security-settings\";\nexport type {\n SecuritySession,\n SecuritySettingsLabels,\n SecuritySettingsPort,\n SecuritySettingsProps,\n SecurityTwoFactorSetup,\n} from \"./types\";\n",
64
+ "type": "registry:block"
65
+ },
66
+ {
67
+ "path": "src/modules/security-settings/types.ts",
68
+ "content": "/**\n * Every string the cards render. The host supplies translated copy.\n */\nexport interface SecuritySettingsLabels {\n activeSessions: string;\n loadingSessions: string;\n loadSessionsFailed: string;\n noSessions: string;\n unknownDevice: string;\n thisDevice: string;\n signOutSession: string;\n twoFactorTitle: string;\n statusEnabled: string;\n statusDisabled: string;\n twoFactorDesc: string;\n qrAlt: string;\n scanQr: string;\n enterCode: string;\n confirmEnable: string;\n currentPassword: string;\n passwordPlaceholder: string;\n or: string;\n authenticatorCode: string;\n disable: string;\n disableTwoFactor: string;\n setupWithApp: string;\n cancel: string;\n retry: string;\n actionFailed: string;\n}\n\n/** One active session row, trimmed to what the card displays. */\nexport interface SecuritySession {\n id: number;\n browser?: string;\n operatingSystem?: string;\n isCurrentSession?: boolean;\n ipAddress?: string;\n city?: string;\n region?: string;\n countryCode?: string;\n createdAt: string;\n}\n\nexport interface SecurityTwoFactorSetup {\n qrCodeDataUrl: string;\n secret: string;\n}\n\n/**\n * Host-owned transport. The module never calls fetch or a query library: the\n * host decides how to reach its backend and what to do after each mutation.\n */\nexport interface SecuritySettingsPort {\n listSessions(): Promise<{ records: SecuritySession[] }>;\n revokeSession(id: number): Promise<void>;\n setupTwoFactor(): Promise<SecurityTwoFactorSetup>;\n enableTwoFactor(code: string): Promise<void>;\n disableTwoFactor(input: { password?: string; code?: string }): Promise<void>;\n}\n\nexport interface SecuritySettingsProps {\n labels: SecuritySettingsLabels;\n /** True when the account already has an authenticator app enrolled. */\n twoFactorEnabled: boolean;\n /**\n * Formats a session timestamp for display. The host owns locale formatting;\n * the module falls back to `toLocaleString` when omitted.\n */\n formatDateTime?: (iso: string) => string;\n port: SecuritySettingsPort;\n /** Called after a session was revoked so the host can refresh its cache. */\n onSessionsChanged?: () => void;\n /** Called after two-factor was enabled or disabled so the host can refresh. */\n onTwoFactorChanged?: () => void;\n}\n",
69
+ "type": "registry:block"
70
+ },
71
+ {
72
+ "path": "src/modules/security-settings/security-settings.tsx",
73
+ "content": "\"use client\";\n\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { Input } from \"@/components/ui/input\";\nimport { Label } from \"@/components/ui/label\";\nimport type { SecuritySession, SecuritySettingsProps, SecurityTwoFactorSetup } from \"./types\";\n\nconst CODE_LENGTH = 6;\n\nfunction Spinner() {\n return (\n <span\n aria-hidden=\"true\"\n className=\"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent\"\n />\n );\n}\n\nfunction MonitorIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <rect x=\"2\" y=\"3\" width=\"20\" height=\"14\" rx=\"2\" />\n <path d=\"M8 21h8M12 17v4\" />\n </svg>\n );\n}\n\nfunction ShieldCheckIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4 text-green-600\"\n >\n <path d=\"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z\" />\n <path d=\"m9 12 2 2 4-4\" />\n </svg>\n );\n}\n\nfunction ShieldOffIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <path d=\"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z\" />\n <path d=\"m4 4 16 16\" />\n </svg>\n );\n}\n\nfunction TrashIcon() {\n return (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"h-4 w-4\"\n >\n <path d=\"M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6M10 11v5M14 11v5\" />\n </svg>\n );\n}\n\n/** Format the location parts carried on a session row. */\nfunction formatLocation(session: SecuritySession): string {\n return [session.city, session.region, session.countryCode].filter(Boolean).join(\", \");\n}\n\n/**\n * Account security cards: active sessions with per-row sign-out, and\n * authenticator-app enrollment. The host owns transport, cache invalidation\n * and toasts; the module only renders and reports through callbacks.\n */\nexport function SecuritySettings({\n labels,\n twoFactorEnabled,\n formatDateTime,\n port,\n onSessionsChanged,\n onTwoFactorChanged,\n}: SecuritySettingsProps) {\n // Keep the port reachable from the mount effect without re-running it when\n // the host re-creates its callback objects on every render.\n const portRef = useRef(port);\n useEffect(() => {\n portRef.current = port;\n }, [port]);\n\n const [sessions, setSessions] = useState<SecuritySession[] | null>(null);\n const [sessionsPending, setSessionsPending] = useState(true);\n const [sessionsFailed, setSessionsFailed] = useState(false);\n const [revokingId, setRevokingId] = useState<number | null>(null);\n const [actionError, setActionError] = useState<string | null>(null);\n\n const [setupData, setSetupData] = useState<SecurityTwoFactorSetup | null>(null);\n const [setupPending, setSetupPending] = useState(false);\n const [enableCode, setEnableCode] = useState(\"\");\n const [enablePending, setEnablePending] = useState(false);\n const [disableMode, setDisableMode] = useState(false);\n const [disablePassword, setDisablePassword] = useState(\"\");\n const [disableCode, setDisableCode] = useState(\"\");\n const [disablePending, setDisablePending] = useState(false);\n\n const loadSessions = useCallback(async (): Promise<void> => {\n try {\n const result = await portRef.current.listSessions();\n setSessions(result.records);\n setSessionsFailed(false);\n } catch {\n setSessionsFailed(true);\n } finally {\n setSessionsPending(false);\n }\n }, []);\n\n useEffect(() => {\n void loadSessions();\n }, [loadSessions]);\n\n function retrySessions(): void {\n setSessionsPending(true);\n setSessionsFailed(false);\n void loadSessions();\n }\n\n const formatDate = formatDateTime ?? ((iso: string) => new Date(iso).toLocaleString());\n\n async function handleRevoke(id: number): Promise<void> {\n if (revokingId !== null) return;\n setRevokingId(id);\n setActionError(null);\n try {\n await port.revokeSession(id);\n onSessionsChanged?.();\n await loadSessions();\n } catch {\n setActionError(labels.actionFailed);\n } finally {\n setRevokingId(null);\n }\n }\n\n async function handleSetup(): Promise<void> {\n if (setupPending) return;\n setSetupPending(true);\n setActionError(null);\n try {\n setSetupData(await port.setupTwoFactor());\n } catch {\n setActionError(labels.actionFailed);\n } finally {\n setSetupPending(false);\n }\n }\n\n async function handleEnable(): Promise<void> {\n if (enablePending) return;\n setEnablePending(true);\n setActionError(null);\n try {\n await port.enableTwoFactor(enableCode);\n setSetupData(null);\n setEnableCode(\"\");\n onTwoFactorChanged?.();\n } catch {\n setActionError(labels.actionFailed);\n } finally {\n setEnablePending(false);\n }\n }\n\n async function handleDisable(): Promise<void> {\n if (disablePending) return;\n setDisablePending(true);\n setActionError(null);\n try {\n await port.disableTwoFactor(disablePassword ? { password: disablePassword } : { code: disableCode });\n setDisableMode(false);\n setDisablePassword(\"\");\n setDisableCode(\"\");\n onTwoFactorChanged?.();\n } catch {\n setActionError(labels.actionFailed);\n } finally {\n setDisablePending(false);\n }\n }\n\n return (\n <div className=\"grid max-w-3xl gap-6\">\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center gap-2 text-base\">\n <MonitorIcon />\n {labels.activeSessions}\n </CardTitle>\n </CardHeader>\n <CardContent>\n {sessionsPending ? (\n <div className=\"flex items-center gap-2 text-sm text-muted-foreground\">\n <Spinner />\n {labels.loadingSessions}\n </div>\n ) : sessionsFailed ? (\n <div className=\"flex flex-wrap items-center gap-2 text-sm text-destructive\">\n {labels.loadSessionsFailed}\n <Button type=\"button\" variant=\"link\" size=\"sm\" className=\"h-auto p-0\" onClick={retrySessions}>\n {labels.retry}\n </Button>\n </div>\n ) : !sessions?.length ? (\n <p className=\"text-sm text-muted-foreground\">{labels.noSessions}</p>\n ) : (\n <ul className=\"divide-y\">\n {sessions.map((session) => (\n <li key={session.id} className=\"flex items-center justify-between gap-4 py-3 first:pt-0 last:pb-0\">\n <div className=\"min-w-0\">\n <div className=\"flex items-center gap-2\">\n <p className=\"truncate text-sm font-medium\">\n {[session.browser, session.operatingSystem].filter(Boolean).join(\" · \") || labels.unknownDevice}\n </p>\n {session.isCurrentSession && (\n <Badge variant=\"outline\" className=\"border-green-200 bg-green-50 text-green-700\">\n {labels.thisDevice}\n </Badge>\n )}\n </div>\n <p className=\"mt-0.5 truncate text-xs text-muted-foreground\">\n {[session.ipAddress, formatLocation(session)].filter(Boolean).join(\" · \")} ·{\" \"}\n {formatDate(session.createdAt)}\n </p>\n </div>\n {!session.isCurrentSession && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n aria-label={labels.signOutSession}\n disabled={revokingId !== null}\n onClick={() => void handleRevoke(session.id)}\n >\n {revokingId === session.id ? <Spinner /> : <TrashIcon />}\n </Button>\n )}\n </li>\n ))}\n </ul>\n )}\n </CardContent>\n </Card>\n\n <Card>\n <CardHeader>\n <CardTitle className=\"flex items-center justify-between gap-2 text-base\">\n <span className=\"flex items-center gap-2\">\n {twoFactorEnabled ? <ShieldCheckIcon /> : <ShieldOffIcon />}\n {labels.twoFactorTitle}\n </span>\n <Badge variant={twoFactorEnabled ? \"default\" : \"outline\"}>\n {twoFactorEnabled ? labels.statusEnabled : labels.statusDisabled}\n </Badge>\n </CardTitle>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n <p className=\"text-sm text-muted-foreground\">{labels.twoFactorDesc}</p>\n\n {/* Enrollment flow: QR code plus code confirmation */}\n {setupData && (\n <div className=\"space-y-4 rounded-md border bg-muted/30 p-4\">\n <div className=\"flex flex-col items-center gap-3 sm:flex-row sm:items-start\">\n {/* eslint-disable-next-line @next/next/no-img-element */}\n <img\n src={setupData.qrCodeDataUrl}\n alt={labels.qrAlt}\n className=\"h-40 w-40 rounded-md border bg-white p-2\"\n />\n <div className=\"min-w-0 space-y-2\">\n <p className=\"text-xs text-muted-foreground\">{labels.scanQr}</p>\n <p className=\"break-all rounded bg-background p-2 font-mono text-xs\">{setupData.secret}</p>\n </div>\n </div>\n <div className=\"space-y-2\">\n <Label htmlFor=\"security-settings-enable-code\">{labels.enterCode}</Label>\n <Input\n id=\"security-settings-enable-code\"\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n value={enableCode}\n onChange={(event) => setEnableCode(event.target.value.replace(/\\D/g, \"\").slice(0, CODE_LENGTH))}\n placeholder=\"123456\"\n />\n </div>\n <div className=\"flex justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => {\n setSetupData(null);\n setEnableCode(\"\");\n }}\n disabled={enablePending}\n >\n {labels.cancel}\n </Button>\n <Button\n type=\"button\"\n onClick={() => void handleEnable()}\n disabled={enablePending || enableCode.length !== CODE_LENGTH}\n >\n {enablePending ? <Spinner /> : labels.confirmEnable}\n </Button>\n </div>\n </div>\n )}\n\n {/* Disable flow: prove identity with password or a current code */}\n {disableMode && (\n <div className=\"space-y-4 rounded-md border bg-muted/30 p-4\">\n <div className=\"space-y-2\">\n <Label htmlFor=\"security-settings-disable-password\">{labels.currentPassword}</Label>\n <Input\n id=\"security-settings-disable-password\"\n type=\"password\"\n autoComplete=\"current-password\"\n value={disablePassword}\n onChange={(event) => {\n setDisablePassword(event.target.value);\n setDisableCode(\"\");\n }}\n placeholder={labels.passwordPlaceholder}\n />\n </div>\n <p className=\"text-center text-xs text-muted-foreground\">{labels.or}</p>\n <div className=\"space-y-2\">\n <Label htmlFor=\"security-settings-disable-code\">{labels.authenticatorCode}</Label>\n <Input\n id=\"security-settings-disable-code\"\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n value={disableCode}\n onChange={(event) => {\n setDisableCode(event.target.value.replace(/\\D/g, \"\").slice(0, CODE_LENGTH));\n setDisablePassword(\"\");\n }}\n placeholder=\"123456\"\n />\n </div>\n <div className=\"flex justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => {\n setDisableMode(false);\n setDisablePassword(\"\");\n setDisableCode(\"\");\n }}\n disabled={disablePending}\n >\n {labels.cancel}\n </Button>\n <Button\n type=\"button\"\n variant=\"destructive\"\n onClick={() => void handleDisable()}\n disabled={disablePending || (!disablePassword && disableCode.length !== CODE_LENGTH)}\n >\n {disablePending ? <Spinner /> : labels.disable}\n </Button>\n </div>\n </div>\n )}\n\n {actionError && <p className=\"text-sm text-destructive\">{actionError}</p>}\n\n {/* Idle actions */}\n {!setupData && !disableMode && (\n <div>\n {twoFactorEnabled ? (\n <Button type=\"button\" variant=\"outline\" onClick={() => setDisableMode(true)}>\n {labels.disableTwoFactor}\n </Button>\n ) : (\n <Button type=\"button\" onClick={() => void handleSetup()} disabled={setupPending}>\n {setupPending ? <Spinner /> : labels.setupWithApp}\n </Button>\n )}\n </div>\n )}\n </CardContent>\n </Card>\n </div>\n );\n}\n",
74
+ "type": "registry:block"
75
+ }
76
+ ]
77
+ }
@@ -1,4 +1,6 @@
1
+ export declare const REGISTRY_ITEMS_DIR = "packages/modules";
1
2
  export declare function isRegistryRoot(candidate: string): Promise<boolean>;
3
+ export declare function locateItemsDir(checkout: string): Promise<string | null>;
2
4
  export declare function resolveRegistryRoot(projectRoot?: string): Promise<string>;
3
5
  export interface RegistryContext {
4
6
  root: string;
@@ -3,7 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.REGISTRY_ITEMS_DIR = void 0;
6
7
  exports.isRegistryRoot = isRegistryRoot;
8
+ exports.locateItemsDir = locateItemsDir;
7
9
  exports.resolveRegistryRoot = resolveRegistryRoot;
8
10
  exports.resolveRegistryContext = resolveRegistryContext;
9
11
  const node_crypto_1 = __importDefault(require("node:crypto"));
@@ -13,8 +15,10 @@ const node_path_1 = __importDefault(require("node:path"));
13
15
  const cli_kit_1 = require("@devbie/cli-kit");
14
16
  const modules_file_1 = require("../lib/modules-file");
15
17
  const git_commit_1 = require("../lib/git-commit");
18
+ const types_1 = require("./types");
16
19
  const REGISTRY_PATH_ENV = "FEWBIE_REGISTRY_PATH";
17
20
  const REGISTRY_CACHE_ENV = "FEWBIE_REGISTRY_CACHE_DIR";
21
+ exports.REGISTRY_ITEMS_DIR = "packages/modules";
18
22
  async function isRegistryRoot(candidate) {
19
23
  let entries;
20
24
  try {
@@ -27,7 +31,7 @@ async function isRegistryRoot(candidate) {
27
31
  if (!entry.isDirectory())
28
32
  continue;
29
33
  const hasItem = await promises_1.default
30
- .access(node_path_1.default.join(candidate, entry.name, "item.json"))
34
+ .access(node_path_1.default.join(candidate, entry.name, types_1.REGISTRY_MANIFEST_FILE))
31
35
  .then(() => true)
32
36
  .catch(() => false);
33
37
  if (hasItem)
@@ -35,6 +39,17 @@ async function isRegistryRoot(candidate) {
35
39
  }
36
40
  return false;
37
41
  }
42
+ async function locateItemsDir(checkout) {
43
+ const container = node_path_1.default.join(checkout, exports.REGISTRY_ITEMS_DIR);
44
+ if (await isRegistryRoot(container))
45
+ return container;
46
+ if (await isRegistryRoot(checkout))
47
+ return checkout;
48
+ return null;
49
+ }
50
+ function expectedRegistryShape() {
51
+ return `${node_path_1.default.join(exports.REGISTRY_ITEMS_DIR, "<item>", types_1.REGISTRY_MANIFEST_FILE)} or <item>/${types_1.REGISTRY_MANIFEST_FILE}`;
52
+ }
38
53
  function assertSafeRef(ref) {
39
54
  if (ref.startsWith("-") || /\s/.test(ref)) {
40
55
  throw new cli_kit_1.CliError(`Invalid registry ref '${ref}': pass a branch, tag or commit without whitespace.`);
@@ -63,19 +78,21 @@ async function syncGitRegistry(url, ref) {
63
78
  catch (error) {
64
79
  throw new cli_kit_1.CliError(`Failed to fetch registry ${url}${ref ? `#${ref}` : ""}: ${error.message}`);
65
80
  }
66
- if (!(await isRegistryRoot(cacheDir))) {
67
- throw new cli_kit_1.CliError(`Registry ${url}${ref ? `#${ref}` : ""} contains no <item>/item.json at its root.`);
81
+ const itemsDir = await locateItemsDir(cacheDir);
82
+ if (itemsDir === null) {
83
+ throw new cli_kit_1.CliError(`Registry ${url}${ref ? `#${ref}` : ""} has no items (expected ${expectedRegistryShape()}).`);
68
84
  }
69
- return cacheDir;
85
+ return itemsDir;
70
86
  }
71
87
  async function resolveRegistryRoot(projectRoot) {
72
88
  const override = process.env[REGISTRY_PATH_ENV];
73
89
  if (override) {
74
90
  const candidate = node_path_1.default.resolve(override);
75
- if (!(await isRegistryRoot(candidate))) {
76
- throw new cli_kit_1.CliError(`${REGISTRY_PATH_ENV} '${candidate}' is not a registry root (no <item>/item.json).`);
91
+ const itemsDir = await locateItemsDir(candidate);
92
+ if (itemsDir === null) {
93
+ throw new cli_kit_1.CliError(`${REGISTRY_PATH_ENV} '${candidate}' is not a registry root (no ${expectedRegistryShape()}).`);
77
94
  }
78
- return candidate;
95
+ return itemsDir;
79
96
  }
80
97
  if (projectRoot) {
81
98
  const declaration = await (0, modules_file_1.readRegistryDeclaration)(projectRoot);
@@ -1 +1 @@
1
- {"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/registry/source.ts"],"names":[],"mappings":";;;;;AAoBA,wCAgBC;AAwDD,kDAyBC;AAUD,wDAGC;AAlID,8DAAiC;AACjC,gEAAkC;AAClC,sDAAyB;AACzB,0DAA6B;AAE7B,6CAAoE;AACpE,sDAA8D;AAC9D,kDAAmD;AAGnD,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AAEjD,MAAM,kBAAkB,GAAG,2BAA2B,CAAC;AAQhD,KAAK,UAAU,cAAc,CAAC,SAAiB;IACpD,IAAI,OAAmC,CAAC;IACxC,IAAI,CAAC;QACH,OAAO,GAAG,MAAM,kBAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE;YAAE,SAAS;QACnC,MAAM,OAAO,GAAG,MAAM,kBAAE;aACrB,MAAM,CAAC,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;aACrD,IAAI,CAAC,GAAG,EAAE,CAAC,IAA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E,MAAM,EAAE,MAAM,IAAA,2BAAc,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/F,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { RegistryManifest } from "./types";
1
+ import { type RegistryManifest } from "./types";
2
2
  export interface LoadedItem {
3
3
  manifest: RegistryManifest;
4
4
  files: Array<{
@@ -12,8 +12,9 @@ const node_path_1 = __importDefault(require("node:path"));
12
12
  const colorette_1 = require("colorette");
13
13
  const cli_kit_1 = require("@devbie/cli-kit");
14
14
  const contract_1 = require("./contract");
15
+ const types_1 = require("./types");
15
16
  async function readItemFile(root, name) {
16
- const raw = await promises_1.default.readFile(node_path_1.default.join(root, name, "item.json"), "utf8");
17
+ const raw = await promises_1.default.readFile(node_path_1.default.join(root, name, types_1.REGISTRY_MANIFEST_FILE), "utf8");
17
18
  return JSON.parse(raw);
18
19
  }
19
20
  function warnMissingContract(name) {
@@ -39,7 +40,7 @@ async function listRegistryItemNames(root) {
39
40
  if (!entry.isDirectory())
40
41
  continue;
41
42
  const hasItem = await promises_1.default
42
- .access(node_path_1.default.join(root, entry.name, "item.json"))
43
+ .access(node_path_1.default.join(root, entry.name, types_1.REGISTRY_MANIFEST_FILE))
43
44
  .then(() => true)
44
45
  .catch(() => false);
45
46
  if (hasItem)
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/registry/store.ts"],"names":[],"mappings":";;;;;AA6CA,sDAYC;AAGD,kDAEC;AAoBD,4BAoCC;AAMD,8CA+BC;AA3JD,gEAAkC;AAClC,0DAA6B;AAC7B,yCAAmC;AAEnC,6CAA2C;AAC3C,yCAA2E;AAU3E,KAAK,UAAU,YAAY,CAAC,IAAY,EAAE,IAAY;IACpD,MAAM,GAAG,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,mBAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CA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
+ export declare const REGISTRY_MANIFEST_FILE = "fewbie.module.json";
1
2
  export type RegistryItemType = "registry:lib" | "registry:component" | "registry:block";
2
3
  export interface RegistryFileRef {
3
4
  path: string;
@@ -1,3 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REGISTRY_MANIFEST_FILE = void 0;
4
+ exports.REGISTRY_MANIFEST_FILE = "fewbie.module.json";
3
5
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":";;;AAUa,QAAA,sBAAsB,GAAG,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devbie/fewbie-cli",
3
- "version": "1.10.0",
3
+ "version": "1.12.0",
4
4
  "description": "fewbie frontend framework CLI",
5
5
  "license": "MIT",
6
6
  "author": "worldzhy",
@@ -25,6 +25,8 @@
25
25
  "check:template-drift": "node --import tsx scripts/check-template-drift.ts",
26
26
  "check:template-deps": "node --import tsx scripts/check-template-deps.ts",
27
27
  "check:registry-dist": "node --import tsx scripts/check-registry-dist.ts",
28
+ "registry:sync": "node --import tsx scripts/sync-registry-snapshot.ts",
29
+ "check:registry-snapshot": "node --import tsx scripts/check-registry-snapshot.ts",
28
30
  "prepublishOnly": "npm run build"
29
31
  },
30
32
  "dependencies": {