Skip to content

Commit b8237a6

Browse files
Patrick SoquetMichael Kellner
authored andcommitted
PIU: avoid Desktop/Mobile conflicts + iOS layers
1 parent f65a1a8 commit b8237a6

File tree

13 files changed

+46
-124
lines changed

13 files changed

+46
-124
lines changed

modules/piu/All/piuAll.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@
2323
// PiuColor.c
2424

2525
export function blendColors(a, c1, c2) @ "Piu_blendColors";
26+
global.blendColors = blendColors;
2627
export function hsl(r, g, b) @ "Piu_hsl";
28+
global.hsl = hsl;
2729
export function hsla(r, g, b, a) @ "Piu_hsla";
30+
global.hsla = hsla;
2831
export function rgb(r, g, b) @ "Piu_rgb";
32+
global.rgb = rgb;
2933
export function rgba(r, g, b, a) @ "Piu_rgba";
34+
global.rgba = rgba;
3035

3136
// PiuSkin.c
3237

@@ -66,6 +71,7 @@ export class Skin @ "PiuSkinDelete" {
6671
}
6772
}
6873
Object.freeze(Skin.prototype);
74+
global.Skin = Skin;
6975

7076
// PiuStyle.c
7177

@@ -105,6 +111,7 @@ export class Style @ "PiuStyleDelete" {
105111
}
106112
}
107113
Object.freeze(Style.prototype);
114+
global.Style = Style;
108115

109116
// BEHAVIOR
110117

@@ -113,6 +120,7 @@ export class Behavior {
113120
}
114121
}
115122
Object.freeze(Behavior.prototype);
123+
global.Behavior = Behavior;
116124

117125
// DISPATCH
118126

@@ -140,6 +148,7 @@ export function template(f) {
140148
result.template = template;
141149
return result;
142150
}
151+
global.template = template;
143152

144153
export function Template(prototype) {
145154
let result = function($, it = {}) {
@@ -151,6 +160,7 @@ export function Template(prototype) {
151160
result.template = template;
152161
return result;
153162
}
163+
global.Template = Template;
154164

155165
// CONTENTS
156166

@@ -235,6 +245,7 @@ export let Content = Template(Object.freeze({
235245
start() @ "PiuContent_start",
236246
stop() @ "PiuContent_stop",
237247
}));
248+
global.Content = Content;
238249

239250
// PiuLabel.c
240251

@@ -246,6 +257,7 @@ export let Label = Template(Object.freeze({
246257

247258
set string(it) @ "PiuLabel_set_string",
248259
}));
260+
global.Label = Label;
249261

250262
// PiuText.c
251263

@@ -267,6 +279,7 @@ export let Text = Template(Object.freeze({
267279
endBlock() @ "PiuText_endBlock",
268280
endSpan() @ "PiuText_endSpan",
269281
}));
282+
global.Text = Text;
270283

271284
export let Link = Template(Object.freeze({
272285
__proto__: proto,
@@ -279,6 +292,7 @@ export let Link = Template(Object.freeze({
279292

280293
captureTouch(id, x, y, ticks) @ "PiuContent_captureTouch",
281294
}));
295+
global.Link = Link;
282296

283297
// PiuPort.c
284298

@@ -303,6 +317,7 @@ export let Port = Template(Object.freeze({
303317
pushClip(x, y, w, h) @ "PiuPort_pushClip",
304318
measureString(string, style) @ "PiuPort_measureString",
305319
}));
320+
global.Port = Port;
306321

307322
// CONTAINERS
308323

@@ -341,27 +356,31 @@ export let Container = Template(Object.freeze({
341356
run(transition) @ "PiuContainer_run",
342357
swap(content0, content1) @ "PiuContainer_swap",
343358
}));
359+
global.Container = Container;
344360

345361
// PiuColumn.c
346362

347363
export let Column = Template(Object.freeze({
348364
__proto__: Container.prototype,
349365
_create($, it) @ "PiuColumn_create",
350366
}));
367+
global.Column = Column;
351368

352369
// PiuLayout.c
353370

354371
export let Layout = Template(Object.freeze({
355372
__proto__: Container.prototype,
356373
_create($, it) @ "PiuLayout_create",
357374
}));
375+
global.Layout = Layout;
358376

359377
// PiuRow.c
360378

361379
export let Row = Template(Object.freeze({
362380
__proto__: Container.prototype,
363381
_create($, it) @ "PiuRow_create",
364382
}));
383+
global.Row = Row;
365384

366385
// PiuScroller.c
367386

@@ -382,13 +401,15 @@ export let Scroller = Template(Object.freeze({
382401
scrollBy(dx, dy) @ "PiuScroller_scrollBy",
383402
scrollTo(x, y) @ "PiuScroller_scrollTo",
384403
}));
404+
global.Scroller = Scroller;
385405

386406
// DEFER
387407

388408
export class DeferLink @ "PiuDeferLinkDelete" {
389409
constructor() @ "PiuDeferLinkCreate"
390410
}
391411
Object.freeze(DeferLink.prototype);
412+
global.DeferLink = DeferLink;
392413

393414
// TOUCH
394415

@@ -398,6 +419,7 @@ export class TouchLink @ "PiuTouchLinkDelete" {
398419
peek(index) @ "PiuTouchLink_peek"
399420
}
400421
Object.freeze(TouchLink.prototype);
422+
global.TouchLink = TouchLink;
401423

402424
// TRANSITION
403425

@@ -418,6 +440,7 @@ export class Transition @ "PiuTransitionDelete" {
418440
}
419441
}
420442
Object.freeze(Transition.prototype);
443+
global.Transition = Transition;
421444

422445
// LOCALS
423446

@@ -430,6 +453,7 @@ export class Locals @ "PiuLocalsDelete" {
430453
get(id) @ "PiuLocals_get"
431454
}
432455
Object.freeze(Locals.prototype);
456+
global.Locals = Locals;
433457

434458
Math.backEaseIn = function(fraction) @ "Math_backEaseIn";
435459
Math.backEaseInOut = function(fraction) @ "Math_backEaseInOut";

modules/piu/All/piuStyle.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ PiuStyle* PiuStyleLinkCompute(xsMachine *the, PiuStyleLink* chain, PiuApplicatio
109109
PiuStyle* result = (*chain)->computedStyle;
110110
if (result == NULL) {
111111
PiuStyleLink* link = chain;
112-
xsResult = xsNewFunction0((*application)->Style);
112+
xsResult = xsGet(xsGlobal, xsID_Style);
113+
xsResult = xsNewFunction0(xsResult);
113114
result = PIU(Style, xsResult);
114115
while (link) {
115116
PiuStyleOverride((*link)->style, result);
@@ -487,8 +488,6 @@ void PiuStyleOverride(PiuStyle* self, PiuStyle* result)
487488
}
488489
}
489490

490-
491-
492491
void PiuStyle_get_bottom(xsMachine* the)
493492
{
494493
PiuStyle* self = PIU(Style, xsThis);

modules/piu/MC/piuDie.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*
1919
*/
2020

21-
#include "piuAll.h"
2221
#include "piuMC.h"
2322

2423
static void PiuDieUpdate(void* it, PiuView* view, PiuRectangle area);

modules/piu/MC/piuFont.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*
1919
*/
2020

21-
#include "piuAll.h"
2221
#include "piuMC.h"
2322

2423
static void PiuFontDelete(void* it);

modules/piu/MC/piuImage.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*
1919
*/
2020

21-
#include "piuAll.h"
2221
#include "piuMC.h"
2322

2423
static void PiuImageDictionary(xsMachine* the, void* it);

modules/piu/MC/piuMC.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
*
1919
*/
2020

21+
#include "piuAll.h"
22+
2123
typedef struct PiuDieStruct PiuDieRecord, *PiuDie;
2224
typedef struct PiuImageStruct PiuImageRecord, *PiuImage;
2325
typedef struct PiuRegionStruct PiuRegionRecord, *PiuRegion;

modules/piu/MC/piuMC.js

Lines changed: 6 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,7 @@ import parseRLE from "commodetto/ParseRLE";
2424
import Poco from "commodetto/Poco";
2525
import Resource from "Resource";
2626

27-
import {
28-
blendColors,
29-
hsl,
30-
hsla,
31-
rgb,
32-
rgba,
33-
Skin,
34-
Style,
35-
Behavior,
36-
Transition,
37-
template,
38-
Template,
39-
Content,
40-
Label,
41-
Text,
42-
Link,
43-
Port,
44-
Container,
45-
Column,
46-
Layout,
47-
Row,
48-
Scroller,
49-
DeferLink,
50-
TouchLink,
51-
Locals,
52-
} from "All";
27+
import {} from "All";
5328
export * from "All";
5429

5530
export class CLUT extends Resource {
@@ -59,6 +34,7 @@ export class CLUT extends Resource {
5934
get colors() @ "PiuCLUT_get_colors"
6035
}
6136
Object.freeze(CLUT.prototype);
37+
global.CLUT = CLUT;
6238

6339
// PiuTexture.c
6440

@@ -115,6 +91,7 @@ export class Texture @ "PiuTextureDelete" {
11591
}
11692
}
11793
Object.freeze(Texture.prototype);
94+
global.Texture = Texture;
11895

11996
// PiuDie.c
12097

@@ -134,6 +111,7 @@ var die = {
134111
};
135112
export var Die = Template(die);
136113
Object.freeze(die);
114+
global.Die = Die;
137115

138116
// PiuImage.c
139117

@@ -148,6 +126,7 @@ var image = {
148126
};
149127
export var Image = Template(image);
150128
Object.freeze(image);
129+
global.Image = Image;
151130

152131
// PiuApplication.c
153132

@@ -180,6 +159,7 @@ export function Application($, it = {}) {
180159
Application.prototype = application;
181160
Application.template = template;
182161
Object.freeze(application);
162+
global.Application = Application;
183163

184164
// PiuView.c
185165

@@ -206,34 +186,10 @@ class View @ "PiuViewDelete" {
206186
}
207187
Object.freeze(View.prototype);
208188

209-
global.blendColors = blendColors;
210-
global.hsl = hsl;
211-
global.hsla = hsla;
212-
global.rgb = rgb;
213-
global.rgba = rgba;
214189

215-
global.Skin = Skin;
216-
global.Style = Style;
217-
global.Behavior = Behavior;
218-
global.Transition = Transition;
219190

220-
global.Content = Content;
221-
global.Label = Label;
222-
global.Port = Port;
223-
global.Text = Text;
224-
global.Link = Link;
225191

226-
global.Container = Container;
227-
global.Column = Column;
228-
global.Layout = Layout;
229-
global.Row = Row;
230-
global.Scroller = Scroller;
231192

232193

233-
global.Locals = Locals;
234-
global.Texture = Texture;
235194

236-
global.Die = Die;
237-
global.Image = Image;
238195

239-
global.Application = Application;

modules/piu/MC/piuRegion.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*
1919
*/
2020

21-
#include "piuAll.h"
2221
#include "piuMC.h"
2322

2423
static PiuBoolean SpanEquals(PiuCoordinate* former, PiuCoordinate* current);

modules/piu/MC/piuSound.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*
1919
*/
2020

21-
#include "piuAll.h"
2221
#include "piuMC.h"
2322
#include "mc.defines.h"
2423

modules/piu/MC/piuTexture.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
*
1919
*/
2020

21-
#include "piuAll.h"
2221
#include "piuMC.h"
2322

2423
static void PiuTextureMark(xsMachine* the, void* it, xsMarkRoot markRoot);

0 commit comments

Comments
 (0)