@arbidocs/blocks 0.5.133 → 0.5.134
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.
- package/dist/{FilesViewerDialog-OA3HDLOI.cjs → FilesViewerDialog-PA2B7O7I.cjs} +3 -3
- package/dist/{FilesViewerDialog-OA3HDLOI.cjs.map → FilesViewerDialog-PA2B7O7I.cjs.map} +1 -1
- package/dist/{chunk-VCEX7COE.cjs → chunk-LIDXIX36.cjs} +10 -5
- package/dist/chunk-LIDXIX36.cjs.map +1 -0
- package/dist/{chunk-5JK3232B.cjs → chunk-O5WVYUFT.cjs} +2 -2
- package/dist/{chunk-5JK3232B.cjs.map → chunk-O5WVYUFT.cjs.map} +1 -1
- package/dist/connect/index.cjs +67 -53
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/viewer.cjs +1 -1
- package/dist/connection/auth/ConnectedSsoCallback.js +21 -5
- package/dist/connection/auth/ConnectedSsoCallback.js.map +2 -2
- package/dist/connection/runtime/ConnectedAppRuntime.js.map +1 -1
- package/dist/connection/runtime/useWelcomeDialog.d.ts +0 -2
- package/dist/connection/runtime/useWelcomeDialog.js +11 -20
- package/dist/connection/runtime/useWelcomeDialog.js.map +2 -2
- package/dist/index.cjs +62 -62
- package/dist/shell/AccountBanners.d.ts +2 -7
- package/dist/shell/AccountBanners.js +9 -3
- package/dist/shell/AccountBanners.js.map +2 -2
- package/dist/shell/index.cjs +14 -14
- package/dist/styles.css +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +5 -5
- package/src/connection/billing/project-purchase.css +2 -0
- package/dist/chunk-VCEX7COE.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbidocs/coedit",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.134",
|
|
4
4
|
"description": "Real-time collaboration for the ARBI native DOCX editor: a Yjs mirror of the canonical OOXML package, session, and server runtime",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbidocs/blocks",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.134",
|
|
4
4
|
"description": "Composable, domain-neutral UI blocks for ARBI apps, organised by capability (retrieval, facts, agents, workspaces, citations, collaboration) plus shell, theme and site primitives, on top of @arbidocs/react.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -344,9 +344,9 @@
|
|
|
344
344
|
"custom-site:test:e2e": "playwright test -c examples/custom-site/playwright.config.ts"
|
|
345
345
|
},
|
|
346
346
|
"dependencies": {
|
|
347
|
-
"@arbidocs/client": "0.5.
|
|
348
|
-
"@arbidocs/coedit": "0.5.
|
|
349
|
-
"@arbidocs/sdk": "0.5.
|
|
347
|
+
"@arbidocs/client": "0.5.134",
|
|
348
|
+
"@arbidocs/coedit": "0.5.134",
|
|
349
|
+
"@arbidocs/sdk": "0.5.134",
|
|
350
350
|
"@auth0/auth0-react": "^2.19.0",
|
|
351
351
|
"@dnd-kit/core": "^6.3.1",
|
|
352
352
|
"@dnd-kit/sortable": "^10.0.0",
|
|
@@ -397,7 +397,7 @@
|
|
|
397
397
|
"y-protocols": "^1.0.6"
|
|
398
398
|
},
|
|
399
399
|
"peerDependencies": {
|
|
400
|
-
"@arbidocs/react": "0.5.
|
|
400
|
+
"@arbidocs/react": "0.5.134",
|
|
401
401
|
"@lexical/html": "0.35.0",
|
|
402
402
|
"@lexical/link": "0.35.0",
|
|
403
403
|
"@lexical/list": "0.35.0",
|
|
@@ -1075,6 +1075,8 @@ details[open] > .project-purchase-adjust .project-purchase-adjust-label svg {
|
|
|
1075
1075
|
.subscription-start .project-purchase-price-heading { font-size: 16px; line-height: 22px; font-weight: 600; }
|
|
1076
1076
|
.subscription-start .project-purchase-period { font: inherit; }
|
|
1077
1077
|
.subscription-free-benefits { display: grid; gap: 7px; }
|
|
1078
|
+
.subscription-start .subscription-free-benefits .subscription-card-unlimited,
|
|
1079
|
+
.subscription-start .subscription-free-benefits svg { color: hsl(var(--muted-foreground)); }
|
|
1078
1080
|
.welcome-greeting-summary { font-size: 16px; font-weight: 400; line-height: 24px; }
|
|
1079
1081
|
.welcome-greeting-balance { white-space: nowrap; }
|
|
1080
1082
|
.welcome-greeting-balance strong { color: #166534; font-weight: 600; }
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/shell/AccountBanners.tsx","../src/shell/use-install-prompt.ts","../src/shell/InstallPrompt.tsx","../src/shell/SplitLayout.tsx"],"names":["canPersistSession","jsx","Banner","useState","useEffect","useCallback","isIosDevice","getInstallInstructions","jsxs","testIdOr","cn","Download","X"],"mappings":";;;;;;;;;;;;AAGO,IAAM,oCAAA,GACX;AAaK,SAAS,qBAAA,CAAsB;AAAA,EACpC,IAAA,GAAO,oCAAA;AAAA,EACP;AACF,CAAA,EAA+B;AAC7B,EAAA,IAAIA,wBAAA,IAAqB,OAAO,IAAA;AAChC,EAAA,uBACEC,cAAA;AAAA,IAACC,wBAAA;AAAA,IAAA;AAAA,MACC,OAAA,EAAQ,OAAA;AAAA,MACR,IAAA,EAAK,SAAA;AAAA,MACL,IAAA;AAAA,MACA,SAAA;AAAA,MACA,MAAA,EAAO;AAAA;AAAA,GACT;AAEJ;AAEO,IAAM,oCAAA,GAAuC,CAAC,IAAA,KACnD,CAAA,8BAAA,EAAiC,IAAI,CAAA,gEAAA;AAWhC,SAAS,qBAAA,CAAsB;AAAA,EACpC,WAAA;AAAA,EACA,IAAA,GAAO,oCAAA;AAAA,EACP;AACF,CAAA,EAA+B;AAC7B,EAAA,MAAM,OAAO,IAAI,IAAA,CAAK,WAAW,CAAA,CAAE,mBAAmB,OAAA,EAAS;AAAA,IAC7D,KAAA,EAAO,OAAA;AAAA,IACP,GAAA,EAAK,SAAA;AAAA,IACL,IAAA,EAAM;AAAA,GACP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,cAAY,CAAA,CAAE,OAAA;AAAA,cACd,WAAA,EAAU,wBAAA;AAAA,cACV,SAAA,EAAU,sJAAA;AAAA,cAEV,0BAAAA,cAAAA,CAACW,aAAA,EAAA,EAAE,SAAA,EAAU,UAAA,EAAW,eAAY,MAAA,EAAO;AAAA;AAAA;AAC7C,SAAA,EACF;AAAA;AAAA;AAAA,GACF;AAEJ;ACrFO,SAAS,WAAA,CAAY;AAAA,EAC1B,OAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,gBAAA;AAAA,EACA,kBAAA;AAAA,EACA,MAAA,GAAS;AACX,CAAA,EAAqB;AACnB,EAAA,uBACEJ,eAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,cAAA;AAAA,MACV,aAAA,EAAa,MAAA;AAAA,MACb,SAAA,EAAWE,KAAAA,CAAG,oDAAA,EAAsD,SAAS,CAAA;AAAA,MAE7E,QAAA,EAAA;AAAA,wBAAAT,cAAAA;AAAA,UAAC,KAAA;AAAA,UAAA;AAAA,YACC,WAAA,EAAU,iBAAA;AAAA,YACV,SAAA,EAAWS,KAAAA,CAAG,iCAAA,EAAmC,kBAAkB,CAAA;AAAA,YAElE,QAAA,EAAA;AAAA;AAAA,SACH;AAAA,wBACAT,cAAAA,CAAC,KAAA,EAAA,EAAI,WAAA,EAAU,eAAA,EAAgB,WAAWS,KAAAA,CAAG,qBAAA,EAAuB,gBAAgB,CAAA,EACjF,QAAA,EAAA,OAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"chunk-VCEX7COE.cjs","sourcesContent":["import { canPersistSession } from '@arbidocs/client'\nimport { Banner } from '../components/Banner'\n\nexport const DEFAULT_INSECURE_SESSION_BANNER_TEXT =\n 'This connection is not secure (no HTTPS), so your session is kept in memory only and you will be signed out when you reload. Use https:// or localhost for a persistent, encrypted session.'\n\nexport interface InsecureSessionBannerProps {\n text?: string\n className?: string\n}\n\n/**\n * Shown whenever the browser has no Web Crypto (a plain-HTTP origin other than localhost,\n * Tracking Prevention, some embedded webviews). Encryption at rest needs a non-extractable key,\n * so the session is held in memory only: everything works, but a reload signs the user out. Said\n * out loud rather than silently degrading. Renders nothing in a secure context.\n */\nexport function InsecureSessionBanner({\n text = DEFAULT_INSECURE_SESSION_BANNER_TEXT,\n className,\n}: InsecureSessionBannerProps) {\n if (canPersistSession()) return null\n return (\n <Banner\n variant=\"alert\"\n tone=\"warning\"\n text={text}\n className={className}\n testId=\"insecure-context-banner\"\n />\n )\n}\n\nexport const DEFAULT_ACCOUNT_DELETION_BANNER_TEXT = (date: string) =>\n `Account deletion requested on ${date}. Your account and all data will be permanently deleted shortly.`\n\nexport interface AccountDeletionBannerProps {\n /** When the user asked for the deletion (ISO timestamp, the user setting `deletion_requested_at`). */\n requestedAt: string\n /** The notice, given the formatted request date. */\n text?: (date: string) => string\n className?: string\n}\n\n/** The account is due for deletion: a standing notice until it goes. */\nexport function AccountDeletionBanner({\n requestedAt,\n text = DEFAULT_ACCOUNT_DELETION_BANNER_TEXT,\n className,\n}: AccountDeletionBannerProps) {\n const date = new Date(requestedAt).toLocaleDateString('en-US', {\n month: 'short',\n day: 'numeric',\n year: 'numeric',\n })\n return (\n <Banner\n variant=\"alert\"\n tone=\"destructive\"\n text={text(date)}\n className={className}\n testId=\"account-deletion-banner\"\n />\n )\n}\n","import { useCallback, useEffect, useState } from 'react'\nimport { getInstallInstructions, isIosDevice, type InstallGuide } from './install-instructions'\n\n/** Non-standard Chromium event, not in lib.dom types. */\ninterface BeforeInstallPromptEvent extends Event {\n readonly platforms: string[]\n readonly userChoice: Promise<{ outcome: 'accepted' | 'dismissed'; platform: string }>\n prompt(): Promise<void>\n}\n\nlet deferredPrompt: BeforeInstallPromptEvent | null = null\nlet installed = false\nlet initialized = false\nlet autoPromptParam: string | null = null\n\nconst subscribers = new Set<() => void>()\nconst notify = () => subscribers.forEach((fn) => fn())\n\nfunction isStandalone(): boolean {\n if (typeof window === 'undefined') return false\n const iosStandalone = (navigator as Navigator & { standalone?: boolean }).standalone === true\n return window.matchMedia?.('(display-mode: standalone)').matches === true || iosStandalone\n}\n\nfunction wantsAutoPrompt(): boolean {\n if (!autoPromptParam) return false\n return new URLSearchParams(window.location.search).get(autoPromptParam) === 'true'\n}\n\nfunction onBeforeInstallPrompt(event: Event): void {\n event.preventDefault()\n deferredPrompt = event as BeforeInstallPromptEvent\n notify()\n if (wantsAutoPrompt()) void promptAppInstall()\n}\n\nfunction onAppInstalled(): void {\n installed = true\n deferredPrompt = null\n notify()\n}\n\n/**\n * Begin capturing install events. Idempotent. Chromium fires `beforeinstallprompt` once, early,\n * usually before a lazy route has mounted, so call this at app startup (before the first render);\n * `useInstallPrompt` also calls it, which is enough when the hook mounts at the root.\n *\n * `options.autoPromptParam`: a share link `/?{param}=true` opens the native dialog as soon as the\n * browser is ready (Chromium).\n */\nexport function initInstallPrompt(options: { autoPromptParam?: string } = {}): void {\n if (options.autoPromptParam) autoPromptParam = options.autoPromptParam\n if (initialized || typeof window === 'undefined') return\n initialized = true\n installed = isStandalone()\n\n window.addEventListener('beforeinstallprompt', onBeforeInstallPrompt)\n window.addEventListener('appinstalled', onAppInstalled)\n}\n\n/**\n * Open the browser's install dialog if one was captured. Returns false when there is none (the\n * caller then shows {@link getInstallInstructions}). A captured prompt works once.\n */\nexport async function promptAppInstall(): Promise<boolean> {\n if (!deferredPrompt) return false\n const prompt = deferredPrompt\n deferredPrompt = null\n notify()\n try {\n await prompt.prompt()\n } catch {\n // The user dismissed it or the browser rejected it: nothing actionable.\n }\n return true\n}\n\n/** Default storage key of the remembered dismissal. */\nexport const INSTALL_PROMPT_DISMISSED_KEY = 'arbi-blocks:install-prompt-dismissed'\nconst DAY_MS = 24 * 60 * 60 * 1000\n\nfunction readDismissedAt(key: string): number | null {\n try {\n const raw = window.localStorage.getItem(key)\n const at = raw ? Number(raw) : NaN\n return Number.isFinite(at) ? at : null\n } catch {\n return null\n }\n}\n\nexport interface UseInstallPromptOptions {\n /** localStorage key remembering a dismissal. */\n storageKey?: string\n /** Days a dismissal is remembered. Default 30. */\n dismissDays?: number\n /** Query param that turns a share link into a one-click install (`install` for `?install=true`). */\n autoPromptParam?: string\n /** App name used in the manual instructions. */\n appName?: string\n}\n\nexport interface UseInstallPromptResult {\n /** A native install dialog can be opened right now (Chromium, once the event fired). */\n canPrompt: boolean\n /** Running as an installed app, or `appinstalled` fired. */\n isInstalled: boolean\n /** iOS has no install API: offer manual instructions instead. */\n isIos: boolean\n /** The user dismissed the offer (remembered across visits). */\n isDismissed: boolean\n /** Open the native dialog; false when none is available. */\n promptInstall: () => Promise<boolean>\n /** Hide the offer and remember it. */\n dismiss: () => void\n /** Manual steps for this browser. */\n instructions: InstallGuide\n}\n\n/** The install state of the app, framework-neutral logic behind `InstallPrompt`. */\nexport function useInstallPrompt({\n storageKey = INSTALL_PROMPT_DISMISSED_KEY,\n dismissDays = 30,\n autoPromptParam: autoParam,\n appName,\n}: UseInstallPromptOptions = {}): UseInstallPromptResult {\n const [, forceRender] = useState(0)\n const [dismissedAt, setDismissedAt] = useState<number | null>(() =>\n typeof window === 'undefined' ? null : readDismissedAt(storageKey)\n )\n\n useEffect(() => {\n initInstallPrompt({ autoPromptParam: autoParam })\n const onChange = () => forceRender((n) => n + 1)\n subscribers.add(onChange)\n // The singleton may have started before this mount: pick up the current state.\n onChange()\n return () => {\n subscribers.delete(onChange)\n }\n }, [autoParam])\n\n const dismiss = useCallback(() => {\n const now = Date.now()\n setDismissedAt(now)\n try {\n window.localStorage.setItem(storageKey, String(now))\n } catch {\n // Storage blocked: the dismissal lasts for this page view only.\n }\n }, [storageKey])\n\n const isDismissed = dismissedAt !== null && Date.now() - dismissedAt < dismissDays * DAY_MS\n const isInstalled = installed || isStandalone()\n return {\n canPrompt: !isInstalled && deferredPrompt !== null,\n isInstalled,\n isIos: isIosDevice(),\n isDismissed,\n promptInstall: promptAppInstall,\n dismiss,\n instructions: getInstallInstructions({ appName }),\n }\n}\n\n/** Test seam: forget captured state (the singleton lives for the page). */\nexport function resetInstallPromptForTests(): void {\n if (typeof window !== 'undefined') {\n window.removeEventListener('beforeinstallprompt', onBeforeInstallPrompt)\n window.removeEventListener('appinstalled', onAppInstalled)\n }\n deferredPrompt = null\n installed = false\n initialized = false\n autoPromptParam = null\n subscribers.clear()\n}\n","import { useState } from 'react'\nimport { Download, X } from 'lucide-react'\nimport { cn } from '@arbidocs/react/ui'\nimport { testIdOr } from '../chat/test-id'\nimport { useInstallPrompt, type UseInstallPromptOptions } from './use-install-prompt'\n\n/** Fixed strings of the install prompt. */\nexport interface InstallPromptLabels {\n /** The pill's text. */\n install: string\n /** The dismiss button's accessible name. */\n dismiss: string\n /** Accessible name of the pill (`{app}` is replaced by `appName`). */\n installAs: string\n}\n\nexport const DEFAULT_INSTALL_PROMPT_LABELS: InstallPromptLabels = {\n install: 'Install app',\n dismiss: 'Dismiss install prompt',\n installAs: 'Install {app} as an app',\n}\n\nexport interface InstallPromptProps extends UseInstallPromptOptions {\n labels?: Partial<InstallPromptLabels>\n className?: string\n 'data-testid'?: string\n}\n\n/**\n * A small floating \"Install app\" pill. Renders only while the app can be installed (the browser\n * fired `beforeinstallprompt`, or on iOS where it shows the Add to Home Screen steps), is not\n * already installed, and was not dismissed (the dismissal is remembered for `dismissDays`).\n *\n * It sits above whatever is pinned to the bottom of the screen: it reads `--shell-bottom-inset`\n * (set by `MobileTabBar` and the chat composer, see `useShellBottomInset`) plus the device\n * safe area, so it never covers the tab bar or the composer. It sits in the bottom start corner\n * (clear of a bottom-right toaster) and clears a docked `Sidebar` (`--shell-start-inset`). Both\n * controls are 44px tall on a phone.\n */\nexport function InstallPrompt({\n labels,\n className,\n 'data-testid': testId,\n ...options\n}: InstallPromptProps) {\n const l = { ...DEFAULT_INSTALL_PROMPT_LABELS, ...labels }\n const install = useInstallPrompt(options)\n const [showSteps, setShowSteps] = useState(false)\n\n const isOffer = install.canPrompt || install.isIos\n if (install.isInstalled || install.isDismissed || !isOffer) return null\n\n const appName = options.appName ?? 'this app'\n const onInstall = async () => {\n if (install.canPrompt) await install.promptInstall()\n else setShowSteps((open) => !open)\n }\n\n return (\n <div\n data-slot=\"install-prompt\"\n data-testid={testIdOr(testId, { testId: 'install-app-prompt' })}\n className={cn(\n 'fixed z-30 flex max-w-[calc(100vw-1.5rem)] flex-col gap-2',\n // Above the bottom bars (tab bar / composer) and the home indicator on a phone, a plain\n // corner offset from `sm` up where the tab bar is gone.\n 'bottom-[calc(max(var(--shell-bottom-inset,0px),env(safe-area-inset-bottom,0px))+0.75rem)] sm:bottom-[calc(env(safe-area-inset-bottom,0px)+0.75rem)]',\n // From `sm` up, clear of a docked sidebar (its footer holds the account menu).\n 'left-3 items-start sm:left-[calc(var(--shell-start-inset,0px)+0.75rem)]',\n className\n )}\n >\n {showSteps && (\n <div\n data-slot=\"install-prompt-steps\"\n className=\"w-72 max-w-full rounded-lg border border-border bg-card p-3 text-sm text-card-foreground shadow-lg\"\n >\n <p className=\"font-medium\">{install.instructions.heading}</p>\n <ol className=\"mt-2 list-decimal space-y-1 pl-5 text-muted-foreground\">\n {install.instructions.steps.map((step) => (\n <li key={step}>{step}</li>\n ))}\n </ol>\n </div>\n )}\n <div className=\"inline-flex items-center rounded-full border border-border bg-card/95 text-foreground shadow-sm backdrop-blur\">\n <button\n type=\"button\"\n onClick={() => void onInstall()}\n aria-label={l.installAs.replace('{app}', appName)}\n aria-expanded={install.canPrompt ? undefined : showSteps}\n data-slot=\"install-prompt-action\"\n className=\"inline-flex min-h-11 items-center gap-1.5 rounded-full pl-4 pr-2 text-xs font-medium transition-colors hover:bg-accent sm:min-h-9 sm:pl-3\"\n >\n <Download className=\"size-3.5\" aria-hidden=\"true\" />\n {l.install}\n </button>\n <button\n type=\"button\"\n onClick={install.dismiss}\n aria-label={l.dismiss}\n data-slot=\"install-prompt-dismiss\"\n className=\"inline-flex size-11 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-accent hover:text-foreground sm:size-9\"\n >\n <X className=\"size-3.5\" aria-hidden=\"true\" />\n </button>\n </div>\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { cn } from '@arbidocs/react/ui'\n\nexport interface SplitLayoutProps {\n /** The main pane (the detail, the form, the transcript): takes the remaining width. */\n primary: ReactNode\n /**\n * The side pane (the picker, the launcher): 20rem wide at the start once side by side, on top\n * when stacked.\n */\n secondary: ReactNode\n className?: string\n primaryClassName?: string\n secondaryClassName?: string\n testId?: string\n}\n\n/**\n * Two panes (list and detail, form and preview) that stack by the width of their CONTAINER,\n * not the viewport: side by side from 48rem of container width, stacked below. Inside\n * `Shell.Content` / `PageContainer` (both are containers) an open dock or a narrow window\n * therefore stacks the panes instead of squeezing the main one to a sliver. Every pane has\n * `min-w-0`, so long words and wide tables shrink instead of stretching the grid.\n */\nexport function SplitLayout({\n primary,\n secondary,\n className,\n primaryClassName,\n secondaryClassName,\n testId = 'split-layout',\n}: SplitLayoutProps) {\n return (\n <div\n data-slot=\"split-layout\"\n data-testid={testId}\n className={cn('flex flex-col gap-6 @3xl:flex-row @3xl:items-start', className)}\n >\n <div\n data-slot=\"split-secondary\"\n className={cn('min-w-0 @3xl:w-80 @3xl:shrink-0', secondaryClassName)}\n >\n {secondary}\n </div>\n <div data-slot=\"split-primary\" className={cn('min-w-0 @3xl:flex-1', primaryClassName)}>\n {primary}\n </div>\n </div>\n )\n}\n"]}
|