uicore-ts 1.1.228 → 1.1.232

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.
@@ -0,0 +1,80 @@
1
+ /**
2
+ * UILayoutCycleTracer
3
+ *
4
+ * A development-only utility that detects and reports layout cycles in the
5
+ * UIView layout system.
6
+ *
7
+ * A layout cycle occurs when layouting a view causes another setNeedsLayout()
8
+ * call on the same view (or an ancestor) within the same layout pass, causing
9
+ * the loop in layoutViewsIfNeeded() to iterate multiple times.
10
+ *
11
+ * Usage:
12
+ * UILayoutCycleTracer.enable() — start tracing
13
+ * UILayoutCycleTracer.disable() — stop tracing
14
+ * UILayoutCycleTracer.isEnabled — check current state
15
+ *
16
+ * When a cycle is detected, a detailed report is printed to the console
17
+ * including:
18
+ * - Which view was re-queued
19
+ * - Its full superview chain
20
+ * - The call stack at the point of the re-queue (setNeedsLayout call)
21
+ * - How many times the view has been laid out in this pass
22
+ *
23
+ * Integration:
24
+ * Call UILayoutCycleTracer.willBeginLayoutPass() at the start of
25
+ * layoutViewsIfNeeded(), UILayoutCycleTracer.didLayoutView(view) after each
26
+ * view is laid out, and UILayoutCycleTracer.viewDidCallSetNeedsLayout(view)
27
+ * from setNeedsLayout() while a pass is active.
28
+ */
29
+ export declare class UILayoutCycleTracer {
30
+ static _isEnabled: boolean;
31
+ static _isPassActive: boolean;
32
+ static _layoutCountsThisPass: Map<any, number>;
33
+ static _setNeedsLayoutCallsThisPass: Map<any, {
34
+ count: number;
35
+ stacks: string[];
36
+ }>;
37
+ static _currentIteration: number;
38
+ static _totalReportsThisPass: number;
39
+ static reportThreshold: number;
40
+ static maxReportsPerPass: number;
41
+ static _noiseFramePrefixes: string[];
42
+ static get isEnabled(): boolean;
43
+ static enable(): void;
44
+ static disable(): void;
45
+ /**
46
+ * Called at the very start of each layoutViewsIfNeeded() invocation.
47
+ */
48
+ static willBeginLayoutPass(): void;
49
+ /**
50
+ * Called after each iteration increment in the layoutViewsIfNeeded() while loop.
51
+ */
52
+ static willBeginIteration(iteration: number): void;
53
+ /**
54
+ * Called after a view's layoutIfNeeded() completes.
55
+ */
56
+ static didLayoutView(view: any): void;
57
+ /**
58
+ * Called from setNeedsLayout() when a view enters the queue.
59
+ * If a layout pass is currently active, this is a potential cycle.
60
+ */
61
+ static viewDidCallSetNeedsLayout(view: any): void;
62
+ /**
63
+ * Called at the end of a layout pass.
64
+ */
65
+ static didFinishLayoutPass(iterationCount: number): void;
66
+ /**
67
+ * Strips the "Error" header line and any leading framework/tracer noise
68
+ * frames from a raw Error.stack string, so the first frame shown is always
69
+ * the application code that triggered the re-queue.
70
+ */
71
+ static _cleanStack(rawStack: string): string;
72
+ static _viewIdentifier(view: any): string;
73
+ static _superviewChain(view: any): string;
74
+ static _reportCycle(view: any, layoutCountThisPass: number, cleanStack: string): void;
75
+ }
76
+ declare global {
77
+ interface Window {
78
+ UILayoutCycleTracer?: typeof UILayoutCycleTracer;
79
+ }
80
+ }
@@ -0,0 +1,193 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var UILayoutCycleTracer_exports = {};
20
+ __export(UILayoutCycleTracer_exports, {
21
+ UILayoutCycleTracer: () => UILayoutCycleTracer
22
+ });
23
+ module.exports = __toCommonJS(UILayoutCycleTracer_exports);
24
+ const _UILayoutCycleTracer = class {
25
+ static get isEnabled() {
26
+ return _UILayoutCycleTracer._isEnabled;
27
+ }
28
+ static enable() {
29
+ ;
30
+ Error.stackTraceLimit = 100;
31
+ _UILayoutCycleTracer._isEnabled = true;
32
+ console.log(
33
+ "%c[UILayoutCycleTracer] Layout cycle tracing ENABLED (Error.stackTraceLimit = 100)",
34
+ "color: #4CAF50; font-weight: bold"
35
+ );
36
+ }
37
+ static disable() {
38
+ ;
39
+ Error.stackTraceLimit = 10;
40
+ _UILayoutCycleTracer._isEnabled = false;
41
+ console.log(
42
+ "%c[UILayoutCycleTracer] Layout cycle tracing DISABLED",
43
+ "color: #9E9E9E; font-weight: bold"
44
+ );
45
+ }
46
+ static willBeginLayoutPass() {
47
+ if (!_UILayoutCycleTracer._isEnabled) {
48
+ return;
49
+ }
50
+ _UILayoutCycleTracer._isPassActive = true;
51
+ _UILayoutCycleTracer._layoutCountsThisPass = /* @__PURE__ */ new Map();
52
+ _UILayoutCycleTracer._setNeedsLayoutCallsThisPass = /* @__PURE__ */ new Map();
53
+ _UILayoutCycleTracer._currentIteration = 0;
54
+ _UILayoutCycleTracer._totalReportsThisPass = 0;
55
+ }
56
+ static willBeginIteration(iteration) {
57
+ if (!_UILayoutCycleTracer._isEnabled) {
58
+ return;
59
+ }
60
+ _UILayoutCycleTracer._currentIteration = iteration;
61
+ if (iteration > 0) {
62
+ console.warn(
63
+ `%c[UILayoutCycleTracer] Layout pass iteration ${iteration + 1} \u2014 views were re-queued during the previous iteration`,
64
+ "color: #FF9800; font-weight: bold"
65
+ );
66
+ }
67
+ }
68
+ static didLayoutView(view) {
69
+ var _a;
70
+ if (!_UILayoutCycleTracer._isEnabled || !_UILayoutCycleTracer._isPassActive) {
71
+ return;
72
+ }
73
+ const previous = (_a = _UILayoutCycleTracer._layoutCountsThisPass.get(view)) != null ? _a : 0;
74
+ _UILayoutCycleTracer._layoutCountsThisPass.set(view, previous + 1);
75
+ }
76
+ static viewDidCallSetNeedsLayout(view) {
77
+ var _a, _b;
78
+ if (!_UILayoutCycleTracer._isEnabled || !_UILayoutCycleTracer._isPassActive) {
79
+ return;
80
+ }
81
+ const layoutCount = (_a = _UILayoutCycleTracer._layoutCountsThisPass.get(view)) != null ? _a : 0;
82
+ if (layoutCount < _UILayoutCycleTracer.reportThreshold) {
83
+ return;
84
+ }
85
+ if (_UILayoutCycleTracer._totalReportsThisPass >= _UILayoutCycleTracer.maxReportsPerPass) {
86
+ if (_UILayoutCycleTracer._totalReportsThisPass === _UILayoutCycleTracer.maxReportsPerPass) {
87
+ console.warn(
88
+ `%c[UILayoutCycleTracer] Maximum reports per pass (${_UILayoutCycleTracer.maxReportsPerPass}) reached. Further reports suppressed.`,
89
+ "color: #F44336"
90
+ );
91
+ _UILayoutCycleTracer._totalReportsThisPass++;
92
+ }
93
+ return;
94
+ }
95
+ _UILayoutCycleTracer._totalReportsThisPass++;
96
+ const rawStack = (_b = new Error().stack) != null ? _b : "(stack unavailable)";
97
+ const cleanStack = _UILayoutCycleTracer._cleanStack(rawStack);
98
+ const existing = _UILayoutCycleTracer._setNeedsLayoutCallsThisPass.get(view);
99
+ if (existing) {
100
+ existing.count++;
101
+ existing.stacks.push(cleanStack);
102
+ } else {
103
+ _UILayoutCycleTracer._setNeedsLayoutCallsThisPass.set(view, { count: 1, stacks: [cleanStack] });
104
+ }
105
+ _UILayoutCycleTracer._reportCycle(view, layoutCount, cleanStack);
106
+ }
107
+ static didFinishLayoutPass(iterationCount) {
108
+ if (!_UILayoutCycleTracer._isEnabled) {
109
+ return;
110
+ }
111
+ _UILayoutCycleTracer._isPassActive = false;
112
+ if (iterationCount > 1) {
113
+ console.warn(
114
+ `%c[UILayoutCycleTracer] Layout pass completed in ${iterationCount} iteration(s). ${_UILayoutCycleTracer._totalReportsThisPass} cycle event(s) recorded.`,
115
+ "color: #FF9800"
116
+ );
117
+ }
118
+ }
119
+ static _cleanStack(rawStack) {
120
+ const lines = rawStack.split("\n");
121
+ let firstAppFrameIndex = 1;
122
+ for (let i = 1; i < lines.length; i++) {
123
+ const trimmed = lines[i].trim();
124
+ const isNoise = _UILayoutCycleTracer._noiseFramePrefixes.some(
125
+ (prefix) => trimmed.includes(prefix)
126
+ );
127
+ if (!isNoise) {
128
+ firstAppFrameIndex = i;
129
+ break;
130
+ }
131
+ }
132
+ return lines.slice(firstAppFrameIndex).join("\n");
133
+ }
134
+ static _viewIdentifier(view) {
135
+ var _a, _b, _c, _d;
136
+ const className = (_b = (_a = view == null ? void 0 : view.constructor) == null ? void 0 : _a.name) != null ? _b : "UnknownView";
137
+ const elementID = (_d = (_c = view == null ? void 0 : view.elementID) != null ? _c : view == null ? void 0 : view._UIViewIndex) != null ? _d : "?";
138
+ return `${className}#${elementID}`;
139
+ }
140
+ static _superviewChain(view) {
141
+ const parts = [];
142
+ let current = view;
143
+ let depth = 0;
144
+ while (current && depth < 20) {
145
+ parts.push(_UILayoutCycleTracer._viewIdentifier(current));
146
+ current = current.superview;
147
+ depth++;
148
+ }
149
+ return parts.join(" \u2192 ");
150
+ }
151
+ static _reportCycle(view, layoutCountThisPass, cleanStack) {
152
+ const identifier = _UILayoutCycleTracer._viewIdentifier(view);
153
+ const chain = _UILayoutCycleTracer._superviewChain(view);
154
+ console.groupCollapsed(
155
+ `%c[UILayoutCycleTracer] \u26A0\uFE0F Layout cycle: ${identifier} re-queued after being laid out ${layoutCountThisPass}x in iteration ${_UILayoutCycleTracer._currentIteration + 1}`,
156
+ "color: #F44336; font-weight: bold"
157
+ );
158
+ console.log("%cView:", "font-weight: bold", view);
159
+ console.log("%cSuperview chain:", "font-weight: bold", chain);
160
+ console.log("%cLayout count this pass:", "font-weight: bold", layoutCountThisPass);
161
+ console.log("%cIteration:", "font-weight: bold", _UILayoutCycleTracer._currentIteration + 1);
162
+ console.log("%cCall stack (noise frames stripped):", "font-weight: bold");
163
+ cleanStack.split("\n").forEach((frame) => console.log(" " + frame.trim()));
164
+ console.groupEnd();
165
+ }
166
+ };
167
+ let UILayoutCycleTracer = _UILayoutCycleTracer;
168
+ UILayoutCycleTracer._isEnabled = false;
169
+ UILayoutCycleTracer._isPassActive = false;
170
+ UILayoutCycleTracer._layoutCountsThisPass = /* @__PURE__ */ new Map();
171
+ UILayoutCycleTracer._setNeedsLayoutCallsThisPass = /* @__PURE__ */ new Map();
172
+ UILayoutCycleTracer._currentIteration = 0;
173
+ UILayoutCycleTracer._totalReportsThisPass = 0;
174
+ UILayoutCycleTracer.reportThreshold = 1;
175
+ UILayoutCycleTracer.maxReportsPerPass = 10;
176
+ UILayoutCycleTracer._noiseFramePrefixes = [
177
+ "UILayoutCycleTracer",
178
+ "UIView.setNeedsLayout",
179
+ "setNeedsLayout",
180
+ "UIView.didLayoutSubviews",
181
+ "didLayoutSubviews",
182
+ "UIView.layoutSubviews",
183
+ "UIView.layoutIfNeeded",
184
+ "layoutIfNeeded",
185
+ "UIView.layoutViewsIfNeeded",
186
+ "layoutViewsIfNeeded"
187
+ ];
188
+ window.UILayoutCycleTracer = UILayoutCycleTracer;
189
+ // Annotate the CommonJS export names for ESM import in node:
190
+ 0 && (module.exports = {
191
+ UILayoutCycleTracer
192
+ });
193
+ //# sourceMappingURL=UILayoutCycleTracer.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../scripts/UILayoutCycleTracer.ts"],
4
+ "sourcesContent": ["/// #if DEV\n\n/**\n * UILayoutCycleTracer\n *\n * A development-only utility that detects and reports layout cycles in the\n * UIView layout system.\n *\n * A layout cycle occurs when layouting a view causes another setNeedsLayout()\n * call on the same view (or an ancestor) within the same layout pass, causing\n * the loop in layoutViewsIfNeeded() to iterate multiple times.\n *\n * Usage:\n * UILayoutCycleTracer.enable() \u2014 start tracing\n * UILayoutCycleTracer.disable() \u2014 stop tracing\n * UILayoutCycleTracer.isEnabled \u2014 check current state\n *\n * When a cycle is detected, a detailed report is printed to the console\n * including:\n * - Which view was re-queued\n * - Its full superview chain\n * - The call stack at the point of the re-queue (setNeedsLayout call)\n * - How many times the view has been laid out in this pass\n *\n * Integration:\n * Call UILayoutCycleTracer.willBeginLayoutPass() at the start of\n * layoutViewsIfNeeded(), UILayoutCycleTracer.didLayoutView(view) after each\n * view is laid out, and UILayoutCycleTracer.viewDidCallSetNeedsLayout(view)\n * from setNeedsLayout() while a pass is active.\n */\nexport class UILayoutCycleTracer {\n \n static _isEnabled: boolean = false\n static _isPassActive: boolean = false\n static _layoutCountsThisPass: Map<any, number> = new Map()\n static _setNeedsLayoutCallsThisPass: Map<any, { count: number; stacks: string[] }> = new Map()\n static _currentIteration: number = 0\n static _totalReportsThisPass: number = 0\n \n // How many times a view must be re-queued before reporting.\n // 1 means: report the first time a view is re-queued after being laid out.\n static reportThreshold: number = 1\n \n // Maximum number of cycle reports per layout pass to avoid console flooding.\n static maxReportsPerPass: number = 10\n \n // Prefixes of stack frames that belong to the tracer or framework internals\n // and should be stripped from the top of the captured stack so that the\n // first visible frame is always application code.\n static _noiseFramePrefixes: string[] = [\n \"UILayoutCycleTracer\",\n \"UIView.setNeedsLayout\",\n \"setNeedsLayout\",\n \"UIView.didLayoutSubviews\",\n \"didLayoutSubviews\",\n \"UIView.layoutSubviews\",\n \"UIView.layoutIfNeeded\",\n \"layoutIfNeeded\",\n \"UIView.layoutViewsIfNeeded\",\n \"layoutViewsIfNeeded\",\n ]\n \n static get isEnabled(): boolean {\n return UILayoutCycleTracer._isEnabled\n }\n \n static enable() {\n // Maximise the V8 stack trace depth so long chains are fully visible.\n // The default is 10 which truncates most interesting call stacks.\n ;(Error as any).stackTraceLimit = 100\n UILayoutCycleTracer._isEnabled = true\n console.log(\n \"%c[UILayoutCycleTracer] Layout cycle tracing ENABLED (Error.stackTraceLimit = 100)\",\n \"color: #4CAF50; font-weight: bold\"\n )\n }\n \n static disable() {\n ;(Error as any).stackTraceLimit = 10\n UILayoutCycleTracer._isEnabled = false\n console.log(\n \"%c[UILayoutCycleTracer] Layout cycle tracing DISABLED\",\n \"color: #9E9E9E; font-weight: bold\"\n )\n }\n \n /**\n * Called at the very start of each layoutViewsIfNeeded() invocation.\n */\n static willBeginLayoutPass() {\n if (!UILayoutCycleTracer._isEnabled) { return }\n UILayoutCycleTracer._isPassActive = true\n UILayoutCycleTracer._layoutCountsThisPass = new Map()\n UILayoutCycleTracer._setNeedsLayoutCallsThisPass = new Map()\n UILayoutCycleTracer._currentIteration = 0\n UILayoutCycleTracer._totalReportsThisPass = 0\n }\n \n /**\n * Called after each iteration increment in the layoutViewsIfNeeded() while loop.\n */\n static willBeginIteration(iteration: number) {\n if (!UILayoutCycleTracer._isEnabled) { return }\n UILayoutCycleTracer._currentIteration = iteration\n if (iteration > 0) {\n console.warn(\n `%c[UILayoutCycleTracer] Layout pass iteration ${iteration + 1} \u2014 views were re-queued during the previous iteration`,\n \"color: #FF9800; font-weight: bold\"\n )\n }\n }\n \n /**\n * Called after a view's layoutIfNeeded() completes.\n */\n static didLayoutView(view: any) {\n if (!UILayoutCycleTracer._isEnabled || !UILayoutCycleTracer._isPassActive) { return }\n const previous = UILayoutCycleTracer._layoutCountsThisPass.get(view) ?? 0\n UILayoutCycleTracer._layoutCountsThisPass.set(view, previous + 1)\n }\n \n /**\n * Called from setNeedsLayout() when a view enters the queue.\n * If a layout pass is currently active, this is a potential cycle.\n */\n static viewDidCallSetNeedsLayout(view: any) {\n if (!UILayoutCycleTracer._isEnabled || !UILayoutCycleTracer._isPassActive) { return }\n \n // Only report if this view has already been laid out at least once this pass.\n const layoutCount = UILayoutCycleTracer._layoutCountsThisPass.get(view) ?? 0\n if (layoutCount < UILayoutCycleTracer.reportThreshold) { return }\n \n if (UILayoutCycleTracer._totalReportsThisPass >= UILayoutCycleTracer.maxReportsPerPass) {\n if (UILayoutCycleTracer._totalReportsThisPass === UILayoutCycleTracer.maxReportsPerPass) {\n console.warn(\n `%c[UILayoutCycleTracer] Maximum reports per pass (${UILayoutCycleTracer.maxReportsPerPass}) reached. Further reports suppressed.`,\n \"color: #F44336\"\n )\n UILayoutCycleTracer._totalReportsThisPass++\n }\n return\n }\n \n UILayoutCycleTracer._totalReportsThisPass++\n \n const rawStack = new Error().stack ?? \"(stack unavailable)\"\n const cleanStack = UILayoutCycleTracer._cleanStack(rawStack)\n \n const existing = UILayoutCycleTracer._setNeedsLayoutCallsThisPass.get(view)\n if (existing) {\n existing.count++\n existing.stacks.push(cleanStack)\n }\n else {\n UILayoutCycleTracer._setNeedsLayoutCallsThisPass.set(view, { count: 1, stacks: [cleanStack] })\n }\n \n UILayoutCycleTracer._reportCycle(view, layoutCount, cleanStack)\n }\n \n /**\n * Called at the end of a layout pass.\n */\n static didFinishLayoutPass(iterationCount: number) {\n if (!UILayoutCycleTracer._isEnabled) { return }\n UILayoutCycleTracer._isPassActive = false\n \n if (iterationCount > 1) {\n console.warn(\n `%c[UILayoutCycleTracer] Layout pass completed in ${iterationCount} iteration(s). ` +\n `${UILayoutCycleTracer._totalReportsThisPass} cycle event(s) recorded.`,\n \"color: #FF9800\"\n )\n }\n }\n \n /**\n * Strips the \"Error\" header line and any leading framework/tracer noise\n * frames from a raw Error.stack string, so the first frame shown is always\n * the application code that triggered the re-queue.\n */\n static _cleanStack(rawStack: string): string {\n const lines = rawStack.split(\"\\n\")\n \n // Find the first line that is NOT the \"Error\" header and NOT a noise frame.\n let firstAppFrameIndex = 1 // skip \"Error\" on line 0\n for (let i = 1; i < lines.length; i++) {\n const trimmed = lines[i].trim()\n const isNoise = UILayoutCycleTracer._noiseFramePrefixes.some(prefix =>\n trimmed.includes(prefix)\n )\n if (!isNoise) {\n firstAppFrameIndex = i\n break\n }\n }\n \n return lines.slice(firstAppFrameIndex).join(\"\\n\")\n }\n \n static _viewIdentifier(view: any): string {\n const className = view?.constructor?.name ?? \"UnknownView\"\n const elementID = view?.elementID ?? view?._UIViewIndex ?? \"?\"\n return `${className}#${elementID}`\n }\n \n static _superviewChain(view: any): string {\n const parts: string[] = []\n let current = view\n let depth = 0\n while (current && depth < 20) {\n parts.push(UILayoutCycleTracer._viewIdentifier(current))\n current = current.superview\n depth++\n }\n return parts.join(\" \u2192 \")\n }\n \n static _reportCycle(view: any, layoutCountThisPass: number, cleanStack: string) {\n const identifier = UILayoutCycleTracer._viewIdentifier(view)\n const chain = UILayoutCycleTracer._superviewChain(view)\n \n console.groupCollapsed(\n `%c[UILayoutCycleTracer] \u26A0\uFE0F Layout cycle: ${identifier} re-queued after being laid out ${layoutCountThisPass}x in iteration ${UILayoutCycleTracer._currentIteration + 1}`,\n \"color: #F44336; font-weight: bold\"\n )\n console.log(\"%cView:\", \"font-weight: bold\", view)\n console.log(\"%cSuperview chain:\", \"font-weight: bold\", chain)\n console.log(\"%cLayout count this pass:\", \"font-weight: bold\", layoutCountThisPass)\n console.log(\"%cIteration:\", \"font-weight: bold\", UILayoutCycleTracer._currentIteration + 1)\n console.log(\"%cCall stack (noise frames stripped):\", \"font-weight: bold\")\n cleanStack.split(\"\\n\").forEach(frame => console.log(\" \" + frame.trim()))\n console.groupEnd()\n }\n \n}\n\nwindow.UILayoutCycleTracer = UILayoutCycleTracer\n\ndeclare global {\n interface Window {\n UILayoutCycleTracer?: typeof UILayoutCycleTracer\n }\n}\n\n/// #endif\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BO,MAAM,uBAAN,MAA0B;AAAA,EAgC7B,WAAW,YAAqB;AAC5B,WAAO,qBAAoB;AAAA,EAC/B;AAAA,EAEA,OAAO,SAAS;AAGZ;AAAC,IAAC,MAAc,kBAAkB;AAClC,yBAAoB,aAAa;AACjC,YAAQ;AAAA,MACJ;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EAEA,OAAO,UAAU;AACb;AAAC,IAAC,MAAc,kBAAkB;AAClC,yBAAoB,aAAa;AACjC,YAAQ;AAAA,MACJ;AAAA,MACA;AAAA,IACJ;AAAA,EACJ;AAAA,EAKA,OAAO,sBAAsB;AACzB,QAAI,CAAC,qBAAo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;AAClB;AAAA,IACJ;AACA,WAAO,MAAM,KAAK,UAAK;AAAA,EAC3B;AAAA,EAEA,OAAO,aAAa,MAAW,qBAA6B,YAAoB;AAC5E,UAAM,aAAa,qBAAoB,gBAAgB,IAAI;AAC3D,UAAM,QAAQ,qBAAoB,gBAAgB,IAAI;AAEtD,YAAQ;AAAA,MACJ,sDAA4C,6CAA6C,qCAAqC,qBAAoB,oBAAoB;AAAA,MACtK;AAAA,IACJ;AACA,YAAQ,IAAI,WAAW,qBAAqB,IAAI;AAChD,YAAQ,IAAI,sBAAsB,qBAAqB,KAAK;AAC5D,YAAQ,IAAI,6BAA6B,qBAAqB,mBAAmB;AACjF,YAAQ,IAAI,gBAAgB,qBAAqB,qBAAoB,oBAAoB,CAAC;AAC1F,YAAQ,IAAI,yCAAyC,mBAAmB;AACxE,eAAW,MAAM,IAAI,EAAE,QAAQ,WAAS,QAAQ,IAAI,OAAO,MAAM,KAAK,CAAC,CAAC;AACxE,YAAQ,SAAS;AAAA,EACrB;AAEJ;AA7MO,IAAM,sBAAN;AAAM,oBAEF,aAAsB;AAFpB,oBAGF,gBAAyB;AAHvB,oBAIF,wBAA0C,oBAAI,IAAI;AAJhD,oBAKF,+BAA8E,oBAAI,IAAI;AALpF,oBAMF,oBAA4B;AAN1B,oBAOF,wBAAgC;AAP9B,oBAWF,kBAA0B;AAXxB,oBAcF,oBAA4B;AAd1B,oBAmBF,sBAAgC;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAiLJ,OAAO,sBAAsB;",
6
+ "names": []
7
+ }
@@ -269,22 +269,20 @@ const _UITextView = class extends import_UIView.UIView {
269
269
  notificationText = '<span style="color: ' + _UITextView.notificationTextColor.stringValue + ';">' + (" (" + this.notificationAmount + ")").bold() + "</span>";
270
270
  }
271
271
  const displayText = this.thousandsSeparator !== null ? _UITextView.applyThousandsSeparatorToNumericalString(text, this.thousandsSeparator) : text;
272
- if (this.textElementView.viewHTMLElement.innerHTML != this.textPrefix + displayText + this.textSuffix + notificationText) {
273
- this.textElementView.viewHTMLElement.innerHTML = this.textPrefix + (0, import_UIObject.FIRST)(
274
- displayText,
275
- ""
276
- ) + this.textSuffix + notificationText;
277
- }
278
- if (this.changesOften) {
279
- this._intrinsicHeightCache = new import_UIObject.UIObject();
280
- this._intrinsicWidthCache = new import_UIObject.UIObject();
272
+ const newInnerHTML = this.textPrefix + (0, import_UIObject.FIRST)(displayText, "") + this.textSuffix + notificationText;
273
+ if (this.textElementView.viewHTMLElement.innerHTML !== newInnerHTML) {
274
+ this.textElementView.viewHTMLElement.innerHTML = newInnerHTML;
275
+ if (this.changesOften) {
276
+ this._intrinsicHeightCache = new import_UIObject.UIObject();
277
+ this._intrinsicWidthCache = new import_UIObject.UIObject();
278
+ }
279
+ this._useFastMeasurement = void 0;
280
+ this._intrinsicSizesCache = {};
281
+ this.invalidateMeasurementStrategy();
282
+ this._invalidateMeasurementStyles();
283
+ this.clearIntrinsicSizeCache();
284
+ this.setNeedsLayout();
281
285
  }
282
- this._useFastMeasurement = void 0;
283
- this._intrinsicSizesCache = {};
284
- this.invalidateMeasurementStrategy();
285
- this._invalidateMeasurementStyles();
286
- this.clearIntrinsicSizeCache();
287
- this.setNeedsLayout();
288
286
  }
289
287
  static applyThousandsSeparatorToNumericalString(value, separator) {
290
288
  const trimmed = (value || "").trim();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../scripts/UITextView.ts"],
4
- "sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UILocalizedTextObject } from \"./UIInterfaces\"\nimport { EXTEND, FIRST, IS_LIKE_NULL, nil, NO, UIObject, ValueOf, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { TextMeasurementStyle, UITextMeasurement } from \"./UITextMeasurement\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UITextView extends UIView {\n \n //#region Static Properties\n \n static defaultTextColor = UIColor.blackColor\n static notificationTextColor = UIColor.redColor\n \n // Global caches for all UILabels\n static _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n static _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n static _ptToPx: number\n static _pxToPt: number\n \n static type = {\n \"paragraph\": \"p\",\n \"header1\": \"h1\",\n \"header2\": \"h2\",\n \"header3\": \"h3\",\n \"header4\": \"h4\",\n \"header5\": \"h5\",\n \"header6\": \"h6\",\n \"textArea\": \"textarea\",\n \"textField\": \"input\",\n \"span\": \"span\",\n \"label\": \"label\"\n } as const\n \n static textAlignment = {\n \"left\": \"left\",\n \"center\": \"center\",\n \"right\": \"right\",\n \"justify\": \"justify\"\n } as const\n \n //#endregion\n \n //#region Constructor\n \n \n constructor(\n elementID?: string,\n textViewType: string | ValueOf<typeof UITextView.type> = UITextView.type.paragraph,\n viewHTMLElement = null\n ) {\n \n // Create inner text element as a UIView\n const innerElementID = elementID ? `${elementID}_textElement` : undefined\n const _textElementView = new UIView(innerElementID, null, textViewType)\n \n // Create outer container (wrapper) - this is the main viewHTMLElement\n super(elementID, viewHTMLElement, \"span\", { _textElementView })\n \n // Configure outer container for vertical centering using direct property access\n \n this.configureWithObject({\n // @ts-ignore\n viewHTMLElement: {\n style: {\n display: \"flex\",\n alignItems: \"center\", // Vertical centering\n overflow: \"hidden\"\n }\n }\n })\n \n this.text = \"\"\n \n this._textElementView = _textElementView\n \n // Configure inner text element for ellipsis and positioning\n this._textElementView.configureWithObject({\n style: {\n position: \"relative\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n width: \"100%\",\n margin: \"0\",\n padding: \"0\"\n },\n // Forward control events from text element to the container\n sendControlEventForKey: EXTEND(this.sendControlEventForKey.bind(this))\n })\n \n // Add text element as a subview\n this.addSubview(this._textElementView)\n \n \n this.isSingleLine = YES\n \n this.textColor = this.textColor\n \n this.userInteractionEnabled = YES\n \n if (textViewType == UITextView.type.textArea) {\n this.pausesPointerEvents = YES\n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n }\n }\n \n //#endregion\n \n //#region Text Element View Property\n \n private _textElementView: UIView\n \n /**\n * The inner text element that holds the actual text content\n */\n get textElementView(): UIView {\n return this._textElementView\n }\n \n /**\n * Override style to apply to the text element instead of the container\n */\n // override get style() {\n // return this._textElementView.style\n // }\n //\n // /**\n // * Override computedStyle to get computed styles from the text element\n // */\n // override get computedStyle() {\n // return this._textElementView.computedStyle\n // }\n \n /**\n * Access the outer container's style (for positioning, layout, etc.)\n */\n get containerStyle() {\n return this.viewHTMLElement.style\n }\n \n /**\n * Override styleClasses to apply to the text element\n */\n override get styleClasses() {\n return this._textElementView.styleClasses\n }\n \n override set styleClasses(styleClasses: string[]) {\n this._textElementView.styleClasses = styleClasses\n }\n \n //#endregion\n \n //#region Lifecycle Methods\n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n super.didReceiveBroadcastEvent(event)\n }\n \n override willMoveToSuperview(superview: UIView) {\n super.willMoveToSuperview(superview)\n }\n \n override documentFontsDidLoad() {\n super.documentFontsDidLoad()\n this._invalidateFontCache()\n this.invalidateMeasurementStrategy()\n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n UITextView._intrinsicHeightCache = new UIObject() as any\n UITextView._intrinsicWidthCache = new UIObject() as any\n }\n \n \n override layoutSubviews() {\n super.layoutSubviews()\n \n if (this._automaticFontSizeSelection) {\n this.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(\n 0,\n 0,\n this.textElementView.viewHTMLElement.offsetHeight,\n this.textElementView.viewHTMLElement.offsetWidth\n ),\n this.intrinsicContentSize(),\n this.fontSize,\n this._minFontSize,\n this._maxFontSize\n )\n }\n }\n \n //#endregion\n \n //#region Measurement & Sizing - Private Methods\n \n private _invalidateMeasurementStyles(): void {\n this._cachedMeasurementStyles = undefined\n UITextMeasurement.invalidateElement(this.textElementView.viewHTMLElement)\n this._intrinsicSizesCache = {}\n }\n \n private _getMeasurementStyles(): TextMeasurementStyle | null {\n if (this._cachedMeasurementStyles) {\n return this._cachedMeasurementStyles\n }\n \n // Ensure element is in document\n if (!this.textElementView.viewHTMLElement.isConnected) {\n return null\n }\n \n // Force a layout flush ONCE to ensure computed styles are available\n // This is only paid once per style change, then we use cached values\n this.textElementView.viewHTMLElement.offsetHeight\n \n const computed = window.getComputedStyle(this.textElementView.viewHTMLElement)\n const fontSizeStr = computed.fontSize\n const fontSize = parseFloat(fontSizeStr)\n \n if (!fontSize || isNaN(fontSize)) {\n return null\n }\n \n const lineHeight = this._parseLineHeight(computed.lineHeight, fontSize)\n \n if (isNaN(lineHeight)) {\n return null\n }\n \n const font = [\n computed.fontStyle || \"normal\",\n computed.fontVariant || \"normal\",\n computed.fontWeight || \"normal\",\n fontSize + \"px\",\n computed.fontFamily || \"sans-serif\"\n ].join(\" \")\n \n this._cachedMeasurementStyles = {\n font: font,\n fontSize: fontSize,\n lineHeight: lineHeight,\n whiteSpace: computed.whiteSpace || \"normal\",\n paddingLeft: parseFloat(computed.paddingLeft) || 0,\n paddingRight: parseFloat(computed.paddingRight) || 0,\n paddingTop: parseFloat(computed.paddingTop) || 0,\n paddingBottom: parseFloat(computed.paddingBottom) || 0,\n letterSpacing: parseFloat(computed.letterSpacing) || 0,\n textTransform: computed.textTransform || \"none\"\n }\n \n return this._cachedMeasurementStyles\n }\n \n private _parseLineHeight(lineHeight: string, fontSize: number): number {\n if (lineHeight === \"normal\") {\n return fontSize * 1.2\n }\n if (lineHeight.endsWith(\"px\")) {\n return parseFloat(lineHeight)\n }\n const numericLineHeight = parseFloat(lineHeight)\n if (!isNaN(numericLineHeight)) {\n return fontSize * numericLineHeight\n }\n return fontSize * 1.2\n }\n \n private _shouldUseFastMeasurement(): boolean {\n const content = this.text || this.textElementView.innerHTML\n \n if (this._innerHTMLKey || this._localizedTextObject) {\n return false\n }\n \n if (this.notificationAmount > 0) {\n return false\n }\n \n const hasComplexHTML = /<(?!\\/?(b|i|em|strong|span|br)\\b)[^>]+>/i.test(content)\n \n if (hasComplexHTML) {\n return false\n }\n \n // Canvas measureText silently falls back to the system font when the\n // custom font hasn't been loaded into the canvas font system yet, even\n // if getComputedStyle already reports the correct font family. Guard\n // against this by checking the font is confirmed available before\n // trusting canvas-based measurement.\n const styles = this._getMeasurementStyles()\n if (styles && !document.fonts.check(styles.font)) {\n return false\n }\n \n return true\n }\n \n //#endregion\n \n //#region Measurement & Sizing - Public Methods\n \n setUseFastMeasurement(useFast: boolean): void {\n this._useFastMeasurement = useFast\n this._intrinsicSizesCache = {}\n }\n \n invalidateMeasurementStrategy(): void {\n this._useFastMeasurement = undefined\n this._invalidateMeasurementStyles()\n }\n \n //#endregion\n \n //#region Getters & Setters - Text Alignment\n \n get textAlignment() {\n return this._textElementView.style.textAlign as ValueOf<typeof UITextView.textAlignment>\n }\n \n set textAlignment(textAlignment: ValueOf<typeof UITextView.textAlignment>) {\n this._textAlignment = textAlignment\n this._textElementView.style.textAlign = textAlignment\n }\n \n //#endregion\n \n //#region Getters & Setters - Text Color\n \n get textColor() {\n return this._textColor\n }\n \n set textColor(color: UIColor) {\n this._textColor = color || UITextView.defaultTextColor\n this._textElementView.style.color = this._textColor.stringValue\n }\n \n //#endregion\n \n //#region Getters & Setters - Single Line\n \n get isSingleLine() {\n return this._isSingleLine\n }\n \n set isSingleLine(isSingleLine: boolean) {\n this._isSingleLine = isSingleLine\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n if (isSingleLine) {\n // Single line: use nowrap with ellipsis\n this._textElementView.style.whiteSpace = \"nowrap\"\n this._textElementView.style.textOverflow = \"ellipsis\"\n this._textElementView.style.display = \"\"\n this._textElementView.style.webkitLineClamp = \"\"\n this._textElementView.style.webkitBoxOrient = \"\"\n return\n }\n \n // Multiline: allow wrapping, but still show ellipsis if content overflows the container\n // This uses the -webkit-line-clamp approach which works for multiline ellipsis\n this._textElementView.style.whiteSpace = \"normal\"\n this._textElementView.style.textOverflow = \"ellipsis\"\n this._textElementView.style.display = \"-webkit-box\"\n this._textElementView.style.webkitBoxOrient = \"vertical\"\n // Don't set line-clamp to a specific number - let it fill available space\n // The overflow: hidden from the constructor will clip content that exceeds the height\n this.invalidateMeasurementStrategy()\n }\n \n //#endregion\n \n //#region Getters & Setters - Notification Amount\n \n get notificationAmount() {\n return this._notificationAmount\n }\n \n set notificationAmount(notificationAmount: number) {\n if (this._notificationAmount == notificationAmount) {\n return\n }\n \n this._notificationAmount = notificationAmount\n this.text = this.text\n this.setNeedsLayoutUpToRootView()\n this.notificationAmountDidChange(notificationAmount)\n }\n \n notificationAmountDidChange(notificationAmount: number) {\n }\n \n //#endregion\n \n //#region Getters & Setters - Text Content\n \n get text() {\n return (this._text || this.textElementView.viewHTMLElement.innerHTML)\n }\n \n set text(text) {\n this._text = text\n var notificationText = \"\"\n if (this.notificationAmount) {\n notificationText = \"<span style=\\\"color: \" + UITextView.notificationTextColor.stringValue + \";\\\">\" +\n (\" (\" + this.notificationAmount + \")\").bold() + \"</span>\"\n }\n \n const displayText = this.thousandsSeparator !== null\n ? UITextView.applyThousandsSeparatorToNumericalString(text, this.thousandsSeparator)\n : text\n \n if (this.textElementView.viewHTMLElement.innerHTML != this.textPrefix + displayText + this.textSuffix + notificationText) {\n this.textElementView.viewHTMLElement.innerHTML = this.textPrefix + FIRST(\n displayText, \"\") + this.textSuffix + notificationText\n }\n \n if (this.changesOften) {\n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n }\n \n this._useFastMeasurement = undefined\n this._intrinsicSizesCache = {}\n this.invalidateMeasurementStrategy()\n this._invalidateMeasurementStyles()\n this.clearIntrinsicSizeCache()\n \n this.setNeedsLayout()\n }\n \n \n /**\n * Formats a raw number string by inserting `separator` every three digits\n * in the integer part. Handles negative numbers and decimals (machine locale\n * \".\" as decimal point). Non-numeric strings are returned unchanged.\n */\n static applyThousandsSeparatorToNumericalString(value: string, separator: string): string {\n const trimmed = (value || \"\").trim()\n if (trimmed === \"\") {\n return value\n }\n \n // Split on the decimal point (machine locale uses \".\")\n const parts = trimmed.split(\".\")\n const integerPart = parts[0]\n const decimalPart = parts.length > 1 ? parts[1] : null\n \n // Only format if the integer part consists solely of digits (optionally\n // prefixed with a minus sign). Non-numeric strings pass through as-is.\n if (!/^-?\\d+$/.test(integerPart)) {\n return value\n }\n \n const isNegative = integerPart.startsWith(\"-\")\n const digits = isNegative ? integerPart.slice(1) : integerPart\n \n let formatted = \"\"\n const offset = digits.length % 3\n for (let index = 0; index < digits.length; index++) {\n if (index > 0 && (index - offset) % 3 === 0) {\n formatted += separator\n }\n formatted += digits[index]\n }\n \n const result = (isNegative ? \"-\" : \"\") + formatted\n return decimalPart !== null ? result + \".\" + decimalPart : result\n }\n \n override set innerHTML(innerHTML: string) {\n this.text = innerHTML\n this.invalidateMeasurementStrategy()\n }\n \n override get innerHTML() {\n return this.viewHTMLElement.innerHTML\n }\n \n setText(key: string, defaultString: string, parameters?: { [x: string]: string | UILocalizedTextObject }) {\n this.textElementView.setInnerHTML(key, defaultString, parameters)\n this.invalidateMeasurementStrategy()\n }\n \n //#endregion\n \n //#region Getters & Setters - Font Size\n \n get fontSize() {\n const style = this._textElementView.style.fontSize || window.getComputedStyle(this._textElementView.viewHTMLElement, null).fontSize\n const result = (parseFloat(style) * UITextView._pxToPt)\n return result\n }\n \n set fontSize(fontSize: number) {\n if (fontSize != this.fontSize) {\n this._textElementView.style.fontSize = \"\" + fontSize + \"pt\"\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n this._invalidateFontCache()\n this._invalidateMeasurementStyles()\n this.clearIntrinsicSizeCache()\n }\n }\n \n useAutomaticFontSize(minFontSize: number = nil, maxFontSize: number = nil) {\n this._automaticFontSizeSelection = YES\n this._minFontSize = minFontSize\n this._maxFontSize = maxFontSize\n this.setNeedsLayout()\n }\n \n //#endregion\n \n //#region Font Caching - Private Methods\n \n /**\n * Get a stable cache key for the font without triggering reflow.\n * Only computes font on first access or when font properties change.\n */\n private _getFontCacheKey(): string {\n // Check if font-related properties have changed\n const currentTriggers = {\n fontSize: this._textElementView.style.fontSize || \"\",\n fontFamily: this._textElementView.style.fontFamily || \"\",\n fontWeight: this._textElementView.style.fontWeight || \"\",\n fontStyle: this._textElementView.style.fontStyle || \"\",\n styleClasses: this.styleClasses.join(\",\")\n }\n \n const hasChanged =\n currentTriggers.fontSize !== this._fontInvalidationTriggers.fontSize ||\n currentTriggers.fontFamily !== this._fontInvalidationTriggers.fontFamily ||\n currentTriggers.fontWeight !== this._fontInvalidationTriggers.fontWeight ||\n currentTriggers.fontStyle !== this._fontInvalidationTriggers.fontStyle ||\n currentTriggers.styleClasses !== this._fontInvalidationTriggers.styleClasses\n \n if (!this._cachedFontKey || hasChanged) {\n // Only access computedStyle when we know something changed\n const computed = this._textElementView.computedStyle\n this._cachedFontKey = [\n computed.fontStyle,\n computed.fontVariant,\n computed.fontWeight,\n computed.fontSize,\n computed.fontFamily\n ].join(\"_\").replace(/[.\\s]/g, \"_\")\n \n this._fontInvalidationTriggers = currentTriggers\n }\n \n return this._cachedFontKey\n }\n \n /**\n * Invalidate font cache when font properties change\n */\n private _invalidateFontCache(): void {\n this._cachedFontKey = undefined\n }\n \n //#endregion\n \n //#region Static Methods\n \n static _determinePXAndPTRatios() {\n if (UITextView._ptToPx) {\n return\n }\n \n const o = document.createElement(\"div\")\n o.style.width = \"1000pt\"\n document.body.appendChild(o)\n UITextView._ptToPx = o.clientWidth / 1000\n document.body.removeChild(o)\n UITextView._pxToPt = 1 / UITextView._ptToPx\n }\n \n static automaticallyCalculatedFontSize(\n bounds: UIRectangle,\n currentSize: UIRectangle,\n currentFontSize: number,\n minFontSize?: number,\n maxFontSize?: number\n ) {\n minFontSize = FIRST(minFontSize, 1)\n maxFontSize = FIRST(maxFontSize, 100000000000)\n \n const heightMultiplier = bounds.height / (currentSize.height + 1)\n const widthMultiplier = bounds.width / (currentSize.width + 1)\n \n var multiplier = heightMultiplier\n if (heightMultiplier > widthMultiplier) {\n multiplier = widthMultiplier\n }\n \n const maxFittingFontSize = currentFontSize * multiplier\n \n if (maxFittingFontSize > maxFontSize) {\n return maxFontSize\n }\n \n if (minFontSize > maxFittingFontSize) {\n return minFontSize\n }\n \n return maxFittingFontSize\n }\n \n //#endregion\n \n //#region Instance Properties - Text Content\n \n _text?: string\n textPrefix = \"\"\n textSuffix = \"\"\n _notificationAmount = 0\n \n _thousandsSeparator: string | null = null\n \n get thousandsSeparator(): string | null {\n return this._thousandsSeparator\n }\n \n set thousandsSeparator(value: string | null) {\n this._thousandsSeparator = value\n }\n \n //#endregion\n \n //#region Instance Properties - Styling\n \n _textColor: UIColor = UITextView.defaultTextColor\n _textAlignment?: ValueOf<typeof UITextView.textAlignment>\n _isSingleLine = YES\n \n //#endregion\n \n //#region Instance Properties - Font & Sizing\n \n _minFontSize?: number\n _maxFontSize?: number\n _automaticFontSizeSelection = NO\n \n // Cache for the computed font string\n private _cachedFontKey?: string\n private _fontInvalidationTriggers = {\n fontSize: \"\",\n fontFamily: \"\",\n fontWeight: \"\",\n fontStyle: \"\",\n styleClasses: \"\"\n }\n \n //#endregion\n \n //#region Instance Properties - Caching & Performance\n \n changesOften = NO\n \n // Local cache for this instance if the label changes often\n _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n private _useFastMeasurement: boolean | undefined\n private _cachedMeasurementStyles: TextMeasurementStyle | undefined | null\n \n override usesVirtualLayoutingForIntrinsicSizing = NO\n \n //#endregion\n \n // Override addStyleClass to invalidate font cache\n override addStyleClass(styleClass: string) {\n super.addStyleClass(styleClass)\n this._invalidateFontCache()\n }\n \n // Override removeStyleClass to invalidate font cache\n override removeStyleClass(styleClass: string) {\n super.removeStyleClass(styleClass)\n this._invalidateFontCache()\n }\n \n // Override focus to focus the text element\n override focus() {\n this._textElementView.focus()\n }\n \n // Override blur to blur the text element\n override blur() {\n this._textElementView.blur()\n }\n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = ((this.textElementView.viewHTMLElement.innerHTML || this.text) + \"_csf_\" + this._getFontCacheKey()) + \".\" +\n (\"\" + constrainingWidth).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicHeightCache\n \n if (this.changesOften) {\n cacheObject = this._intrinsicHeightCache\n }\n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n if (IS_LIKE_NULL(result)) {\n // Determine if we should use fast measurement\n const shouldUseFastPath = this._useFastMeasurement ?? this._shouldUseFastMeasurement()\n \n if (shouldUseFastPath) {\n // Fast path: use UITextMeasurement with pre-extracted styles\n const styles = this._getMeasurementStyles()\n \n // If styles are invalid (element not properly initialized), fall back to DOM\n if (styles) {\n const size = UITextMeasurement.calculateTextSize(\n this.textElementView.viewHTMLElement,\n ((this.text || this.textElementView.innerHTML || \"\") + \"\").replace(/<br\\s*\\/?>/gi, \"\\n\"),\n constrainingWidth || undefined,\n undefined,\n styles\n )\n result = size.height\n }\n else {\n // Styles not ready, use DOM measurement\n result = super.intrinsicContentHeight(constrainingWidth)\n }\n }\n else {\n // Fallback: DOM-based measurement for complex content\n result = super.intrinsicContentHeight(constrainingWidth)\n }\n \n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n if (isNaN(result) || (!result && !this.text)) {\n result = super.intrinsicContentHeight(constrainingWidth)\n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n return result\n }\n \n override intrinsicContentWidth(constrainingHeight = 0) {\n \n const keyPath = ((this.textElementView.viewHTMLElement.innerHTML || this.text) + \"_csf_\" + this._getFontCacheKey()) + \".\" +\n (\"\" + constrainingHeight).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicWidthCache\n \n if (this.changesOften) {\n cacheObject = this._intrinsicWidthCache\n }\n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n if (IS_LIKE_NULL(result)) {\n // Determine if we should use fast measurement\n const shouldUseFastPath = this._useFastMeasurement ?? this._shouldUseFastMeasurement()\n \n if (shouldUseFastPath) {\n // Fast path: use UITextMeasurement with pre-extracted styles\n const styles = this._getMeasurementStyles()\n \n // If styles are invalid (element not properly initialized), fall back to DOM\n if (styles) {\n const size = UITextMeasurement.calculateTextSize(\n this.textElementView.viewHTMLElement,\n ((this.text || this.textElementView.innerHTML || \"\") + \"\").replace(/<br\\s*\\/?>/gi, \"\\n\"),\n undefined,\n constrainingHeight || undefined,\n styles\n )\n result = size.width\n }\n else {\n // Styles not ready, use DOM measurement\n result = super.intrinsicContentWidth(constrainingHeight)\n }\n }\n else {\n // Fallback: DOM-based measurement for complex content\n result = super.intrinsicContentWidth(constrainingHeight)\n }\n \n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n return result\n }\n \n \n override intrinsicContentSizeWithConstraints(constrainingHeight: number = 0, constrainingWidth: number = 0) {\n \n const cacheKey = this._getIntrinsicSizeCacheKey(constrainingHeight, constrainingWidth)\n const cachedResult = this._getCachedIntrinsicSize(cacheKey)\n if (cachedResult) {\n return cachedResult\n }\n \n // UITextView needs to measure the text element, not the outer container\n const result = new UIRectangle(0, 0, 0, 0)\n if (this.rootView.forceIntrinsicSizeZero) {\n return result\n }\n \n let temporarilyInViewTree = NO\n let nodeAboveThisView: Node | null = null\n if (!this.isMemberOfViewTree) {\n document.body.appendChild(this.viewHTMLElement)\n temporarilyInViewTree = YES\n nodeAboveThisView = this.viewHTMLElement.nextSibling\n }\n \n // Save and clear styles on the TEXT ELEMENT (not the container)\n const height = this._textElementView.style.height\n const width = this._textElementView.style.width\n \n this._textElementView.style.height = \"\" + constrainingHeight\n this._textElementView.style.width = \"\" + constrainingWidth\n \n const left = this._textElementView.style.left\n const right = this._textElementView.style.right\n const bottom = this._textElementView.style.bottom\n const top = this._textElementView.style.top\n \n this._textElementView.style.left = \"\"\n this._textElementView.style.right = \"\"\n this._textElementView.style.bottom = \"\"\n this._textElementView.style.top = \"\"\n \n // Measure height with the text element\n const resultHeight = this._textElementView.viewHTMLElement.scrollHeight\n \n // Measure width by temporarily setting nowrap\n const whiteSpace = this._textElementView.style.whiteSpace\n this._textElementView.style.whiteSpace = \"nowrap\"\n \n const resultWidth = this._textElementView.viewHTMLElement.scrollWidth\n \n this._textElementView.style.whiteSpace = whiteSpace\n \n // Restore styles on the TEXT ELEMENT\n this._textElementView.style.height = height\n this._textElementView.style.width = width\n \n this._textElementView.style.left = left\n this._textElementView.style.right = right\n this._textElementView.style.bottom = bottom\n this._textElementView.style.top = top\n \n if (temporarilyInViewTree) {\n document.body.removeChild(this.viewHTMLElement)\n if (this.superview) {\n if (nodeAboveThisView) {\n this.superview.viewHTMLElement.insertBefore(this.viewHTMLElement, nodeAboveThisView)\n }\n else {\n this.superview.viewHTMLElement.appendChild(this.viewHTMLElement)\n }\n }\n }\n \n result.height = resultHeight\n result.width = resultWidth\n \n this._setCachedIntrinsicSize(cacheKey, result)\n \n return result\n }\n \n \n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AAExB,sBAA6E;AAC7E,yBAA4B;AAC5B,+BAAwD;AACxD,oBAA6C;AAGtC,MAAM,cAAN,cAAyB,qBAAO;AAAA,EAwCnC,YACI,WACA,eAAyD,YAAW,KAAK,WACzE,kBAAkB,MACpB;AAGE,UAAM,iBAAiB,YAAY,GAAG,0BAA0B;AAChE,UAAM,mBAAmB,IAAI,qBAAO,gBAAgB,MAAM,YAAY;AAGtE,UAAM,WAAW,iBAAiB,QAAQ,EAAE,iBAAiB,CAAC;AAsjBlE,sBAAa;AACb,sBAAa;AACb,+BAAsB;AAEtB,+BAAqC;AAcrC,sBAAsB,Y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,iBAAiB,gBAAgB;AAE1D,SAAK,iBAAiB,MAAM,aAAa;AAGzC,SAAK,iBAAiB,MAAM,SAAS;AACrC,SAAK,iBAAiB,MAAM,QAAQ;AAEpC,SAAK,iBAAiB,MAAM,OAAO;AACnC,SAAK,iBAAiB,MAAM,QAAQ;AACpC,SAAK,iBAAiB,MAAM,SAAS;AACrC,SAAK,iBAAiB,MAAM,MAAM;AAElC,QAAI,uBAAuB;AACvB,eAAS,KAAK,YAAY,KAAK,eAAe;AAC9C,UAAI,KAAK,WAAW;AAChB,YAAI,mBAAmB;AACnB,eAAK,UAAU,gBAAgB,aAAa,KAAK,iBAAiB,iBAAiB;AAAA,QACvF,OACK;AACD,eAAK,UAAU,gBAAgB,YAAY,KAAK,eAAe;AAAA,QACnE;AAAA,MACJ;AAAA,IACJ;AAEA,WAAO,SAAS;AAChB,WAAO,QAAQ;AAEf,SAAK,wBAAwB,UAAU,MAAM;AAE7C,WAAO;AAAA,EACX;AAGJ;AA92BO,IAAM,aAAN;AAAM,WAIF,mBAAmB,uBAAQ;AAJzB,WAKF,wBAAwB,uBAAQ;AAL9B,WAQF,wBAA+E,IAAI,yBAAS;AAR1F,WASF,uBAA8E,IAAI,yBAAS;AATzF,WAcF,OAAO;AAAA,EACV,aAAa;AAAA,EACb,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,SAAS;AACb;AA1BS,WA4BF,gBAAgB;AAAA,EACnB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AACf;",
4
+ "sourcesContent": ["import { UIColor } from \"./UIColor\"\nimport { UILocalizedTextObject } from \"./UIInterfaces\"\nimport { EXTEND, FIRST, IS_LIKE_NULL, nil, NO, UIObject, ValueOf, YES } from \"./UIObject\"\nimport { UIRectangle } from \"./UIRectangle\"\nimport { TextMeasurementStyle, UITextMeasurement } from \"./UITextMeasurement\"\nimport { UIView, UIViewBroadcastEvent } from \"./UIView\"\n\n\nexport class UITextView extends UIView {\n \n //#region Static Properties\n \n static defaultTextColor = UIColor.blackColor\n static notificationTextColor = UIColor.redColor\n \n // Global caches for all UILabels\n static _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n static _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n static _ptToPx: number\n static _pxToPt: number\n \n static type = {\n \"paragraph\": \"p\",\n \"header1\": \"h1\",\n \"header2\": \"h2\",\n \"header3\": \"h3\",\n \"header4\": \"h4\",\n \"header5\": \"h5\",\n \"header6\": \"h6\",\n \"textArea\": \"textarea\",\n \"textField\": \"input\",\n \"span\": \"span\",\n \"label\": \"label\"\n } as const\n \n static textAlignment = {\n \"left\": \"left\",\n \"center\": \"center\",\n \"right\": \"right\",\n \"justify\": \"justify\"\n } as const\n \n //#endregion\n \n //#region Constructor\n \n \n constructor(\n elementID?: string,\n textViewType: string | ValueOf<typeof UITextView.type> = UITextView.type.paragraph,\n viewHTMLElement = null\n ) {\n \n // Create inner text element as a UIView\n const innerElementID = elementID ? `${elementID}_textElement` : undefined\n const _textElementView = new UIView(innerElementID, null, textViewType)\n \n // Create outer container (wrapper) - this is the main viewHTMLElement\n super(elementID, viewHTMLElement, \"span\", { _textElementView })\n \n // Configure outer container for vertical centering using direct property access\n \n this.configureWithObject({\n // @ts-ignore\n viewHTMLElement: {\n style: {\n display: \"flex\",\n alignItems: \"center\", // Vertical centering\n overflow: \"hidden\"\n }\n }\n })\n \n this.text = \"\"\n \n this._textElementView = _textElementView\n \n // Configure inner text element for ellipsis and positioning\n this._textElementView.configureWithObject({\n style: {\n position: \"relative\",\n overflow: \"hidden\",\n textOverflow: \"ellipsis\",\n width: \"100%\",\n margin: \"0\",\n padding: \"0\"\n },\n // Forward control events from text element to the container\n sendControlEventForKey: EXTEND(this.sendControlEventForKey.bind(this))\n })\n \n // Add text element as a subview\n this.addSubview(this._textElementView)\n \n \n this.isSingleLine = YES\n \n this.textColor = this.textColor\n \n this.userInteractionEnabled = YES\n \n if (textViewType == UITextView.type.textArea) {\n this.pausesPointerEvents = YES\n this.addTargetForControlEvent(\n UIView.controlEvent.PointerUpInside,\n (sender, event) => sender.focus()\n )\n }\n }\n \n //#endregion\n \n //#region Text Element View Property\n \n private _textElementView: UIView\n \n /**\n * The inner text element that holds the actual text content\n */\n get textElementView(): UIView {\n return this._textElementView\n }\n \n /**\n * Override style to apply to the text element instead of the container\n */\n // override get style() {\n // return this._textElementView.style\n // }\n //\n // /**\n // * Override computedStyle to get computed styles from the text element\n // */\n // override get computedStyle() {\n // return this._textElementView.computedStyle\n // }\n \n /**\n * Access the outer container's style (for positioning, layout, etc.)\n */\n get containerStyle() {\n return this.viewHTMLElement.style\n }\n \n /**\n * Override styleClasses to apply to the text element\n */\n override get styleClasses() {\n return this._textElementView.styleClasses\n }\n \n override set styleClasses(styleClasses: string[]) {\n this._textElementView.styleClasses = styleClasses\n }\n \n //#endregion\n \n //#region Lifecycle Methods\n \n override didReceiveBroadcastEvent(event: UIViewBroadcastEvent) {\n super.didReceiveBroadcastEvent(event)\n }\n \n override willMoveToSuperview(superview: UIView) {\n super.willMoveToSuperview(superview)\n }\n \n override documentFontsDidLoad() {\n super.documentFontsDidLoad()\n this._invalidateFontCache()\n this.invalidateMeasurementStrategy()\n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n UITextView._intrinsicHeightCache = new UIObject() as any\n UITextView._intrinsicWidthCache = new UIObject() as any\n }\n \n \n override layoutSubviews() {\n super.layoutSubviews()\n \n if (this._automaticFontSizeSelection) {\n this.fontSize = UITextView.automaticallyCalculatedFontSize(\n new UIRectangle(\n 0,\n 0,\n this.textElementView.viewHTMLElement.offsetHeight,\n this.textElementView.viewHTMLElement.offsetWidth\n ),\n this.intrinsicContentSize(),\n this.fontSize,\n this._minFontSize,\n this._maxFontSize\n )\n }\n }\n \n //#endregion\n \n //#region Measurement & Sizing - Private Methods\n \n private _invalidateMeasurementStyles(): void {\n this._cachedMeasurementStyles = undefined\n UITextMeasurement.invalidateElement(this.textElementView.viewHTMLElement)\n this._intrinsicSizesCache = {}\n }\n \n private _getMeasurementStyles(): TextMeasurementStyle | null {\n if (this._cachedMeasurementStyles) {\n return this._cachedMeasurementStyles\n }\n \n // Ensure element is in document\n if (!this.textElementView.viewHTMLElement.isConnected) {\n return null\n }\n \n // Force a layout flush ONCE to ensure computed styles are available\n // This is only paid once per style change, then we use cached values\n this.textElementView.viewHTMLElement.offsetHeight\n \n const computed = window.getComputedStyle(this.textElementView.viewHTMLElement)\n const fontSizeStr = computed.fontSize\n const fontSize = parseFloat(fontSizeStr)\n \n if (!fontSize || isNaN(fontSize)) {\n return null\n }\n \n const lineHeight = this._parseLineHeight(computed.lineHeight, fontSize)\n \n if (isNaN(lineHeight)) {\n return null\n }\n \n const font = [\n computed.fontStyle || \"normal\",\n computed.fontVariant || \"normal\",\n computed.fontWeight || \"normal\",\n fontSize + \"px\",\n computed.fontFamily || \"sans-serif\"\n ].join(\" \")\n \n this._cachedMeasurementStyles = {\n font: font,\n fontSize: fontSize,\n lineHeight: lineHeight,\n whiteSpace: computed.whiteSpace || \"normal\",\n paddingLeft: parseFloat(computed.paddingLeft) || 0,\n paddingRight: parseFloat(computed.paddingRight) || 0,\n paddingTop: parseFloat(computed.paddingTop) || 0,\n paddingBottom: parseFloat(computed.paddingBottom) || 0,\n letterSpacing: parseFloat(computed.letterSpacing) || 0,\n textTransform: computed.textTransform || \"none\"\n }\n \n return this._cachedMeasurementStyles\n }\n \n private _parseLineHeight(lineHeight: string, fontSize: number): number {\n if (lineHeight === \"normal\") {\n return fontSize * 1.2\n }\n if (lineHeight.endsWith(\"px\")) {\n return parseFloat(lineHeight)\n }\n const numericLineHeight = parseFloat(lineHeight)\n if (!isNaN(numericLineHeight)) {\n return fontSize * numericLineHeight\n }\n return fontSize * 1.2\n }\n \n private _shouldUseFastMeasurement(): boolean {\n const content = this.text || this.textElementView.innerHTML\n \n if (this._innerHTMLKey || this._localizedTextObject) {\n return false\n }\n \n if (this.notificationAmount > 0) {\n return false\n }\n \n const hasComplexHTML = /<(?!\\/?(b|i|em|strong|span|br)\\b)[^>]+>/i.test(content)\n \n if (hasComplexHTML) {\n return false\n }\n \n // Canvas measureText silently falls back to the system font when the\n // custom font hasn't been loaded into the canvas font system yet, even\n // if getComputedStyle already reports the correct font family. Guard\n // against this by checking the font is confirmed available before\n // trusting canvas-based measurement.\n const styles = this._getMeasurementStyles()\n if (styles && !document.fonts.check(styles.font)) {\n return false\n }\n \n return true\n }\n \n //#endregion\n \n //#region Measurement & Sizing - Public Methods\n \n setUseFastMeasurement(useFast: boolean): void {\n this._useFastMeasurement = useFast\n this._intrinsicSizesCache = {}\n }\n \n invalidateMeasurementStrategy(): void {\n this._useFastMeasurement = undefined\n this._invalidateMeasurementStyles()\n }\n \n //#endregion\n \n //#region Getters & Setters - Text Alignment\n \n get textAlignment() {\n return this._textElementView.style.textAlign as ValueOf<typeof UITextView.textAlignment>\n }\n \n set textAlignment(textAlignment: ValueOf<typeof UITextView.textAlignment>) {\n this._textAlignment = textAlignment\n this._textElementView.style.textAlign = textAlignment\n }\n \n //#endregion\n \n //#region Getters & Setters - Text Color\n \n get textColor() {\n return this._textColor\n }\n \n set textColor(color: UIColor) {\n this._textColor = color || UITextView.defaultTextColor\n this._textElementView.style.color = this._textColor.stringValue\n }\n \n //#endregion\n \n //#region Getters & Setters - Single Line\n \n get isSingleLine() {\n return this._isSingleLine\n }\n \n set isSingleLine(isSingleLine: boolean) {\n this._isSingleLine = isSingleLine\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n if (isSingleLine) {\n // Single line: use nowrap with ellipsis\n this._textElementView.style.whiteSpace = \"nowrap\"\n this._textElementView.style.textOverflow = \"ellipsis\"\n this._textElementView.style.display = \"\"\n this._textElementView.style.webkitLineClamp = \"\"\n this._textElementView.style.webkitBoxOrient = \"\"\n return\n }\n \n // Multiline: allow wrapping, but still show ellipsis if content overflows the container\n // This uses the -webkit-line-clamp approach which works for multiline ellipsis\n this._textElementView.style.whiteSpace = \"normal\"\n this._textElementView.style.textOverflow = \"ellipsis\"\n this._textElementView.style.display = \"-webkit-box\"\n this._textElementView.style.webkitBoxOrient = \"vertical\"\n // Don't set line-clamp to a specific number - let it fill available space\n // The overflow: hidden from the constructor will clip content that exceeds the height\n this.invalidateMeasurementStrategy()\n }\n \n //#endregion\n \n //#region Getters & Setters - Notification Amount\n \n get notificationAmount() {\n return this._notificationAmount\n }\n \n set notificationAmount(notificationAmount: number) {\n if (this._notificationAmount == notificationAmount) {\n return\n }\n \n this._notificationAmount = notificationAmount\n this.text = this.text\n this.setNeedsLayoutUpToRootView()\n this.notificationAmountDidChange(notificationAmount)\n }\n \n notificationAmountDidChange(notificationAmount: number) {\n }\n \n //#endregion\n \n //#region Getters & Setters - Text Content\n \n get text() {\n return (this._text || this.textElementView.viewHTMLElement.innerHTML)\n }\n \n set text(text) {\n this._text = text\n var notificationText = \"\"\n if (this.notificationAmount) {\n notificationText = \"<span style=\\\"color: \" + UITextView.notificationTextColor.stringValue + \";\\\">\" +\n (\" (\" + this.notificationAmount + \")\").bold() + \"</span>\"\n }\n \n const displayText = this.thousandsSeparator !== null\n ? UITextView.applyThousandsSeparatorToNumericalString(text, this.thousandsSeparator)\n : text\n \n const newInnerHTML = this.textPrefix + FIRST(displayText, \"\") + this.textSuffix + notificationText\n \n if (this.textElementView.viewHTMLElement.innerHTML !== newInnerHTML) {\n this.textElementView.viewHTMLElement.innerHTML = newInnerHTML\n \n if (this.changesOften) {\n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n }\n \n this._useFastMeasurement = undefined\n this._intrinsicSizesCache = {}\n this.invalidateMeasurementStrategy()\n this._invalidateMeasurementStyles()\n this.clearIntrinsicSizeCache()\n this.setNeedsLayout()\n }\n }\n \n \n /**\n * Formats a raw number string by inserting `separator` every three digits\n * in the integer part. Handles negative numbers and decimals (machine locale\n * \".\" as decimal point). Non-numeric strings are returned unchanged.\n */\n static applyThousandsSeparatorToNumericalString(value: string, separator: string): string {\n const trimmed = (value || \"\").trim()\n if (trimmed === \"\") {\n return value\n }\n \n // Split on the decimal point (machine locale uses \".\")\n const parts = trimmed.split(\".\")\n const integerPart = parts[0]\n const decimalPart = parts.length > 1 ? parts[1] : null\n \n // Only format if the integer part consists solely of digits (optionally\n // prefixed with a minus sign). Non-numeric strings pass through as-is.\n if (!/^-?\\d+$/.test(integerPart)) {\n return value\n }\n \n const isNegative = integerPart.startsWith(\"-\")\n const digits = isNegative ? integerPart.slice(1) : integerPart\n \n let formatted = \"\"\n const offset = digits.length % 3\n for (let index = 0; index < digits.length; index++) {\n if (index > 0 && (index - offset) % 3 === 0) {\n formatted += separator\n }\n formatted += digits[index]\n }\n \n const result = (isNegative ? \"-\" : \"\") + formatted\n return decimalPart !== null ? result + \".\" + decimalPart : result\n }\n \n override set innerHTML(innerHTML: string) {\n this.text = innerHTML\n this.invalidateMeasurementStrategy()\n }\n \n override get innerHTML() {\n return this.viewHTMLElement.innerHTML\n }\n \n setText(key: string, defaultString: string, parameters?: { [x: string]: string | UILocalizedTextObject }) {\n this.textElementView.setInnerHTML(key, defaultString, parameters)\n this.invalidateMeasurementStrategy()\n }\n \n //#endregion\n \n //#region Getters & Setters - Font Size\n \n get fontSize() {\n const style = this._textElementView.style.fontSize || window.getComputedStyle(this._textElementView.viewHTMLElement, null).fontSize\n const result = (parseFloat(style) * UITextView._pxToPt)\n return result\n }\n \n set fontSize(fontSize: number) {\n if (fontSize != this.fontSize) {\n this._textElementView.style.fontSize = \"\" + fontSize + \"pt\"\n \n this._intrinsicHeightCache = new UIObject() as any\n this._intrinsicWidthCache = new UIObject() as any\n \n this._invalidateFontCache()\n this._invalidateMeasurementStyles()\n this.clearIntrinsicSizeCache()\n }\n }\n \n useAutomaticFontSize(minFontSize: number = nil, maxFontSize: number = nil) {\n this._automaticFontSizeSelection = YES\n this._minFontSize = minFontSize\n this._maxFontSize = maxFontSize\n this.setNeedsLayout()\n }\n \n //#endregion\n \n //#region Font Caching - Private Methods\n \n /**\n * Get a stable cache key for the font without triggering reflow.\n * Only computes font on first access or when font properties change.\n */\n private _getFontCacheKey(): string {\n // Check if font-related properties have changed\n const currentTriggers = {\n fontSize: this._textElementView.style.fontSize || \"\",\n fontFamily: this._textElementView.style.fontFamily || \"\",\n fontWeight: this._textElementView.style.fontWeight || \"\",\n fontStyle: this._textElementView.style.fontStyle || \"\",\n styleClasses: this.styleClasses.join(\",\")\n }\n \n const hasChanged =\n currentTriggers.fontSize !== this._fontInvalidationTriggers.fontSize ||\n currentTriggers.fontFamily !== this._fontInvalidationTriggers.fontFamily ||\n currentTriggers.fontWeight !== this._fontInvalidationTriggers.fontWeight ||\n currentTriggers.fontStyle !== this._fontInvalidationTriggers.fontStyle ||\n currentTriggers.styleClasses !== this._fontInvalidationTriggers.styleClasses\n \n if (!this._cachedFontKey || hasChanged) {\n // Only access computedStyle when we know something changed\n const computed = this._textElementView.computedStyle\n this._cachedFontKey = [\n computed.fontStyle,\n computed.fontVariant,\n computed.fontWeight,\n computed.fontSize,\n computed.fontFamily\n ].join(\"_\").replace(/[.\\s]/g, \"_\")\n \n this._fontInvalidationTriggers = currentTriggers\n }\n \n return this._cachedFontKey\n }\n \n /**\n * Invalidate font cache when font properties change\n */\n private _invalidateFontCache(): void {\n this._cachedFontKey = undefined\n }\n \n //#endregion\n \n //#region Static Methods\n \n static _determinePXAndPTRatios() {\n if (UITextView._ptToPx) {\n return\n }\n \n const o = document.createElement(\"div\")\n o.style.width = \"1000pt\"\n document.body.appendChild(o)\n UITextView._ptToPx = o.clientWidth / 1000\n document.body.removeChild(o)\n UITextView._pxToPt = 1 / UITextView._ptToPx\n }\n \n static automaticallyCalculatedFontSize(\n bounds: UIRectangle,\n currentSize: UIRectangle,\n currentFontSize: number,\n minFontSize?: number,\n maxFontSize?: number\n ) {\n minFontSize = FIRST(minFontSize, 1)\n maxFontSize = FIRST(maxFontSize, 100000000000)\n \n const heightMultiplier = bounds.height / (currentSize.height + 1)\n const widthMultiplier = bounds.width / (currentSize.width + 1)\n \n var multiplier = heightMultiplier\n if (heightMultiplier > widthMultiplier) {\n multiplier = widthMultiplier\n }\n \n const maxFittingFontSize = currentFontSize * multiplier\n \n if (maxFittingFontSize > maxFontSize) {\n return maxFontSize\n }\n \n if (minFontSize > maxFittingFontSize) {\n return minFontSize\n }\n \n return maxFittingFontSize\n }\n \n //#endregion\n \n //#region Instance Properties - Text Content\n \n _text?: string\n textPrefix = \"\"\n textSuffix = \"\"\n _notificationAmount = 0\n \n _thousandsSeparator: string | null = null\n \n get thousandsSeparator(): string | null {\n return this._thousandsSeparator\n }\n \n set thousandsSeparator(value: string | null) {\n this._thousandsSeparator = value\n }\n \n //#endregion\n \n //#region Instance Properties - Styling\n \n _textColor: UIColor = UITextView.defaultTextColor\n _textAlignment?: ValueOf<typeof UITextView.textAlignment>\n _isSingleLine = YES\n \n //#endregion\n \n //#region Instance Properties - Font & Sizing\n \n _minFontSize?: number\n _maxFontSize?: number\n _automaticFontSizeSelection = NO\n \n // Cache for the computed font string\n private _cachedFontKey?: string\n private _fontInvalidationTriggers = {\n fontSize: \"\",\n fontFamily: \"\",\n fontWeight: \"\",\n fontStyle: \"\",\n styleClasses: \"\"\n }\n \n //#endregion\n \n //#region Instance Properties - Caching & Performance\n \n changesOften = NO\n \n // Local cache for this instance if the label changes often\n _intrinsicHeightCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n _intrinsicWidthCache: { [x: string]: { [x: string]: number; }; } & UIObject = new UIObject() as any\n \n private _useFastMeasurement: boolean | undefined\n private _cachedMeasurementStyles: TextMeasurementStyle | undefined | null\n \n override usesVirtualLayoutingForIntrinsicSizing = NO\n \n //#endregion\n \n // Override addStyleClass to invalidate font cache\n override addStyleClass(styleClass: string) {\n super.addStyleClass(styleClass)\n this._invalidateFontCache()\n }\n \n // Override removeStyleClass to invalidate font cache\n override removeStyleClass(styleClass: string) {\n super.removeStyleClass(styleClass)\n this._invalidateFontCache()\n }\n \n // Override focus to focus the text element\n override focus() {\n this._textElementView.focus()\n }\n \n // Override blur to blur the text element\n override blur() {\n this._textElementView.blur()\n }\n \n override intrinsicContentHeight(constrainingWidth = 0) {\n \n const keyPath = ((this.textElementView.viewHTMLElement.innerHTML || this.text) + \"_csf_\" + this._getFontCacheKey()) + \".\" +\n (\"\" + constrainingWidth).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicHeightCache\n \n if (this.changesOften) {\n cacheObject = this._intrinsicHeightCache\n }\n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n if (IS_LIKE_NULL(result)) {\n // Determine if we should use fast measurement\n const shouldUseFastPath = this._useFastMeasurement ?? this._shouldUseFastMeasurement()\n \n if (shouldUseFastPath) {\n // Fast path: use UITextMeasurement with pre-extracted styles\n const styles = this._getMeasurementStyles()\n \n // If styles are invalid (element not properly initialized), fall back to DOM\n if (styles) {\n const size = UITextMeasurement.calculateTextSize(\n this.textElementView.viewHTMLElement,\n ((this.text || this.textElementView.innerHTML || \"\") + \"\").replace(/<br\\s*\\/?>/gi, \"\\n\"),\n constrainingWidth || undefined,\n undefined,\n styles\n )\n result = size.height\n }\n else {\n // Styles not ready, use DOM measurement\n result = super.intrinsicContentHeight(constrainingWidth)\n }\n }\n else {\n // Fallback: DOM-based measurement for complex content\n result = super.intrinsicContentHeight(constrainingWidth)\n }\n \n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n if (isNaN(result) || (!result && !this.text)) {\n result = super.intrinsicContentHeight(constrainingWidth)\n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n return result\n }\n \n override intrinsicContentWidth(constrainingHeight = 0) {\n \n const keyPath = ((this.textElementView.viewHTMLElement.innerHTML || this.text) + \"_csf_\" + this._getFontCacheKey()) + \".\" +\n (\"\" + constrainingHeight).replace(new RegExp(\"\\\\.\", \"g\"), \"_\")\n \n let cacheObject = UITextView._intrinsicWidthCache\n \n if (this.changesOften) {\n cacheObject = this._intrinsicWidthCache\n }\n \n var result = cacheObject.valueForKeyPath(keyPath)\n \n if (IS_LIKE_NULL(result)) {\n // Determine if we should use fast measurement\n const shouldUseFastPath = this._useFastMeasurement ?? this._shouldUseFastMeasurement()\n \n if (shouldUseFastPath) {\n // Fast path: use UITextMeasurement with pre-extracted styles\n const styles = this._getMeasurementStyles()\n \n // If styles are invalid (element not properly initialized), fall back to DOM\n if (styles) {\n const size = UITextMeasurement.calculateTextSize(\n this.textElementView.viewHTMLElement,\n ((this.text || this.textElementView.innerHTML || \"\") + \"\").replace(/<br\\s*\\/?>/gi, \"\\n\"),\n undefined,\n constrainingHeight || undefined,\n styles\n )\n result = size.width\n }\n else {\n // Styles not ready, use DOM measurement\n result = super.intrinsicContentWidth(constrainingHeight)\n }\n }\n else {\n // Fallback: DOM-based measurement for complex content\n result = super.intrinsicContentWidth(constrainingHeight)\n }\n \n cacheObject.setValueForKeyPath(keyPath, result)\n }\n \n return result\n }\n \n \n override intrinsicContentSizeWithConstraints(constrainingHeight: number = 0, constrainingWidth: number = 0) {\n \n const cacheKey = this._getIntrinsicSizeCacheKey(constrainingHeight, constrainingWidth)\n const cachedResult = this._getCachedIntrinsicSize(cacheKey)\n if (cachedResult) {\n return cachedResult\n }\n \n // UITextView needs to measure the text element, not the outer container\n const result = new UIRectangle(0, 0, 0, 0)\n if (this.rootView.forceIntrinsicSizeZero) {\n return result\n }\n \n let temporarilyInViewTree = NO\n let nodeAboveThisView: Node | null = null\n if (!this.isMemberOfViewTree) {\n document.body.appendChild(this.viewHTMLElement)\n temporarilyInViewTree = YES\n nodeAboveThisView = this.viewHTMLElement.nextSibling\n }\n \n // Save and clear styles on the TEXT ELEMENT (not the container)\n const height = this._textElementView.style.height\n const width = this._textElementView.style.width\n \n this._textElementView.style.height = \"\" + constrainingHeight\n this._textElementView.style.width = \"\" + constrainingWidth\n \n const left = this._textElementView.style.left\n const right = this._textElementView.style.right\n const bottom = this._textElementView.style.bottom\n const top = this._textElementView.style.top\n \n this._textElementView.style.left = \"\"\n this._textElementView.style.right = \"\"\n this._textElementView.style.bottom = \"\"\n this._textElementView.style.top = \"\"\n \n // Measure height with the text element\n const resultHeight = this._textElementView.viewHTMLElement.scrollHeight\n \n // Measure width by temporarily setting nowrap\n const whiteSpace = this._textElementView.style.whiteSpace\n this._textElementView.style.whiteSpace = \"nowrap\"\n \n const resultWidth = this._textElementView.viewHTMLElement.scrollWidth\n \n this._textElementView.style.whiteSpace = whiteSpace\n \n // Restore styles on the TEXT ELEMENT\n this._textElementView.style.height = height\n this._textElementView.style.width = width\n \n this._textElementView.style.left = left\n this._textElementView.style.right = right\n this._textElementView.style.bottom = bottom\n this._textElementView.style.top = top\n \n if (temporarilyInViewTree) {\n document.body.removeChild(this.viewHTMLElement)\n if (this.superview) {\n if (nodeAboveThisView) {\n this.superview.viewHTMLElement.insertBefore(this.viewHTMLElement, nodeAboveThisView)\n }\n else {\n this.superview.viewHTMLElement.appendChild(this.viewHTMLElement)\n }\n }\n }\n \n result.height = resultHeight\n result.width = resultWidth\n \n this._setCachedIntrinsicSize(cacheKey, result)\n \n return result\n }\n \n \n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAwB;AAExB,sBAA6E;AAC7E,yBAA4B;AAC5B,+BAAwD;AACxD,oBAA6C;AAGtC,MAAM,cAAN,cAAyB,qBAAO;AAAA,EAwCnC,YACI,WACA,eAAyD,YAAW,KAAK,WACzE,kBAAkB,MACpB;AAGE,UAAM,iBAAiB,YAAY,GAAG,0BAA0B;AAChE,UAAM,mBAAmB,IAAI,qBAAO,gBAAgB,MAAM,YAAY;AAGtE,UAAM,WAAW,iBAAiB,QAAQ,EAAE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AAC/C,SAAK,iBAAiB,MAAM,aAAa;AAEzC,UAAM,cAAc,KAAK,iBAAiB,gBAAgB;AAE1D,SAAK,iBAAiB,MAAM,aAAa;AAGzC,SAAK,iBAAiB,MAAM,SAAS;AACrC,SAAK,iBAAiB,MAAM,QAAQ;AAEpC,SAAK,iBAAiB,MAAM,OAAO;AACnC,SAAK,iBAAiB,MAAM,QAAQ;AACpC,SAAK,iBAAiB,MAAM,SAAS;AACrC,SAAK,iBAAiB,MAAM,MAAM;AAElC,QAAI,uBAAuB;AACvB,eAAS,KAAK,YAAY,KAAK,eAAe;AAC9C,UAAI,KAAK,WAAW;AAChB,YAAI,mBAAmB;AACnB,eAAK,UAAU,gBAAgB,aAAa,KAAK,iBAAiB,iBAAiB;AAAA,QACvF,OACK;AACD,eAAK,UAAU,gBAAgB,YAAY,KAAK,eAAe;AAAA,QACnE;AAAA,MACJ;AAAA,IACJ;AAEA,WAAO,SAAS;AAChB,WAAO,QAAQ;AAEf,SAAK,wBAAwB,UAAU,MAAM;AAE7C,WAAO;AAAA,EACX;AAGJ;AA92BO,IAAM,aAAN;AAAM,WAIF,mBAAmB,uBAAQ;AAJzB,WAKF,wBAAwB,uBAAQ;AAL9B,WAQF,wBAA+E,IAAI,yBAAS;AAR1F,WASF,uBAA8E,IAAI,yBAAS;AATzF,WAcF,OAAO;AAAA,EACV,aAAa;AAAA,EACb,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,SAAS;AACb;AA1BS,WA4BF,gBAAgB;AAAA,EACnB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW;AACf;",
6
6
  "names": []
7
7
  }
@@ -1085,16 +1085,19 @@ const _UIView = class extends import_UIObject.UIObject {
1085
1085
  });
1086
1086
  }
1087
1087
  static layoutViewsIfNeeded() {
1088
+ var _a, _b, _c, _d;
1088
1089
  if (!_UIView._isLayoutViewsIfNeededScheduled) {
1089
1090
  _UIView.scheduleLayoutViewsIfNeeded();
1090
1091
  }
1091
1092
  if (!_UIView._viewsToLayout.length) {
1092
1093
  return;
1093
1094
  }
1095
+ (_a = window.UILayoutCycleTracer) == null ? void 0 : _a.willBeginLayoutPass();
1094
1096
  const maxIterations = 10;
1095
1097
  let iteration = 0;
1096
1098
  const layoutCounts = /* @__PURE__ */ new Map();
1097
1099
  while (_UIView._viewsToLayout.length > 0 && iteration < maxIterations) {
1100
+ (_b = window.UILayoutCycleTracer) == null ? void 0 : _b.willBeginIteration(iteration);
1098
1101
  const viewsToProcess = _UIView._viewsToLayout;
1099
1102
  _UIView._viewsToLayout = [];
1100
1103
  const viewDepthMap = /* @__PURE__ */ new Map();
@@ -1116,17 +1119,21 @@ const _UIView = class extends import_UIObject.UIObject {
1116
1119
  const view = sortedViews[i];
1117
1120
  view.layoutIfNeeded();
1118
1121
  layoutCounts.set(view, (layoutCounts.get(view) || 0) + 1);
1122
+ (_c = window.UILayoutCycleTracer) == null ? void 0 : _c.didLayoutView(view);
1119
1123
  }
1120
1124
  iteration++;
1121
1125
  }
1126
+ (_d = window.UILayoutCycleTracer) == null ? void 0 : _d.didFinishLayoutPass(iteration);
1122
1127
  }
1123
1128
  setNeedsLayout() {
1129
+ var _a;
1124
1130
  if (this._shouldLayout && _UIView._viewsToLayout.contains(this)) {
1125
1131
  return;
1126
1132
  }
1127
1133
  this._shouldLayout = import_UIObject.YES;
1128
1134
  _UIView._viewsToLayout.push(this);
1129
1135
  this.clearIntrinsicSizeCache();
1136
+ (_a = window.UILayoutCycleTracer) == null ? void 0 : _a.viewDidCallSetNeedsLayout(this);
1130
1137
  if (!_UIView._isLayoutViewsIfNeededScheduled) {
1131
1138
  _UIView.scheduleLayoutViewsIfNeeded();
1132
1139
  }