@rexezuge/web 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 (64) hide show
  1. package/README.md +81 -6
  2. package/dist/Button.d.ts +18 -2
  3. package/dist/Button.d.ts.map +1 -1
  4. package/dist/Button.js +1 -1
  5. package/dist/Button.js.map +3 -3
  6. package/dist/FocusInput.js +1 -1
  7. package/dist/FocusInput.js.map +3 -3
  8. package/dist/LanguageSelector.d.ts +22 -1
  9. package/dist/LanguageSelector.d.ts.map +1 -1
  10. package/dist/LanguageSelector.js +1 -1
  11. package/dist/LanguageSelector.js.map +3 -3
  12. package/dist/Spinner.d.ts +1 -1
  13. package/dist/Spinner.d.ts.map +1 -1
  14. package/dist/Spinner.js +1 -1
  15. package/dist/Spinner.js.map +3 -3
  16. package/dist/api.d.ts +8 -4
  17. package/dist/api.d.ts.map +1 -1
  18. package/dist/api.js +1 -1
  19. package/dist/api.js.map +3 -3
  20. package/dist/bookmarks.d.ts +50 -0
  21. package/dist/bookmarks.d.ts.map +1 -0
  22. package/dist/bookmarks.js +1 -0
  23. package/dist/bookmarks.js.map +7 -0
  24. package/dist/contractClient.d.ts +55 -0
  25. package/dist/contractClient.d.ts.map +1 -0
  26. package/dist/contractClient.js +1 -0
  27. package/dist/contractClient.js.map +7 -0
  28. package/dist/i18n.d.ts +110 -0
  29. package/dist/i18n.d.ts.map +1 -0
  30. package/dist/i18n.js +1 -0
  31. package/dist/i18n.js.map +7 -0
  32. package/dist/index.d.ts +13 -6
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +1 -1
  35. package/dist/index.js.map +3 -3
  36. package/dist/language.d.ts +30 -0
  37. package/dist/language.d.ts.map +1 -0
  38. package/dist/language.js +1 -0
  39. package/dist/language.js.map +7 -0
  40. package/dist/legacyPalette.d.ts +24 -0
  41. package/dist/legacyPalette.d.ts.map +1 -0
  42. package/dist/legacyPalette.js +1 -0
  43. package/dist/legacyPalette.js.map +7 -0
  44. package/dist/styles.css +99 -0
  45. package/dist/theme.d.ts +38 -7
  46. package/dist/theme.d.ts.map +1 -1
  47. package/dist/theme.js +1 -1
  48. package/dist/theme.js.map +3 -3
  49. package/dist/useNotice.d.ts +6 -3
  50. package/dist/useNotice.d.ts.map +1 -1
  51. package/dist/useNotice.js.map +2 -2
  52. package/dist/useResource.d.ts +107 -0
  53. package/dist/useResource.d.ts.map +1 -0
  54. package/dist/useResource.js +1 -0
  55. package/dist/useResource.js.map +7 -0
  56. package/dist/useSpaLanguage.d.ts +71 -39
  57. package/dist/useSpaLanguage.d.ts.map +1 -1
  58. package/dist/useSpaLanguage.js +1 -1
  59. package/dist/useSpaLanguage.js.map +3 -3
  60. package/dist/utils.d.ts +15 -6
  61. package/dist/utils.d.ts.map +1 -1
  62. package/dist/utils.js +1 -1
  63. package/dist/utils.js.map +3 -3
  64. package/package.json +21 -6
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["/**\n * `@rexezuge/web` — the SPA layer of the kit.\n *\n * React primitives, the hooks every app's shell needs, and the one API client.\n * Every export is the converged form of a framework that lived as copies inside\n * the nine consumer repos; see the `## Provenance` block at the top of each\n * module for what it replaced and which copy won.\n *\n * ```ts\n * import { AppPage, Button, Card, createApiClient, useCurrentUser, useNotice, useSpaLanguage } from '@rexezuge/web';\n * ```\n *\n * ## What a consumer must provide\n *\n * - **The CSS variables the class-based components read.** All six Tailwind\n * repos define the same set, so this is usually already present:\n * `--color-accent`, `--color-accent-dim`, `--color-border`,\n * `--color-surface-base`, `--color-surface-1..4`,\n * `--color-text-primary`, `--color-text-secondary`, `--color-text-muted`, and\n * `--color-{success,error,warning,info,neutral}-{bg,text}`.\n * - **`animate-spin`**, for `Spinner` (and therefore `Button`'s busy state).\n * Tailwind ships it; a non-Tailwind app defines the keyframes once.\n * - **A dependency on `@rexezuge/errors`**, which `api.ts` imports for\n * `ServiceError` and the status classes.\n *\n * ## Glyphs in, strings out\n *\n * Three components (`RefreshButton`, `ReadOnlyField`, `TypeToConfirmModal`) take\n * their icon from `lucide-react`, which is why it is a peer rather than a\n * dependency. Everything *sayable* is a prop: no component here calls\n * `useTranslation`, because the app rendering a dialog knows what it says and a\n * kit that hard-codes English for it has taken over the app's string catalogue.\n *\n * The dividing line is deliberate. `Button` keeps using this package's own\n * `Spinner` rather than lucide's `Loader2` — chrome is cheap to draw, iconography\n * is not, and vendoring a glyph's path data freezes it at whatever version was\n * current when it was copied.\n *\n * ## Migrating the copies\n *\n * `codemods/` rewrites the family's `../components/…` imports onto this package\n * for every component converged here, and names the ones it has not. Those\n * imports are **relative**, so this is a separate transform from the\n * `@scope/pkg` one — see `codemods/src/web-components.ts`.\n *\n * ## What is deliberately not here\n *\n * Domain badges (`ConnectionBadge`, `TaskRunStatusBadge`, …), the OAuth\n * `?oauth2=` notice seeding, the D1 bookmark header, WebDAV `207` handling, the\n * authed-first public fallback, and every app's `SUPPORTED_LANGUAGES`. Each had\n * exactly one consumer, so each stays with it — see `constants.ts` and the\n * per-module provenance notes for the list.\n */\n\nexport { Badge, badgeBaseClass, badgeClass, badgeVariantClass } from './Badge.tsx';\nexport type { BadgeProps, BadgeVariant } from './Badge.tsx';\n\nexport { Button, buttonBaseClass, buttonClass, buttonSizeClass, buttonVariantClass } from './Button.tsx';\nexport type { ButtonProps, ButtonSize, ButtonVariant } from './Button.tsx';\n\nexport { Card, cardClass, cardHeaderClass, cardTitleClass, CardHeader, CardTitle } from './Card.tsx';\nexport type { CardHeaderProps, CardProps, CardTitleProps } from './Card.tsx';\n\nexport { FocusInput } from './FocusInput.tsx';\nexport type { FocusInputProps } from './FocusInput.tsx';\n\nexport { Input, Label, Select, Textarea, fieldClass } from './Input.tsx';\nexport type { InputProps, LabelProps, SelectProps, TextareaProps } from './Input.tsx';\n\nexport { LoadingButton } from './LoadingButton.tsx';\nexport type { LoadingButtonProps } from './LoadingButton.tsx';\n\n// Converged from the `ModalShell` / `ConfirmDeleteModal` / `PageState` copies\n// that Durable-DAV, Durable-DAV-Router, Mail-Otter and Edge-Git each shipped.\n// Deliberately dependency-free — labels are props, not `useTranslation` — so\n// adopting these does not require a translation library or an icon set.\nexport { ModalShell } from './ModalShell.tsx';\nexport type { ModalShellProps } from './ModalShell.tsx';\nexport { ConfirmDeleteModal, EmptyState, LoadingSpinner } from './PageState.tsx';\n\n// The second convergence round: page layout, the notice banner, the access\n// page, the language picker, and the two clipboard-bearing controls. Same rule\n// on labels — the app owns its string catalogue. Three of these need\n// `lucide-react`, which is why it is a peer and not a dependency.\nexport { AppPage } from './AppPage.tsx';\nexport type { AppPageProps, AppPageVariant } from './AppPage.tsx';\nexport { PageHeaderCard } from './PageHeaderCard.tsx';\nexport type { PageHeaderCardProps } from './PageHeaderCard.tsx';\nexport { ContextBar } from './ContextBar.tsx';\nexport type { ContextBarProps } from './ContextBar.tsx';\nexport { Unauthorized } from './Unauthorized.tsx';\nexport type { UnauthorizedProps } from './Unauthorized.tsx';\nexport { NoticeBar } from './NoticeBar.tsx';\nexport type { NoticeBarProps, NoticeStatusLabels } from './NoticeBar.tsx';\nexport { LanguageSelector } from './LanguageSelector.tsx';\nexport type { LanguageSelectorProps } from './LanguageSelector.tsx';\nexport { RefreshButton } from './RefreshButton.tsx';\nexport type { RefreshButtonProps } from './RefreshButton.tsx';\nexport { ReadOnlyField } from './ReadOnlyField.tsx';\nexport type { ReadOnlyFieldProps } from './ReadOnlyField.tsx';\nexport { TypeToConfirmModal } from './TypeToConfirmModal.tsx';\nexport type { TypeToConfirmModalProps } from './TypeToConfirmModal.tsx';\nexport { useCopyToClipboard } from './useCopyToClipboard.ts';\nexport type { UseCopyToClipboardResult } from './useCopyToClipboard.ts';\n\nexport { Pagination, clampPage, pageCountFor, pageWindow } from './Pagination.tsx';\nexport type { PaginationLabels, PaginationProps } from './Pagination.tsx';\n\nexport { Spinner } from './Spinner.tsx';\nexport type { SpinnerProps } from './Spinner.tsx';\n\nexport {\n btnBase,\n btnBlueStyle,\n btnGreenStyle,\n btnSmallStyle,\n buttonColors,\n cardStyle,\n inputStyle,\n paginationBtnStyle,\n tableCardStyle,\n tdStyle,\n theme,\n thStyle,\n} from './theme.ts';\n\nexport { cn } from './utils.ts';\nexport type { ClassDictionary, ClassValue } from './utils.ts';\n\nexport { COPY_FEEDBACK_TIMEOUT_MS, NOTICE_TIMEOUT_MS, ZERO_TRUST_AUTHENTICATION_PATH } from './constants.ts';\n\nexport { useNotice } from './useNotice.ts';\nexport type { Notice, NoticeKind, ShowNotice, UseNoticeOptions, UseNoticeResult } from './useNotice.ts';\n\nexport {\n canonicalizeLanguageTag,\n DEFAULT_FALLBACK_LANGUAGE,\n DEFAULT_LANGUAGE_STORAGE_KEY,\n DEFAULT_SUPPORTED_LANGUAGES,\n resolveLanguageTag,\n useSpaLanguage,\n} from './useSpaLanguage.ts';\nexport type { LanguageTag, UseSpaLanguageOptions, UseSpaLanguageResult } from './useSpaLanguage.ts';\n\nexport { CURRENT_USER_PATH, useCurrentUser } from './useCurrentUser.ts';\nexport type { CurrentUser, UseCurrentUserOptions, UseCurrentUserResult } from './useCurrentUser.ts';\n\nexport { buildQuery, createApiClient, HttpStatusError, MAX_ERROR_MESSAGE_LENGTH } from './api.ts';\nexport type { ApiClient, ApiRequestInit, CreateApiClientOptions, FetchFn, QueryParams, QueryValue } from './api.ts';\n"],
5
- "mappings": "AAsDA,OAAS,SAAAA,EAAO,kBAAAC,EAAgB,cAAAC,EAAY,qBAAAC,MAAyB,aAGrE,OAAS,UAAAC,EAAQ,mBAAAC,EAAiB,eAAAC,EAAa,mBAAAC,EAAiB,sBAAAC,MAA0B,cAG1F,OAAS,QAAAC,EAAM,aAAAC,EAAW,mBAAAC,EAAiB,kBAAAC,EAAgB,cAAAC,EAAY,aAAAC,MAAiB,YAGxF,OAAS,cAAAC,MAAkB,kBAG3B,OAAS,SAAAC,EAAO,SAAAC,EAAO,UAAAC,EAAQ,YAAAC,EAAU,cAAAC,MAAkB,aAG3D,OAAS,iBAAAC,MAAqB,qBAO9B,OAAS,cAAAC,MAAkB,kBAE3B,OAAS,sBAAAC,EAAoB,cAAAC,EAAY,kBAAAC,MAAsB,iBAM/D,OAAS,WAAAC,MAAe,eAExB,OAAS,kBAAAC,MAAsB,sBAE/B,OAAS,cAAAC,MAAkB,kBAE3B,OAAS,gBAAAC,MAAoB,oBAE7B,OAAS,aAAAC,MAAiB,iBAE1B,OAAS,oBAAAC,MAAwB,wBAEjC,OAAS,iBAAAC,MAAqB,qBAE9B,OAAS,iBAAAC,MAAqB,qBAE9B,OAAS,sBAAAC,MAA0B,0BAEnC,OAAS,sBAAAC,OAA0B,0BAGnC,OAAS,cAAAC,GAAY,aAAAC,GAAW,gBAAAC,GAAc,cAAAC,OAAkB,kBAGhE,OAAS,WAAAC,OAAe,eAGxB,OACE,WAAAC,GACA,gBAAAC,GACA,iBAAAC,GACA,iBAAAC,GACA,gBAAAC,GACA,aAAAC,GACA,cAAAC,GACA,sBAAAC,GACA,kBAAAC,GACA,WAAAC,GACA,SAAAC,GACA,WAAAC,OACK,aAEP,OAAS,MAAAC,OAAU,aAGnB,OAAS,4BAAAC,GAA0B,qBAAAC,GAAmB,kCAAAC,OAAsC,iBAE5F,OAAS,aAAAC,OAAiB,iBAG1B,OACE,2BAAAC,GACA,6BAAAC,GACA,gCAAAC,GACA,+BAAAC,GACA,sBAAAC,GACA,kBAAAC,OACK,sBAGP,OAAS,qBAAAC,GAAmB,kBAAAC,OAAsB,sBAGlD,OAAS,cAAAC,GAAY,mBAAAC,GAAiB,mBAAAC,GAAiB,4BAAAC,OAAgC",
6
- "names": ["Badge", "badgeBaseClass", "badgeClass", "badgeVariantClass", "Button", "buttonBaseClass", "buttonClass", "buttonSizeClass", "buttonVariantClass", "Card", "cardClass", "cardHeaderClass", "cardTitleClass", "CardHeader", "CardTitle", "FocusInput", "Input", "Label", "Select", "Textarea", "fieldClass", "LoadingButton", "ModalShell", "ConfirmDeleteModal", "EmptyState", "LoadingSpinner", "AppPage", "PageHeaderCard", "ContextBar", "Unauthorized", "NoticeBar", "LanguageSelector", "RefreshButton", "ReadOnlyField", "TypeToConfirmModal", "useCopyToClipboard", "Pagination", "clampPage", "pageCountFor", "pageWindow", "Spinner", "btnBase", "btnBlueStyle", "btnGreenStyle", "btnSmallStyle", "buttonColors", "cardStyle", "inputStyle", "paginationBtnStyle", "tableCardStyle", "tdStyle", "theme", "thStyle", "cn", "COPY_FEEDBACK_TIMEOUT_MS", "NOTICE_TIMEOUT_MS", "ZERO_TRUST_AUTHENTICATION_PATH", "useNotice", "canonicalizeLanguageTag", "DEFAULT_FALLBACK_LANGUAGE", "DEFAULT_LANGUAGE_STORAGE_KEY", "DEFAULT_SUPPORTED_LANGUAGES", "resolveLanguageTag", "useSpaLanguage", "CURRENT_USER_PATH", "useCurrentUser", "buildQuery", "createApiClient", "HttpStatusError", "MAX_ERROR_MESSAGE_LENGTH"]
4
+ "sourcesContent": ["/**\n * `@rexezuge/web` — the SPA layer of the kit.\n *\n * React primitives, the hooks every app's shell needs, and the one API client.\n * Every export is the converged form of a framework that lived as copies inside\n * the nine consumer repos; see the `## Provenance` block at the top of each\n * module for what it replaced and which copy won.\n *\n * ```ts\n * import { AppPage, Button, Card, createApiClient, useCurrentUser, useNotice, useSpaLanguage } from '@rexezuge/web';\n * ```\n *\n * ## What a consumer must provide\n *\n * - **The CSS variables the class-based components read.** Import\n * `@rexezuge/web/styles.css` for defaults (and the source scan), or define\n * them yourself:\n * `--color-accent`, `--color-accent-dim`, `--color-border`,\n * `--color-surface-base`, `--color-surface-1..4`,\n * `--color-text-primary`, `--color-text-secondary`, `--color-text-muted`, and\n * `--color-{success,error,warning,info,neutral}-{bg,text}`.\n * - **`animate-spin`**, for `Spinner` (and therefore `Button`'s busy state).\n * Tailwind ships it; a non-Tailwind app defines the keyframes once.\n * - **A dependency on `@rexezuge/errors`**, which `api.ts` imports for\n * `ServiceError` and the status classes.\n *\n * ## Glyphs in, strings out\n *\n * Three components (`RefreshButton`, `ReadOnlyField`, `TypeToConfirmModal`) take\n * their icon from `lucide-react`, which is why it is a peer rather than a\n * dependency. Everything *sayable* is a prop: no component here calls\n * `useTranslation`, because the app rendering a dialog knows what it says and a\n * kit that hard-codes English for it has taken over the app's string catalogue.\n *\n * The dividing line is deliberate. `Button` keeps using this package's own\n * `Spinner` rather than lucide's `Loader2` — chrome is cheap to draw, iconography\n * is not, and vendoring a glyph's path data freezes it at whatever version was\n * current when it was copied.\n *\n * ## Migrating the copies\n *\n * `codemods/` rewrites the family's `../components/…` imports onto this package\n * for every component converged here, and names the ones it has not. Those\n * imports are **relative**, so this is a separate transform from the\n * `@scope/pkg` one — see `codemods/src/web-components.ts`.\n *\n * ## What is deliberately not here\n *\n * Domain badges (`ConnectionBadge`, `TaskRunStatusBadge`, …), the OAuth\n * `?oauth2=` notice seeding, WebDAV `207` handling, the authed-first public\n * fallback, and every app's `SUPPORTED_LANGUAGES`. Each had\n * exactly one consumer, so each stays with it — see `constants.ts` and the\n * per-module provenance notes for the list.\n */\n\nexport { Badge, badgeBaseClass, badgeClass, badgeVariantClass } from './Badge.tsx';\nexport type { BadgeProps, BadgeVariant } from './Badge.tsx';\n\nexport { Button, buttonBaseClass, buttonClass, buttonSizeClass, buttonVariantClass } from './Button.tsx';\nexport type { ButtonProps, ButtonSize, ButtonVariant } from './Button.tsx';\n\nexport { Card, cardClass, cardHeaderClass, cardTitleClass, CardHeader, CardTitle } from './Card.tsx';\nexport type { CardHeaderProps, CardProps, CardTitleProps } from './Card.tsx';\n\nexport { FocusInput } from './FocusInput.tsx';\nexport type { FocusInputProps } from './FocusInput.tsx';\n\nexport { Input, Label, Select, Textarea, fieldClass } from './Input.tsx';\nexport type { InputProps, LabelProps, SelectProps, TextareaProps } from './Input.tsx';\n\nexport { LoadingButton } from './LoadingButton.tsx';\nexport type { LoadingButtonProps } from './LoadingButton.tsx';\n\n// Converged from the `ModalShell` / `ConfirmDeleteModal` / `PageState` copies\n// that Durable-DAV, Durable-DAV-Router, Mail-Otter and Edge-Git each shipped.\n// Deliberately dependency-free — labels are props, not `useTranslation` — so\n// adopting these does not require a translation library or an icon set.\nexport { ModalShell } from './ModalShell.tsx';\nexport type { ModalShellProps } from './ModalShell.tsx';\nexport { ConfirmDeleteModal, EmptyState, LoadingSpinner } from './PageState.tsx';\n\n// The second convergence round: page layout, the notice banner, the access\n// page, the language picker, and the two clipboard-bearing controls. Same rule\n// on labels — the app owns its string catalogue. Three of these need\n// `lucide-react`, which is why it is a peer and not a dependency.\nexport { AppPage } from './AppPage.tsx';\nexport type { AppPageProps, AppPageVariant } from './AppPage.tsx';\nexport { PageHeaderCard } from './PageHeaderCard.tsx';\nexport type { PageHeaderCardProps } from './PageHeaderCard.tsx';\nexport { ContextBar } from './ContextBar.tsx';\nexport type { ContextBarProps } from './ContextBar.tsx';\nexport { Unauthorized } from './Unauthorized.tsx';\nexport type { UnauthorizedProps } from './Unauthorized.tsx';\nexport { NoticeBar } from './NoticeBar.tsx';\nexport type { NoticeBarProps, NoticeStatusLabels } from './NoticeBar.tsx';\nexport { LanguageSelector } from './LanguageSelector.tsx';\nexport type { LanguageSelectorProps } from './LanguageSelector.tsx';\nexport { RefreshButton } from './RefreshButton.tsx';\nexport type { RefreshButtonProps } from './RefreshButton.tsx';\nexport { ReadOnlyField } from './ReadOnlyField.tsx';\nexport type { ReadOnlyFieldProps } from './ReadOnlyField.tsx';\nexport { TypeToConfirmModal } from './TypeToConfirmModal.tsx';\nexport type { TypeToConfirmModalProps } from './TypeToConfirmModal.tsx';\nexport { useCopyToClipboard } from './useCopyToClipboard.ts';\nexport type { UseCopyToClipboardResult } from './useCopyToClipboard.ts';\n\nexport { Pagination, clampPage, pageCountFor, pageWindow } from './Pagination.tsx';\nexport type { PaginationLabels, PaginationProps } from './Pagination.tsx';\n\nexport { Spinner } from './Spinner.tsx';\nexport type { SpinnerProps } from './Spinner.tsx';\n\nexport {\n btnBase,\n btnBlueStyle,\n btnGreenStyle,\n btnSmallStyle,\n buttonColors,\n cardStyle,\n inputStyle,\n paginationBtnStyle,\n tableCardStyle,\n tdStyle,\n theme,\n thStyle,\n} from './theme.ts';\n\nexport { cn, configureClassMerge } from './utils.ts';\nexport type { ClassDictionary, ClassValue } from './utils.ts';\n\nexport { COPY_FEEDBACK_TIMEOUT_MS, NOTICE_TIMEOUT_MS, ZERO_TRUST_AUTHENTICATION_PATH } from './constants.ts';\n\nexport { useNotice } from './useNotice.ts';\nexport type { Notice, NoticeKind, ShowNotice, UseNoticeOptions, UseNoticeResult } from './useNotice.ts';\n\nexport {\n canonicalizeLanguageTag,\n DEFAULT_FALLBACK_LANGUAGE,\n DEFAULT_LANGUAGE_STORAGE_KEY,\n DEFAULT_SUPPORTED_LANGUAGES,\n resolveLanguageTag,\n useSpaLanguage,\n} from './useSpaLanguage.ts';\nexport type { LanguageRuntime, LanguageStatus, LanguageTag, UseSpaLanguageOptions, UseSpaLanguageResult } from './useSpaLanguage.ts';\n\nexport { useMutation, useResource } from './useResource.ts';\nexport type { MutationState, MutationStatus, ResourceState, ResourceStatus, UseResourceOptions } from './useResource.ts';\n\nexport { CURRENT_USER_PATH, useCurrentUser } from './useCurrentUser.ts';\nexport type { CurrentUser, UseCurrentUserOptions, UseCurrentUserResult } from './useCurrentUser.ts';\n\nexport { buildQuery, createApiClient, HttpStatusError, MAX_ERROR_MESSAGE_LENGTH } from './api.ts';\nexport type { ApiClient, ApiRequestInit, CreateApiClientOptions, FetchFn, QueryParams, QueryValue } from './api.ts';\n\nexport { createBookmarkStore, D1_BOOKMARK_HEADER } from './bookmarks.ts';\nexport type { BookmarkStore } from './bookmarks.ts';\n\nexport { createContractClient } from './contractClient.ts';\nexport type { ContractCall, ContractCallOptions, ContractClient, CreateContractClientOptions } from './contractClient.ts';\n\n// `createSpaI18n` is deliberately NOT here: it imports the optional i18next\n// peers, so it lives at `@rexezuge/web/i18n` and the root stays i18n-free.\n"],
5
+ "mappings": "AAuDA,OAAS,SAAAA,EAAO,kBAAAC,EAAgB,cAAAC,EAAY,qBAAAC,MAAyB,aAGrE,OAAS,UAAAC,EAAQ,mBAAAC,EAAiB,eAAAC,EAAa,mBAAAC,EAAiB,sBAAAC,MAA0B,cAG1F,OAAS,QAAAC,EAAM,aAAAC,EAAW,mBAAAC,EAAiB,kBAAAC,EAAgB,cAAAC,EAAY,aAAAC,MAAiB,YAGxF,OAAS,cAAAC,MAAkB,kBAG3B,OAAS,SAAAC,EAAO,SAAAC,EAAO,UAAAC,EAAQ,YAAAC,EAAU,cAAAC,MAAkB,aAG3D,OAAS,iBAAAC,MAAqB,qBAO9B,OAAS,cAAAC,MAAkB,kBAE3B,OAAS,sBAAAC,EAAoB,cAAAC,EAAY,kBAAAC,MAAsB,iBAM/D,OAAS,WAAAC,MAAe,eAExB,OAAS,kBAAAC,MAAsB,sBAE/B,OAAS,cAAAC,MAAkB,kBAE3B,OAAS,gBAAAC,MAAoB,oBAE7B,OAAS,aAAAC,MAAiB,iBAE1B,OAAS,oBAAAC,MAAwB,wBAEjC,OAAS,iBAAAC,MAAqB,qBAE9B,OAAS,iBAAAC,MAAqB,qBAE9B,OAAS,sBAAAC,MAA0B,0BAEnC,OAAS,sBAAAC,OAA0B,0BAGnC,OAAS,cAAAC,GAAY,aAAAC,GAAW,gBAAAC,GAAc,cAAAC,OAAkB,kBAGhE,OAAS,WAAAC,OAAe,eAGxB,OACE,WAAAC,GACA,gBAAAC,GACA,iBAAAC,GACA,iBAAAC,GACA,gBAAAC,GACA,aAAAC,GACA,cAAAC,GACA,sBAAAC,GACA,kBAAAC,GACA,WAAAC,GACA,SAAAC,GACA,WAAAC,OACK,aAEP,OAAS,MAAAC,GAAI,uBAAAC,OAA2B,aAGxC,OAAS,4BAAAC,GAA0B,qBAAAC,GAAmB,kCAAAC,OAAsC,iBAE5F,OAAS,aAAAC,OAAiB,iBAG1B,OACE,2BAAAC,GACA,6BAAAC,GACA,gCAAAC,GACA,+BAAAC,GACA,sBAAAC,GACA,kBAAAC,OACK,sBAGP,OAAS,eAAAC,GAAa,eAAAC,OAAmB,mBAGzC,OAAS,qBAAAC,GAAmB,kBAAAC,OAAsB,sBAGlD,OAAS,cAAAC,GAAY,mBAAAC,GAAiB,mBAAAC,GAAiB,4BAAAC,OAAgC,WAGvF,OAAS,uBAAAC,GAAqB,sBAAAC,OAA0B,iBAGxD,OAAS,wBAAAC,OAA4B",
6
+ "names": ["Badge", "badgeBaseClass", "badgeClass", "badgeVariantClass", "Button", "buttonBaseClass", "buttonClass", "buttonSizeClass", "buttonVariantClass", "Card", "cardClass", "cardHeaderClass", "cardTitleClass", "CardHeader", "CardTitle", "FocusInput", "Input", "Label", "Select", "Textarea", "fieldClass", "LoadingButton", "ModalShell", "ConfirmDeleteModal", "EmptyState", "LoadingSpinner", "AppPage", "PageHeaderCard", "ContextBar", "Unauthorized", "NoticeBar", "LanguageSelector", "RefreshButton", "ReadOnlyField", "TypeToConfirmModal", "useCopyToClipboard", "Pagination", "clampPage", "pageCountFor", "pageWindow", "Spinner", "btnBase", "btnBlueStyle", "btnGreenStyle", "btnSmallStyle", "buttonColors", "cardStyle", "inputStyle", "paginationBtnStyle", "tableCardStyle", "tdStyle", "theme", "thStyle", "cn", "configureClassMerge", "COPY_FEEDBACK_TIMEOUT_MS", "NOTICE_TIMEOUT_MS", "ZERO_TRUST_AUTHENTICATION_PATH", "useNotice", "canonicalizeLanguageTag", "DEFAULT_FALLBACK_LANGUAGE", "DEFAULT_LANGUAGE_STORAGE_KEY", "DEFAULT_SUPPORTED_LANGUAGES", "resolveLanguageTag", "useSpaLanguage", "useMutation", "useResource", "CURRENT_USER_PATH", "useCurrentUser", "buildQuery", "createApiClient", "HttpStatusError", "MAX_ERROR_MESSAGE_LENGTH", "createBookmarkStore", "D1_BOOKMARK_HEADER", "createContractClient"]
7
7
  }
@@ -0,0 +1,30 @@
1
+ import type { LanguageTag } from '@rexezuge/shared';
2
+ /**
3
+ * Resolves a tag against the supported list: an exact match wins, then the
4
+ * same-language entry that shares the tag's region, then the one that shares
5
+ * its script (stated, or implied by the region), then the first same-language
6
+ * entry, then the fallback.
7
+ *
8
+ * The prefix step is why a browser reporting `en-US` does not defeat an
9
+ * English-only app. The region and script steps are why `zh-Hant-TW` and
10
+ * `zh-HK` land on a supported `zh-TW` instead of on whichever Chinese bundle is
11
+ * listed first. Mail-Meow fixed that bug locally, and the kit had it too.
12
+ */
13
+ declare function resolveLanguageTag(value: string | null | undefined, supported: readonly LanguageTag[], fallback: LanguageTag): LanguageTag;
14
+ declare function readStoredLanguage(storageKey: string): string | null;
15
+ declare function writeStoredLanguage(storageKey: string, language: LanguageTag): void;
16
+ declare function readNavigatorLanguage(): string | null;
17
+ /**
18
+ * The language to start in: `preferred` (the backend's), then the stored choice,
19
+ * then the browser's, then the fallback. The first **present** source wins, so an
20
+ * unsupported stored value falls to the fallback rather than to the browser. The
21
+ * stored value is the reader's own choice.
22
+ */
23
+ declare function detectLanguage(options: {
24
+ supported: readonly LanguageTag[];
25
+ fallback: LanguageTag;
26
+ storageKey: string;
27
+ preferred?: string | null;
28
+ }): LanguageTag;
29
+ export { detectLanguage, readNavigatorLanguage, readStoredLanguage, resolveLanguageTag, writeStoredLanguage };
30
+ //# sourceMappingURL=language.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../src/language.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAyBpD;;;;;;;;;;GAUG;AACH,iBAAS,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,SAAS,EAAE,SAAS,WAAW,EAAE,EAAE,QAAQ,EAAE,WAAW,GAAG,WAAW,CAsBnI;AAED,iBAAS,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAQ7D;AAED,iBAAS,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,GAAG,IAAI,CAO5E;AAED,iBAAS,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAM9C;AAED;;;;;GAKG;AACH,iBAAS,cAAc,CAAC,OAAO,EAAE;IAC/B,SAAS,EAAE,SAAS,WAAW,EAAE,CAAC;IAClC,QAAQ,EAAE,WAAW,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,GAAG,WAAW,CAKd;AAED,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ var d=Object.defineProperty;var a=(t,n)=>d(t,"name",{value:n,configurable:!0});import{canonicalizeLanguageTag as h}from"@rexezuge/shared";const y={TW:"hant",HK:"hant",MO:"hant",CN:"hans",SG:"hans"};function u(t){const n=h(t),[r=n,...e]=n.split("-"),i=e.find(o=>o.length===2||/^\d{3}$/.test(o))?.toUpperCase()??null,c=e.find(o=>o.length===4)?.toLowerCase()??null;return{tag:t,key:n,primary:r,region:i,script:c??(i===null?null:y[i]??null)}}a(u,"describeTag");function s(t,n,r){if(typeof t!="string"||t.trim()==="")return r;const e=u(t);let i=null,c=0;for(const o of n){const l=u(o);if(l.key===e.key)return l.tag;if(l.primary!==e.primary)continue;let g=1;e.script!==null&&l.script===e.script&&(g=2),e.region!==null&&l.region===e.region&&(g=3),!(g<=c)&&(i=l.tag,c=g)}return i??r}a(s,"resolveLanguageTag");function f(t){try{return globalThis.localStorage?.getItem(t)??null}catch{return null}}a(f,"readStoredLanguage");function m(t,n){try{globalThis.localStorage?.setItem(t,n)}catch{}}a(m,"writeStoredLanguage");function p(){try{return globalThis.navigator?.language??null}catch{return null}}a(p,"readNavigatorLanguage");function L(t){const n=[t.preferred,f(t.storageKey),p()].find(r=>typeof r=="string"&&r.trim()!=="");return s(n,t.supported,t.fallback)}a(L,"detectLanguage");export{L as detectLanguage,p as readNavigatorLanguage,f as readStoredLanguage,s as resolveLanguageTag,m as writeStoredLanguage};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/language.ts"],
4
+ "sourcesContent": ["/**\n * Language-tag resolution and the persisted choice: the framework-free half of\n * `useSpaLanguage`, shared with `createSpaI18n` (`@rexezuge/web/i18n`) so the\n * hook and the i18n bootstrap can never disagree about which bundle a tag means.\n *\n * Canonicalization is `@rexezuge/shared`'s `canonicalizeLanguageTag`. There is no\n * local canonicalizer: the ten `i18n.ts` copies each carried one.\n */\nimport { canonicalizeLanguageTag } from '@rexezuge/shared';\nimport type { LanguageTag } from '@rexezuge/shared';\n\n/**\n * The script a region implies when a tag names no script. Only the regions\n * whose script decides between two shipped bundles are listed: Traditional for\n * Taiwan, Hong Kong and Macau, Simplified for mainland China and Singapore.\n */\nconst IMPLIED_SCRIPT: Readonly<Record<string, string>> = { TW: 'hant', HK: 'hant', MO: 'hant', CN: 'hans', SG: 'hans' };\n\ninterface DescribedTag {\n tag: LanguageTag;\n key: string;\n primary: string;\n region: string | null;\n script: string | null;\n}\n\nfunction describeTag(tag: LanguageTag): DescribedTag {\n const key = canonicalizeLanguageTag(tag);\n const [primary = key, ...subtags] = key.split('-');\n const region = subtags.find((part) => part.length === 2 || /^\\d{3}$/.test(part))?.toUpperCase() ?? null;\n const explicitScript = subtags.find((part) => part.length === 4)?.toLowerCase() ?? null;\n return { tag, key, primary, region, script: explicitScript ?? (region === null ? null : (IMPLIED_SCRIPT[region] ?? null)) };\n}\n\n/**\n * Resolves a tag against the supported list: an exact match wins, then the\n * same-language entry that shares the tag's region, then the one that shares\n * its script (stated, or implied by the region), then the first same-language\n * entry, then the fallback.\n *\n * The prefix step is why a browser reporting `en-US` does not defeat an\n * English-only app. The region and script steps are why `zh-Hant-TW` and\n * `zh-HK` land on a supported `zh-TW` instead of on whichever Chinese bundle is\n * listed first. Mail-Meow fixed that bug locally, and the kit had it too.\n */\nfunction resolveLanguageTag(value: string | null | undefined, supported: readonly LanguageTag[], fallback: LanguageTag): LanguageTag {\n if (typeof value !== 'string' || value.trim() === '') {\n return fallback;\n }\n // The shared canonicalizer maps a degenerate tag to `en`, so the empty check\n // above has to happen first. Otherwise an empty stored value would silently\n // resolve to `en` instead of the caller's fallback.\n const wanted = describeTag(value);\n let best: LanguageTag | null = null;\n let bestScore = 0;\n for (const tag of supported) {\n const entry = describeTag(tag);\n if (entry.key === wanted.key) return entry.tag;\n if (entry.primary !== wanted.primary) continue;\n let score = 1;\n if (wanted.script !== null && entry.script === wanted.script) score = 2;\n if (wanted.region !== null && entry.region === wanted.region) score = 3;\n if (score <= bestScore) continue;\n best = entry.tag;\n bestScore = score;\n }\n return best ?? fallback;\n}\n\nfunction readStoredLanguage(storageKey: string): string | null {\n try {\n return globalThis.localStorage?.getItem(storageKey) ?? null;\n } catch {\n // Private-mode Safari and a blocked-storage context both throw. Detection\n // carries on without the stored value; the language still works.\n return null;\n }\n}\n\nfunction writeStoredLanguage(storageKey: string, language: LanguageTag): void {\n try {\n globalThis.localStorage?.setItem(storageKey, language);\n } catch {\n // Non-fatal: the selection still applies to this session, it just does not\n // survive a reload.\n }\n}\n\nfunction readNavigatorLanguage(): string | null {\n try {\n return globalThis.navigator?.language ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * The language to start in: `preferred` (the backend's), then the stored choice,\n * then the browser's, then the fallback. The first **present** source wins, so an\n * unsupported stored value falls to the fallback rather than to the browser. The\n * stored value is the reader's own choice.\n */\nfunction detectLanguage(options: {\n supported: readonly LanguageTag[];\n fallback: LanguageTag;\n storageKey: string;\n preferred?: string | null;\n}): LanguageTag {\n const source = [options.preferred, readStoredLanguage(options.storageKey), readNavigatorLanguage()].find(\n (value) => typeof value === 'string' && value.trim() !== '',\n );\n return resolveLanguageTag(source, options.supported, options.fallback);\n}\n\nexport { detectLanguage, readNavigatorLanguage, readStoredLanguage, resolveLanguageTag, writeStoredLanguage };\n"],
5
+ "mappings": "+EAQA,OAAS,2BAAAA,MAA+B,mBAQxC,MAAMC,EAAmD,CAAE,GAAI,OAAQ,GAAI,OAAQ,GAAI,OAAQ,GAAI,OAAQ,GAAI,MAAM,EAUrH,SAASC,EAAYC,EAAgB,CACnC,MAAMC,EAAMJ,EAAwBG,CAAG,EACjC,CAACE,EAAUD,EAAK,GAAGE,CAAO,EAAIF,EAAI,MAAM,GAAG,EAC3CG,EAASD,EAAQ,KAAME,GAASA,EAAK,SAAW,GAAK,UAAU,KAAKA,CAAI,CAAC,GAAG,YAAW,GAAM,KAC7FC,EAAiBH,EAAQ,KAAME,GAASA,EAAK,SAAW,CAAC,GAAG,YAAW,GAAM,KACnF,MAAO,CAAE,IAAAL,EAAK,IAAAC,EAAK,QAAAC,EAAS,OAAAE,EAAQ,OAAQE,IAAmBF,IAAW,KAAO,KAAQN,EAAeM,CAAM,GAAK,KAAM,CAC3H,CANSG,EAAAR,EAAA,eAmBT,SAASS,EAAmBC,EAAkCC,EAAmCC,EAAqB,CACpH,GAAI,OAAOF,GAAU,UAAYA,EAAM,KAAI,IAAO,GAChD,OAAOE,EAKT,MAAMC,EAASb,EAAYU,CAAK,EAChC,IAAII,EAA2B,KAC3BC,EAAY,EAChB,UAAWd,KAAOU,EAAW,CAC3B,MAAMK,EAAQhB,EAAYC,CAAG,EAC7B,GAAIe,EAAM,MAAQH,EAAO,IAAK,OAAOG,EAAM,IAC3C,GAAIA,EAAM,UAAYH,EAAO,QAAS,SACtC,IAAII,EAAQ,EACRJ,EAAO,SAAW,MAAQG,EAAM,SAAWH,EAAO,SAAQI,EAAQ,GAClEJ,EAAO,SAAW,MAAQG,EAAM,SAAWH,EAAO,SAAQI,EAAQ,GAClE,EAAAA,GAASF,KACbD,EAAOE,EAAM,IACbD,EAAYE,EACd,CACA,OAAOH,GAAQF,CACjB,CAtBSJ,EAAAC,EAAA,sBAwBT,SAASS,EAAmBC,EAAkB,CAC5C,GAAI,CACF,OAAO,WAAW,cAAc,QAAQA,CAAU,GAAK,IACzD,MAAQ,CAGN,OAAO,IACT,CACF,CARSX,EAAAU,EAAA,sBAUT,SAASE,EAAoBD,EAAoBE,EAAqB,CACpE,GAAI,CACF,WAAW,cAAc,QAAQF,EAAYE,CAAQ,CACvD,MAAQ,CAGR,CACF,CAPSb,EAAAY,EAAA,uBAST,SAASE,GAAqB,CAC5B,GAAI,CACF,OAAO,WAAW,WAAW,UAAY,IAC3C,MAAQ,CACN,OAAO,IACT,CACF,CANSd,EAAAc,EAAA,yBAcT,SAASC,EAAeC,EAKvB,CACC,MAAMC,EAAS,CAACD,EAAQ,UAAWN,EAAmBM,EAAQ,UAAU,EAAGF,EAAqB,CAAE,EAAE,KACjGZ,GAAU,OAAOA,GAAU,UAAYA,EAAM,KAAI,IAAO,EAAE,EAE7D,OAAOD,EAAmBgB,EAAQD,EAAQ,UAAWA,EAAQ,QAAQ,CACvE,CAVShB,EAAAe,EAAA",
6
+ "names": ["canonicalizeLanguageTag", "IMPLIED_SCRIPT", "describeTag", "tag", "key", "primary", "subtags", "region", "part", "explicitScript", "__name", "resolveLanguageTag", "value", "supported", "fallback", "wanted", "best", "bestScore", "entry", "score", "readStoredLanguage", "storageKey", "writeStoredLanguage", "language", "readNavigatorLanguage", "detectLanguage", "options", "source"]
7
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @internal The raw values behind the deprecated `theme` export, for the two kit
3
+ * components (`Spinner`, `FocusInput`) that still default to them. Not part of the
4
+ * public API: when `theme` is removed in 2.0, these defaults move to the
5
+ * `--color-*` tokens in `styles.css`.
6
+ */
7
+ declare const legacyPalette: {
8
+ readonly cardBg: "#1e2433";
9
+ readonly inputBg: "#252d3d";
10
+ readonly border: "#374151";
11
+ readonly blue: "#2563eb";
12
+ readonly blueHover: "#1d4ed8";
13
+ readonly green: "#16a34a";
14
+ readonly greenHover: "#15803d";
15
+ readonly red: "#dc2626";
16
+ readonly redHover: "#b91c1c";
17
+ readonly spinnerBlue: "#60a5fa";
18
+ /**
19
+ The border colour a focused field paints.
20
+ */
21
+ readonly focusBorder: "#3b82f6";
22
+ };
23
+ export { legacyPalette };
24
+ //# sourceMappingURL=legacyPalette.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legacyPalette.d.ts","sourceRoot":"","sources":["../src/legacyPalette.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,QAAA,MAAM,aAAa;;;;;;;;;;;IAWjB;;MAEE;;CAEM,CAAC;AAEX,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ const e={cardBg:"#1e2433",inputBg:"#252d3d",border:"#374151",blue:"#2563eb",blueHover:"#1d4ed8",green:"#16a34a",greenHover:"#15803d",red:"#dc2626",redHover:"#b91c1c",spinnerBlue:"#60a5fa",focusBorder:"#3b82f6"};export{e as legacyPalette};
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/legacyPalette.ts"],
4
+ "sourcesContent": ["/**\n * @internal The raw values behind the deprecated `theme` export, for the two kit\n * components (`Spinner`, `FocusInput`) that still default to them. Not part of the\n * public API: when `theme` is removed in 2.0, these defaults move to the\n * `--color-*` tokens in `styles.css`.\n */\nconst legacyPalette = {\n cardBg: '#1e2433',\n inputBg: '#252d3d',\n border: '#374151',\n blue: '#2563eb',\n blueHover: '#1d4ed8',\n green: '#16a34a',\n greenHover: '#15803d',\n red: '#dc2626',\n redHover: '#b91c1c',\n spinnerBlue: '#60a5fa',\n /**\n The border colour a focused field paints.\n */\n focusBorder: '#3b82f6',\n} as const;\n\nexport { legacyPalette };\n"],
5
+ "mappings": "AAMA,MAAMA,EAAgB,CACpB,OAAQ,UACR,QAAS,UACT,OAAQ,UACR,KAAM,UACN,UAAW,UACX,MAAO,UACP,WAAY,UACZ,IAAK,UACL,SAAU,UACV,YAAa,UAIb,YAAa",
6
+ "names": ["legacyPalette"]
7
+ }
@@ -0,0 +1,99 @@
1
+ /*
2
+ * @rexezuge/web/styles.css: the token defaults the kit components read.
3
+ *
4
+ * Import it after Tailwind, before your own theme:
5
+ *
6
+ * @import 'tailwindcss';
7
+ * @import '@rexezuge/web/styles.css';
8
+ * @theme { --color-accent: #7aa2f7; }
9
+ *
10
+ * Converged from apps/web/src/globals.css in ten repos. Seven of them carry this
11
+ * warm-dark palette (CalDAV-Bridge, Durable-DAV, Edge-Git, Edge-Sonic, Mail-Bee,
12
+ * Mail-Otter, TOTP-Generator; all but CalDAV-Bridge with this accent too), so the
13
+ * majority is the default. The other three keep theirs by overriding.
14
+ *
15
+ * Three things this file does that each copy did by hand:
16
+ *
17
+ * 1. The colour variables. They are declared as theme DEFAULTS, so any value you
18
+ * set in your own theme block, or in a plain root rule, wins whatever the
19
+ * import order. You override a token, never this file.
20
+ * 2. The three entrance animations the dialog, its backdrop and the notice bar
21
+ * use. In Tailwind 4 an animation only becomes a utility when the theme
22
+ * registers it, so a bare keyframes block was not enough. The spinner's
23
+ * animation is Tailwind's own and is not repeated here.
24
+ * 3. The source directive below. Tailwind does not scan node_modules, so every
25
+ * repo had to add a source line pointing at this package's dist, and a repo
26
+ * that forgot it rendered the kit's markup unstyled while the build passed.
27
+ * The path is relative to this file, which sits in that dist directory.
28
+ *
29
+ * Keep utility class names out of the comments in this file: it is inside the
30
+ * scanned directory, so a class named here would be generated whether or not a
31
+ * component uses it.
32
+ */
33
+ @source './';
34
+
35
+ @theme default {
36
+ /* Surfaces and text */
37
+ --color-surface-base: #100f0d;
38
+ --color-surface-1: #1a1814;
39
+ --color-surface-2: #201e1b;
40
+ --color-surface-3: #2a2722;
41
+ --color-surface-4: #332f29;
42
+ --color-border: #2e2a24;
43
+ --color-border-muted: #3a3530;
44
+ --color-text-primary: #f5f0eb;
45
+ --color-text-secondary: #b0a89a;
46
+ --color-text-muted: #7a7068;
47
+
48
+ /* Status pairs: background and the text drawn on it */
49
+ --color-success-bg: #0e2d22;
50
+ --color-success-text: #6ee7b7;
51
+ --color-error-bg: #2d1214;
52
+ --color-error-text: #fca5a5;
53
+ --color-warning-bg: #2d2007;
54
+ --color-warning-text: #fbbf24;
55
+ --color-info-bg: #0e1e3a;
56
+ --color-info-text: #93c5fd;
57
+ --color-neutral-bg: #252219;
58
+ --color-neutral-text: #b0a89a;
59
+
60
+ /* Accent */
61
+ --color-accent: #6ee7b7;
62
+ --color-accent-dim: #4fd1a0;
63
+
64
+ /* Entrance animations used by the dialog, its backdrop and the notice bar */
65
+ --animate-fade-in: fade-in 0.2s ease-out both;
66
+ --animate-backdrop-in: backdrop-in 0.2s ease-out both;
67
+ --animate-slide-down: slide-down 0.2s ease-out both;
68
+
69
+ @keyframes fade-in {
70
+ from {
71
+ opacity: 0;
72
+ transform: scale(0.97);
73
+ }
74
+ to {
75
+ opacity: 1;
76
+ transform: scale(1);
77
+ }
78
+ }
79
+
80
+ @keyframes backdrop-in {
81
+ from {
82
+ opacity: 0;
83
+ }
84
+ to {
85
+ opacity: 1;
86
+ }
87
+ }
88
+
89
+ @keyframes slide-down {
90
+ from {
91
+ opacity: 0;
92
+ transform: translateY(-4px);
93
+ }
94
+ to {
95
+ opacity: 1;
96
+ transform: translateY(0);
97
+ }
98
+ }
99
+ }
package/dist/theme.d.ts CHANGED
@@ -2,9 +2,14 @@ import type { CSSProperties } from 'react';
2
2
  /**
3
3
  * Design tokens for the inline-styled parts of the SPA.
4
4
  *
5
+ * **Deprecated, removed in 2.0.** Tailwind class helpers are the single styling
6
+ * API: `buttonClass`, `cardClass`, `fieldClass` and friends, over the `--color-*`
7
+ * tokens `@rexezuge/web/styles.css` ships defaults for. Each export below is
8
+ * `@deprecated`; nothing new may be added here.
9
+ *
5
10
  * ## Provenance
6
11
  *
7
- * Verbatim from `apps/web/src/components/ui/theme.ts` in **AWS-AccessBridge**,
12
+ * Verbatim from `apps/web/src/components/ui/legacyPalette.ts` in **AWS-AccessBridge**,
8
13
  * which is the only repo of the eight that styled its primitives with inline
9
14
  * styles rather than Tailwind classes. It wins by default: nothing else in the
10
15
  * family carries a token table, and the six Tailwind repos encode the same
@@ -26,7 +31,12 @@ import type { CSSProperties } from 'react';
26
31
  */
27
32
  /**
28
33
  * The palette. One flat record so a consumer can spread it into a CSS-in-JS
29
- * theme or read `theme.accent`-style names without a nested lookup.
34
+ * theme or read `legacyPalette.accent`-style names without a nested lookup.
35
+ */
36
+ /**
37
+ * @deprecated Inline-style tokens are removed in 2.0. Tailwind class helpers
38
+ * (`buttonClass`, `cardClass`, `fieldClass`, …) over the `--color-*` tokens in
39
+ * `@rexezuge/web/styles.css` are the single styling API.
30
40
  */
31
41
  declare const theme: {
32
42
  readonly cardBg: "#1e2433";
@@ -39,9 +49,6 @@ declare const theme: {
39
49
  readonly red: "#dc2626";
40
50
  readonly redHover: "#b91c1c";
41
51
  readonly spinnerBlue: "#60a5fa";
42
- /**
43
- The border colour a focused field paints.
44
- */
45
52
  readonly focusBorder: "#3b82f6";
46
53
  };
47
54
  /**
@@ -50,45 +57,69 @@ declare const theme: {
50
57
  * Keyed by colour name rather than by the kit's `Button` variants because a
51
58
  * plain colour table is what a bespoke button needs; `Button` maps its
52
59
  * normalized variants onto its own classes.
53
- */
60
+
61
+ @deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.
62
+ */
54
63
  declare const buttonColors: Record<string, {
55
64
  bg: string;
56
65
  hover: string;
57
66
  }>;
58
67
  /**
59
68
  The standard content card surface.
69
+
70
+ @deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.
60
71
  */
61
72
  declare const cardStyle: CSSProperties;
62
73
  /**
63
74
  The standard text field surface.
75
+
76
+ @deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.
64
77
  */
65
78
  declare const inputStyle: CSSProperties;
66
79
  /**
67
80
  A card whose content is a table: the table supplies its own padding.
81
+
82
+ @deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.
68
83
  */
69
84
  declare const tableCardStyle: CSSProperties;
70
85
  /**
71
86
  Column header cell.
87
+
88
+ @deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.
72
89
  */
73
90
  declare const thStyle: CSSProperties;
74
91
  /**
75
92
  Body cell.
93
+
94
+ @deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.
76
95
  */
77
96
  declare const tdStyle: CSSProperties;
78
97
  /**
79
98
  A pager control, as used by `Pagination`'s inline-styled consumers.
99
+
100
+ @deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.
80
101
  */
81
102
  declare const paginationBtnStyle: CSSProperties;
82
103
  /**
83
104
  * Shared geometry for the solid action buttons: `btnBlueStyle`, `btnGreenStyle`
84
105
  * and the small variant each spread it and override only what differs, so a
85
106
  * change to the radius or weight lands in all of them at once.
86
- */
107
+
108
+ @deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.
109
+ */
87
110
  declare const btnBase: CSSProperties;
111
+ /**
112
+ @deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.
113
+ */
88
114
  declare const btnBlueStyle: CSSProperties;
115
+ /**
116
+ @deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.
117
+ */
89
118
  declare const btnGreenStyle: CSSProperties;
90
119
  /**
91
120
  The dense action button used in table rows.
121
+
122
+ @deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.
92
123
  */
93
124
  declare const btnSmallStyle: CSSProperties;
94
125
  export { btnBase, btnBlueStyle, btnGreenStyle, btnSmallStyle, buttonColors, cardStyle, inputStyle, paginationBtnStyle, tableCardStyle, tdStyle, theme, thStyle, };
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;GAGG;AACH,QAAA,MAAM,KAAK;;;;;;;;;;;IAWT;;MAEE;;CAEM,CAAC;AAEX;;;;;;GAMG;AACH,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAI/D,CAAC;AAEF;;EAEE;AACF,QAAA,MAAM,SAAS,EAAE,aAIhB,CAAC;AAEF;;EAEE;AACF,QAAA,MAAM,UAAU,EAAE,aAUjB,CAAC;AAEF;;EAEE;AACF,QAAA,MAAM,cAAc,EAAE,aAIrB,CAAC;AAEF;;EAEE;AACF,QAAA,MAAM,OAAO,EAAE,aASd,CAAC;AAEF;;EAEE;AACF,QAAA,MAAM,OAAO,EAAE,aAGd,CAAC;AAEF;;EAEE;AACF,QAAA,MAAM,kBAAkB,EAAE,aAQzB,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,OAAO,EAAE,aAQd,CAAC;AAEF,QAAA,MAAM,YAAY,EAAE,aAAsD,CAAC;AAC3E,QAAA,MAAM,aAAa,EAAE,aAAuD,CAAC;AAE7E;;EAEE;AACF,QAAA,MAAM,aAAa,EAAE,aASpB,CAAC;AAEF,OAAO,EACL,OAAO,EACP,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,KAAK,EACL,OAAO,GACR,CAAC"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;GAGG;AACH;;;;GAIG;AACH,QAAA,MAAM,KAAK;;;;;;;;;;;;CAAgB,CAAC;AAE5B;;;;;;;;EAQE;AACF,QAAA,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAI/D,CAAC;AAEF;;;;EAIE;AACF,QAAA,MAAM,SAAS,EAAE,aAIhB,CAAC;AAEF;;;;EAIE;AACF,QAAA,MAAM,UAAU,EAAE,aAUjB,CAAC;AAEF;;;;EAIE;AACF,QAAA,MAAM,cAAc,EAAE,aAIrB,CAAC;AAEF;;;;EAIE;AACF,QAAA,MAAM,OAAO,EAAE,aASd,CAAC;AAEF;;;;EAIE;AACF,QAAA,MAAM,OAAO,EAAE,aAGd,CAAC;AAEF;;;;EAIE;AACF,QAAA,MAAM,kBAAkB,EAAE,aAQzB,CAAC;AAEF;;;;;;EAME;AACF,QAAA,MAAM,OAAO,EAAE,aAQd,CAAC;AAEF;;EAEE;AACF,QAAA,MAAM,YAAY,EAAE,aAA8D,CAAC;AACnF;;EAEE;AACF,QAAA,MAAM,aAAa,EAAE,aAA+D,CAAC;AAErF;;;;EAIE;AACF,QAAA,MAAM,aAAa,EAAE,aASpB,CAAC;AAEF,OAAO,EACL,OAAO,EACP,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,OAAO,EACP,KAAK,EACL,OAAO,GACR,CAAC"}
package/dist/theme.js CHANGED
@@ -1 +1 @@
1
- const e={cardBg:"#1e2433",inputBg:"#252d3d",border:"#374151",blue:"#2563eb",blueHover:"#1d4ed8",green:"#16a34a",greenHover:"#15803d",red:"#dc2626",redHover:"#b91c1c",spinnerBlue:"#60a5fa",focusBorder:"#3b82f6"},o={blue:{bg:e.blue,hover:e.blueHover},green:{bg:e.green,hover:e.greenHover},red:{bg:e.red,hover:e.redHover}},n={background:e.cardBg,borderRadius:"12px",padding:"24px"},t={width:"100%",padding:"12px",background:e.inputBg,borderRadius:"8px",border:`1px solid ${e.border}`,color:"#ffffff",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s"},d={background:e.cardBg,borderRadius:"12px",overflow:"hidden"},i={textAlign:"left",padding:"12px",background:e.inputBg,color:"#9ca3af",textTransform:"uppercase",letterSpacing:"0.05em",fontSize:"12px",fontWeight:500},a={padding:"12px",borderTop:"1px solid rgba(55,65,81,0.3)"},b={padding:"6px 12px",background:e.inputBg,border:"none",borderRadius:"8px",color:"white",cursor:"pointer",transition:"background 0.15s"},r={padding:"10px 20px",borderRadius:"8px",color:"white",fontWeight:500,border:"none",cursor:"pointer",transition:"background 0.15s"},c={...r,background:e.blue},p={...r,background:e.green},g={padding:"6px 12px",borderRadius:"6px",color:"white",fontWeight:500,fontSize:"13px",border:"none",cursor:"pointer",transition:"background 0.15s"};export{r as btnBase,c as btnBlueStyle,p as btnGreenStyle,g as btnSmallStyle,o as buttonColors,n as cardStyle,t as inputStyle,b as paginationBtnStyle,d as tableCardStyle,a as tdStyle,i as thStyle,e as theme};
1
+ import{legacyPalette as o}from"./legacyPalette.js";const e=o,n={blue:{bg:o.blue,hover:o.blueHover},green:{bg:o.green,hover:o.greenHover},red:{bg:o.red,hover:o.redHover}},t={background:o.cardBg,borderRadius:"12px",padding:"24px"},d={width:"100%",padding:"12px",background:o.inputBg,borderRadius:"8px",border:`1px solid ${o.border}`,color:"#ffffff",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s"},i={background:o.cardBg,borderRadius:"12px",overflow:"hidden"},a={textAlign:"left",padding:"12px",background:o.inputBg,color:"#9ca3af",textTransform:"uppercase",letterSpacing:"0.05em",fontSize:"12px",fontWeight:500},p={padding:"12px",borderTop:"1px solid rgba(55,65,81,0.3)"},b={padding:"6px 12px",background:o.inputBg,border:"none",borderRadius:"8px",color:"white",cursor:"pointer",transition:"background 0.15s"},r={padding:"10px 20px",borderRadius:"8px",color:"white",fontWeight:500,border:"none",cursor:"pointer",transition:"background 0.15s"},c={...r,background:o.blue},g={...r,background:o.green},s={padding:"6px 12px",borderRadius:"6px",color:"white",fontWeight:500,fontSize:"13px",border:"none",cursor:"pointer",transition:"background 0.15s"};export{r as btnBase,c as btnBlueStyle,g as btnGreenStyle,s as btnSmallStyle,n as buttonColors,t as cardStyle,d as inputStyle,b as paginationBtnStyle,i as tableCardStyle,p as tdStyle,a as thStyle,e as theme};
package/dist/theme.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/theme.ts"],
4
- "sourcesContent": ["import type { CSSProperties } from 'react';\n\n/**\n * Design tokens for the inline-styled parts of the SPA.\n *\n * ## Provenance\n *\n * Verbatim from `apps/web/src/components/ui/theme.ts` in **AWS-AccessBridge**,\n * which is the only repo of the eight that styled its primitives with inline\n * styles rather than Tailwind classes. It wins by default: nothing else in the\n * family carries a token table, and the six Tailwind repos encode the same\n * decisions as CSS custom properties (`--color-accent`, `--color-surface-1`, …)\n * in their `globals.css` instead of in TypeScript.\n *\n * So this file serves two audiences:\n *\n * - Consumers that render the class-based primitives (`Button`, `Card`, `Input`,\n * `Badge`, `Pagination`) need nothing from here — those components carry\n * Tailwind classes that read the CSS variables their `globals.css` defines.\n * - Consumers with bespoke, non-Tailwind surfaces (AWS-AccessBridge's admin\n * tables and its `LoadingButton` chrome) use these tokens directly.\n *\n * The two are deliberately not unified: collapsing them would either push hex\n * values into the class-based components or force every Tailwind consumer to\n * declare a TypeScript mirror of their theme. Neither repo family does that\n * today, and a token that exists in two places is a token that drifts.\n */\n\n/**\n * The palette. One flat record so a consumer can spread it into a CSS-in-JS\n * theme or read `theme.accent`-style names without a nested lookup.\n */\nconst theme = {\n cardBg: '#1e2433',\n inputBg: '#252d3d',\n border: '#374151',\n blue: '#2563eb',\n blueHover: '#1d4ed8',\n green: '#16a34a',\n greenHover: '#15803d',\n red: '#dc2626',\n redHover: '#b91c1c',\n spinnerBlue: '#60a5fa',\n /**\n The border colour a focused field paints.\n */\n focusBorder: '#3b82f6',\n} as const;\n\n/**\n * Background/hover pairs for the solid action colours.\n *\n * Keyed by colour name rather than by the kit's `Button` variants because a\n * plain colour table is what a bespoke button needs; `Button` maps its\n * normalized variants onto its own classes.\n */\nconst buttonColors: Record<string, { bg: string; hover: string }> = {\n blue: { bg: theme.blue, hover: theme.blueHover },\n green: { bg: theme.green, hover: theme.greenHover },\n red: { bg: theme.red, hover: theme.redHover },\n};\n\n/**\nThe standard content card surface.\n*/\nconst cardStyle: CSSProperties = {\n background: theme.cardBg,\n borderRadius: '12px',\n padding: '24px',\n};\n\n/**\nThe standard text field surface.\n*/\nconst inputStyle: CSSProperties = {\n width: '100%',\n padding: '12px',\n background: theme.inputBg,\n borderRadius: '8px',\n border: `1px solid ${theme.border}`,\n color: '#ffffff',\n outline: 'none',\n boxSizing: 'border-box',\n transition: 'border-color 0.15s',\n};\n\n/**\nA card whose content is a table: the table supplies its own padding.\n*/\nconst tableCardStyle: CSSProperties = {\n background: theme.cardBg,\n borderRadius: '12px',\n overflow: 'hidden',\n};\n\n/**\nColumn header cell.\n*/\nconst thStyle: CSSProperties = {\n textAlign: 'left',\n padding: '12px',\n background: theme.inputBg,\n color: '#9ca3af',\n textTransform: 'uppercase',\n letterSpacing: '0.05em',\n fontSize: '12px',\n fontWeight: 500,\n};\n\n/**\nBody cell.\n*/\nconst tdStyle: CSSProperties = {\n padding: '12px',\n borderTop: '1px solid rgba(55,65,81,0.3)',\n};\n\n/**\nA pager control, as used by `Pagination`'s inline-styled consumers.\n*/\nconst paginationBtnStyle: CSSProperties = {\n padding: '6px 12px',\n background: theme.inputBg,\n border: 'none',\n borderRadius: '8px',\n color: 'white',\n cursor: 'pointer',\n transition: 'background 0.15s',\n};\n\n/**\n * Shared geometry for the solid action buttons: `btnBlueStyle`, `btnGreenStyle`\n * and the small variant each spread it and override only what differs, so a\n * change to the radius or weight lands in all of them at once.\n */\nconst btnBase: CSSProperties = {\n padding: '10px 20px',\n borderRadius: '8px',\n color: 'white',\n fontWeight: 500,\n border: 'none',\n cursor: 'pointer',\n transition: 'background 0.15s',\n};\n\nconst btnBlueStyle: CSSProperties = { ...btnBase, background: theme.blue };\nconst btnGreenStyle: CSSProperties = { ...btnBase, background: theme.green };\n\n/**\nThe dense action button used in table rows.\n*/\nconst btnSmallStyle: CSSProperties = {\n padding: '6px 12px',\n borderRadius: '6px',\n color: 'white',\n fontWeight: 500,\n fontSize: '13px',\n border: 'none',\n cursor: 'pointer',\n transition: 'background 0.15s',\n};\n\nexport {\n btnBase,\n btnBlueStyle,\n btnGreenStyle,\n btnSmallStyle,\n buttonColors,\n cardStyle,\n inputStyle,\n paginationBtnStyle,\n tableCardStyle,\n tdStyle,\n theme,\n thStyle,\n};\n"],
5
- "mappings": "AAgCA,MAAMA,EAAQ,CACZ,OAAQ,UACR,QAAS,UACT,OAAQ,UACR,KAAM,UACN,UAAW,UACX,MAAO,UACP,WAAY,UACZ,IAAK,UACL,SAAU,UACV,YAAa,UAIb,YAAa,WAUTC,EAA8D,CAClE,KAAM,CAAE,GAAID,EAAM,KAAM,MAAOA,EAAM,SAAS,EAC9C,MAAO,CAAE,GAAIA,EAAM,MAAO,MAAOA,EAAM,UAAU,EACjD,IAAK,CAAE,GAAIA,EAAM,IAAK,MAAOA,EAAM,QAAQ,GAMvCE,EAA2B,CAC/B,WAAYF,EAAM,OAClB,aAAc,OACd,QAAS,QAMLG,EAA4B,CAChC,MAAO,OACP,QAAS,OACT,WAAYH,EAAM,QAClB,aAAc,MACd,OAAQ,aAAaA,EAAM,MAAM,GACjC,MAAO,UACP,QAAS,OACT,UAAW,aACX,WAAY,sBAMRI,EAAgC,CACpC,WAAYJ,EAAM,OAClB,aAAc,OACd,SAAU,UAMNK,EAAyB,CAC7B,UAAW,OACX,QAAS,OACT,WAAYL,EAAM,QAClB,MAAO,UACP,cAAe,YACf,cAAe,SACf,SAAU,OACV,WAAY,KAMRM,EAAyB,CAC7B,QAAS,OACT,UAAW,gCAMPC,EAAoC,CACxC,QAAS,WACT,WAAYP,EAAM,QAClB,OAAQ,OACR,aAAc,MACd,MAAO,QACP,OAAQ,UACR,WAAY,oBAQRQ,EAAyB,CAC7B,QAAS,YACT,aAAc,MACd,MAAO,QACP,WAAY,IACZ,OAAQ,OACR,OAAQ,UACR,WAAY,oBAGRC,EAA8B,CAAE,GAAGD,EAAS,WAAYR,EAAM,IAAI,EAClEU,EAA+B,CAAE,GAAGF,EAAS,WAAYR,EAAM,KAAK,EAKpEW,EAA+B,CACnC,QAAS,WACT,aAAc,MACd,MAAO,QACP,WAAY,IACZ,SAAU,OACV,OAAQ,OACR,OAAQ,UACR,WAAY",
6
- "names": ["theme", "buttonColors", "cardStyle", "inputStyle", "tableCardStyle", "thStyle", "tdStyle", "paginationBtnStyle", "btnBase", "btnBlueStyle", "btnGreenStyle", "btnSmallStyle"]
4
+ "sourcesContent": ["import type { CSSProperties } from 'react';\nimport { legacyPalette } from './legacyPalette.ts';\n\n/**\n * Design tokens for the inline-styled parts of the SPA.\n *\n * **Deprecated, removed in 2.0.** Tailwind class helpers are the single styling\n * API: `buttonClass`, `cardClass`, `fieldClass` and friends, over the `--color-*`\n * tokens `@rexezuge/web/styles.css` ships defaults for. Each export below is\n * `@deprecated`; nothing new may be added here.\n *\n * ## Provenance\n *\n * Verbatim from `apps/web/src/components/ui/legacyPalette.ts` in **AWS-AccessBridge**,\n * which is the only repo of the eight that styled its primitives with inline\n * styles rather than Tailwind classes. It wins by default: nothing else in the\n * family carries a token table, and the six Tailwind repos encode the same\n * decisions as CSS custom properties (`--color-accent`, `--color-surface-1`, …)\n * in their `globals.css` instead of in TypeScript.\n *\n * So this file serves two audiences:\n *\n * - Consumers that render the class-based primitives (`Button`, `Card`, `Input`,\n * `Badge`, `Pagination`) need nothing from here — those components carry\n * Tailwind classes that read the CSS variables their `globals.css` defines.\n * - Consumers with bespoke, non-Tailwind surfaces (AWS-AccessBridge's admin\n * tables and its `LoadingButton` chrome) use these tokens directly.\n *\n * The two are deliberately not unified: collapsing them would either push hex\n * values into the class-based components or force every Tailwind consumer to\n * declare a TypeScript mirror of their theme. Neither repo family does that\n * today, and a token that exists in two places is a token that drifts.\n */\n\n/**\n * The palette. One flat record so a consumer can spread it into a CSS-in-JS\n * theme or read `legacyPalette.accent`-style names without a nested lookup.\n */\n/**\n * @deprecated Inline-style tokens are removed in 2.0. Tailwind class helpers\n * (`buttonClass`, `cardClass`, `fieldClass`, …) over the `--color-*` tokens in\n * `@rexezuge/web/styles.css` are the single styling API.\n */\nconst theme = legacyPalette;\n\n/**\n * Background/hover pairs for the solid action colours.\n *\n * Keyed by colour name rather than by the kit's `Button` variants because a\n * plain colour table is what a bespoke button needs; `Button` maps its\n * normalized variants onto its own classes.\n\n@deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.\n*/\nconst buttonColors: Record<string, { bg: string; hover: string }> = {\n blue: { bg: legacyPalette.blue, hover: legacyPalette.blueHover },\n green: { bg: legacyPalette.green, hover: legacyPalette.greenHover },\n red: { bg: legacyPalette.red, hover: legacyPalette.redHover },\n};\n\n/**\nThe standard content card surface.\n\n@deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.\n*/\nconst cardStyle: CSSProperties = {\n background: legacyPalette.cardBg,\n borderRadius: '12px',\n padding: '24px',\n};\n\n/**\nThe standard text field surface.\n\n@deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.\n*/\nconst inputStyle: CSSProperties = {\n width: '100%',\n padding: '12px',\n background: legacyPalette.inputBg,\n borderRadius: '8px',\n border: `1px solid ${legacyPalette.border}`,\n color: '#ffffff',\n outline: 'none',\n boxSizing: 'border-box',\n transition: 'border-color 0.15s',\n};\n\n/**\nA card whose content is a table: the table supplies its own padding.\n\n@deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.\n*/\nconst tableCardStyle: CSSProperties = {\n background: legacyPalette.cardBg,\n borderRadius: '12px',\n overflow: 'hidden',\n};\n\n/**\nColumn header cell.\n\n@deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.\n*/\nconst thStyle: CSSProperties = {\n textAlign: 'left',\n padding: '12px',\n background: legacyPalette.inputBg,\n color: '#9ca3af',\n textTransform: 'uppercase',\n letterSpacing: '0.05em',\n fontSize: '12px',\n fontWeight: 500,\n};\n\n/**\nBody cell.\n\n@deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.\n*/\nconst tdStyle: CSSProperties = {\n padding: '12px',\n borderTop: '1px solid rgba(55,65,81,0.3)',\n};\n\n/**\nA pager control, as used by `Pagination`'s inline-styled consumers.\n\n@deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.\n*/\nconst paginationBtnStyle: CSSProperties = {\n padding: '6px 12px',\n background: legacyPalette.inputBg,\n border: 'none',\n borderRadius: '8px',\n color: 'white',\n cursor: 'pointer',\n transition: 'background 0.15s',\n};\n\n/**\n * Shared geometry for the solid action buttons: `btnBlueStyle`, `btnGreenStyle`\n * and the small variant each spread it and override only what differs, so a\n * change to the radius or weight lands in all of them at once.\n\n@deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.\n*/\nconst btnBase: CSSProperties = {\n padding: '10px 20px',\n borderRadius: '8px',\n color: 'white',\n fontWeight: 500,\n border: 'none',\n cursor: 'pointer',\n transition: 'background 0.15s',\n};\n\n/**\n@deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.\n*/\nconst btnBlueStyle: CSSProperties = { ...btnBase, background: legacyPalette.blue };\n/**\n@deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.\n*/\nconst btnGreenStyle: CSSProperties = { ...btnBase, background: legacyPalette.green };\n\n/**\nThe dense action button used in table rows.\n\n@deprecated Removed in 2.0; use the Tailwind class helpers over `@rexezuge/web/styles.css`.\n*/\nconst btnSmallStyle: CSSProperties = {\n padding: '6px 12px',\n borderRadius: '6px',\n color: 'white',\n fontWeight: 500,\n fontSize: '13px',\n border: 'none',\n cursor: 'pointer',\n transition: 'background 0.15s',\n};\n\nexport {\n btnBase,\n btnBlueStyle,\n btnGreenStyle,\n btnSmallStyle,\n buttonColors,\n cardStyle,\n inputStyle,\n paginationBtnStyle,\n tableCardStyle,\n tdStyle,\n theme,\n thStyle,\n};\n"],
5
+ "mappings": "AACA,OAAS,iBAAAA,MAAqB,qBA0C9B,MAAMC,EAAQD,EAWRE,EAA8D,CAClE,KAAM,CAAE,GAAIF,EAAc,KAAM,MAAOA,EAAc,SAAS,EAC9D,MAAO,CAAE,GAAIA,EAAc,MAAO,MAAOA,EAAc,UAAU,EACjE,IAAK,CAAE,GAAIA,EAAc,IAAK,MAAOA,EAAc,QAAQ,GAQvDG,EAA2B,CAC/B,WAAYH,EAAc,OAC1B,aAAc,OACd,QAAS,QAQLI,EAA4B,CAChC,MAAO,OACP,QAAS,OACT,WAAYJ,EAAc,QAC1B,aAAc,MACd,OAAQ,aAAaA,EAAc,MAAM,GACzC,MAAO,UACP,QAAS,OACT,UAAW,aACX,WAAY,sBAQRK,EAAgC,CACpC,WAAYL,EAAc,OAC1B,aAAc,OACd,SAAU,UAQNM,EAAyB,CAC7B,UAAW,OACX,QAAS,OACT,WAAYN,EAAc,QAC1B,MAAO,UACP,cAAe,YACf,cAAe,SACf,SAAU,OACV,WAAY,KAQRO,EAAyB,CAC7B,QAAS,OACT,UAAW,gCAQPC,EAAoC,CACxC,QAAS,WACT,WAAYR,EAAc,QAC1B,OAAQ,OACR,aAAc,MACd,MAAO,QACP,OAAQ,UACR,WAAY,oBAURS,EAAyB,CAC7B,QAAS,YACT,aAAc,MACd,MAAO,QACP,WAAY,IACZ,OAAQ,OACR,OAAQ,UACR,WAAY,oBAMRC,EAA8B,CAAE,GAAGD,EAAS,WAAYT,EAAc,IAAI,EAI1EW,EAA+B,CAAE,GAAGF,EAAS,WAAYT,EAAc,KAAK,EAO5EY,EAA+B,CACnC,QAAS,WACT,aAAc,MACd,MAAO,QACP,WAAY,IACZ,SAAU,OACV,OAAQ,OACR,OAAQ,UACR,WAAY",
6
+ "names": ["legacyPalette", "theme", "buttonColors", "cardStyle", "inputStyle", "tableCardStyle", "thStyle", "tdStyle", "paginationBtnStyle", "btnBase", "btnBlueStyle", "btnGreenStyle", "btnSmallStyle"]
7
7
  }
@@ -50,9 +50,12 @@ interface UseNoticeOptions {
50
50
  */
51
51
  dismissAfterMs?: number;
52
52
  /**
53
- A notice to start with — the URL-seeded OAuth result, in a consumer.
54
- */
55
- initial?: Notice | null;
53
+ * A notice to start with — the URL-seeded OAuth result, in a consumer. A
54
+ * function is called once, on mount, like `useState`'s initializer: Mail-Otter
55
+ * passed `oauthNoticeFromUrl(t)` as a value, which re-read the URL on every
56
+ * render.
57
+ */
58
+ initial?: Notice | null | (() => Notice | null);
56
59
  }
57
60
  interface UseNoticeResult {
58
61
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"useNotice.d.ts","sourceRoot":"","sources":["../src/useNotice.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,KAAK,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;AAEtC;;EAEE;AACF,UAAU,MAAM;IACd,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;EAEE;AACF,KAAK,UAAU,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAE9D,UAAU,gBAAgB;IACxB;;MAEE;IACF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;MAEE;IACF,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,UAAU,eAAe;IACvB;;MAEE;IACF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;MAEE;IACF,UAAU,EAAE,UAAU,CAAC;IACvB;;MAEE;IACF,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,iBAAS,SAAS,CAAC,EAAE,cAAkC,EAAE,OAAc,EAAE,GAAE,QAAQ,CAAC,gBAAgB,CAAM,GAAG,eAAe,CAqC3H;AAED,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"useNotice.d.ts","sourceRoot":"","sources":["../src/useNotice.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,KAAK,UAAU,GAAG,SAAS,GAAG,OAAO,CAAC;AAEtC;;EAEE;AACF,UAAU,MAAM;IACd,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;EAEE;AACF,KAAK,UAAU,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAE9D,UAAU,gBAAgB;IACxB;;MAEE;IACF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,CAAC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC;CACjD;AAED,UAAU,eAAe;IACvB;;MAEE;IACF,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;MAEE;IACF,UAAU,EAAE,UAAU,CAAC;IACvB;;MAEE;IACF,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,iBAAS,SAAS,CAAC,EAAE,cAAkC,EAAE,OAAc,EAAE,GAAE,QAAQ,CAAC,gBAAgB,CAAM,GAAG,eAAe,CAqC3H;AAED,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/useNotice.ts"],
4
- "sourcesContent": ["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { NOTICE_TIMEOUT_MS } from './constants.ts';\n\n/**\n * A transient status message.\n *\n * ## Provenance\n *\n * `hooks/useNotice.ts` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies of one hook, with AWS-AccessBridge's `useToast` as the seventh in\n * everything but name. Each contributes one thing:\n *\n * - **Durable-DAV** — the unmount cleanup. Its comment records the bug: the\n * timer was only ever cleared in favour of the *next* notice, so unmounting\n * with a notice showing left it live to call `setState` on a gone component.\n * - **Edge-Sonic** — `clearNotice`, a dismissal that is not just \"replace it\",\n * and the exported `ShowNotice` type so feature tabs stop re-spelling the\n * setter's signature.\n * - **CalDAV-Bridge / Mail-Otter** — seeding the first notice from the URL's\n * `?oauth2=` result. That is *left local*: the parameter names are\n * product-specific, and a hook that reads a query string is a hook a test\n * has to fake a location for. A consumer seeds its own notice by passing\n * `initial` — see `UseNoticeOptions`.\n * - **All six** — a ref-held timer, so a new notice replaces the old one's\n * dismissal instead of being cut short by it (\"the error banner vanished\n * before I read it\").\n *\n * ## Normalization\n *\n * The type is `{ kind, message }`. Every copy used `{ type, text }`, and the\n * field names collided with the DOM's `type` on unrelated elements often enough\n * that `kind`/`message` read better at the call sites that build one by hand\n * (`describeProbe` in Edge-Sonic returns a notice-shaped value). The imperative\n * API is `showNotice(kind, message)` — positional, as every copy had it, so a\n * call site reads as the event it reports — plus `dismissNotice()`.\n */\n\ntype NoticeKind = 'success' | 'error';\n\n/**\nOne transient message. `kind` is the tone, `message` the sentence.\n*/\ninterface Notice {\n kind: NoticeKind;\n message: string;\n}\n\n/**\nThe setter views and hooks are handed.\n*/\ntype ShowNotice = (kind: NoticeKind, message: string) => void;\n\ninterface UseNoticeOptions {\n /**\n How long a notice stays up. Defaults to `NOTICE_TIMEOUT_MS`.\n */\n dismissAfterMs?: number;\n /**\n A notice to start with — the URL-seeded OAuth result, in a consumer.\n */\n initial?: Notice | null;\n}\n\ninterface UseNoticeResult {\n /**\n The notice to render, or `null` when there is nothing to say.\n */\n notice: Notice | null;\n /**\n Shows a notice, replacing any notice already showing (and its timer).\n */\n showNotice: ShowNotice;\n /**\n Hides the notice and cancels its pending dismissal.\n */\n dismissNotice: () => void;\n}\n\nfunction useNotice({ dismissAfterMs = NOTICE_TIMEOUT_MS, initial = null }: Readonly<UseNoticeOptions> = {}): UseNoticeResult {\n const [notice, setNotice] = useState<Notice | null>(initial);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const clearPendingDismissal = useCallback(() => {\n if (timerRef.current === null) {\n return;\n }\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }, []);\n\n const dismissNotice = useCallback(() => {\n clearPendingDismissal();\n setNotice(null);\n }, [clearPendingDismissal]);\n\n const showNotice = useCallback<ShowNotice>(\n (kind, message) => {\n // Replace the pending dismissal rather than stacking a second timer: two\n // live timers mean the first notice's timeout fires while the second is\n // still on screen.\n clearPendingDismissal();\n setNotice({ kind, message });\n timerRef.current = setTimeout(() => {\n timerRef.current = null;\n setNotice(null);\n }, dismissAfterMs);\n },\n [clearPendingDismissal, dismissAfterMs],\n );\n\n // Unmounting cancels the dismissal. Without this the timer outlives the\n // component and calls `setState` on a tree that is gone.\n useEffect(() => clearPendingDismissal, [clearPendingDismissal]);\n\n return { notice, showNotice, dismissNotice };\n}\n\nexport { useNotice };\nexport type { Notice, NoticeKind, ShowNotice, UseNoticeOptions, UseNoticeResult };\n"],
5
- "mappings": "+EAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,UAAAC,EAAQ,YAAAC,MAAgB,QACzD,OAAS,qBAAAC,MAAyB,iBA8ElC,SAASC,EAAU,CAAE,eAAAC,EAAiBF,EAAmB,QAAAG,EAAU,IAAI,EAAiC,CAAA,EAAE,CACxG,KAAM,CAACC,EAAQC,CAAS,EAAIN,EAAwBI,CAAO,EACrDG,EAAWR,EAA6C,IAAI,EAE5DS,EAAwBX,EAAY,IAAK,CACzCU,EAAS,UAAY,OAGzB,aAAaA,EAAS,OAAO,EAC7BA,EAAS,QAAU,KACrB,EAAG,CAAA,CAAE,EAECE,EAAgBZ,EAAY,IAAK,CACrCW,EAAqB,EACrBF,EAAU,IAAI,CAChB,EAAG,CAACE,CAAqB,CAAC,EAEpBE,EAAab,EACjB,CAACc,EAAMC,IAAW,CAIhBJ,EAAqB,EACrBF,EAAU,CAAE,KAAAK,EAAM,QAAAC,CAAO,CAAE,EAC3BL,EAAS,QAAU,WAAW,IAAK,CACjCA,EAAS,QAAU,KACnBD,EAAU,IAAI,CAChB,EAAGH,CAAc,CACnB,EACA,CAACK,EAAuBL,CAAc,CAAC,EAKzC,OAAAL,EAAU,IAAMU,EAAuB,CAACA,CAAqB,CAAC,EAEvD,CAAE,OAAAH,EAAQ,WAAAK,EAAY,cAAAD,CAAa,CAC5C,CArCSI,EAAAX,EAAA",
4
+ "sourcesContent": ["import { useCallback, useEffect, useRef, useState } from 'react';\nimport { NOTICE_TIMEOUT_MS } from './constants.ts';\n\n/**\n * A transient status message.\n *\n * ## Provenance\n *\n * `hooks/useNotice.ts` in **CalDAV-Bridge**, **Durable-DAV**,\n * **Durable-DAV-Router**, **Edge-Git**, **Edge-Sonic** and **Mail-Otter** — six\n * copies of one hook, with AWS-AccessBridge's `useToast` as the seventh in\n * everything but name. Each contributes one thing:\n *\n * - **Durable-DAV** — the unmount cleanup. Its comment records the bug: the\n * timer was only ever cleared in favour of the *next* notice, so unmounting\n * with a notice showing left it live to call `setState` on a gone component.\n * - **Edge-Sonic** — `clearNotice`, a dismissal that is not just \"replace it\",\n * and the exported `ShowNotice` type so feature tabs stop re-spelling the\n * setter's signature.\n * - **CalDAV-Bridge / Mail-Otter** — seeding the first notice from the URL's\n * `?oauth2=` result. That is *left local*: the parameter names are\n * product-specific, and a hook that reads a query string is a hook a test\n * has to fake a location for. A consumer seeds its own notice by passing\n * `initial` — see `UseNoticeOptions`.\n * - **All six** — a ref-held timer, so a new notice replaces the old one's\n * dismissal instead of being cut short by it (\"the error banner vanished\n * before I read it\").\n *\n * ## Normalization\n *\n * The type is `{ kind, message }`. Every copy used `{ type, text }`, and the\n * field names collided with the DOM's `type` on unrelated elements often enough\n * that `kind`/`message` read better at the call sites that build one by hand\n * (`describeProbe` in Edge-Sonic returns a notice-shaped value). The imperative\n * API is `showNotice(kind, message)` — positional, as every copy had it, so a\n * call site reads as the event it reports — plus `dismissNotice()`.\n */\n\ntype NoticeKind = 'success' | 'error';\n\n/**\nOne transient message. `kind` is the tone, `message` the sentence.\n*/\ninterface Notice {\n kind: NoticeKind;\n message: string;\n}\n\n/**\nThe setter views and hooks are handed.\n*/\ntype ShowNotice = (kind: NoticeKind, message: string) => void;\n\ninterface UseNoticeOptions {\n /**\n How long a notice stays up. Defaults to `NOTICE_TIMEOUT_MS`.\n */\n dismissAfterMs?: number;\n /**\n * A notice to start with — the URL-seeded OAuth result, in a consumer. A\n * function is called once, on mount, like `useState`'s initializer: Mail-Otter\n * passed `oauthNoticeFromUrl(t)` as a value, which re-read the URL on every\n * render.\n */\n initial?: Notice | null | (() => Notice | null);\n}\n\ninterface UseNoticeResult {\n /**\n The notice to render, or `null` when there is nothing to say.\n */\n notice: Notice | null;\n /**\n Shows a notice, replacing any notice already showing (and its timer).\n */\n showNotice: ShowNotice;\n /**\n Hides the notice and cancels its pending dismissal.\n */\n dismissNotice: () => void;\n}\n\nfunction useNotice({ dismissAfterMs = NOTICE_TIMEOUT_MS, initial = null }: Readonly<UseNoticeOptions> = {}): UseNoticeResult {\n const [notice, setNotice] = useState<Notice | null>(initial);\n const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const clearPendingDismissal = useCallback(() => {\n if (timerRef.current === null) {\n return;\n }\n clearTimeout(timerRef.current);\n timerRef.current = null;\n }, []);\n\n const dismissNotice = useCallback(() => {\n clearPendingDismissal();\n setNotice(null);\n }, [clearPendingDismissal]);\n\n const showNotice = useCallback<ShowNotice>(\n (kind, message) => {\n // Replace the pending dismissal rather than stacking a second timer: two\n // live timers mean the first notice's timeout fires while the second is\n // still on screen.\n clearPendingDismissal();\n setNotice({ kind, message });\n timerRef.current = setTimeout(() => {\n timerRef.current = null;\n setNotice(null);\n }, dismissAfterMs);\n },\n [clearPendingDismissal, dismissAfterMs],\n );\n\n // Unmounting cancels the dismissal. Without this the timer outlives the\n // component and calls `setState` on a tree that is gone.\n useEffect(() => clearPendingDismissal, [clearPendingDismissal]);\n\n return { notice, showNotice, dismissNotice };\n}\n\nexport { useNotice };\nexport type { Notice, NoticeKind, ShowNotice, UseNoticeOptions, UseNoticeResult };\n"],
5
+ "mappings": "+EAAA,OAAS,eAAAA,EAAa,aAAAC,EAAW,UAAAC,EAAQ,YAAAC,MAAgB,QACzD,OAAS,qBAAAC,MAAyB,iBAiFlC,SAASC,EAAU,CAAE,eAAAC,EAAiBF,EAAmB,QAAAG,EAAU,IAAI,EAAiC,CAAA,EAAE,CACxG,KAAM,CAACC,EAAQC,CAAS,EAAIN,EAAwBI,CAAO,EACrDG,EAAWR,EAA6C,IAAI,EAE5DS,EAAwBX,EAAY,IAAK,CACzCU,EAAS,UAAY,OAGzB,aAAaA,EAAS,OAAO,EAC7BA,EAAS,QAAU,KACrB,EAAG,CAAA,CAAE,EAECE,EAAgBZ,EAAY,IAAK,CACrCW,EAAqB,EACrBF,EAAU,IAAI,CAChB,EAAG,CAACE,CAAqB,CAAC,EAEpBE,EAAab,EACjB,CAACc,EAAMC,IAAW,CAIhBJ,EAAqB,EACrBF,EAAU,CAAE,KAAAK,EAAM,QAAAC,CAAO,CAAE,EAC3BL,EAAS,QAAU,WAAW,IAAK,CACjCA,EAAS,QAAU,KACnBD,EAAU,IAAI,CAChB,EAAGH,CAAc,CACnB,EACA,CAACK,EAAuBL,CAAc,CAAC,EAKzC,OAAAL,EAAU,IAAMU,EAAuB,CAACA,CAAqB,CAAC,EAEvD,CAAE,OAAAH,EAAQ,WAAAK,EAAY,cAAAD,CAAa,CAC5C,CArCSI,EAAAX,EAAA",
6
6
  "names": ["useCallback", "useEffect", "useRef", "useState", "NOTICE_TIMEOUT_MS", "useNotice", "dismissAfterMs", "initial", "notice", "setNotice", "timerRef", "clearPendingDismissal", "dismissNotice", "showNotice", "kind", "message", "__name"]
7
7
  }
@@ -0,0 +1,107 @@
1
+ import type { DependencyList } from 'react';
2
+ /**
3
+ * `useResource` / `useMutation`: the two data hooks every SPA rebuilt.
4
+ *
5
+ * ## Provenance
6
+ *
7
+ * Mail-Meow's `hooks/useAsyncResource.ts`, written after two of its three data
8
+ * hooks lost their failures: `useProcessing` swallowed the error and rendered
9
+ * "no task runs yet", and the shell read a transient list failure as signed-out.
10
+ * Every other repo still hand-rolls `useEffect` + `useState` + a `cancelled`
11
+ * flag per view. What changed in the kit version:
12
+ *
13
+ * - **Aborted, not just ignored.** The loader gets an `AbortSignal`, aborted when
14
+ * the deps change, on `reload`, and on unmount, so a superseded request stops
15
+ * costing a Worker invocation. Hand it to `createApiClient`'s `signal` or to a
16
+ * contract call's options.
17
+ * - **Stale-response guard.** Only the latest run may set state, so a slow first
18
+ * response cannot overwrite a fast second one. Mail-Meow's per-run `cancelled`
19
+ * flag did this, and the kit keeps it.
20
+ * - **A typed error.** `error` is an `Error` (`createApiClient` rejects with a
21
+ * `ServiceError`, so `error.status` is there to narrow on). A non-`Error` throw
22
+ * is normalized through `ServiceError.from`, never stored raw as `unknown`.
23
+ * - **`null`, not `undefined`, for absent** (the kit's null rule): `data` and
24
+ * `error` are `null` until there is one.
25
+ * - Data is kept across a reload, so a refresh does not blank the view, and is
26
+ * cleared on an error only if you ask (`keepDataOnError: false`).
27
+ *
28
+ * Deliberately thin: no cache, no dedup across components, no retries. The RFC
29
+ * keeps react-query out until a repo proves it needs it.
30
+ */
31
+ type ResourceStatus = 'idle' | 'loading' | 'ready' | 'error';
32
+ interface ResourceState<T> {
33
+ /**
34
+ The last loaded value, or `null` before the first success.
35
+ */
36
+ data: T | null;
37
+ /**
38
+ The last failure, or `null`. Cleared by the next success.
39
+ */
40
+ error: Error | null;
41
+ status: ResourceStatus;
42
+ isLoading: boolean;
43
+ /**
44
+ Run the loader again (aborting a run in flight).
45
+ */
46
+ reload: () => void;
47
+ }
48
+ interface UseResourceOptions {
49
+ /**
50
+ Skip loading while `false` (a dependency not known yet). Defaults to `true`.
51
+ */
52
+ enabled?: boolean;
53
+ /**
54
+ Keep the last `data` when a later run fails. Defaults to `true`.
55
+ */
56
+ keepDataOnError?: boolean;
57
+ }
58
+ /**
59
+ * Load data for a view:
60
+ *
61
+ * ```ts
62
+ * const items = useResource((signal) => api.listItems({ query: { cursor } }, { signal }), [cursor]);
63
+ * ```
64
+ *
65
+ * `deps` works like an effect's: the loader re-runs when one changes. The loader
66
+ * itself is read from the latest render, so it may close over anything.
67
+ */
68
+ declare function useResource<T>(loader: (signal: AbortSignal) => Promise<T>, deps: DependencyList, { enabled, keepDataOnError }?: Readonly<UseResourceOptions>): ResourceState<T>;
69
+ type MutationStatus = 'idle' | 'pending' | 'success' | 'error';
70
+ interface MutationState<I, R> {
71
+ /**
72
+ Run it, and reject with the failure. For a caller that awaits the result.
73
+ */
74
+ mutateAsync: (input: I) => Promise<R>;
75
+ /**
76
+ Run it, fire-and-forget: the failure goes to `error`, never to an unhandled rejection.
77
+ */
78
+ mutate: (input: I) => void;
79
+ /**
80
+ The latest run's result, or `null`.
81
+ */
82
+ data: R | null;
83
+ error: Error | null;
84
+ status: MutationStatus;
85
+ isPending: boolean;
86
+ /**
87
+ Back to `idle`, aborting a run in flight.
88
+ */
89
+ reset: () => void;
90
+ }
91
+ /**
92
+ * A write from an event handler:
93
+ *
94
+ * ```ts
95
+ * const rename = useMutation((input: { id: string; name: string }, signal) =>
96
+ * api.renameItem({ params: { id: input.id }, body: { name: input.name } }, { signal }),
97
+ * );
98
+ * <Button loading={rename.isPending} onClick={() => rename.mutate({ id, name })}>Save</Button>
99
+ * ```
100
+ *
101
+ * The latest call owns the state, and an earlier one still resolves its own
102
+ * promise. Unmounting aborts the call in flight and stops every state update.
103
+ */
104
+ declare function useMutation<I, R>(fn: (input: I, signal: AbortSignal) => Promise<R>): MutationState<I, R>;
105
+ export { useMutation, useResource };
106
+ export type { MutationState, MutationStatus, ResourceState, ResourceStatus, UseResourceOptions };
107
+ //# sourceMappingURL=useResource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useResource.d.ts","sourceRoot":"","sources":["../src/useResource.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,KAAK,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE7D,UAAU,aAAa,CAAC,CAAC;IACvB;;MAEE;IACF,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf;;MAEE;IACF,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB;;MAEE;IACF,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,UAAU,kBAAkB;IAC1B;;MAEE;IACF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;MAEE;IACF,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAUD;;;;;;;;;GASG;AACH,iBAAS,WAAW,CAAC,CAAC,EACpB,MAAM,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EAC3C,IAAI,EAAE,cAAc,EACpB,EAAE,OAAc,EAAE,eAAsB,EAAE,GAAE,QAAQ,CAAC,kBAAkB,CAAM,GAC5E,aAAa,CAAC,CAAC,CAAC,CA+ClB;AAED,KAAK,cAAc,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE/D,UAAU,aAAa,CAAC,CAAC,EAAE,CAAC;IAC1B;;MAEE;IACF,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC;IACtC;;MAEE;IACF,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC3B;;MAEE;IACF,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB;;MAEE;IACF,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,iBAAS,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,CA2DjG;AAED,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;AACpC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ var C=Object.defineProperty;var a=(r,o)=>C(r,"name",{value:o,configurable:!0});import{useCallback as p,useEffect as w,useRef as E,useState as c}from"react";import{ServiceError as k}from"@rexezuge/errors";function S(r){return r instanceof Error?r:k.from(r)}a(S,"toError");function M(r,o){return o.aborted||r instanceof Error&&r.name==="AbortError"}a(M,"isAbort");function q(r,o,{enabled:i=!0,keepDataOnError:R=!0}={}){const[f,d]=c(null),[s,g]=c(null),[e,u]=c("idle"),[b,A]=c(0),h=E(r),l=E(R);w(()=>{h.current=r,l.current=R}),w(()=>{if(!i)return;const t=new AbortController;return queueMicrotask(()=>{t.signal.aborted||u("loading")}),h.current(t.signal).then(n=>{t.signal.aborted||(d(()=>n),g(null),u("ready"))}).catch(n=>{M(n,t.signal)||(g(S(n)),l.current||d(null),u("error"))}),()=>{t.abort()}},[...o,i,b]);const m=p(()=>{A(t=>t+1)},[]);return{data:f,error:s,status:e,isLoading:e==="loading",reload:m}}a(q,"useResource");function v(r){const[o,i]=c(null),[R,f]=c(null),[d,s]=c("idle"),g=E(r),e=E(null),u=E(!0);w(()=>{g.current=r}),w(()=>(u.current=!0,()=>{u.current=!1,e.current?.abort()}),[]);const b=p(async l=>{const m=new AbortController;e.current=m;const t=a(()=>u.current&&e.current===m,"owns");s("pending"),f(null);try{const n=await g.current(l,m.signal);return t()&&(i(()=>n),s("success")),n}catch(n){const y=S(n);throw t()&&(f(y),s("error")),y}},[]),A=p(l=>{b(l).catch(()=>{})},[b]),h=p(()=>{e.current?.abort(),e.current=null,i(null),f(null),s("idle")},[]);return{mutateAsync:b,mutate:A,data:o,error:R,status:d,isPending:d==="pending",reset:h}}a(v,"useMutation");export{v as useMutation,q as useResource};