@tamagui/web 3.0.5 → 3.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_withNativeStyle.cjs +37 -20
- package/dist/cjs/_withNativeStyle.native.cjs +37 -20
- package/dist/cjs/_withNativeStyle.native.js +37 -20
- package/dist/cjs/_withNativeStyle.native.js.map +1 -1
- package/dist/cjs/createComponent.native.cjs +1 -0
- package/dist/cjs/createComponent.native.js +1 -0
- package/dist/cjs/createComponent.native.js.map +1 -1
- package/dist/cjs/helpers/getSplitStyles.cjs +2 -1
- package/dist/cjs/helpers/getSplitStyles.native.cjs +2 -1
- package/dist/cjs/helpers/getSplitStyles.native.js +2 -1
- package/dist/cjs/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/cjs/helpers/nativeStyleEngine.cjs +80 -122
- package/dist/cjs/helpers/nativeStyleEngine.native.cjs +81 -161
- package/dist/cjs/helpers/nativeStyleEngine.native.js +81 -161
- package/dist/cjs/helpers/nativeStyleEngine.native.js.map +1 -1
- package/dist/esm/_withNativeStyle.mjs +38 -21
- package/dist/esm/_withNativeStyle.mjs.map +1 -1
- package/dist/esm/_withNativeStyle.native.js +38 -21
- package/dist/esm/_withNativeStyle.native.js.map +1 -1
- package/dist/esm/createComponent.native.js +2 -1
- package/dist/esm/createComponent.native.js.map +1 -1
- package/dist/esm/helpers/getSplitStyles.mjs +2 -1
- package/dist/esm/helpers/getSplitStyles.mjs.map +1 -1
- package/dist/esm/helpers/getSplitStyles.native.js +2 -1
- package/dist/esm/helpers/getSplitStyles.native.js.map +1 -1
- package/dist/esm/helpers/nativeStyleEngine.mjs +78 -122
- package/dist/esm/helpers/nativeStyleEngine.mjs.map +1 -1
- package/dist/esm/helpers/nativeStyleEngine.native.js +79 -161
- package/dist/esm/helpers/nativeStyleEngine.native.js.map +1 -1
- package/package.json +17 -17
- package/src/_withNativeStyle.tsx +67 -31
- package/src/createComponent.tsx +6 -1
- package/src/helpers/getSplitStyles.tsx +3 -0
- package/src/helpers/nativeStyleEngine.ts +118 -163
- package/types/_withNativeStyle.d.ts +4 -3
- package/types/_withNativeStyle.d.ts.map +1 -1
- package/types/createComponent.d.ts.map +1 -1
- package/types/helpers/getSplitStyles.d.ts.map +1 -1
- package/types/helpers/nativeStyleEngine.d.ts +26 -6
- package/types/helpers/nativeStyleEngine.d.ts.map +1 -1
|
@@ -101,11 +101,10 @@ function syncTableState(compiled, stateName, theme) {
|
|
|
101
101
|
}
|
|
102
102
|
function setNativeStyleEngine(next) {
|
|
103
103
|
if (engine !== next) {
|
|
104
|
-
settleReleases();
|
|
105
104
|
compiledMappings.clear();
|
|
106
105
|
scopeMappings.clear();
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
pendingHosts = [];
|
|
107
|
+
pendingStates = [];
|
|
109
108
|
}
|
|
110
109
|
engine = next;
|
|
111
110
|
if (next) {
|
|
@@ -128,7 +127,7 @@ function updateNativeStyleScope(scopeId, stateName, theme) {
|
|
|
128
127
|
if (engine) {
|
|
129
128
|
const linked = scopeMappings.get(scopeId);
|
|
130
129
|
if (linked) {
|
|
131
|
-
for (const compiled of linked
|
|
130
|
+
for (const compiled of linked) {
|
|
132
131
|
syncTableState(compiled, stateName, theme);
|
|
133
132
|
}
|
|
134
133
|
}
|
|
@@ -137,137 +136,83 @@ function updateNativeStyleScope(scopeId, stateName, theme) {
|
|
|
137
136
|
}
|
|
138
137
|
function removeNativeStyleScope(scopeId) {
|
|
139
138
|
if (!scopeStates.delete(scopeId)) return;
|
|
139
|
+
queueMicrotask(() => {
|
|
140
|
+
if (!scopeStates.has(scopeId)) scopeMappings.delete(scopeId);
|
|
141
|
+
});
|
|
140
142
|
engine?.removeScope(scopeId);
|
|
141
143
|
}
|
|
142
144
|
function resolveNativeStyleMapping(mapping, stateName, theme) {
|
|
143
145
|
return resolveCompiledMapping(getCompiledMapping(mapping), stateName, theme).renderProps;
|
|
144
146
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
147
|
+
function createNativeStyleLinkState(mapping, scopeId, stateName, theme) {
|
|
148
|
+
return {
|
|
149
|
+
mapping,
|
|
150
|
+
scopeId,
|
|
151
|
+
stateName,
|
|
152
|
+
theme
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
let pendingHosts = [];
|
|
156
|
+
let pendingStates = [];
|
|
157
|
+
const maxPendingHosts = 4096;
|
|
158
|
+
let idleFlushQueued = false;
|
|
159
|
+
function idleFlush() {
|
|
160
|
+
idleFlushQueued = false;
|
|
161
|
+
flushNativeStyleLinks();
|
|
162
|
+
}
|
|
163
|
+
function addScopeMapping(scopeId, compiled) {
|
|
164
|
+
let linked = scopeMappings.get(scopeId);
|
|
165
|
+
if (!linked) scopeMappings.set(scopeId, linked = /* @__PURE__ */ new Set());
|
|
166
|
+
linked.add(compiled);
|
|
157
167
|
}
|
|
158
168
|
function flushNativeStyleLinks() {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
169
|
+
if (!pendingHosts.length) return;
|
|
170
|
+
const hosts = pendingHosts;
|
|
171
|
+
const states = pendingStates;
|
|
172
|
+
pendingHosts = [];
|
|
173
|
+
pendingStates = [];
|
|
164
174
|
if (!engine) return;
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
const refs = [];
|
|
168
|
-
const tableIds = [];
|
|
169
|
-
const scopeIndexes = [];
|
|
175
|
+
const tableIds = new Array(hosts.length);
|
|
176
|
+
const scopeIndexes = new Array(hosts.length);
|
|
170
177
|
const scopes = [];
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
trackScopeMapping(link, 1);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
const releases = /* @__PURE__ */ new Map();
|
|
188
|
-
let settleQueued = false;
|
|
189
|
-
function settleReleases() {
|
|
190
|
-
settleQueued = false;
|
|
191
|
-
if (!releases.size) return;
|
|
192
|
-
const settling = [...releases.values()];
|
|
193
|
-
releases.clear();
|
|
194
|
-
for (const release of settling) release.settle();
|
|
195
|
-
}
|
|
196
|
-
function releasable(ref, compiled, scopeId, id, settle) {
|
|
197
|
-
const handle = {
|
|
198
|
-
id,
|
|
199
|
-
unlink: () => {
|
|
200
|
-
const prior = releases.get(ref);
|
|
201
|
-
if (prior && prior.handle !== handle) prior.settle();
|
|
202
|
-
releases.set(ref, {
|
|
203
|
-
compiled,
|
|
204
|
-
scopeId,
|
|
205
|
-
handle,
|
|
206
|
-
settle
|
|
207
|
-
});
|
|
208
|
-
if (!settleQueued) {
|
|
209
|
-
settleQueued = true;
|
|
210
|
-
queueMicrotask(settleReleases);
|
|
211
|
-
}
|
|
178
|
+
let last;
|
|
179
|
+
let tableId = 0;
|
|
180
|
+
let scopeIndex = 0;
|
|
181
|
+
for (let i = 0; i < hosts.length; i++) {
|
|
182
|
+
const state = states[i];
|
|
183
|
+
if (state !== last) {
|
|
184
|
+
last = state;
|
|
185
|
+
const compiled = getCompiledMapping(state.mapping);
|
|
186
|
+
syncTableState(compiled, state.stateName, state.theme);
|
|
187
|
+
addScopeMapping(state.scopeId, compiled);
|
|
188
|
+
tableId = compiled.tableId;
|
|
189
|
+
scopeIndex = scopes.indexOf(state.scopeId);
|
|
190
|
+
if (scopeIndex === -1) scopeIndex = scopes.push(state.scopeId) - 1;
|
|
212
191
|
}
|
|
213
|
-
|
|
214
|
-
|
|
192
|
+
tableIds[i] = tableId;
|
|
193
|
+
scopeIndexes[i] = scopeIndex;
|
|
194
|
+
}
|
|
195
|
+
engine.linkTables(hosts, tableIds, scopeIndexes, scopes);
|
|
215
196
|
}
|
|
216
|
-
function
|
|
217
|
-
if (!engine) return
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
kept.settle();
|
|
197
|
+
function linkNativeStyleHost(host, state) {
|
|
198
|
+
if (!engine) return;
|
|
199
|
+
const live = scopeStates.get(state.scopeId);
|
|
200
|
+
if (live && (live.name !== state.stateName || live.theme !== state.theme)) {
|
|
201
|
+
const compiled = getCompiledMapping(state.mapping);
|
|
202
|
+
syncTableState(compiled, live.name, live.theme);
|
|
203
|
+
addScopeMapping(state.scopeId, compiled);
|
|
204
|
+
engine.link(host, compiled.tableId, state.scopeId, true);
|
|
205
|
+
return;
|
|
226
206
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
ref: null,
|
|
233
|
-
compiled,
|
|
234
|
-
scopeId,
|
|
235
|
-
id: handle.id,
|
|
236
|
-
owner: engine
|
|
237
|
-
};
|
|
238
|
-
trackScopeMapping(link2, 1);
|
|
239
|
-
return releasable(ref, compiled, scopeId, handle.id, () => {
|
|
240
|
-
if (link2.id === -1) return;
|
|
241
|
-
link2.id = -1;
|
|
242
|
-
if (link2.owner === engine) trackScopeMapping(link2, -1);
|
|
243
|
-
handle.unlink();
|
|
244
|
-
});
|
|
207
|
+
pendingHosts.push(host);
|
|
208
|
+
pendingStates.push(state);
|
|
209
|
+
if (pendingHosts.length >= maxPendingHosts && !idleFlushQueued) {
|
|
210
|
+
idleFlushQueued = true;
|
|
211
|
+
requestIdleCallback(idleFlush);
|
|
245
212
|
}
|
|
246
|
-
syncTableState(compiled, stateName, theme);
|
|
247
|
-
const link = {
|
|
248
|
-
ref,
|
|
249
|
-
compiled,
|
|
250
|
-
scopeId,
|
|
251
|
-
id: 0,
|
|
252
|
-
owner: null
|
|
253
|
-
};
|
|
254
|
-
pendingLinks.push(link);
|
|
255
|
-
return releasable(ref, compiled, scopeId, 0, () => {
|
|
256
|
-
const id = link.id;
|
|
257
|
-
if (id === -1) return;
|
|
258
|
-
link.id = -1;
|
|
259
|
-
link.ref = null;
|
|
260
|
-
if (id > 0) {
|
|
261
|
-
if (link.owner === engine) trackScopeMapping(link, -1);
|
|
262
|
-
link.owner.unlink(id);
|
|
263
|
-
} else if (++unlinkedPending > 512 && unlinkedPending * 2 > pendingLinks.length) {
|
|
264
|
-
pendingLinks = pendingLinks.filter((pending2) => pending2.id === 0);
|
|
265
|
-
unlinkedPending = 0;
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
213
|
}
|
|
269
214
|
const getNativeStyleEngineCacheStats = () => {
|
|
270
|
-
const active = new Set([...scopeMappings.values()].flatMap((linked) => [...linked
|
|
215
|
+
const active = new Set([...scopeMappings.values()].flatMap((linked) => [...linked]));
|
|
271
216
|
return {
|
|
272
217
|
mappings: compiledMappings.size,
|
|
273
218
|
activeMappings: active.size,
|
|
@@ -289,19 +234,30 @@ function updateNativeStyleLink(ref, host) {
|
|
|
289
234
|
ref.nativeLink = engine.link(host, {});
|
|
290
235
|
}
|
|
291
236
|
}
|
|
237
|
+
let superseded = null;
|
|
292
238
|
function queueNativeViewState(entry) {
|
|
293
239
|
if (!engine) return;
|
|
294
240
|
if (!pending) {
|
|
295
241
|
pending = [];
|
|
296
242
|
queueMicrotask(() => {
|
|
297
|
-
|
|
243
|
+
let entries = pending;
|
|
244
|
+
const dropped = superseded;
|
|
298
245
|
pending = null;
|
|
246
|
+
superseded = null;
|
|
247
|
+
if (dropped) {
|
|
248
|
+
entries = entries.filter((queued, index) => index >= (dropped.get(queued.id) ?? 0));
|
|
249
|
+
}
|
|
250
|
+
if (!entries.length) return;
|
|
299
251
|
engine?.applyViewStates(entries);
|
|
300
252
|
flushListener?.(entries);
|
|
301
253
|
});
|
|
302
254
|
}
|
|
303
255
|
pending.push(entry);
|
|
304
256
|
}
|
|
257
|
+
function supersedeNativeViewStates(id) {
|
|
258
|
+
if (!pending) return;
|
|
259
|
+
(superseded ||= /* @__PURE__ */ new Map()).set(id, pending.length);
|
|
260
|
+
}
|
|
305
261
|
|
|
306
|
-
export { flushNativeStyleLinks, getNativeStyleEngine, getNativeStyleEngineCacheStats,
|
|
262
|
+
export { createNativeStyleLinkState, flushNativeStyleLinks, getNativeStyleEngine, getNativeStyleEngineCacheStats, linkNativeStyleHost, nativeTextInputColorProps, normalizeNativeStyle, queueNativeViewState, removeNativeStyleScope, resolveNativeStyleMapping, setNativeStyleEngine, setNativeStyleEngineFlushListener, supersedeNativeViewStates, updateNativeStyleLink, updateNativeStyleScope };
|
|
307
263
|
//# sourceMappingURL=nativeStyleEngine.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nativeStyleEngine.js","names":[],"sources":["esm/helpers/nativeStyleEngine.js"],"sourcesContent":["import { getVariableValue } from \"../createVariable\";\nconst nativeTextInputColorProps = {\n placeholderTextColor: \"placeholderTextColor\",\n selectionColor: \"selectionColor\",\n cursorColor: \"cursorColor\",\n selectionHandleColor: \"selectionHandleColor\"\n};\nconst nativeOutlineProps = [\n \"outlineStyle\",\n \"outlineWidth\",\n \"outlineColor\",\n \"outlineOffset\"\n];\nconst nativeIntrinsicSizeProps = [\n \"width\",\n \"height\",\n \"minWidth\",\n \"minHeight\",\n \"maxWidth\",\n \"maxHeight\"\n];\nfunction normalizeNativeStyle(style, reset = false) {\n let next;\n if (style.outlineStyle === \"none\") {\n next = { ...style };\n for (const key of nativeOutlineProps) {\n if (reset) {\n next[key] = null;\n } else {\n delete next[key];\n }\n }\n }\n for (const key of nativeIntrinsicSizeProps) {\n const value = style[key];\n if (value === \"max-content\" || value === \"min-content\" || value === \"fit-content\") {\n next ||= { ...style };\n if (reset) {\n next[key] = null;\n } else {\n delete next[key];\n }\n }\n }\n return next ?? style;\n}\nlet engine = null;\nconst scopeStates = /* @__PURE__ */ new Map();\nconst mappingKeys = /* @__PURE__ */ new WeakMap();\nconst compiledMappings = /* @__PURE__ */ new Map();\nconst scopeMappings = /* @__PURE__ */ new Map();\nlet nextTableId = 1;\nfunction getCompiledMapping(mapping) {\n let key = mappingKeys.get(mapping);\n if (!key) {\n key = JSON.stringify(\n Object.keys(mapping).sort().map((styleKey) => [styleKey, mapping[styleKey]])\n );\n mappingKeys.set(mapping, key);\n }\n let compiled = compiledMappings.get(key);\n if (!compiled) {\n compiled = {\n mapping,\n states: /* @__PURE__ */ new Map(),\n tableId: nextTableId++,\n sent: /* @__PURE__ */ new Map()\n };\n if (compiledMappings.size >= 1e4) {\n compiledMappings.clear();\n }\n compiledMappings.set(key, compiled);\n }\n return compiled;\n}\nfunction resolveCompiledMapping(compiled, stateName, theme) {\n const cached = compiled.states.get(stateName);\n if (cached?.theme === theme) return cached;\n let renderProps = {};\n for (const styleKey in compiled.mapping) {\n const value = theme[compiled.mapping[styleKey]];\n renderProps[styleKey] = value === void 0 ? null : getVariableValue(value);\n }\n renderProps = normalizeNativeStyle(renderProps, true);\n const nativeProps = engine?.processStyleColors(renderProps) ?? renderProps;\n if (compiled.states.size >= 1e4) {\n compiled.states.clear();\n }\n const resolved = { theme, renderProps, nativeProps };\n compiled.states.set(stateName, resolved);\n return resolved;\n}\nfunction syncTableState(compiled, stateName, theme) {\n const resolved = resolveCompiledMapping(compiled, stateName, theme);\n if (compiled.sent.get(stateName) === resolved) return;\n compiled.sent.set(stateName, resolved);\n engine.setTableState(compiled.tableId, stateName, resolved.nativeProps);\n}\nfunction setNativeStyleEngine(next) {\n if (engine !== next) {\n settleReleases();\n compiledMappings.clear();\n scopeMappings.clear();\n pendingLinks = [];\n unlinkedPending = 0;\n }\n engine = next;\n if (next) {\n for (const [scopeId, state] of scopeStates) {\n next.setStateName(state.name, scopeId);\n }\n }\n}\nfunction getNativeStyleEngine() {\n return engine;\n}\nfunction updateNativeStyleScope(scopeId, stateName, theme) {\n const previous = scopeStates.get(scopeId);\n if (previous?.name === stateName && previous.theme === theme) return;\n flushNativeStyleLinks();\n scopeStates.set(scopeId, { name: stateName, theme });\n if (engine) {\n const linked = scopeMappings.get(scopeId);\n if (linked) {\n for (const compiled of linked.keys()) {\n syncTableState(compiled, stateName, theme);\n }\n }\n }\n engine?.setStateName(stateName, scopeId);\n}\nfunction removeNativeStyleScope(scopeId) {\n if (!scopeStates.delete(scopeId)) return;\n engine?.removeScope(scopeId);\n}\nfunction resolveNativeStyleMapping(mapping, stateName, theme) {\n return resolveCompiledMapping(getCompiledMapping(mapping), stateName, theme).renderProps;\n}\nlet pendingLinks = [];\nlet unlinkedPending = 0;\nfunction trackScopeMapping(link, delta) {\n let linked = scopeMappings.get(link.scopeId);\n if (!linked) scopeMappings.set(link.scopeId, linked = /* @__PURE__ */ new Map());\n const count = (linked.get(link.compiled) ?? 0) + delta;\n if (count) {\n linked.set(link.compiled, count);\n } else {\n linked.delete(link.compiled);\n if (!linked.size) scopeMappings.delete(link.scopeId);\n }\n}\nfunction flushNativeStyleLinks() {\n settleReleases();\n if (!pendingLinks.length) return;\n const links = pendingLinks;\n pendingLinks = [];\n unlinkedPending = 0;\n if (!engine) return;\n const live = links.filter((link) => link.id === 0);\n if (!live.length) return;\n const refs = [];\n const tableIds = [];\n const scopeIndexes = [];\n const scopes = [];\n for (const link of live) {\n let scopeIndex = scopes.indexOf(link.scopeId);\n if (scopeIndex === -1) scopeIndex = scopes.push(link.scopeId) - 1;\n refs.push(link.ref);\n tableIds.push(link.compiled.tableId);\n scopeIndexes.push(scopeIndex);\n }\n const firstId = engine.linkTables(refs, tableIds, scopeIndexes, scopes);\n for (let i = 0; i < live.length; i++) {\n const link = live[i];\n link.id = firstId + i;\n link.owner = engine;\n link.ref = null;\n trackScopeMapping(link, 1);\n }\n}\nconst releases = /* @__PURE__ */ new Map();\nlet settleQueued = false;\nfunction settleReleases() {\n settleQueued = false;\n if (!releases.size) return;\n const settling = [...releases.values()];\n releases.clear();\n for (const release of settling) release.settle();\n}\nfunction releasable(ref, compiled, scopeId, id, settle) {\n const handle = {\n id,\n unlink: () => {\n const prior = releases.get(ref);\n if (prior && prior.handle !== handle) prior.settle();\n releases.set(ref, { compiled, scopeId, handle, settle });\n if (!settleQueued) {\n settleQueued = true;\n queueMicrotask(settleReleases);\n }\n }\n };\n return handle;\n}\nfunction linkNativeStyleMapping(ref, mapping, scopeId, stateName, theme) {\n if (!engine) return null;\n const compiled = getCompiledMapping(mapping);\n const scopeState = scopeStates.get(scopeId);\n const stale = scopeState && (scopeState.name !== stateName || scopeState.theme !== theme);\n const kept = releases.get(ref);\n if (kept) {\n releases.delete(ref);\n if (!stale && kept.compiled === compiled && kept.scopeId === scopeId)\n return kept.handle;\n kept.settle();\n }\n if (stale) {\n syncTableState(compiled, scopeState.name, scopeState.theme);\n const handle = engine.link(ref, compiled.tableId, scopeId, true);\n if (!handle) return null;\n const link2 = {\n ref: null,\n compiled,\n scopeId,\n id: handle.id,\n owner: engine\n };\n trackScopeMapping(link2, 1);\n return releasable(ref, compiled, scopeId, handle.id, () => {\n if (link2.id === -1) return;\n link2.id = -1;\n if (link2.owner === engine) trackScopeMapping(link2, -1);\n handle.unlink();\n });\n }\n syncTableState(compiled, stateName, theme);\n const link = { ref, compiled, scopeId, id: 0, owner: null };\n pendingLinks.push(link);\n return releasable(ref, compiled, scopeId, 0, () => {\n const id = link.id;\n if (id === -1) return;\n link.id = -1;\n link.ref = null;\n if (id > 0) {\n if (link.owner === engine) trackScopeMapping(link, -1);\n link.owner.unlink(id);\n } else if (++unlinkedPending > 512 && unlinkedPending * 2 > pendingLinks.length) {\n pendingLinks = pendingLinks.filter((pending2) => pending2.id === 0);\n unlinkedPending = 0;\n }\n });\n}\nconst getNativeStyleEngineCacheStats = () => {\n const active = new Set(\n [...scopeMappings.values()].flatMap((linked) => [...linked.keys()])\n );\n return {\n mappings: compiledMappings.size,\n activeMappings: active.size,\n states: [.../* @__PURE__ */ new Set([...compiledMappings.values(), ...active])].reduce(\n (total, compiled) => total + compiled.states.size,\n 0\n )\n };\n};\nlet pending = null;\nlet flushListener = null;\nfunction setNativeStyleEngineFlushListener(cb) {\n flushListener = cb;\n}\nfunction updateNativeStyleLink(ref, host) {\n if (ref.nativeLink) {\n ref.nativeLink.unlink();\n ref.nativeLink = null;\n }\n ref.nativePushedKeys = void 0;\n if (host && engine && ref.nativeStyleUpdate) {\n ref.nativeLink = engine.link(host, {});\n }\n}\nfunction queueNativeViewState(entry) {\n if (!engine) return;\n if (!pending) {\n pending = [];\n queueMicrotask(() => {\n const entries = pending;\n pending = null;\n engine?.applyViewStates(entries);\n flushListener?.(entries);\n });\n }\n pending.push(entry);\n}\nexport {\n flushNativeStyleLinks,\n getNativeStyleEngine,\n getNativeStyleEngineCacheStats,\n linkNativeStyleMapping,\n nativeTextInputColorProps,\n normalizeNativeStyle,\n queueNativeViewState,\n removeNativeStyleScope,\n resolveNativeStyleMapping,\n setNativeStyleEngine,\n setNativeStyleEngineFlushListener,\n updateNativeStyleLink,\n updateNativeStyleScope\n};\n//# sourceMappingURL=nativeStyleEngine.js.map\n"],"mappings":";;;AACA,MAAM,4BAA4B;CAChC,sBAAsB;CACtB,gBAAgB;CAChB,aAAa;CACb,sBAAsB;AACxB;AACA,MAAM,qBAAqB;CACzB;CACA;CACA;CACA;AACF;AACA,MAAM,2BAA2B;CAC/B;CACA;CACA;CACA;CACA;CACA;AACF;AACA,SAAS,qBAAqB,OAAO,QAAQ,OAAO;CAClD,IAAI;CACJ,IAAI,MAAM,iBAAiB,QAAQ;EACjC,OAAO,EAAE,GAAG,MAAM;EAClB,KAAK,MAAM,OAAO,oBAAoB;GACpC,IAAI,OAAO;IACT,KAAK,OAAO;GACd,OAAO;IACL,OAAO,KAAK;GACd;EACF;CACF;CACA,KAAK,MAAM,OAAO,0BAA0B;EAC1C,MAAM,QAAQ,MAAM;EACpB,IAAI,UAAU,iBAAiB,UAAU,iBAAiB,UAAU,eAAe;GACjF,SAAS,EAAE,GAAG,MAAM;GACpB,IAAI,OAAO;IACT,KAAK,OAAO;GACd,OAAO;IACL,OAAO,KAAK;GACd;EAC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AQ;CACb,IAAI,CAAC,SAAS;EACZ,UAAU,CAAC;EACX,qBAAqB;GACnB,MAAM,UAAU;GAChB,UAAU;GACV,QAAQ,gBAAgB,OAAO;GAC/B,gBAAgB,OAAO;EACzB,CAAC;CACH;CACA,QAAQ,KAAK,KAAK;AACpB"}
|
|
1
|
+
{"version":3,"file":"nativeStyleEngine.js","names":[],"sources":["esm/helpers/nativeStyleEngine.js"],"sourcesContent":["import { getVariableValue } from \"../createVariable\";\nconst nativeTextInputColorProps = {\n placeholderTextColor: \"placeholderTextColor\",\n selectionColor: \"selectionColor\",\n cursorColor: \"cursorColor\",\n selectionHandleColor: \"selectionHandleColor\"\n};\nconst nativeOutlineProps = [\n \"outlineStyle\",\n \"outlineWidth\",\n \"outlineColor\",\n \"outlineOffset\"\n];\nconst nativeIntrinsicSizeProps = [\n \"width\",\n \"height\",\n \"minWidth\",\n \"minHeight\",\n \"maxWidth\",\n \"maxHeight\"\n];\nfunction normalizeNativeStyle(style, reset = false) {\n let next;\n if (style.outlineStyle === \"none\") {\n next = { ...style };\n for (const key of nativeOutlineProps) {\n if (reset) {\n next[key] = null;\n } else {\n delete next[key];\n }\n }\n }\n for (const key of nativeIntrinsicSizeProps) {\n const value = style[key];\n if (value === \"max-content\" || value === \"min-content\" || value === \"fit-content\") {\n next ||= { ...style };\n if (reset) {\n next[key] = null;\n } else {\n delete next[key];\n }\n }\n }\n return next ?? style;\n}\nlet engine = null;\nconst scopeStates = /* @__PURE__ */ new Map();\nconst mappingKeys = /* @__PURE__ */ new WeakMap();\nconst compiledMappings = /* @__PURE__ */ new Map();\nconst scopeMappings = /* @__PURE__ */ new Map();\nlet nextTableId = 1;\nfunction getCompiledMapping(mapping) {\n let key = mappingKeys.get(mapping);\n if (!key) {\n key = JSON.stringify(\n Object.keys(mapping).sort().map((styleKey) => [styleKey, mapping[styleKey]])\n );\n mappingKeys.set(mapping, key);\n }\n let compiled = compiledMappings.get(key);\n if (!compiled) {\n compiled = {\n mapping,\n states: /* @__PURE__ */ new Map(),\n tableId: nextTableId++,\n sent: /* @__PURE__ */ new Map()\n };\n if (compiledMappings.size >= 1e4) {\n compiledMappings.clear();\n }\n compiledMappings.set(key, compiled);\n }\n return compiled;\n}\nfunction resolveCompiledMapping(compiled, stateName, theme) {\n const cached = compiled.states.get(stateName);\n if (cached?.theme === theme) return cached;\n let renderProps = {};\n for (const styleKey in compiled.mapping) {\n const value = theme[compiled.mapping[styleKey]];\n renderProps[styleKey] = value === void 0 ? null : getVariableValue(value);\n }\n renderProps = normalizeNativeStyle(renderProps, true);\n const nativeProps = engine?.processStyleColors(renderProps) ?? renderProps;\n if (compiled.states.size >= 1e4) {\n compiled.states.clear();\n }\n const resolved = { theme, renderProps, nativeProps };\n compiled.states.set(stateName, resolved);\n return resolved;\n}\nfunction syncTableState(compiled, stateName, theme) {\n const resolved = resolveCompiledMapping(compiled, stateName, theme);\n if (compiled.sent.get(stateName) === resolved) return;\n compiled.sent.set(stateName, resolved);\n engine.setTableState(compiled.tableId, stateName, resolved.nativeProps);\n}\nfunction setNativeStyleEngine(next) {\n if (engine !== next) {\n compiledMappings.clear();\n scopeMappings.clear();\n pendingHosts = [];\n pendingStates = [];\n }\n engine = next;\n if (next) {\n for (const [scopeId, state] of scopeStates) {\n next.setStateName(state.name, scopeId);\n }\n }\n}\nfunction getNativeStyleEngine() {\n return engine;\n}\nfunction updateNativeStyleScope(scopeId, stateName, theme) {\n const previous = scopeStates.get(scopeId);\n if (previous?.name === stateName && previous.theme === theme) return;\n flushNativeStyleLinks();\n scopeStates.set(scopeId, { name: stateName, theme });\n if (engine) {\n const linked = scopeMappings.get(scopeId);\n if (linked) {\n for (const compiled of linked) {\n syncTableState(compiled, stateName, theme);\n }\n }\n }\n engine?.setStateName(stateName, scopeId);\n}\nfunction removeNativeStyleScope(scopeId) {\n if (!scopeStates.delete(scopeId)) return;\n queueMicrotask(() => {\n if (!scopeStates.has(scopeId)) scopeMappings.delete(scopeId);\n });\n engine?.removeScope(scopeId);\n}\nfunction resolveNativeStyleMapping(mapping, stateName, theme) {\n return resolveCompiledMapping(getCompiledMapping(mapping), stateName, theme).renderProps;\n}\nfunction createNativeStyleLinkState(mapping, scopeId, stateName, theme) {\n return { mapping, scopeId, stateName, theme };\n}\nlet pendingHosts = [];\nlet pendingStates = [];\nconst maxPendingHosts = 4096;\nlet idleFlushQueued = false;\nfunction idleFlush() {\n idleFlushQueued = false;\n flushNativeStyleLinks();\n}\nfunction addScopeMapping(scopeId, compiled) {\n let linked = scopeMappings.get(scopeId);\n if (!linked) scopeMappings.set(scopeId, linked = /* @__PURE__ */ new Set());\n linked.add(compiled);\n}\nfunction flushNativeStyleLinks() {\n if (!pendingHosts.length) return;\n const hosts = pendingHosts;\n const states = pendingStates;\n pendingHosts = [];\n pendingStates = [];\n if (!engine) return;\n const tableIds = new Array(hosts.length);\n const scopeIndexes = new Array(hosts.length);\n const scopes = [];\n let last;\n let tableId = 0;\n let scopeIndex = 0;\n for (let i = 0; i < hosts.length; i++) {\n const state = states[i];\n if (state !== last) {\n last = state;\n const compiled = getCompiledMapping(state.mapping);\n syncTableState(compiled, state.stateName, state.theme);\n addScopeMapping(state.scopeId, compiled);\n tableId = compiled.tableId;\n scopeIndex = scopes.indexOf(state.scopeId);\n if (scopeIndex === -1) scopeIndex = scopes.push(state.scopeId) - 1;\n }\n tableIds[i] = tableId;\n scopeIndexes[i] = scopeIndex;\n }\n engine.linkTables(hosts, tableIds, scopeIndexes, scopes);\n}\nfunction linkNativeStyleHost(host, state) {\n if (!engine) return;\n const live = scopeStates.get(state.scopeId);\n if (live && (live.name !== state.stateName || live.theme !== state.theme)) {\n const compiled = getCompiledMapping(state.mapping);\n syncTableState(compiled, live.name, live.theme);\n addScopeMapping(state.scopeId, compiled);\n engine.link(host, compiled.tableId, state.scopeId, true);\n return;\n }\n pendingHosts.push(host);\n pendingStates.push(state);\n if (pendingHosts.length >= maxPendingHosts && !idleFlushQueued) {\n idleFlushQueued = true;\n requestIdleCallback(idleFlush);\n }\n}\nconst getNativeStyleEngineCacheStats = () => {\n const active = new Set([...scopeMappings.values()].flatMap((linked) => [...linked]));\n return {\n mappings: compiledMappings.size,\n activeMappings: active.size,\n states: [.../* @__PURE__ */ new Set([...compiledMappings.values(), ...active])].reduce(\n (total, compiled) => total + compiled.states.size,\n 0\n )\n };\n};\nlet pending = null;\nlet flushListener = null;\nfunction setNativeStyleEngineFlushListener(cb) {\n flushListener = cb;\n}\nfunction updateNativeStyleLink(ref, host) {\n if (ref.nativeLink) {\n ref.nativeLink.unlink();\n ref.nativeLink = null;\n }\n ref.nativePushedKeys = void 0;\n if (host && engine && ref.nativeStyleUpdate) {\n ref.nativeLink = engine.link(host, {});\n }\n}\nlet superseded = null;\nfunction queueNativeViewState(entry) {\n if (!engine) return;\n if (!pending) {\n pending = [];\n queueMicrotask(() => {\n let entries = pending;\n const dropped = superseded;\n pending = null;\n superseded = null;\n if (dropped) {\n entries = entries.filter(\n (queued, index) => index >= (dropped.get(queued.id) ?? 0)\n );\n }\n if (!entries.length) return;\n engine?.applyViewStates(entries);\n flushListener?.(entries);\n });\n }\n pending.push(entry);\n}\nfunction supersedeNativeViewStates(id) {\n if (!pending) return;\n (superseded ||= /* @__PURE__ */ new Map()).set(id, pending.length);\n}\nexport {\n createNativeStyleLinkState,\n flushNativeStyleLinks,\n getNativeStyleEngine,\n getNativeStyleEngineCacheStats,\n linkNativeStyleHost,\n nativeTextInputColorProps,\n normalizeNativeStyle,\n queueNativeViewState,\n removeNativeStyleScope,\n resolveNativeStyleMapping,\n setNativeStyleEngine,\n setNativeStyleEngineFlushListener,\n supersedeNativeViewStates,\n updateNativeStyleLink,\n updateNativeStyleScope\n};\n//# sourceMappingURL=nativeStyleEngine.js.map\n"],"mappings":";;;AACA,MAAM,4BAA4B;CAChC,sBAAsB;CACtB,gBAAgB;CAChB,aAAa;CACb,sBAAsB;AACxB;AACA,MAAM,qBAAqB;CACzB;CACA;CACA;CACA;AACF;AACA,MAAM,2BAA2B;CA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,kCAAkC,IAAI;CAC7C,gBAAgB;AAClB;AACA,SAAS,sBAAsB,KAAK,MAAM;CACxC,IAAI,IAAI,YAAY;EAClB,IAAI,WAAW,OAAO;EACtB,IAAI,aAAa;CACnB;CACA,IAAI,mBAAmB,KAAK;CAC5B,IAAI,QAAQ,UAAU,IAAI,mBAAmB;EAC3C,IAAI,aAAa,OAAO,KAAK,MAAM,CAAC,CAAC;CACvC;AACF;AACA,IAAI,aAAa;AACjB,SAAS,qBAAqB,OAAO;CACnC,IAAI,CAAC,QAAQ;CACb,IAAI,CAAC,SAAS;EACZ,UAAU,CAAC;EACX,qBAAqB;GACnB,IAAI,UAAU;GACd,MAAM,UAAU;GAChB,UAAU;GACV,aAAa;GACb,IAAI,SAAS;IACX,UAAU,QAAQ,QACf,QAAQ,UAAU,UAAU,QAAQ,IAAI,OAAO,EAAE,KAAK,EACzD;GACF;GACA,IAAI,CAAC,QAAQ,QAAQ;GACrB,QAAQ,gBAAgB,OAAO;GAC/B,gBAAgB,OAAO;EACzB,CAAC;CACH;CACA,QAAQ,KAAK,KAAK;AACpB;AACA,SAAS,0BAA0B,IAAI;CACrC,IAAI,CAAC,SAAS;CACd,CAAC,+BAA+B,IAAI,IAAI,EAAC,CAAE,IAAI,IAAI,QAAQ,MAAM;AACnE"}
|
|
@@ -139,11 +139,10 @@ function syncTableState(compiled, stateName, theme) {
|
|
|
139
139
|
}
|
|
140
140
|
function setNativeStyleEngine(next) {
|
|
141
141
|
if (engine !== next) {
|
|
142
|
-
settleReleases();
|
|
143
142
|
compiledMappings.clear();
|
|
144
143
|
scopeMappings.clear();
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
pendingHosts = [];
|
|
145
|
+
pendingStates = [];
|
|
147
146
|
}
|
|
148
147
|
engine = next;
|
|
149
148
|
if (next) {
|
|
@@ -185,7 +184,7 @@ function updateNativeStyleScope(scopeId, stateName, theme) {
|
|
|
185
184
|
if (linked) {
|
|
186
185
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
187
186
|
try {
|
|
188
|
-
for (var _iterator = linked
|
|
187
|
+
for (var _iterator = linked[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
189
188
|
var compiled = _step.value;
|
|
190
189
|
syncTableState(compiled, stateName, theme);
|
|
191
190
|
}
|
|
@@ -209,179 +208,84 @@ function updateNativeStyleScope(scopeId, stateName, theme) {
|
|
|
209
208
|
}
|
|
210
209
|
function removeNativeStyleScope(scopeId) {
|
|
211
210
|
if (!scopeStates.delete(scopeId)) return;
|
|
211
|
+
queueMicrotask(function() {
|
|
212
|
+
if (!scopeStates.has(scopeId)) scopeMappings.delete(scopeId);
|
|
213
|
+
});
|
|
212
214
|
engine === null || engine === void 0 ? void 0 : engine.removeScope(scopeId);
|
|
213
215
|
}
|
|
214
216
|
function resolveNativeStyleMapping(mapping, stateName, theme) {
|
|
215
217
|
return resolveCompiledMapping(getCompiledMapping(mapping), stateName, theme).renderProps;
|
|
216
218
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
219
|
+
function createNativeStyleLinkState(mapping, scopeId, stateName, theme) {
|
|
220
|
+
return {
|
|
221
|
+
mapping,
|
|
222
|
+
scopeId,
|
|
223
|
+
stateName,
|
|
224
|
+
theme
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
var pendingHosts = [];
|
|
228
|
+
var pendingStates = [];
|
|
229
|
+
var maxPendingHosts = 4096;
|
|
230
|
+
var idleFlushQueued = false;
|
|
231
|
+
function idleFlush() {
|
|
232
|
+
idleFlushQueued = false;
|
|
233
|
+
flushNativeStyleLinks();
|
|
234
|
+
}
|
|
235
|
+
function addScopeMapping(scopeId, compiled) {
|
|
236
|
+
var linked = scopeMappings.get(scopeId);
|
|
237
|
+
if (!linked) scopeMappings.set(scopeId, linked = /* @__PURE__ */ new Set());
|
|
238
|
+
linked.add(compiled);
|
|
230
239
|
}
|
|
231
240
|
function flushNativeStyleLinks() {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
var
|
|
235
|
-
|
|
236
|
-
|
|
241
|
+
if (!pendingHosts.length) return;
|
|
242
|
+
var hosts = pendingHosts;
|
|
243
|
+
var states = pendingStates;
|
|
244
|
+
pendingHosts = [];
|
|
245
|
+
pendingStates = [];
|
|
237
246
|
if (!engine) return;
|
|
238
|
-
var
|
|
239
|
-
|
|
240
|
-
});
|
|
241
|
-
if (!live.length) return;
|
|
242
|
-
var refs = [];
|
|
243
|
-
var tableIds = [];
|
|
244
|
-
var scopeIndexes = [];
|
|
247
|
+
var tableIds = new Array(hosts.length);
|
|
248
|
+
var scopeIndexes = new Array(hosts.length);
|
|
245
249
|
var scopes = [];
|
|
246
|
-
var
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
250
|
+
var last;
|
|
251
|
+
var tableId = 0;
|
|
252
|
+
var scopeIndex = 0;
|
|
253
|
+
for (var i = 0; i < hosts.length; i++) {
|
|
254
|
+
var state = states[i];
|
|
255
|
+
if (state !== last) {
|
|
256
|
+
last = state;
|
|
257
|
+
var compiled = getCompiledMapping(state.mapping);
|
|
258
|
+
syncTableState(compiled, state.stateName, state.theme);
|
|
259
|
+
addScopeMapping(state.scopeId, compiled);
|
|
260
|
+
tableId = compiled.tableId;
|
|
261
|
+
scopeIndex = scopes.indexOf(state.scopeId);
|
|
262
|
+
if (scopeIndex === -1) scopeIndex = scopes.push(state.scopeId) - 1;
|
|
255
263
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
_iteratorError = err;
|
|
259
|
-
} finally {
|
|
260
|
-
try {
|
|
261
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
262
|
-
_iterator.return();
|
|
263
|
-
}
|
|
264
|
-
} finally {
|
|
265
|
-
if (_didIteratorError) {
|
|
266
|
-
throw _iteratorError;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
var firstId = engine.linkTables(refs, tableIds, scopeIndexes, scopes);
|
|
271
|
-
for (var i = 0; i < live.length; i++) {
|
|
272
|
-
var link1 = live[i];
|
|
273
|
-
link1.id = firstId + i;
|
|
274
|
-
link1.owner = engine;
|
|
275
|
-
link1.ref = null;
|
|
276
|
-
trackScopeMapping(link1, 1);
|
|
264
|
+
tableIds[i] = tableId;
|
|
265
|
+
scopeIndexes[i] = scopeIndex;
|
|
277
266
|
}
|
|
267
|
+
engine.linkTables(hosts, tableIds, scopeIndexes, scopes);
|
|
278
268
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
for (var _iterator = settling[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
289
|
-
var release = _step.value;
|
|
290
|
-
release.settle();
|
|
291
|
-
}
|
|
292
|
-
} catch (err) {
|
|
293
|
-
_didIteratorError = true;
|
|
294
|
-
_iteratorError = err;
|
|
295
|
-
} finally {
|
|
296
|
-
try {
|
|
297
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
298
|
-
_iterator.return();
|
|
299
|
-
}
|
|
300
|
-
} finally {
|
|
301
|
-
if (_didIteratorError) {
|
|
302
|
-
throw _iteratorError;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
function releasable(ref, compiled, scopeId, id, settle) {
|
|
308
|
-
var handle = {
|
|
309
|
-
id,
|
|
310
|
-
unlink: function() {
|
|
311
|
-
var prior = releases.get(ref);
|
|
312
|
-
if (prior && prior.handle !== handle) prior.settle();
|
|
313
|
-
releases.set(ref, {
|
|
314
|
-
compiled,
|
|
315
|
-
scopeId,
|
|
316
|
-
handle,
|
|
317
|
-
settle
|
|
318
|
-
});
|
|
319
|
-
if (!settleQueued) {
|
|
320
|
-
settleQueued = true;
|
|
321
|
-
queueMicrotask(settleReleases);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
return handle;
|
|
326
|
-
}
|
|
327
|
-
function linkNativeStyleMapping(ref, mapping, scopeId, stateName, theme) {
|
|
328
|
-
if (!engine) return null;
|
|
329
|
-
var compiled = getCompiledMapping(mapping);
|
|
330
|
-
var scopeState = scopeStates.get(scopeId);
|
|
331
|
-
var stale = scopeState && (scopeState.name !== stateName || scopeState.theme !== theme);
|
|
332
|
-
var kept = releases.get(ref);
|
|
333
|
-
if (kept) {
|
|
334
|
-
releases.delete(ref);
|
|
335
|
-
if (!stale && kept.compiled === compiled && kept.scopeId === scopeId) return kept.handle;
|
|
336
|
-
kept.settle();
|
|
269
|
+
function linkNativeStyleHost(host, state) {
|
|
270
|
+
if (!engine) return;
|
|
271
|
+
var live = scopeStates.get(state.scopeId);
|
|
272
|
+
if (live && (live.name !== state.stateName || live.theme !== state.theme)) {
|
|
273
|
+
var compiled = getCompiledMapping(state.mapping);
|
|
274
|
+
syncTableState(compiled, live.name, live.theme);
|
|
275
|
+
addScopeMapping(state.scopeId, compiled);
|
|
276
|
+
engine.link(host, compiled.tableId, state.scopeId, true);
|
|
277
|
+
return;
|
|
337
278
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
ref: null,
|
|
344
|
-
compiled,
|
|
345
|
-
scopeId,
|
|
346
|
-
id: handle.id,
|
|
347
|
-
owner: engine
|
|
348
|
-
};
|
|
349
|
-
trackScopeMapping(link, 1);
|
|
350
|
-
return releasable(ref, compiled, scopeId, handle.id, function() {
|
|
351
|
-
if (link.id === -1) return;
|
|
352
|
-
link.id = -1;
|
|
353
|
-
if (link.owner === engine) trackScopeMapping(link, -1);
|
|
354
|
-
handle.unlink();
|
|
355
|
-
});
|
|
279
|
+
pendingHosts.push(host);
|
|
280
|
+
pendingStates.push(state);
|
|
281
|
+
if (pendingHosts.length >= maxPendingHosts && !idleFlushQueued) {
|
|
282
|
+
idleFlushQueued = true;
|
|
283
|
+
requestIdleCallback(idleFlush);
|
|
356
284
|
}
|
|
357
|
-
syncTableState(compiled, stateName, theme);
|
|
358
|
-
var link1 = {
|
|
359
|
-
ref,
|
|
360
|
-
compiled,
|
|
361
|
-
scopeId,
|
|
362
|
-
id: 0,
|
|
363
|
-
owner: null
|
|
364
|
-
};
|
|
365
|
-
pendingLinks.push(link1);
|
|
366
|
-
return releasable(ref, compiled, scopeId, 0, function() {
|
|
367
|
-
var id = link1.id;
|
|
368
|
-
if (id === -1) return;
|
|
369
|
-
link1.id = -1;
|
|
370
|
-
link1.ref = null;
|
|
371
|
-
if (id > 0) {
|
|
372
|
-
if (link1.owner === engine) trackScopeMapping(link1, -1);
|
|
373
|
-
link1.owner.unlink(id);
|
|
374
|
-
} else if (++unlinkedPending > 512 && unlinkedPending * 2 > pendingLinks.length) {
|
|
375
|
-
pendingLinks = pendingLinks.filter(function(pending2) {
|
|
376
|
-
return pending2.id === 0;
|
|
377
|
-
});
|
|
378
|
-
unlinkedPending = 0;
|
|
379
|
-
}
|
|
380
|
-
});
|
|
381
285
|
}
|
|
382
286
|
var getNativeStyleEngineCacheStats = function() {
|
|
383
287
|
var active = new Set([...scopeMappings.values()].flatMap(function(linked) {
|
|
384
|
-
return [...linked
|
|
288
|
+
return [...linked];
|
|
385
289
|
}));
|
|
386
290
|
return {
|
|
387
291
|
mappings: compiledMappings.size,
|
|
@@ -406,19 +310,33 @@ function updateNativeStyleLink(ref, host) {
|
|
|
406
310
|
ref.nativeLink = engine.link(host, {});
|
|
407
311
|
}
|
|
408
312
|
}
|
|
313
|
+
var superseded = null;
|
|
409
314
|
function queueNativeViewState(entry) {
|
|
410
315
|
if (!engine) return;
|
|
411
316
|
if (!pending) {
|
|
412
317
|
pending = [];
|
|
413
318
|
queueMicrotask(function() {
|
|
414
319
|
var entries = pending;
|
|
320
|
+
var dropped = superseded;
|
|
415
321
|
pending = null;
|
|
322
|
+
superseded = null;
|
|
323
|
+
if (dropped) {
|
|
324
|
+
entries = entries.filter(function(queued, index) {
|
|
325
|
+
var _dropped_get;
|
|
326
|
+
return index >= ((_dropped_get = dropped.get(queued.id)) !== null && _dropped_get !== void 0 ? _dropped_get : 0);
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
if (!entries.length) return;
|
|
416
330
|
engine === null || engine === void 0 ? void 0 : engine.applyViewStates(entries);
|
|
417
331
|
flushListener === null || flushListener === void 0 ? void 0 : flushListener(entries);
|
|
418
332
|
});
|
|
419
333
|
}
|
|
420
334
|
pending.push(entry);
|
|
421
335
|
}
|
|
336
|
+
function supersedeNativeViewStates(id) {
|
|
337
|
+
if (!pending) return;
|
|
338
|
+
(superseded || (superseded = /* @__PURE__ */ new Map())).set(id, pending.length);
|
|
339
|
+
}
|
|
422
340
|
|
|
423
|
-
export { flushNativeStyleLinks, getNativeStyleEngine, getNativeStyleEngineCacheStats,
|
|
341
|
+
export { createNativeStyleLinkState, flushNativeStyleLinks, getNativeStyleEngine, getNativeStyleEngineCacheStats, linkNativeStyleHost, nativeTextInputColorProps, normalizeNativeStyle, queueNativeViewState, removeNativeStyleScope, resolveNativeStyleMapping, setNativeStyleEngine, setNativeStyleEngineFlushListener, supersedeNativeViewStates, updateNativeStyleLink, updateNativeStyleScope };
|
|
424
342
|
//# sourceMappingURL=nativeStyleEngine.native.js.map
|