create-octane-xplat 0.7.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,428 +0,0 @@
1
- diff --git a/css/css-tree-parser.js b/css/css-tree-parser.js
2
- index 0c13e7e67a8eb306248d738bb73189b772b4a409..7ce38a9ba8f1f9aef709136b46f8e5b2435ba714 100644
3
- --- a/css/css-tree-parser.js
4
- +++ b/css/css-tree-parser.js
5
- @@ -66,6 +66,10 @@ function transformAst(node, css, type = null) {
6
- atrule.keyframes = transformAst(node.block, css, 'keyframe');
7
- atrule.vendor = undefined;
8
- }
9
- + else if (node.name === 'layer') {
10
- + atrule.layer = node.prelude ? node.prelude.value.trim() : '';
11
- + atrule.rules = transformAst(node.block, css);
12
- + }
13
- else {
14
- atrule.rules = transformAst(node.block, css);
15
- }
16
- diff --git a/css/reworkcss.d.ts b/css/reworkcss.d.ts
17
- index 3ac4f618f307864cb95b70cd01f4ecdc42c9d9e4..1906ed1457de195a799c9e938136f078e7ed6307 100644
18
- --- a/css/reworkcss.d.ts
19
- +++ b/css/reworkcss.d.ts
20
- @@ -10,7 +10,7 @@ export interface Position {
21
- };
22
- }
23
- export interface Node {
24
- - type: 'rule' | 'keyframes' | 'declaration' | 'import' | 'media';
25
- + type: 'rule' | 'keyframes' | 'declaration' | 'import' | 'media' | 'layer';
26
- position: Position;
27
- }
28
- export interface Declaration extends Node {
29
- @@ -21,7 +21,7 @@ export interface Rule extends Node {
30
- selectors: string[];
31
- declarations: Declaration[];
32
- }
33
- -export type AtRule = KeyFrames | Media;
34
- +export type AtRule = KeyFrames | Media | Layer;
35
- export interface Keyframes extends Rule {
36
- name: string;
37
- vendor?: string;
38
- @@ -35,6 +35,11 @@ export interface Media extends Node {
39
- media: string;
40
- rules: Array<Rule | AtRule>;
41
- }
42
- +export interface Layer extends Node {
43
- + /** Layer-name prelude — '' for an anonymous block. Statement form (`@layer a, b;`) leaves rules undefined. */
44
- + layer: string;
45
- + rules?: Array<Rule | AtRule>;
46
- +}
47
- export interface StyleSheet {
48
- rules: Rule[];
49
- }
50
- diff --git a/ui/core/view-base/index.d.ts b/ui/core/view-base/index.d.ts
51
- index 170ceb1c65bbf17cffb1c648f2cc5c7c21065115..6941110802e2ade9b4d48a172dbb95801bba96d1 100644
52
- --- a/ui/core/view-base/index.d.ts
53
- +++ b/ui/core/view-base/index.d.ts
54
- @@ -498,6 +498,12 @@ export declare abstract class ViewBase extends Observable {
55
- * @param view to unload.
56
- */
57
- unloadView(view: ViewBase): void;
58
- + /**
59
- + * Whether a child is the one currently shown. Containers that keep several children
60
- + * alive but show one at a time (a TabView's items) override it for the hidden ones.
61
- + * @param child A direct child of this view.
62
- + */
63
- + _isChildPresented(child: ViewBase): boolean;
64
- /**
65
- * Core logic for removing a child view from this instance. Used by the framework to handle lifecycle events more centralized. Do not use outside the UI Stack implementation.
66
- */
67
- diff --git a/ui/core/view-base/index.js b/ui/core/view-base/index.js
68
- index 5f54440b3a3e0a36ddc0139d49db5cbcd6695b75..580061c78ae9326f733f7ea5ebd0dbf92382d031 100644
69
- --- a/ui/core/view-base/index.js
70
- +++ b/ui/core/view-base/index.js
71
- @@ -633,6 +633,14 @@ export class ViewBase extends Observable {
72
- view.callUnloaded();
73
- }
74
- }
75
- + /**
76
- + * Whether a child is the one currently shown. Containers that keep several children
77
- + * alive but show one at a time (a TabView's items) override it for the hidden ones.
78
- + * @param child A direct child of this view.
79
- + */
80
- + _isChildPresented(child) {
81
- + return true;
82
- + }
83
- /**
84
- * Core logic for removing a child view from this instance. Used by the framework to handle lifecycle events more centralized. Do not use outside the UI Stack implementation.
85
- */
86
- diff --git a/ui/frame/frame-common.js b/ui/frame/frame-common.js
87
- index 8637cacf417baebce945c58681daa86ca83dce46..c06da239d58b6174652b120e024f853f58d2c13f 100644
88
- --- a/ui/frame/frame-common.js
89
- +++ b/ui/frame/frame-common.js
90
- @@ -3,7 +3,7 @@ import { NavigationType } from './frame-interfaces';
91
- import { CustomLayoutView, CSSType } from '../core/view';
92
- import { Property } from '../core/properties';
93
- import { Trace } from '../../trace';
94
- -import { frameStack, topmost as frameStackTopmost, _pushInFrameStack, _popFromFrameStack, _removeFromFrameStack, _isFrameStackEmpty } from './frame-stack';
95
- +import { frameStack, topmost as frameStackTopmost, _pushInFrameStack, _insertAtFrameStackBottom, _popFromFrameStack, _removeFromFrameStack, _isFrameStackEmpty } from './frame-stack';
96
- import { viewMatchesModuleContext } from '../core/view/view-common';
97
- import { getAncestor } from '../core/view-base';
98
- import { Builder } from '../builder';
99
- @@ -12,6 +12,19 @@ import { profile } from '../../profiling';
100
- import { FRAME_SYMBOL } from './frame-helpers';
101
- import { SharedTransition } from '../transition/shared-transition';
102
- export { NavigationType } from './frame-interfaces';
103
- +/**
104
- + * A view is presented while every ancestor shows the child leading to it; a frame in an
105
- + * unselected tab is loaded on Android but must never outrank the tab that is shown.
106
- + */
107
- +function isPresented(view) {
108
- + while (view.parent) {
109
- + if (!view.parent._isChildPresented(view)) {
110
- + return false;
111
- + }
112
- + view = view.parent;
113
- + }
114
- + return true;
115
- +}
116
- function buildEntryFromArgs(arg) {
117
- let entry;
118
- if (typeof arg === 'string') {
119
- @@ -463,7 +476,12 @@ let FrameBase = FrameBase_1 = class FrameBase extends CustomLayoutView {
120
- return _isFrameStackEmpty();
121
- }
122
- _pushInFrameStack() {
123
- - _pushInFrameStack(this);
124
- + if (isPresented(this)) {
125
- + _pushInFrameStack(this);
126
- + }
127
- + else {
128
- + _insertAtFrameStackBottom(this);
129
- + }
130
- }
131
- _popFromFrameStack() {
132
- _popFromFrameStack(this);
133
- diff --git a/ui/frame/frame-stack.d.ts b/ui/frame/frame-stack.d.ts
134
- index 8387e6202380ec502adbc577c8de73e354ced9a9..0c874161af12d69ea4ced8f43d3e8a4d92032dcd 100644
135
- --- a/ui/frame/frame-stack.d.ts
136
- +++ b/ui/frame/frame-stack.d.ts
137
- @@ -19,5 +19,6 @@ export declare function topmostForWindow(window: WindowBase): FrameBase | undefi
138
- export declare function topmost(window?: WindowBase): FrameBase;
139
- export declare function _isFrameStackEmpty(): boolean;
140
- export declare function _pushInFrameStack(frame: FrameBase): void;
141
- +export declare function _insertAtFrameStackBottom(frame: FrameBase): void;
142
- export declare function _popFromFrameStack(frame: FrameBase): void;
143
- export declare function _removeFromFrameStack(frame: FrameBase): void;
144
- diff --git a/ui/frame/frame-stack.js b/ui/frame/frame-stack.js
145
- index 9ded225f53e4c4af92166a3e019671a1a65a2db2..9a9f5d5f9f891c9bcf6035b0345f4bb21c72831c 100644
146
- --- a/ui/frame/frame-stack.js
147
- +++ b/ui/frame/frame-stack.js
148
- @@ -46,6 +46,17 @@ export function _pushInFrameStack(frame) {
149
- frameStack.push(frame);
150
- frame._isInFrameStack = true;
151
- }
152
- +/**
153
- + * Keeps a frame in the stack without making it topmost: the frame stays findable by id,
154
- + * while every frame that is actually shown outranks it.
155
- + */
156
- +export function _insertAtFrameStackBottom(frame) {
157
- + if (frame._isInFrameStack) {
158
- + return;
159
- + }
160
- + frameStack.unshift(frame);
161
- + frame._isInFrameStack = true;
162
- +}
163
- export function _popFromFrameStack(frame) {
164
- if (!frame._isInFrameStack) {
165
- return;
166
- diff --git a/ui/layouts/flexbox-layout/flexbox-layout-common.js b/ui/layouts/flexbox-layout/flexbox-layout-common.js
167
- index 50c747a85135d761c1a646a007c4930f790fb0a3..8f3a627224cf903555574480a0cdeba74b1c3e35 100644
168
- --- a/ui/layouts/flexbox-layout/flexbox-layout-common.js
169
- +++ b/ui/layouts/flexbox-layout/flexbox-layout-common.js
170
- @@ -195,7 +195,21 @@ let FlexboxLayoutBase = class FlexboxLayoutBase extends LayoutBase {
171
- validateArgs(view).style.alignSelf = align;
172
- }
173
- static getAlignSelf(view) {
174
- - return validateArgs(view).style.alignSelf;
175
- + const style = validateArgs(view).style;
176
- + const alignSelf = style.alignSelf;
177
- + if (alignSelf !== 'auto' && alignSelf !== 'stretch') {
178
- + return alignSelf;
179
- + }
180
- + const parent = view.parent;
181
- + if (!(parent instanceof FlexboxLayoutBase)) {
182
- + return alignSelf;
183
- + }
184
- + if (alignSelf === 'auto' && parent.alignItems !== 'stretch') {
185
- + return alignSelf;
186
- + }
187
- + const isRow = parent.flexDirection === 'row' || parent.flexDirection === 'row-reverse';
188
- + const crossSize = isRow ? style.height : style.width;
189
- + return crossSize == null || crossSize === 'auto' ? alignSelf : 'flex-start';
190
- }
191
- static setFlexWrapBefore(view, wrap) {
192
- validateArgs(view).style.flexWrapBefore = wrap;
193
- diff --git a/ui/styling/css-selector.d.ts b/ui/styling/css-selector.d.ts
194
- index 734d886877b867e69b36fd75785b0a4372008f0f..d90f0e4fcf0f136bf4e9b10f9b08cc14f9b73e32 100644
195
- --- a/ui/styling/css-selector.d.ts
196
- +++ b/ui/styling/css-selector.d.ts
197
- @@ -222,6 +222,8 @@ export declare class RuleSet {
198
- mediaQueryString: string | string[];
199
- tag?: string | number;
200
- scopedTag?: string;
201
- + /** Cascade-layer rank per nesting depth; undefined/shortest path sorts after every layer (unlayered styles win). */
202
- + layerPath?: number[];
203
- constructor(selectors: SelectorCore[], declarations: Declaration[]);
204
- toString(): string;
205
- lookupSort(sorter: LookupSorter): void;
206
- diff --git a/ui/styling/css-selector.js b/ui/styling/css-selector.js
207
- index 702ca508f27ace527938860dfe4b13dbcbb93c2f..b6fa55a9570d4ed0714f053301bbe69efbd6900c 100644
208
- --- a/ui/styling/css-selector.js
209
- +++ b/ui/styling/css-selector.js
210
- @@ -1081,9 +1081,27 @@ export class StyleSheetSelectorScope extends SelectorScope {
211
- return matchSelectorCandidates(node, this.collectCandidates(node));
212
- }
213
- }
214
- -/** Cascade order: specificity, then source order - (tier, position) across stylesheets. */
215
- +/**
216
- + * Cascade layers order before specificity: rules in an earlier-declared layer lose
217
- + * to rules in a later-declared layer regardless of specificity, and unlayered
218
- + * rules (absent rank at a depth) beat every layered rule.
219
- + */
220
- +function compareLayerPaths(a, b) {
221
- + const aLength = a?.length ?? 0;
222
- + const bLength = b?.length ?? 0;
223
- + const length = Math.max(aLength, bLength);
224
- + for (let i = 0; i < length; i++) {
225
- + const rankA = i < aLength ? a[i] : Number.POSITIVE_INFINITY;
226
- + const rankB = i < bLength ? b[i] : Number.POSITIVE_INFINITY;
227
- + if (rankA !== rankB) {
228
- + return rankA - rankB;
229
- + }
230
- + }
231
- + return 0;
232
- +}
233
- +/** Cascade order: cascade layer, then specificity, then source order - (tier, position) across stylesheets. */
234
- function compareSelectors(a, b) {
235
- - return a.specificity - b.specificity || a.tier - b.tier || a.pos - b.pos;
236
- + return compareLayerPaths(a.ruleset?.layerPath, b.ruleset?.layerPath) || a.specificity - b.specificity || a.tier - b.tier || a.pos - b.pos;
237
- }
238
- /**
239
- * Resolve collected candidates against a node, compacting the array in place.
240
- diff --git a/ui/styling/style-scope.d.ts b/ui/styling/style-scope.d.ts
241
- index d6f026616cc33cf02f312a5e4f3b6effd71b5dda..321217d036b2fc726c88bf2076d82dcc62e6917e 100644
242
- --- a/ui/styling/style-scope.d.ts
243
- +++ b/ui/styling/style-scope.d.ts
244
- @@ -8,7 +8,7 @@ import { Keyframes, KeyframeAnimationInfo, KeyframeAnimation } from '../animatio
245
- */
246
- export declare function mergeCssSelectors(): void;
247
- export declare function mergeCssKeyframes(): void;
248
- -export declare function _populateRules(nodes: ReworkCSS.Node[], rulesets: RuleSet[], keyframes: Keyframes[], mediaQueryString?: string | string[]): void;
249
- +export declare function _populateRules(nodes: ReworkCSS.Node[], rulesets: RuleSet[], keyframes: Keyframes[], mediaQueryString?: string | string[], layerPath?: number[], layerPrefix?: string): void;
250
- export declare function removeTaggedAdditionalCSS(tag: string | number): boolean;
251
- export declare function addTaggedAdditionalCSS(cssText: string, tag?: string | number): boolean;
252
- export declare const loadAppCSS: any;
253
- diff --git a/ui/styling/style-scope.js b/ui/styling/style-scope.js
254
- index 0dbbb309924858ab2b435a004f562c808168b1d9..37495df5a3e0c452ddad493493c12f42d25fba68 100644
255
- --- a/ui/styling/style-scope.js
256
- +++ b/ui/styling/style-scope.js
257
- @@ -399,6 +399,33 @@ __decorate([
258
- __metadata("design:paramtypes", [String, String]),
259
- __metadata("design:returntype", String)
260
- ], CSSSource, "resolveCSSPathFromURL", null);
261
- +// Cascade-layer registry: qualified name -> first-seen ordinal, shared across
262
- +// every stylesheet feeding the cascade (layer order is document-wide per spec).
263
- +// '~' synthesizes names for anonymous layers, which authors cannot reference —
264
- +// the char is illegal in a CSS ident, so they never collide with named layers.
265
- +const cascadeLayerOrdinals = new Map();
266
- +let cascadeLayerCount = 0;
267
- +let anonymousLayerCount = 0;
268
- +function layerOrdinal(name) {
269
- + let ordinal = cascadeLayerOrdinals.get(name);
270
- + if (ordinal === undefined) {
271
- + ordinal = cascadeLayerCount++;
272
- + cascadeLayerOrdinals.set(name, ordinal);
273
- + }
274
- + return ordinal;
275
- +}
276
- +// Rank path for `name` nested under the layer at prefixPath/prefixName. Dotted
277
- +// names register each ancestor on the way down, so a top-level `@layer a.b`
278
- +// refers to the same layer as `@layer a { @layer b }`.
279
- +function layerPathFor(name, prefixPath, prefixName) {
280
- + const path = [...prefixPath];
281
- + let qualified = prefixName;
282
- + for (const segment of name.split('.')) {
283
- + qualified = qualified ? `${qualified}.${segment}` : segment;
284
- + path.push(layerOrdinal(qualified));
285
- + }
286
- + return path;
287
- +}
288
- function populateRulesFromImports(nodes, rulesets, keyframes) {
289
- const imports = nodes.filter((r) => r.type === 'import');
290
- if (!imports.length) {
291
- @@ -409,6 +436,11 @@ function populateRulesFromImports(nodes, rulesets, keyframes) {
292
- const urlMatch = importItem && importItem.match(pattern);
293
- return urlMatch && urlMatch[2];
294
- };
295
- + const layerFromImportObject = (importObject) => {
296
- + const importItem = importObject['import'];
297
- + const layerMatch = importItem && importItem.match(/\blayer\b(?:\(\s*([^)]*?)\s*\))?/);
298
- + return layerMatch ? layerMatch[1] ?? '' : null;
299
- + };
300
- const sourceFromImportObject = (importObject) => importObject['position'] && importObject['position']['source'];
301
- const toUrlSourcePair = (importObject) => ({
302
- url: urlFromImportObject(importObject),
303
- @@ -416,17 +448,25 @@ function populateRulesFromImports(nodes, rulesets, keyframes) {
304
- });
305
- const getCssFile = ({ url, source }) => (source ? CSSSource.fromFileImport(url, source) : CSSSource.fromURI(url));
306
- const cssFiles = imports
307
- - .map(toUrlSourcePair)
308
- + .map((importObject) => ({ ...toUrlSourcePair(importObject), layer: layerFromImportObject(importObject) }))
309
- .filter(({ url }) => !!url)
310
- - .map(getCssFile);
311
- - for (const cssFile of cssFiles) {
312
- + .map(({ url, source, layer }) => ({ cssFile: getCssFile({ url, source }), layer }));
313
- + for (const { cssFile, layer } of cssFiles) {
314
- if (cssFile) {
315
- + if (layer !== null) {
316
- + // @import "x.css" layer(name) — the imported sheet joins the named
317
- + // layer; its own layers become nested sublayers of it.
318
- + const importPath = [layerOrdinal(layer.trim() || `~import-${anonymousLayerCount++}`)];
319
- + for (const ruleset of cssFile.selectors) {
320
- + ruleset.layerPath = [...importPath, ...(ruleset.layerPath ?? [])];
321
- + }
322
- + }
323
- rulesets.push(...cssFile.selectors);
324
- keyframes.push(...cssFile.keyframes);
325
- }
326
- }
327
- }
328
- -export function _populateRules(nodes, rulesets, keyframes, mediaQueryString) {
329
- +export function _populateRules(nodes, rulesets, keyframes, mediaQueryString, layerPath, layerPrefix) {
330
- for (const node of nodes) {
331
- if (isKeyframe(node)) {
332
- const keyframeRule = {
333
- @@ -451,11 +491,32 @@ export function _populateRules(nodes, rulesets, keyframes, mediaQueryString) {
334
- else {
335
- compositeMediaQuery = node.media;
336
- }
337
- - _populateRules(node.rules, rulesets, keyframes, compositeMediaQuery);
338
- + _populateRules(node.rules, rulesets, keyframes, compositeMediaQuery, layerPath, layerPrefix);
339
- + }
340
- + else if (isLayer(node)) {
341
- + const name = (node.layer ?? '').trim();
342
- + if (node.rules) {
343
- + // Block at-rule: a single name, or anonymous when the prelude is empty.
344
- + const qualified = name ? (layerPrefix ? `${layerPrefix}.${name}` : name) : `${layerPrefix ?? ''}~${anonymousLayerCount++}`;
345
- + const childPath = name ? layerPathFor(name, layerPath ?? [], layerPrefix ?? '') : [...(layerPath ?? []), layerOrdinal(qualified)];
346
- + _populateRules(node.rules, rulesets, keyframes, mediaQueryString, childPath, qualified);
347
- + }
348
- + else {
349
- + // Statement at-rule: `@layer a, b;` pre-declares order only.
350
- + for (const declared of name.split(',')) {
351
- + const declaredName = declared.trim();
352
- + if (declaredName) {
353
- + layerPathFor(declaredName, layerPath ?? [], layerPrefix ?? '');
354
- + }
355
- + }
356
- + }
357
- }
358
- else if (isRule(node)) {
359
- const ruleset = fromAstNode(node);
360
- ruleset.mediaQueryString = mediaQueryString;
361
- + if (layerPath?.length) {
362
- + ruleset.layerPath = layerPath;
363
- + }
364
- rulesets.push(ruleset);
365
- }
366
- }
367
- @@ -1335,6 +1396,9 @@ function isMedia(node) {
368
- function isKeyframe(node) {
369
- return node.type === 'keyframes';
370
- }
371
- +function isLayer(node) {
372
- + return node.type === 'layer';
373
- +}
374
- function isRule(node) {
375
- return node.type === 'rule';
376
- }
377
- diff --git a/ui/tab-view/tab-view-common.d.ts b/ui/tab-view/tab-view-common.d.ts
378
- index 35d1ba1f2479bbbf64cd4b1acb9563e0f823fd4e..e96b3085d75549d06d2c2e9cae183887e8e1adcc 100644
379
- --- a/ui/tab-view/tab-view-common.d.ts
380
- +++ b/ui/tab-view/tab-view-common.d.ts
381
- @@ -66,6 +66,7 @@ export declare class TabViewBase extends View implements TabViewDefinition, AddC
382
- eachChild(callback: (child: ViewBase) => boolean): void;
383
- eachChildView(callback: (child: View) => boolean): void;
384
- onItemsChanged(oldItems: TabViewItemDefinition[], newItems: TabViewItemDefinition[]): void;
385
- + _isChildPresented(child: ViewBase): boolean;
386
- onSelectedIndexChanged(oldIndex: number, newIndex: number): void;
387
- }
388
- export interface TabViewBase {
389
- diff --git a/ui/tab-view/tab-view-common.js b/ui/tab-view/tab-view-common.js
390
- index 66672f1fa5ccb31f06a83a2a21bfe1e5c668712f..1eb3676f0346d7ee21ab7ff1c1b78292da641463 100644
391
- --- a/ui/tab-view/tab-view-common.js
392
- +++ b/ui/tab-view/tab-view-common.js
393
- @@ -144,21 +144,33 @@ let TabViewBase = TabViewBase_1 = class TabViewBase extends View {
394
- }
395
- onItemsChanged(oldItems, newItems) {
396
- if (oldItems) {
397
- - oldItems.forEach((item) => this._removeView(item));
398
- + oldItems.forEach((item) => {
399
- + if (!newItems || newItems.indexOf(item) < 0) {
400
- + this._removeView(item);
401
- + }
402
- + });
403
- }
404
- if (newItems) {
405
- newItems.forEach((item) => {
406
- if (!item.view) {
407
- throw new Error(`TabViewItem must have a view.`);
408
- }
409
- + // An item kept across the change stays loaded; tearing it down would unload its view.
410
- + if (item.parent === this) {
411
- + return;
412
- + }
413
- // A view can only have one parent, and _addView throws if it already has one.
414
- - if (item.parent && item.parent !== this) {
415
- + if (item.parent) {
416
- item.parent._removeView(item);
417
- }
418
- this._addView(item);
419
- });
420
- }
421
- }
422
- + _isChildPresented(child) {
423
- + const items = this.items;
424
- + return !items || items[this.selectedIndex] === child;
425
- + }
426
- onSelectedIndexChanged(oldIndex, newIndex) {
427
- // to be overridden in platform specific files
428
- this.notify({