@lincyaw/kernel 1.0.0-rc.10 → 1.0.0-rc.101

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 (61) hide show
  1. package/README.md +1 -1
  2. package/package.json +4 -2
  3. package/src/authoring.ts +3 -1
  4. package/src/contracts/agent-activity.ts +18 -0
  5. package/src/contracts/authoring-actions.ts +3 -3
  6. package/src/contracts/authoring-clients.ts +94 -6
  7. package/src/contracts/authoring-windows.ts +47 -0
  8. package/src/contracts/authoring.ts +1 -1
  9. package/src/contracts/capture.ts +174 -0
  10. package/src/contracts/document-audio.ts +8 -6
  11. package/src/contracts/document-image.ts +7 -5
  12. package/src/contracts/document-voice.ts +42 -2
  13. package/src/contracts/document.ts +18 -1
  14. package/src/contracts/media-uploads.ts +28 -0
  15. package/src/contracts/plugin.ts +1 -3
  16. package/src/contracts/preview.ts +3 -3
  17. package/src/contracts/projects.ts +4 -1
  18. package/src/contracts/speech-settings.ts +13 -0
  19. package/src/contracts/speech.ts +16 -0
  20. package/src/contracts/voiceover-execution.ts +25 -1
  21. package/src/contracts/workspace-changes.ts +27 -0
  22. package/src/contracts/workspace-review.ts +39 -0
  23. package/src/contracts/workspace-source.ts +38 -0
  24. package/src/contracts/workspace.ts +3 -0
  25. package/src/contracts.ts +7 -0
  26. package/src/document-authoring-actions.ts +23 -4
  27. package/src/document-caption-scale.ts +17 -0
  28. package/src/document-caption-timings.ts +2 -0
  29. package/src/document-comments.ts +30 -37
  30. package/src/document-components.ts +4 -12
  31. package/src/document-narrations.ts +57 -0
  32. package/src/document-operations.ts +32 -2
  33. package/src/document-pages.ts +8 -1
  34. package/src/document-places.ts +92 -0
  35. package/src/document-schema.ts +4 -4
  36. package/src/document.ts +13 -1
  37. package/src/embed.ts +26 -0
  38. package/src/escape-html.ts +4 -0
  39. package/src/html.ts +1 -4
  40. package/src/index.ts +16 -6
  41. package/src/ir.ts +23 -48
  42. package/src/lower-myst.ts +3 -12
  43. package/src/myst-marks.ts +15 -0
  44. package/src/node/authoring-actions.ts +3 -1
  45. package/src/node/authoring-windows.ts +11 -0
  46. package/src/node/document-voice.ts +6 -2
  47. package/src/node/fonts.ts +6 -3
  48. package/src/node/index.ts +11 -3
  49. package/src/node/operator-speech.ts +4 -0
  50. package/src/node/packages.ts +25 -0
  51. package/src/node/service-lease.ts +34 -0
  52. package/src/node/service-state.ts +67 -0
  53. package/src/node/workspace-changes.ts +7 -0
  54. package/src/node/workspace-review.ts +9 -0
  55. package/src/node/workspace-source.ts +10 -0
  56. package/src/preview-events.ts +6 -4
  57. package/src/preview-frame-connect.ts +1105 -0
  58. package/src/preview-frame.ts +30 -1131
  59. package/src/production-captions.ts +9 -0
  60. package/src/random-uuid.ts +8 -0
  61. package/src/stale-module.ts +15 -0
@@ -0,0 +1,9 @@
1
+ import type { Production } from './contracts/document.ts'
2
+
3
+ /** Caption visibility inherits independently of voice choice and timing. */
4
+ export function stepCaptionsVisible(production: Production | undefined, sectionId: string, stepId?: string): boolean {
5
+ return (stepId ? production?.stepOverrides[stepId]?.captionVisible : undefined)
6
+ ?? production?.sectionOverrides?.[sectionId]?.captionVisible
7
+ ?? production?.defaults.captionVisible
8
+ ?? true
9
+ }
@@ -0,0 +1,8 @@
1
+ /** Random v4 UUID from crypto.getRandomValues, which browsers expose outside secure contexts. */
2
+ export function randomUUID(): string {
3
+ const bytes = crypto.getRandomValues(new Uint8Array(16))
4
+ bytes[6] = bytes[6]! & 0x0f | 0x40
5
+ bytes[8] = bytes[8]! & 0x3f | 0x80
6
+ const hex = Array.from(bytes, byte => byte.toString(16).padStart(2, '0')).join('')
7
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`
8
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * A page cached from before a deployment names an app version the deployment removed: its modules then fail to load
3
+ * ("Failed to fetch dynamically imported module", and the like in other browsers). The page's head answers the event
4
+ * below with one reload from the network (`STALE_RELOAD` in @lincyaw/web's page HTML).
5
+ */
6
+ export const STALE_MODULE_PATTERN = /dynamically imported module|Importing a module script failed|error loading dynamically imported module/i
7
+
8
+ /** The event a page dispatches on `window` when a module of it failed for a removed version. */
9
+ export const STALE_MODULE_EVENT = 'presmium:stale-module'
10
+
11
+ /** Reports a module load failure that a removed version explains; other failures are left alone. */
12
+ export function reportStaleModule(error: unknown): void {
13
+ if (typeof window === 'undefined' || !STALE_MODULE_PATTERN.test(String(error instanceof Error ? error.message : error))) return
14
+ window.dispatchEvent(new Event(STALE_MODULE_EVENT))
15
+ }