@mentra/sdk 2.1.28 → 2.1.29-beta.2

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 (55) hide show
  1. package/dist/app/session/events.d.ts +8 -3
  2. package/dist/app/session/events.d.ts.map +1 -1
  3. package/dist/app/session/index.d.ts +2 -1
  4. package/dist/app/session/index.d.ts.map +1 -1
  5. package/dist/app/session/modules/camera.d.ts +6 -5
  6. package/dist/app/session/modules/camera.d.ts.map +1 -1
  7. package/dist/app/session/modules/simple-storage.d.ts +22 -1
  8. package/dist/app/session/modules/simple-storage.d.ts.map +1 -1
  9. package/dist/display-utils/helpers/DisplayHelpers.d.ts +165 -0
  10. package/dist/display-utils/helpers/DisplayHelpers.d.ts.map +1 -0
  11. package/dist/display-utils/helpers/ScrollView.d.ts +183 -0
  12. package/dist/display-utils/helpers/ScrollView.d.ts.map +1 -0
  13. package/dist/display-utils/helpers/index.d.ts +11 -0
  14. package/dist/display-utils/helpers/index.d.ts.map +1 -0
  15. package/dist/display-utils/index.d.ts +108 -0
  16. package/dist/display-utils/index.d.ts.map +1 -0
  17. package/dist/display-utils/measurer/TextMeasurer.d.ts +160 -0
  18. package/dist/display-utils/measurer/TextMeasurer.d.ts.map +1 -0
  19. package/dist/display-utils/measurer/index.d.ts +10 -0
  20. package/dist/display-utils/measurer/index.d.ts.map +1 -0
  21. package/dist/display-utils/measurer/script-detection.d.ts +53 -0
  22. package/dist/display-utils/measurer/script-detection.d.ts.map +1 -0
  23. package/dist/display-utils/profiles/g1.d.ts +33 -0
  24. package/dist/display-utils/profiles/g1.d.ts.map +1 -0
  25. package/dist/display-utils/profiles/index.d.ts +9 -0
  26. package/dist/display-utils/profiles/index.d.ts.map +1 -0
  27. package/dist/display-utils/profiles/types.d.ts +95 -0
  28. package/dist/display-utils/profiles/types.d.ts.map +1 -0
  29. package/dist/display-utils/test/ScrollView.test.d.ts +2 -0
  30. package/dist/display-utils/test/ScrollView.test.d.ts.map +1 -0
  31. package/dist/display-utils/test/TextMeasurer.test.d.ts +2 -0
  32. package/dist/display-utils/test/TextMeasurer.test.d.ts.map +1 -0
  33. package/dist/display-utils/test/TextWrapper.test.d.ts +2 -0
  34. package/dist/display-utils/test/TextWrapper.test.d.ts.map +1 -0
  35. package/dist/display-utils/wrapper/TextWrapper.d.ts +94 -0
  36. package/dist/display-utils/wrapper/TextWrapper.d.ts.map +1 -0
  37. package/dist/display-utils/wrapper/index.d.ts +12 -0
  38. package/dist/display-utils/wrapper/index.d.ts.map +1 -0
  39. package/dist/display-utils/wrapper/types.d.ts +71 -0
  40. package/dist/display-utils/wrapper/types.d.ts.map +1 -0
  41. package/dist/display-utils.d.ts +30 -0
  42. package/dist/display-utils.d.ts.map +1 -0
  43. package/dist/display-utils.js +1197 -0
  44. package/dist/display-utils.js.map +17 -0
  45. package/dist/index.js +102 -22
  46. package/dist/index.js.map +10 -10
  47. package/dist/types/messages/app-to-cloud.d.ts +1 -1
  48. package/dist/types/messages/app-to-cloud.d.ts.map +1 -1
  49. package/dist/types/messages/cloud-to-app.d.ts +2 -0
  50. package/dist/types/messages/cloud-to-app.d.ts.map +1 -1
  51. package/dist/types/messages/cloud-to-glasses.d.ts +1 -1
  52. package/dist/types/messages/cloud-to-glasses.d.ts.map +1 -1
  53. package/dist/types/streams.d.ts +3 -1
  54. package/dist/types/streams.d.ts.map +1 -1
  55. package/package.json +24 -10
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Options for text wrapping.
3
+ */
4
+ export interface WrapOptions {
5
+ /** Maximum width in pixels (defaults to profile's displayWidthPx) */
6
+ maxWidthPx?: number;
7
+ /** Maximum number of lines (defaults to profile's maxLines) */
8
+ maxLines?: number;
9
+ /** Maximum total bytes (defaults to profile's maxPayloadBytes) */
10
+ maxBytes?: number;
11
+ /**
12
+ * Break mode:
13
+ * - 'character': Break mid-word with hyphen for 100% utilization
14
+ * - 'word': Break at word boundaries, hyphenate only if word > line
15
+ * - 'strict-word': Break at word boundaries only, truncate long words
16
+ */
17
+ breakMode?: BreakMode;
18
+ /** Character to use for hyphenation (default: '-') */
19
+ hyphenChar?: string;
20
+ /** Minimum characters before allowing hyphen break (default: 3) */
21
+ minCharsBeforeHyphen?: number;
22
+ /** Whether to trim whitespace from line ends (default: true) */
23
+ trimLines?: boolean;
24
+ /** Whether to preserve explicit newlines in input (default: true) */
25
+ preserveNewlines?: boolean;
26
+ }
27
+ /**
28
+ * Break mode for text wrapping.
29
+ */
30
+ export type BreakMode = "character" | "word" | "strict-word";
31
+ /**
32
+ * Result of wrapping operation.
33
+ */
34
+ export interface WrapResult {
35
+ /** Wrapped lines */
36
+ lines: string[];
37
+ /** Whether content was truncated to fit constraints */
38
+ truncated: boolean;
39
+ /** Total pixel width of widest line */
40
+ maxLineWidthPx: number;
41
+ /** Total byte size of all lines */
42
+ totalBytes: number;
43
+ /** Per-line metadata */
44
+ lineMetrics: LineMetrics[];
45
+ /** Original input text */
46
+ originalText: string;
47
+ /** Break mode used */
48
+ breakMode: BreakMode;
49
+ }
50
+ /**
51
+ * Per-line metrics from wrapping.
52
+ */
53
+ export interface LineMetrics {
54
+ /** The line text */
55
+ text: string;
56
+ /** Width in pixels */
57
+ widthPx: number;
58
+ /** Byte size of this line */
59
+ bytes: number;
60
+ /** Utilization percentage (widthPx / maxWidthPx * 100) */
61
+ utilizationPercent: number;
62
+ /** Whether this line ends with a hyphen from breaking */
63
+ endsWithHyphen: boolean;
64
+ /** Whether this line was created from an explicit newline */
65
+ fromExplicitNewline: boolean;
66
+ }
67
+ /**
68
+ * Default wrap options.
69
+ */
70
+ export declare const DEFAULT_WRAP_OPTIONS: Required<Omit<WrapOptions, "maxWidthPx" | "maxLines" | "maxBytes">>;
71
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/display-utils/wrapper/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1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,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,YAAY,GAAG,UAAU,GAAG,UAAU,CAAC,CAMpG,CAAA"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Display Utils
3
+ *
4
+ * Glasses-agnostic, pixel-accurate text measurement and wrapping library
5
+ * for smart glasses displays.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import {
10
+ * TextMeasurer,
11
+ * TextWrapper,
12
+ * DisplayHelpers,
13
+ * ScrollView,
14
+ * G1_PROFILE,
15
+ * createG1Toolkit
16
+ * } from '@mentra/sdk/display-utils'
17
+ *
18
+ * // Quick start
19
+ * const { wrapper } = createG1Toolkit()
20
+ * const result = wrapper.wrap("Your text here")
21
+ *
22
+ * // Scrollable content
23
+ * const scrollView = new ScrollView(measurer, wrapper)
24
+ * scrollView.setContent("Very long text...")
25
+ * scrollView.scrollDown()
26
+ * const viewport = scrollView.getViewport()
27
+ * ```
28
+ */
29
+ export { type DisplayProfile, type FontMetrics, type UniformScriptWidths, type FallbackConfig, type DisplayConstraints, type ScriptType, G1_PROFILE, G1_PROFILE_LEGACY, G1_HYPHEN_WIDTH_PX, G1_SPACE_WIDTH_PX, TextMeasurer, type CharMeasurement, type TextMeasurement, detectScript, isCJKCharacter, isKoreanCharacter, isUniformWidthScript, isUnsupportedScript, needsHyphenForBreak, SCRIPT_RANGES, TextWrapper, type WrapOptions, type WrapResult, type LineMetrics, type BreakMode, DEFAULT_WRAP_OPTIONS, DisplayHelpers, type TruncateResult, type Page, type Chunk, ScrollView, type ScrollPosition, type ScrollViewport, createDisplayToolkit, createG1Toolkit, createG1LegacyToolkit, } from "./display-utils/index";
30
+ //# sourceMappingURL=display-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display-utils.d.ts","sourceRoot":"","sources":["../src/display-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EAGjB,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EAGb,WAAW,EACX,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,oBAAoB,EAGpB,cAAc,EACd,KAAK,cAAc,EACnB,KAAK,IAAI,EACT,KAAK,KAAK,EAGV,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,cAAc,EAGnB,oBAAoB,EACpB,eAAe,EACf,qBAAqB,GACtB,MAAM,uBAAuB,CAAA"}