@devcabs/folio-engine 0.0.0-stage → 0.1.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 (180) hide show
  1. package/dist/App.d.ts +7 -0
  2. package/dist/components/canvas/CanvasAddBar.d.ts +28 -0
  3. package/dist/components/canvas/CanvasAddModal.d.ts +38 -0
  4. package/dist/components/canvas/CanvasChart.d.ts +23 -0
  5. package/dist/components/canvas/CanvasDeleteConfirmModal.d.ts +21 -0
  6. package/dist/components/canvas/CanvasGallery.d.ts +20 -0
  7. package/dist/components/canvas/CanvasItemControls.d.ts +33 -0
  8. package/dist/components/canvas/CanvasPhoto.d.ts +28 -0
  9. package/dist/components/canvas/CanvasSection.d.ts +27 -0
  10. package/dist/components/canvas/CanvasSubsection.d.ts +23 -0
  11. package/dist/components/canvas/CanvasText.d.ts +23 -0
  12. package/dist/components/canvas/DocumentCanvas.d.ts +20 -0
  13. package/dist/components/canvas/HeroPhoto.d.ts +17 -0
  14. package/dist/components/canvas/NodeCanvas.d.ts +2 -0
  15. package/dist/components/canvas/index.d.ts +17 -0
  16. package/dist/components/chart/BarChart.d.ts +23 -0
  17. package/dist/components/chart/ChartCard.d.ts +33 -0
  18. package/dist/components/chart/ChartConfigDrawer.d.ts +16 -0
  19. package/dist/components/chart/ChartGhostWireframe.d.ts +16 -0
  20. package/dist/components/chart/ChartLegend.d.ts +14 -0
  21. package/dist/components/chart/ChartRouter.d.ts +8 -0
  22. package/dist/components/chart/ChartSortingControls.d.ts +15 -0
  23. package/dist/components/chart/ChartTableModal.d.ts +26 -0
  24. package/dist/components/chart/ChartTooltip.d.ts +12 -0
  25. package/dist/components/chart/DataPendingCard.d.ts +28 -0
  26. package/dist/components/chart/DonutChart.d.ts +16 -0
  27. package/dist/components/chart/HistogramChart.d.ts +23 -0
  28. package/dist/components/chart/LineChart.d.ts +22 -0
  29. package/dist/components/chart/RangePreviewMatrix.d.ts +19 -0
  30. package/dist/components/chart/ScatterPlot.d.ts +21 -0
  31. package/dist/components/chart/drawer/controls/BarVisualControls.d.ts +9 -0
  32. package/dist/components/chart/drawer/controls/ChartTitlesSection.d.ts +15 -0
  33. package/dist/components/chart/drawer/controls/DonutVisualControls.d.ts +7 -0
  34. package/dist/components/chart/drawer/controls/HistogramVisualControls.d.ts +13 -0
  35. package/dist/components/chart/drawer/controls/LineVisualControls.d.ts +14 -0
  36. package/dist/components/chart/drawer/controls/ScatterDataControls.d.ts +17 -0
  37. package/dist/components/chart/drawer/controls/ScatterVisualControls.d.ts +23 -0
  38. package/dist/components/chart/drawer/controls/SortingAndOrderControls.d.ts +18 -0
  39. package/dist/components/chart/drawer/controls/StandardDataControls.d.ts +31 -0
  40. package/dist/components/chart/drawer/hooks/useChartConfigForm.d.ts +156 -0
  41. package/dist/components/chart/drawer/hooks/useLiveMatrixSync.d.ts +21 -0
  42. package/dist/components/chart/drawer/hooks/useSheetVerification.d.ts +26 -0
  43. package/dist/components/chart/drawer/index.d.ts +17 -0
  44. package/dist/components/chart/drawer/panels/Step1Source.d.ts +18 -0
  45. package/dist/components/chart/drawer/panels/Step1SourceRange.d.ts +32 -0
  46. package/dist/components/chart/drawer/panels/Step2DataRange.d.ts +15 -0
  47. package/dist/components/chart/drawer/panels/Step3ChartSetup.d.ts +17 -0
  48. package/dist/components/chart/drawer/panels/Step4Review.d.ts +11 -0
  49. package/dist/components/chart/index.d.ts +22 -0
  50. package/dist/components/dev/DevActionAffordance.d.ts +4 -0
  51. package/dist/components/dev/DevExitConfirmModal.d.ts +14 -0
  52. package/dist/components/dev/DevLockBlockedModal.d.ts +3 -0
  53. package/dist/components/dev/DevModeBadge.d.ts +3 -0
  54. package/dist/components/dev/DevPinModal.d.ts +3 -0
  55. package/dist/components/dev/DevPublishModal.d.ts +9 -0
  56. package/dist/components/dev/UniversalEditModal.d.ts +40 -0
  57. package/dist/components/dev/index.d.ts +8 -0
  58. package/dist/components/feedback/EmptyState.d.ts +13 -0
  59. package/dist/components/feedback/PageNotFound.d.ts +15 -0
  60. package/dist/components/feedback/Toast.d.ts +25 -0
  61. package/dist/components/feedback/index.d.ts +2 -0
  62. package/dist/components/history/HistoryHubModal.d.ts +44 -0
  63. package/dist/components/history/index.d.ts +1 -0
  64. package/dist/components/layout/AppFooter.d.ts +10 -0
  65. package/dist/components/layout/AppHeader.d.ts +21 -0
  66. package/dist/components/layout/EditorialSection.d.ts +27 -0
  67. package/dist/components/layout/EditorialSidebar.d.ts +34 -0
  68. package/dist/components/layout/HeroSection.d.ts +2 -0
  69. package/dist/components/layout/HeroWelcome.d.ts +11 -0
  70. package/dist/components/layout/SearchField.d.ts +9 -0
  71. package/dist/components/layout/StatusPill.d.ts +2 -0
  72. package/dist/components/layout/index.d.ts +8 -0
  73. package/dist/components/roadmap/RoadmapNode.d.ts +30 -0
  74. package/dist/components/roadmap/RoadmapSection.d.ts +27 -0
  75. package/dist/components/roadmap/RoadmapTrack.d.ts +25 -0
  76. package/dist/components/roadmap/serpentine-generator.d.ts +60 -0
  77. package/dist/components/roadmap/use-roadmap-scroll.d.ts +19 -0
  78. package/dist/components/source/EditPhotoModal.d.ts +22 -0
  79. package/dist/components/source/LightboxPhotoStrip.d.ts +23 -0
  80. package/dist/components/source/LinkFolderModal.d.ts +24 -0
  81. package/dist/components/source/SourceCard.d.ts +31 -0
  82. package/dist/components/source/SourceFolderAttachment.d.ts +25 -0
  83. package/dist/components/source/SourceGallery.d.ts +26 -0
  84. package/dist/components/source/SourceImage.d.ts +26 -0
  85. package/dist/components/source/SourceLightbox.d.ts +28 -0
  86. package/dist/components/source/index.d.ts +9 -0
  87. package/dist/components/ui/AccordionSection.d.ts +21 -0
  88. package/dist/components/ui/Breadcrumb.d.ts +29 -0
  89. package/dist/components/ui/Button.d.ts +31 -0
  90. package/dist/components/ui/ColumnSelect.d.ts +17 -0
  91. package/dist/components/ui/ColumnTypeBadge.d.ts +6 -0
  92. package/dist/components/ui/DevHelpTooltip.d.ts +11 -0
  93. package/dist/components/ui/DraggableRows.d.ts +21 -0
  94. package/dist/components/ui/Drawer.d.ts +50 -0
  95. package/dist/components/ui/DrawerTier.d.ts +8 -0
  96. package/dist/components/ui/EditableText.d.ts +48 -0
  97. package/dist/components/ui/FAB.d.ts +24 -0
  98. package/dist/components/ui/Modal.d.ts +24 -0
  99. package/dist/components/ui/PageTitle.d.ts +33 -0
  100. package/dist/components/ui/ParametricShape.d.ts +57 -0
  101. package/dist/components/ui/RevolvingButton.d.ts +5 -0
  102. package/dist/components/ui/SectionTitle.d.ts +42 -0
  103. package/dist/components/ui/SeriesSelectToolbar.d.ts +10 -0
  104. package/dist/components/ui/StatusPill.d.ts +21 -0
  105. package/dist/components/ui/TieredSlider.d.ts +19 -0
  106. package/dist/components/ui/Toast.d.ts +1 -0
  107. package/dist/components/ui/ValueLabelToggle.d.ts +10 -0
  108. package/dist/components/ui/index.d.ts +21 -0
  109. package/dist/config/engine.config.d.ts +31 -0
  110. package/dist/context/DeveloperModeContext.d.ts +11 -0
  111. package/dist/context/UndoRedoContext.d.ts +20 -0
  112. package/dist/folio.js +24996 -0
  113. package/dist/folio.umd.cjs +42 -0
  114. package/dist/hooks/use-auto-toc.d.ts +31 -0
  115. package/dist/hooks/use-discrete-step-navigation.d.ts +26 -0
  116. package/dist/hooks/use-dynamic-section-numbers.d.ts +30 -0
  117. package/dist/hooks/use-hash-route.d.ts +36 -0
  118. package/dist/hooks/use-scroll.d.ts +22 -0
  119. package/dist/hooks/use-scrollspy.d.ts +19 -0
  120. package/dist/hooks/useChartTooltip.d.ts +25 -0
  121. package/dist/hooks/useContent.d.ts +36 -0
  122. package/dist/hooks/useDeveloperMode.d.ts +1 -0
  123. package/dist/hooks/useDocumentCanvas.d.ts +53 -0
  124. package/dist/hooks/useDrivePhotoSync.d.ts +15 -0
  125. package/dist/hooks/useImageLoader.d.ts +12 -0
  126. package/dist/hooks/useLightboxHistory.d.ts +14 -0
  127. package/dist/hooks/useNodeCanvas.d.ts +2 -0
  128. package/dist/hooks/useSheetChartData.d.ts +30 -0
  129. package/dist/hooks/useSourcePoint.d.ts +35 -0
  130. package/dist/hooks/useSwipeGesture.d.ts +30 -0
  131. package/dist/hooks/useUndoRedo.d.ts +9 -0
  132. package/dist/hooks/useUnsavedChangesPrompt.d.ts +18 -0
  133. package/dist/index.d.ts +52 -0
  134. package/dist/main.d.ts +1 -0
  135. package/dist/services/canvasLayoutService.d.ts +158 -0
  136. package/dist/services/chartSourceService.d.ts +128 -0
  137. package/dist/services/devLockService.d.ts +76 -0
  138. package/dist/services/draftService.d.ts +129 -0
  139. package/dist/services/drivePhotoSyncService.d.ts +60 -0
  140. package/dist/services/driveVerificationService.d.ts +41 -0
  141. package/dist/services/edgePreBakeService.d.ts +81 -0
  142. package/dist/services/historyService.d.ts +215 -0
  143. package/dist/services/historyStorage.d.ts +17 -0
  144. package/dist/services/mediaService.d.ts +25 -0
  145. package/dist/services/sheetsDataService.d.ts +59 -0
  146. package/dist/services/sheetsVerificationService.d.ts +87 -0
  147. package/dist/services/sourceService.d.ts +43 -0
  148. package/dist/services/undoRedoService.d.ts +63 -0
  149. package/dist/services/unsavedChangesService.d.ts +32 -0
  150. package/dist/style.css +1 -0
  151. package/dist/types/canvas.d.ts +115 -0
  152. package/dist/types/chart.d.ts +117 -0
  153. package/dist/types/developer.d.ts +144 -0
  154. package/dist/types/draft.d.ts +21 -0
  155. package/dist/types/edge.d.ts +232 -0
  156. package/dist/types/history.d.ts +81 -0
  157. package/dist/types/media.d.ts +16 -0
  158. package/dist/types/navigation.d.ts +19 -0
  159. package/dist/types/node.d.ts +51 -0
  160. package/dist/types/source.d.ts +88 -0
  161. package/dist/utils/canvasDefaults.d.ts +43 -0
  162. package/dist/utils/chartColors.d.ts +48 -0
  163. package/dist/utils/chartDimensions.d.ts +50 -0
  164. package/dist/utils/chartMath.d.ts +142 -0
  165. package/dist/utils/chartSanitizer.d.ts +84 -0
  166. package/dist/utils/contentDb.d.ts +86 -0
  167. package/dist/utils/devSecurity.d.ts +84 -0
  168. package/dist/utils/mediaUrl.d.ts +32 -0
  169. package/dist/utils/modalActions.d.ts +32 -0
  170. package/dist/utils/node-sections.d.ts +15 -0
  171. package/dist/utils/page-sections.d.ts +1 -0
  172. package/dist/utils/runtime-env.d.ts +21 -0
  173. package/dist/utils/scrollLock.d.ts +10 -0
  174. package/dist/utils/smooth-scroll.d.ts +24 -0
  175. package/dist/utils/source.d.ts +25 -0
  176. package/dist/utils/storage.d.ts +13 -0
  177. package/dist/utils/supabase-config.d.ts +29 -0
  178. package/dist/utils/supabase-write-guard.d.ts +15 -0
  179. package/package.json +56 -4
  180. package/README.md +0 -3
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Content Database & Dynamic Text Registry Engine
3
+ * Folio Engine
4
+ *
5
+ * Implements a reactive, client-side dual-channel content repository.
6
+ * Strictly separates uncommitted drafts (isDevMode = true) from canonical live
7
+ * published text (isDevMode = false), preventing cross-talk and leaks to public visitors.
8
+ */
9
+ export declare const getLiveContentStorageKey: (ns?: string) => string;
10
+ export declare const STORAGE_KEY_LIVE_CONTENT: string;
11
+ export declare const getDraftContentStorageKey: (ns?: string) => string;
12
+ export declare const STORAGE_KEY_DRAFT_CONTENT: string;
13
+ export declare const getLegacyContentStorageKey: (ns?: string) => string;
14
+ export declare const STORAGE_KEY_LEGACY_CONTENT: string;
15
+ export declare const STORAGE_KEY_CONTENT_OVERRIDES: string;
16
+ export declare const EVENT_LIVE_CONTENT_CHANGE = "engine-live-content-change";
17
+ export declare const EVENT_DRAFT_CONTENT_CHANGE = "engine-draft-content-change";
18
+ /**
19
+ * Retrieves the current text for a given key with strict channel isolation.
20
+ * Public visitors (isDevMode = false) strictly read canonical live overrides;
21
+ * Coordinators (isDevMode = true) read draft overrides, falling back to live before hardcoded defaults.
22
+ */
23
+ export declare function getContent(key: string, defaultValue: string, isDevMode?: boolean): string;
24
+ /**
25
+ * Checks whether a specific content key currently has a custom override saved.
26
+ */
27
+ export declare function hasContentOverride(key: string, isDevMode?: boolean): boolean;
28
+ /**
29
+ * Persists an edited text override strictly isolated to the specified channel.
30
+ */
31
+ export declare function setContent(key: string, value: string, isDevMode?: boolean): void;
32
+ /**
33
+ * Retrieves structured content (link, image, file, or object) from the DB.
34
+ * Gracefully parses JSON if serialized, falling back to defaultValue.
35
+ */
36
+ export declare function getContentObject<T>(key: string, defaultValue: T, isDevMode?: boolean): T;
37
+ /**
38
+ * Persists a structured object into the DB by serializing it to JSON.
39
+ */
40
+ export declare function setContentObject<T>(key: string, value: T, isDevMode?: boolean): void;
41
+ /**
42
+ * Resets a content key back to its default value by removing the override.
43
+ */
44
+ export declare function resetContent(key: string, isDevMode?: boolean): void;
45
+ /**
46
+ * Returns a copy of all current content overrides for the targeted channel.
47
+ */
48
+ export declare function getAllContentOverrides(isDevMode?: boolean): Record<string, string>;
49
+ /**
50
+ * Resets all content overrides back to system defaults.
51
+ */
52
+ export declare function resetAllContentOverrides(isDevMode?: boolean): void;
53
+ /**
54
+ * Replaces all content overrides and notifies all reactive subscribers.
55
+ * Used during historical snapshot restoration.
56
+ */
57
+ export declare function setAllContentOverrides(overrides: Record<string, string>, isDevMode?: boolean): void;
58
+ /**
59
+ * Invalidates the in-memory cache and forces next read from storage.
60
+ */
61
+ export declare function invalidateContentCache(): void;
62
+ /**
63
+ * Reads content overrides strictly from the canonical live/published channel.
64
+ */
65
+ export declare function getLiveContentOverrides(): Record<string, string>;
66
+ /**
67
+ * Persists content overrides strictly to the canonical live/published channel.
68
+ */
69
+ export declare function setLiveContentOverrides(overrides: Record<string, string>): void;
70
+ /**
71
+ * Subscribes to content changes strictly scoped by channel.
72
+ */
73
+ export declare function subscribeToContentChange(callback: (detail: {
74
+ key: string;
75
+ value: string | null;
76
+ }) => void, isDevMode?: boolean): () => void;
77
+ /**
78
+ * Subscribes a listener to updates for a specific content key.
79
+ * Used by useSyncExternalStore for granular, zero-overhead store subscriptions.
80
+ */
81
+ export declare function subscribeContentKey(key: string, callback: () => void, isDevMode?: boolean): () => void;
82
+ /**
83
+ * Snapshot getter for useSyncExternalStore.
84
+ * Guarantees stable raw string snapshots from in-memory cache.
85
+ */
86
+ export declare function getContentSnapshot(key: string, defaultValue: string, isDevMode?: boolean): string;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Security and Cryptographic Primitives for Developer Mode
3
+ * Task 4.5.0: docs/tasks/task4_5_0_developer_mode.md
4
+ *
5
+ * Implements salted SHA-256 hashing via native Web Crypto API.
6
+ * The raw 4-digit PIN is NEVER stored in cleartext.
7
+ */
8
+ export declare const getDevSalt: (ns?: string) => any;
9
+ export declare const DEV_SALT: any;
10
+ export declare const EXPECTED_PIN_HASH = "73b1e1cccbe22119e026c333e9de035db2a553f8acecdb5406af95f59bf46178";
11
+ export declare const SESSION_DURATION_MS: number;
12
+ export declare const LOCKOUT_DURATION_MS: number;
13
+ export declare const MAX_ATTEMPTS = 5;
14
+ export declare const getDevUnlockedAtKey: (ns?: string) => string;
15
+ export declare const STORAGE_KEY_UNLOCKED_AT: string;
16
+ export declare const getDevLockoutUntilKey: (ns?: string) => string;
17
+ export declare const STORAGE_KEY_LOCKOUT_UNTIL: string;
18
+ export declare const getDevFailedAttemptsKey: (ns?: string) => string;
19
+ export declare const STORAGE_KEY_FAILED_ATTEMPTS: string;
20
+ /**
21
+ * Zero-dependency pure-TypeScript SHA-256 implementation.
22
+ * Used as a seamless fallback when window.crypto.subtle is unavailable
23
+ * (e.g. non-HTTPS environments, IP-based staging deploys, or restricted WebViews).
24
+ */
25
+ export declare function sha256Fallback(ascii: string): string;
26
+ /**
27
+ * Computes salted SHA-256 hex digest for a given input PIN string.
28
+ * Native Web Crypto API execution: SHA-256(`${salt}:${pin}`) with
29
+ * automatic graceful fallback to pure-TypeScript SHA-256.
30
+ */
31
+ export declare function hashPin(pin: string, salt?: string): Promise<string>;
32
+ /**
33
+ * Verifies a 4-digit numeric PIN against the salted SHA-256 hash digest.
34
+ */
35
+ export declare function verifyPin(inputPin: string, salt?: string, expectedHash?: string): Promise<boolean>;
36
+ /**
37
+ * Verifies whether the runtime environment is a PC / Desktop viewport.
38
+ * Developer Mode is strictly locked to viewports >= 1024px with fine pointer precision.
39
+ */
40
+ export declare function isDesktopDevice(): boolean;
41
+ /**
42
+ * Retrieves the stored session unlock timestamp from sessionStorage.
43
+ */
44
+ export declare function getSessionUnlockTime(): number | null;
45
+ /**
46
+ * Stores the session unlock timestamp in sessionStorage.
47
+ */
48
+ export declare function setSessionUnlockTime(timestamp: number): void;
49
+ /**
50
+ * Clears the session unlock timestamp from sessionStorage.
51
+ */
52
+ export declare function clearSessionUnlockTime(): void;
53
+ /**
54
+ * Evaluates whether a session timestamp is still active (< 30 minutes).
55
+ */
56
+ export declare function isSessionValid(unlockedAt: number | null, now?: number): boolean;
57
+ /**
58
+ * Calculates remaining session duration in minutes (rounded up).
59
+ */
60
+ export declare function getRemainingSessionMinutes(unlockedAt: number | null, now?: number): number;
61
+ /**
62
+ * Retrieves the lockout expiration timestamp if active.
63
+ */
64
+ export declare function getLockoutUntil(): number | null;
65
+ /**
66
+ * Stores the lockout expiration timestamp.
67
+ */
68
+ export declare function setLockoutUntil(timestamp: number): void;
69
+ /**
70
+ * Clears the lockout expiration timestamp.
71
+ */
72
+ export declare function clearLockoutUntil(): void;
73
+ /**
74
+ * Retrieves current failed attempts count.
75
+ */
76
+ export declare function getFailedAttempts(): number;
77
+ /**
78
+ * Updates failed attempts count.
79
+ */
80
+ export declare function setFailedAttempts(count: number): void;
81
+ /**
82
+ * Resets failed attempts count.
83
+ */
84
+ export declare function resetFailedAttempts(): void;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Folio Engine — Client Media URL Utilities for Cloudflare Edge Proxy
3
+ * Location: src/utils/mediaUrl.ts
4
+ * Specification: docs/tasks/task15_2_edge_media_proxy_and_stream_transcoder.md
5
+ */
6
+ export declare const ALLOWED_EDGE_WIDTHS: readonly [320, 400, 600, 800, 1200, 1600];
7
+ export type EdgeWidth = (typeof ALLOWED_EDGE_WIDTHS)[number];
8
+ /**
9
+ * Clamps or snaps an arbitrary image pixel width to the nearest allowed edge bucket.
10
+ */
11
+ export declare function normalizeEdgeWidth(rawWidth: number): EdgeWidth;
12
+ /**
13
+ * Extracts a Google Drive alphanumeric file ID from a raw ID or standard Drive URL formats:
14
+ * - Direct ID: 1ABCxyz0123456789_-
15
+ * - Thumbnail URL: https://drive.google.com/thumbnail?id=1ABC...&sz=w1600
16
+ * - File View URL: https://drive.google.com/file/d/1ABC.../view
17
+ * - Open URL: https://drive.google.com/open?id=1ABC...
18
+ */
19
+ export declare function extractDriveFileId(input: string): string | null;
20
+ export interface EdgeMediaUrlOptions {
21
+ width?: number;
22
+ format?: 'auto' | 'webp' | 'jpeg';
23
+ }
24
+ /**
25
+ * Generates an edge media proxy URL pointing to /api/media/drive/:fileId
26
+ */
27
+ export declare function buildEdgeMediaUrl(fileIdOrUrl: string, options?: EdgeMediaUrlOptions): string;
28
+ /**
29
+ * Generates a responsive HTML `srcset` attribute value mapping to edge media proxy buckets.
30
+ * Defaults to [400, 800, 1200, 1600] for optimal mobile and high-DPI rendering.
31
+ */
32
+ export declare function buildEdgeSrcSet(fileIdOrUrl: string, widths?: readonly number[] | number[]): string;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Folio Engine — Canonical Modal & Dialog Positive Action Utilities
3
+ * Handles Ctrl+Enter / Cmd+Enter positive action discovery and triggering.
4
+ */
5
+ export declare function registerActiveModal(el: HTMLElement | null): void;
6
+ export declare function unregisterActiveModal(el: HTMLElement | null): void;
7
+ export declare function isTopmostModal(el: HTMLElement | null): boolean;
8
+ /**
9
+ * Checks if a keyboard event corresponds to the canonical positive submission shortcut:
10
+ * Ctrl+Enter (Windows/Linux) or Cmd+Enter (Mac).
11
+ */
12
+ export declare function isPositiveShortcut(e: KeyboardEvent | React.KeyboardEvent): boolean;
13
+ /**
14
+ * Verifies whether an element is an enabled, visible, clickable positive candidate.
15
+ */
16
+ export declare function isClickablePositiveCandidate(el: HTMLElement | null): el is HTMLElement;
17
+ /**
18
+ * Discovers the canonical positive action element (button or form) inside a modal container.
19
+ * Priority:
20
+ * 1. Explicit data attributes: [data-positive="true"], [data-action="confirm"|"save"|"submit"|"primary"]
21
+ * 2. Form submit button: button[type="submit"]:not([disabled])
22
+ * 3. Primary/Admin variant buttons: button[data-variant="primary"|"admin"], button[data-primary="true"]
23
+ * 4. Text-matched buttons (Save, Submit, Publish, Add, Confirm, Next, etc.)
24
+ * 5. Containing form (for form.requestSubmit())
25
+ */
26
+ export declare function findPositiveActionElement(container: HTMLElement | null): HTMLElement | null;
27
+ /**
28
+ * Triggers the positive action element cleanly:
29
+ * - If form: calls requestSubmit() or submits
30
+ * - If button: calls .click()
31
+ */
32
+ export declare function triggerPositiveAction(element: HTMLElement | null): boolean;
@@ -0,0 +1,15 @@
1
+ import type { NodeItem } from '../types/node';
2
+ import type { NavItem } from '../types/navigation';
3
+ export interface NodeSection extends NavItem {
4
+ id: string;
5
+ label: string;
6
+ number?: string;
7
+ href: string;
8
+ }
9
+ /**
10
+ * Generates the semantic sub-sections for a dedicated node page.
11
+ * Strictly binds to authentic stages, project indicators status, and source.
12
+ */
13
+ export declare function getNodeSections(node: NodeItem): NavItem[];
14
+ export type PageSection = NodeSection;
15
+ export declare const getPageSections: typeof getNodeSections;
@@ -0,0 +1 @@
1
+ export * from './node-sections';
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Runtime environment separation (Task 11.98).
3
+ * Pure functions: no globals read inside decision logic, so they are unit-testable.
4
+ */
5
+ export declare const PROD_PROJECT_REF = "mjuwqlxdxhujqiqpkcaj";
6
+ /** Hostnames allowed to WRITE to the production database. */
7
+ export declare const PROD_WRITE_HOSTS: readonly string[];
8
+ export type TargetVerdict = {
9
+ ok: true;
10
+ } | {
11
+ ok: false;
12
+ code: string;
13
+ message: string;
14
+ };
15
+ export declare function urlTargetsProdProject(url: string): boolean;
16
+ export declare function isProductionBuild(): boolean;
17
+ /** L2: does the configured DB match the build mode? */
18
+ export declare function evaluateSupabaseTarget(url: string, prodBuild: boolean): TargetVerdict;
19
+ /** L3: may a mutating request to this Supabase URL be sent from this page host? */
20
+ export declare function isWriteAllowed(supabaseUrl: string, pageHostname: string, prodBuild: boolean): boolean;
21
+ export declare function currentTargetLabel(supabaseUrl: string): 'PROD-DB' | 'DEV-DB';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * scrollLock.ts
3
+ * Folio Engine
4
+ *
5
+ * Universal scroll lock coordinator with reference-counting.
6
+ * Safely coordinates scroll locking between stacked Modals, Drawers, and Lightboxes.
7
+ * Automatically computes desktop scrollbar compensation to eliminate layout jitter.
8
+ */
9
+ export declare function acquireScrollLock(): void;
10
+ export declare function releaseScrollLock(): void;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * smooth-scroll.ts
3
+ * Precision cinematic smooth scrolling engine — Folio Engine
4
+ *
5
+ * Replaces the browser's jarring, high-velocity default smooth scroll (~300ms)
6
+ * with a stately, leisurely editorial motion curve (~1000ms - 1200ms) that allows
7
+ * visitors to comfortably appreciate the illuminated serpentine conduit path and
8
+ * milestone transitions.
9
+ */
10
+ /**
11
+ * Aborts any ongoing cinematic smooth scroll immediately.
12
+ */
13
+ export declare function cancelCinematicScroll(): void;
14
+ export interface SmoothScrollOptions {
15
+ /** Target vertical scroll position in pixels */
16
+ top: number;
17
+ /** Duration in milliseconds. Defaults to dynamic calculation based on distance (~2300ms–2600ms per fold) */
18
+ duration?: number;
19
+ /** Callback fired when scroll completes */
20
+ onComplete?: () => void;
21
+ /** Whether user wheel/touch events can cancel this scroll. Defaults to true. */
22
+ interruptible?: boolean;
23
+ }
24
+ export declare function cinematicScrollTo({ top, duration, onComplete, interruptible }: SmoothScrollOptions): void;
@@ -0,0 +1,25 @@
1
+ import type { SourceSource } from '../types/source';
2
+ /**
3
+ * Normalizes point and node identifiers to ensure consistent lookup.
4
+ * Handles both "node-access" and "access" seamlessly, trimming whitespace
5
+ * and lowering case. Defensively handles null/undefined or empty input.
6
+ */
7
+ export declare function normalizePointId(pointId: string): string;
8
+ /**
9
+ * Safely retrieves the official SourceSource for a given node or point ID.
10
+ * Incorporates dynamic client-side Content DB overrides if configured.
11
+ * Returns null if the source is not registered or invalid.
12
+ */
13
+ export declare function getSourceSource(pointId: string): SourceSource | null;
14
+ /**
15
+ * Matches canonical Google Drive folder URL patterns:
16
+ * - https://drive.google.com/drive/folders/{folderId}
17
+ * - https://drive.google.com/drive/u/{userIndex}/folders/{folderId}
18
+ * - https://drive.google.com/open?id={folderId}
19
+ */
20
+ export declare const GOOGLE_DRIVE_FOLDER_REGEX: RegExp;
21
+ /**
22
+ * Validates whether a given URL string is a valid Google Drive folder URL.
23
+ * Defensively handles null, undefined, non-string, or malformed inputs.
24
+ */
25
+ export declare function isValidDriveFolderUrl(url: string): boolean;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Canonical browser storage accessor for Folio Engine.
3
+ * Safely accesses window.localStorage, falling back to window.sessionStorage.
4
+ */
5
+ export declare function getStorage(): Storage | null;
6
+ /**
7
+ * Task 11.2.G3: Zero-LocalStorage Document Policy Enforcement.
8
+ * Purges legacy draft and bloated document payloads from window.localStorage,
9
+ * preserving solely small scalar session tokens (folio_session_id, folio_dev_unlocked_at,
10
+ * folio_live_active_published_id, folio_draft_active, folio_draft_dirty).
11
+ * Enforces a strict < 5 KB total localStorage footprint.
12
+ */
13
+ export declare function purgeLegacyDocumentStorage(): void;
@@ -0,0 +1,29 @@
1
+ export interface SupabaseConfig {
2
+ url: string;
3
+ anonKey: string;
4
+ }
5
+ /**
6
+ * Canonical Supabase endpoint configuration parser.
7
+ * Validates against placeholder defaults and trailing slashes.
8
+ */
9
+ export declare function getSupabaseConfig(): SupabaseConfig | null;
10
+ export declare const getMissingTablesStorageKey: (ns?: string) => string;
11
+ export declare const STORAGE_KEY_MISSING_TABLES: string;
12
+ /**
13
+ * Checks whether a Supabase table is known to be available.
14
+ * Returns false if the table previously returned 404 in this browser session.
15
+ * dev_mode_session is always queried to enforce institutional exclusivity.
16
+ */
17
+ export declare function isTableAvailable(tableName: string): boolean;
18
+ /**
19
+ * Marks a Supabase table as missing (404) for the remainder of this session.
20
+ */
21
+ export declare function markTableMissing(tableName: string): void;
22
+ /**
23
+ * Marks a Supabase table as available, removing any previously memoized 404 block.
24
+ */
25
+ export declare function markTableAvailable(tableName: string): void;
26
+ /**
27
+ * Resets memoized missing tables (used in automated tests and session resets).
28
+ */
29
+ export declare function resetMissingTablesForTesting(): void;
@@ -0,0 +1,15 @@
1
+ interface GuardTarget {
2
+ fetch: typeof fetch;
3
+ location?: {
4
+ hostname: string;
5
+ };
6
+ }
7
+ /**
8
+ * Wraps fetch. Any mutating request whose URL starts with the configured
9
+ * Supabase URL is rejected (HTTP 403 Response, never sent) unless isWriteAllowed().
10
+ * Idempotent. Call once, before any service module issues requests.
11
+ */
12
+ export declare function installSupabaseWriteGuard(supabaseUrl?: string | undefined, target?: GuardTarget, prodBuild?: boolean): void;
13
+ /** Test helper only. */
14
+ export declare function resetWriteGuardForTesting(): void;
15
+ export {};
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "@devcabs/folio-engine",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "./dist/folio.umd.cjs",
6
+ "module": "./dist/folio.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/folio.js",
12
+ "require": "./dist/folio.umd.cjs"
13
+ },
14
+ "./style.css": "./dist/style.css"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ },
19
+ "peerDependencies": {
20
+ "react": "^19.0.0",
21
+ "react-dom": "^19.0.0"
22
+ },
23
+ "dependencies": {
24
+ "d3-array": "^3.2.4",
25
+ "d3-scale": "^4.0.2",
26
+ "zod": "^3.24.2"
27
+ },
28
+ "devDependencies": {
29
+ "@eslint/js": "^9.21.0",
30
+ "@types/d3-array": "^3.2.2",
31
+ "@types/d3-scale": "^4.0.9",
32
+ "@types/node": "^22.13.9",
33
+ "@types/react": "^19.0.10",
34
+ "@types/react-dom": "^19.0.4",
35
+ "@typescript-eslint/eslint-plugin": "^8.26.0",
36
+ "@typescript-eslint/parser": "^8.26.0",
37
+ "@vitejs/plugin-react": "^4.3.4",
38
+ "eslint": "^9.21.0",
39
+ "tsx": "^4.19.3",
40
+ "typescript": "^5.7.3",
41
+ "vite": "^6.2.0",
42
+ "vitest": "^3.0.7"
43
+ },
44
+ "scripts": {
45
+ "dev": "vite --port 5174",
46
+ "start": "vite --port 5174",
47
+ "build": "npm run test:tokens && tsc --noEmit && vite build",
48
+ "build:lib": "npm run test:tokens && vite build -c vite.config.lib.ts && tsc -p tsconfig.lib.json",
49
+ "preview": "vite preview --port 5174",
50
+ "test:purity": "vitest run tests/purity",
51
+ "test:tokens": "tsx scripts/verify-token-aliases.ts",
52
+ "lint": "eslint .",
53
+ "prepack": "npm run build:lib"
54
+ },
55
+ "files": [
56
+ "dist"
57
+ ]
58
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.