@qooxdoo/framework 7.5.0 → 7.6.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.
- package/Manifest.json +169 -44
- package/bin/deploy/qx +7 -5
- package/lib/compiler/compile-info.json +70 -62
- package/lib/compiler/index.js +3809 -2695
- package/lib/resource/qx/tool/cli/templates/skeleton/desktop/source/class/custom/Application.tmpl.js +7 -7
- package/lib/resource/qx/tool/cli/templates/skeleton/desktop/source/class/custom/test/DemoTest.tmpl.js +10 -10
- package/lib/resource/qx/tool/cli/templates/skeleton/mobile/source/class/custom/Application.tmpl.js +6 -6
- package/lib/resource/qx/tool/cli/templates/skeleton/mobile/source/class/custom/page/Login.tmpl.js +9 -9
- package/lib/resource/qx/tool/cli/templates/skeleton/mobile/source/class/custom/page/Overview.tmpl.js +5 -5
- package/lib/resource/qx/tool/cli/templates/skeleton/package/source/class/custom/demo/Application.tmpl.js +7 -7
- package/lib/resource/qx/tool/cli/templates/skeleton/package/source/class/custom/test/DemoTest.tmpl.js +10 -10
- package/lib/resource/qx/tool/cli/templates/skeleton/server/source/class/custom/Application.tmpl.js +6 -6
- package/lib/resource/qx/tool/cli/templates/skeleton/server/source/class/custom/test/DemoTest.tmpl.js +12 -12
- package/lib/resource/qx/tool/schema/Manifest-1-0-0.json +79 -26
- package/lib/resource/qx/tool/schema/Manifest-2-0-0.json +17 -26
- package/lib/resource/qx/tool/schema/compile-1-0-0.json +40 -53
- package/lib/resource/qx/tool/website/src/about.md +1 -1
- package/package.json +3 -3
- package/source/class/qx/bom/Font.js +36 -0
- package/source/class/qx/bom/webfonts/Validator.js +31 -6
- package/source/class/qx/bom/webfonts/WebFont.js +60 -64
- package/source/class/qx/bom/webfonts/WebFontLoader.js +461 -0
- package/source/class/qx/core/Object.js +1 -1
- package/source/class/qx/data/Array.js +27 -0
- package/source/class/qx/dev/FakeServer.js +1 -1
- package/source/class/qx/event/handler/Focus.js +2 -1
- package/source/class/qx/event/handler/GestureCore.js +1 -1
- package/source/class/qx/test/bom/webfonts/Validator.js +0 -6
- package/source/class/qx/test/core/Environment.js +8 -8
- package/source/class/qx/test/core/Validation.js +2 -2
- package/source/class/qx/test/dev/unit/Requirements.js +6 -6
- package/source/class/qx/test/io/transport/Websocket.js +1 -1
- package/source/class/qx/test/ui/basic/Image.js +3 -3
- package/source/class/qx/test/ui/basic/Label.js +0 -65
- package/source/class/qx/test/ui/form/Field.js +56 -52
- package/source/class/qx/theme/IndigoDark.js +1 -1
- package/source/class/qx/theme/classic/Font.js +7 -23
- package/source/class/qx/theme/iconfont/LoadMaterialIcons.js +2 -4
- package/source/class/qx/theme/iconfont/LoadMaterialIconsOutlined.js +2 -4
- package/source/class/qx/theme/iconfont/LoadMaterialIconsRound.js +2 -4
- package/source/class/qx/theme/iconfont/LoadMaterialIconsSharp.js +2 -4
- package/source/class/qx/theme/iconfont/LoadMaterialIconsTwoTone.js +2 -4
- package/source/class/qx/theme/indigo/DecorationDark.js +30 -0
- package/source/class/qx/theme/indigo/Font.js +8 -15
- package/source/class/qx/theme/manager/Font.js +151 -38
- package/source/class/qx/theme/modern/Font.js +1 -0
- package/source/class/qx/theme/simple/Font.js +3 -1
- package/source/class/qx/theme/tangible/Appearance.js +1 -0
- package/source/class/qx/theme/tangible/Font.js +9 -62
- package/source/class/qx/theme/tangible/Image.js +1 -4
- package/source/class/qx/tool/cli/Application.js +4 -1
- package/source/class/qx/tool/cli/Cli.js +34 -23
- package/source/class/qx/tool/cli/Watch.js +8 -6
- package/source/class/qx/tool/cli/api/CompilerApi.js +8 -0
- package/source/class/qx/tool/cli/commands/Add.js +1 -1
- package/source/class/qx/tool/cli/commands/Compile.js +24 -1
- package/source/class/qx/tool/cli/commands/Config.js +16 -141
- package/source/class/qx/tool/cli/commands/ExportGlyphs.js +134 -0
- package/source/class/qx/tool/cli/commands/Lint.js +1 -1
- package/source/class/qx/tool/cli/commands/Package.js +3 -0
- package/source/class/qx/tool/cli/commands/Pkg.js +1 -1
- package/source/class/qx/tool/cli/commands/Run.js +6 -7
- package/source/class/qx/tool/cli/commands/Serve.js +29 -36
- package/source/class/qx/tool/cli/commands/Test.js +3 -2
- package/source/class/qx/tool/cli/commands/add/Script.js +3 -1
- package/source/class/qx/tool/cli/commands/config/Delete.js +47 -0
- package/source/class/qx/tool/cli/commands/config/Get.js +52 -0
- package/source/class/qx/tool/cli/commands/config/List.js +81 -0
- package/source/class/qx/tool/cli/commands/config/Set.js +61 -0
- package/source/class/qx/tool/cli/commands/package/Install.js +3 -0
- package/source/class/qx/tool/cli/commands/package/Update.js +3 -3
- package/source/class/qx/tool/compiler/Analyser.js +45 -0
- package/source/class/qx/tool/compiler/ClassFile.js +43 -1
- package/source/class/qx/tool/compiler/Console.js +6 -1
- package/source/class/qx/tool/compiler/app/Application.js +19 -0
- package/source/class/qx/tool/compiler/app/Cldr.js +63 -26
- package/source/class/qx/tool/compiler/app/Library.js +51 -2
- package/source/class/qx/tool/compiler/app/ManifestFont.js +181 -0
- package/source/class/qx/tool/compiler/app/WebFont.js +144 -234
- package/source/class/qx/tool/compiler/makers/AppMaker.js +13 -0
- package/source/class/qx/tool/compiler/resources/ImageLoader.js +22 -12
- package/source/class/qx/tool/compiler/resources/Manager.js +2 -2
- package/source/class/qx/tool/compiler/resources/MetaLoader.js +7 -2
- package/source/class/qx/tool/compiler/resources/ResourceLoader.js +21 -0
- package/source/class/qx/tool/compiler/targets/Target.js +186 -67
- package/source/class/qx/tool/migration/M7_5_6.js +75 -0
- package/source/class/qx/tool/utils/Http.js +69 -0
- package/source/class/qx/ui/basic/Image.js +6 -2
- package/source/class/qx/ui/basic/Label.js +20 -38
- package/source/class/qx/ui/core/Widget.js +13 -42
- package/source/class/qx/ui/form/AbstractField.js +8 -2
- package/source/class/qx/ui/form/FileSelectorButton.js +5 -0
- package/source/class/qx/ui/table/pane/FocusIndicator.js +5 -4
- package/source/class/qx/ui/table/pane/Pane.js +14 -0
- package/source/class/qx/ui/table/pane/Scroller.js +3 -3
- package/source/class/qx/ui/virtual/core/Scroller.js +8 -2
- package/source/class/qx/ui/window/Window.js +9 -8
- package/source/resource/qx/iconfont/MaterialIcons/materialicons.json +10912 -0
- package/source/resource/qx/iconfont/MaterialIcons/materialiconsoutlined.json +10967 -0
- package/source/resource/qx/iconfont/MaterialIcons/materialiconsround.json +10992 -0
- package/source/resource/qx/iconfont/MaterialIcons/materialiconssharp.json +10992 -0
- package/source/resource/qx/iconfont/MaterialIcons/materialiconstwotone.json +9947 -0
- package/source/resource/qx/iconfont/MaterialIcons/x.json +10967 -0
- package/source/resource/qx/iconfont/export-glyphs.sh +22 -0
- package/source/resource/qx/mobile/scss/common/_gradients.scss +1 -1
- package/source/resource/qx/tool/cli/templates/skeleton/desktop/source/class/custom/Application.tmpl.js +7 -7
- package/source/resource/qx/tool/cli/templates/skeleton/desktop/source/class/custom/test/DemoTest.tmpl.js +10 -10
- package/source/resource/qx/tool/cli/templates/skeleton/mobile/source/class/custom/Application.tmpl.js +6 -6
- package/source/resource/qx/tool/cli/templates/skeleton/mobile/source/class/custom/page/Login.tmpl.js +9 -9
- package/source/resource/qx/tool/cli/templates/skeleton/mobile/source/class/custom/page/Overview.tmpl.js +5 -5
- package/source/resource/qx/tool/cli/templates/skeleton/package/source/class/custom/demo/Application.tmpl.js +7 -7
- package/source/resource/qx/tool/cli/templates/skeleton/package/source/class/custom/test/DemoTest.tmpl.js +10 -10
- package/source/resource/qx/tool/cli/templates/skeleton/server/source/class/custom/Application.tmpl.js +6 -6
- package/source/resource/qx/tool/cli/templates/skeleton/server/source/class/custom/test/DemoTest.tmpl.js +12 -12
- package/source/resource/qx/tool/schema/Manifest-1-0-0.json +79 -26
- package/source/resource/qx/tool/schema/Manifest-2-0-0.json +17 -26
- package/source/resource/qx/tool/schema/compile-1-0-0.json +40 -53
- package/source/resource/qx/tool/website/src/about.md +1 -1
- package/source/class/qx/bom/webfonts/Manager.js +0 -652
- package/source/class/qx/test/bom/webfonts/Manager.js +0 -238
|
@@ -27,8 +27,13 @@ var log = qx.tool.utils.LogManager.createLog("resource-manager");
|
|
|
27
27
|
qx.Class.define("qx.tool.compiler.resources.ImageLoader", {
|
|
28
28
|
extend: qx.tool.compiler.resources.ResourceLoader,
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Constructor
|
|
32
|
+
*
|
|
33
|
+
* @param {qx.tool.compiler.resources.Manager} manager resource manager
|
|
34
|
+
*/
|
|
35
|
+
construct(manager) {
|
|
36
|
+
super([".png", ".gif", ".jpg", ".jpeg", ".svg"], manager);
|
|
32
37
|
},
|
|
33
38
|
|
|
34
39
|
members: {
|
|
@@ -50,16 +55,18 @@ qx.Class.define("qx.tool.compiler.resources.ImageLoader", {
|
|
|
50
55
|
* @Override
|
|
51
56
|
*/
|
|
52
57
|
matches(filename, library) {
|
|
53
|
-
if (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
library
|
|
57
|
-
.getWebFonts()
|
|
58
|
-
.find(webFont =>
|
|
59
|
-
webFont.getResources().find(resource => resource == filename)
|
|
60
|
-
);
|
|
58
|
+
if (library.isFontAsset(filename)) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
if (filename.endsWith(".svg")) {
|
|
63
|
+
let withoutExt = filename.substring(0, filename.length - 3);
|
|
64
|
+
let manager = this.getManager();
|
|
65
|
+
if (
|
|
66
|
+
["eot", "woff2", "woff", "ttf"].find(
|
|
67
|
+
ext => !!manager.findLibraryForResource(withoutExt + ext)
|
|
68
|
+
)
|
|
69
|
+
) {
|
|
63
70
|
return false;
|
|
64
71
|
}
|
|
65
72
|
}
|
|
@@ -79,7 +86,10 @@ qx.Class.define("qx.tool.compiler.resources.ImageLoader", {
|
|
|
79
86
|
fileInfo.width = dimensions.width;
|
|
80
87
|
fileInfo.height = dimensions.height;
|
|
81
88
|
} catch (ex) {
|
|
82
|
-
|
|
89
|
+
// When we can't get the image size, we don't report it because there are SVG types
|
|
90
|
+
// that have no size (eg fonts) and it's proved quite hard (or impossible) to
|
|
91
|
+
// suppress the warning accurately in those cases. Ultimately, if the image is
|
|
92
|
+
// corrupt it will be found.
|
|
83
93
|
delete fileInfo.width;
|
|
84
94
|
delete fileInfo.height;
|
|
85
95
|
}
|
|
@@ -43,8 +43,8 @@ qx.Class.define("qx.tool.compiler.resources.Manager", {
|
|
|
43
43
|
this.__analyser = analyser;
|
|
44
44
|
this.__dbFilename = analyser.getResDbFilename() || "resource-db.json";
|
|
45
45
|
this.__loaders = [
|
|
46
|
-
new qx.tool.compiler.resources.ImageLoader(),
|
|
47
|
-
new qx.tool.compiler.resources.MetaLoader()
|
|
46
|
+
new qx.tool.compiler.resources.ImageLoader(this),
|
|
47
|
+
new qx.tool.compiler.resources.MetaLoader(this)
|
|
48
48
|
];
|
|
49
49
|
|
|
50
50
|
this.__converters = [
|
|
@@ -23,8 +23,13 @@
|
|
|
23
23
|
qx.Class.define("qx.tool.compiler.resources.MetaLoader", {
|
|
24
24
|
extend: qx.tool.compiler.resources.ResourceLoader,
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Constructor
|
|
28
|
+
*
|
|
29
|
+
* @param {qx.tool.compiler.resources.Manager} manager resource manager
|
|
30
|
+
*/
|
|
31
|
+
construct(manager) {
|
|
32
|
+
super(".meta", manager);
|
|
28
33
|
},
|
|
29
34
|
|
|
30
35
|
members: {
|
|
@@ -28,7 +28,21 @@ qx.Class.define("qx.tool.compiler.resources.ResourceLoader", {
|
|
|
28
28
|
extend: qx.tool.compiler.resources.AbstractMatcher,
|
|
29
29
|
type: "abstract",
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* Constructor
|
|
33
|
+
*
|
|
34
|
+
* @param {String} match the match for the filename
|
|
35
|
+
* @param {qx.tool.compiler.resources.Manager} manager resource manager
|
|
36
|
+
*/
|
|
37
|
+
construct(match, manager) {
|
|
38
|
+
super(match);
|
|
39
|
+
this.__manager = manager;
|
|
40
|
+
},
|
|
41
|
+
|
|
31
42
|
members: {
|
|
43
|
+
/** @type{qx.tool.compiler.resources.Manager} the resource manager this loader belongs to */
|
|
44
|
+
__manager: null,
|
|
45
|
+
|
|
32
46
|
/**
|
|
33
47
|
* Detects whether the file needs to be recompiled/coverted/analysed/ etc; this should
|
|
34
48
|
* not take any time or be asynchronous, if you need to do any real work it should be
|
|
@@ -56,6 +70,13 @@ qx.Class.define("qx.tool.compiler.resources.ResourceLoader", {
|
|
|
56
70
|
*/
|
|
57
71
|
async load(asset) {
|
|
58
72
|
throw new Error("No implementation for " + this.classname + ".compile");
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* @return {qx.tool.compiler.resources.Manager} the manager
|
|
77
|
+
*/
|
|
78
|
+
getManager() {
|
|
79
|
+
return this.__manager;
|
|
59
80
|
}
|
|
60
81
|
}
|
|
61
82
|
});
|
|
@@ -106,6 +106,22 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
|
|
|
106
106
|
check: "Boolean"
|
|
107
107
|
},
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Whether to prefer local fonts instead of CDNs
|
|
111
|
+
*/
|
|
112
|
+
preferLocalFonts: {
|
|
113
|
+
init: false,
|
|
114
|
+
check: "Boolean"
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Types of fonts to be included
|
|
119
|
+
*/
|
|
120
|
+
fontTypes: {
|
|
121
|
+
init: ["woff"],
|
|
122
|
+
check: "Array"
|
|
123
|
+
},
|
|
124
|
+
|
|
109
125
|
/**
|
|
110
126
|
* Whether to add timestamps to all URLs (cache busting)
|
|
111
127
|
*/
|
|
@@ -442,7 +458,7 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
|
|
|
442
458
|
bootPackage.addJavascriptMeta(
|
|
443
459
|
new qx.tool.compiler.targets.meta.Browserify(appMeta)
|
|
444
460
|
);
|
|
445
|
-
}
|
|
461
|
+
}
|
|
446
462
|
|
|
447
463
|
/*
|
|
448
464
|
* Assemble the Parts
|
|
@@ -506,12 +522,10 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
|
|
|
506
522
|
var assetUris = application.getAssetUris(t, rm, appMeta.getEnvironment()); // Save any changes that getAssets collected
|
|
507
523
|
await rm.saveDatabase();
|
|
508
524
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
];
|
|
525
|
+
let cldr = await analyser.getCldr("en");
|
|
526
|
+
await bootPackage.addLocale("C", cldr);
|
|
527
|
+
await this._writeTranslations();
|
|
513
528
|
|
|
514
|
-
var fontCntr = 0;
|
|
515
529
|
var assets = {};
|
|
516
530
|
rm.getAssetsForPaths(assetUris).forEach(asset => {
|
|
517
531
|
bootPackage.addAsset(asset);
|
|
@@ -519,75 +533,180 @@ qx.Class.define("qx.tool.compiler.targets.Target", {
|
|
|
519
533
|
});
|
|
520
534
|
|
|
521
535
|
if (analyser.getApplicationTypes().indexOf("browser") > -1) {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
fonts.forEach(font => {
|
|
535
|
-
fontsToLoad[font.getName()] = {
|
|
536
|
-
font,
|
|
537
|
-
library
|
|
538
|
-
};
|
|
539
|
-
});
|
|
540
|
-
};
|
|
541
|
-
requiredLibs.forEach(libnamespace => {
|
|
542
|
-
var library = analyser.findLibrary(libnamespace);
|
|
543
|
-
if (library != appLibrary) {
|
|
544
|
-
addLibraryFonts(library);
|
|
545
|
-
}
|
|
546
|
-
});
|
|
547
|
-
addLibraryFonts(appLibrary);
|
|
548
|
-
|
|
549
|
-
const loadFont = async (library, font) => {
|
|
550
|
-
try {
|
|
551
|
-
// check if font is asset somewhere
|
|
552
|
-
let res = font.getResources().filter(res => assets[res]);
|
|
553
|
-
if (res.length === 0) {
|
|
554
|
-
qx.tool.compiler.Console.print(
|
|
555
|
-
"qx.tool.compiler.webfonts.noResources",
|
|
556
|
-
font.toString(),
|
|
557
|
-
application.getName(),
|
|
558
|
-
font.getResources().join(",")
|
|
559
|
-
);
|
|
536
|
+
appMeta.addPreBootCode("qx.$$fontBootstrap={};\n");
|
|
537
|
+
await this.__writeDeprecatedWebFonts(application, appMeta, assets);
|
|
538
|
+
await this.__writeManifestFonts(
|
|
539
|
+
application,
|
|
540
|
+
appMeta,
|
|
541
|
+
assets,
|
|
542
|
+
bootPackage
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
await this._writeApplication();
|
|
546
|
+
this.__appMeta = null;
|
|
547
|
+
},
|
|
560
548
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
549
|
+
/**
|
|
550
|
+
* Writes the fonts defined in provides.webfonts
|
|
551
|
+
* @deprecated
|
|
552
|
+
*/
|
|
553
|
+
async __writeDeprecatedWebFonts(application, appMeta, assets) {
|
|
554
|
+
let analyser = application.getAnalyser();
|
|
555
|
+
const requiredLibs = application.getRequiredLibraries();
|
|
564
556
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
557
|
+
// Get a list of all fonts to load; use the font name as a unique identifier, and
|
|
558
|
+
// prioritise the application's library's definitions - this allows the application
|
|
559
|
+
// the opportunity to override the font definitions. This is important when the
|
|
560
|
+
// library uses the open source/free versions of a font but the application
|
|
561
|
+
// developer has purchased the commercial/full version of the font (eg FontAwesome)
|
|
562
|
+
let appLibrary = appMeta.getAppLibrary();
|
|
563
|
+
let fontsToLoad = {};
|
|
564
|
+
const addLibraryFonts = library => {
|
|
565
|
+
var fonts = library.getWebFonts();
|
|
566
|
+
if (!fonts) {
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
fonts.forEach(font => {
|
|
570
|
+
fontsToLoad[font.getName()] = {
|
|
571
|
+
font,
|
|
572
|
+
library
|
|
573
|
+
};
|
|
574
|
+
});
|
|
575
|
+
};
|
|
576
|
+
requiredLibs.forEach(libnamespace => {
|
|
577
|
+
var library = analyser.findLibrary(libnamespace);
|
|
578
|
+
if (library != appLibrary) {
|
|
579
|
+
addLibraryFonts(library);
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
addLibraryFonts(appLibrary);
|
|
583
|
+
|
|
584
|
+
const loadFont = async (library, font) => {
|
|
585
|
+
try {
|
|
586
|
+
// check if font is asset somewhere
|
|
587
|
+
let res = font.getResources().filter(res => assets[res]);
|
|
588
|
+
if (res.length === 0) {
|
|
575
589
|
qx.tool.compiler.Console.print(
|
|
576
|
-
"qx.tool.compiler.webfonts.
|
|
590
|
+
"qx.tool.compiler.webfonts.noResources",
|
|
577
591
|
font.toString(),
|
|
578
|
-
|
|
592
|
+
application.getName(),
|
|
593
|
+
font.getResources().join(",")
|
|
579
594
|
);
|
|
595
|
+
|
|
596
|
+
return;
|
|
580
597
|
}
|
|
581
|
-
|
|
598
|
+
font.setResources(res);
|
|
582
599
|
|
|
583
|
-
|
|
584
|
-
let
|
|
585
|
-
|
|
586
|
-
|
|
600
|
+
await font.generateForTarget(this);
|
|
601
|
+
let resources = await font.generateForApplication(this, application);
|
|
602
|
+
for (var key in resources) {
|
|
603
|
+
appMeta.addResource(key, resources[key]);
|
|
604
|
+
}
|
|
605
|
+
var code = font.getBootstrapCode(this, application);
|
|
606
|
+
if (code) {
|
|
607
|
+
appMeta.addPreBootCode(code);
|
|
608
|
+
}
|
|
609
|
+
} catch (ex) {
|
|
610
|
+
qx.tool.compiler.Console.print(
|
|
611
|
+
"qx.tool.compiler.webfonts.error",
|
|
612
|
+
font.toString(),
|
|
613
|
+
ex.toString()
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
for (let fontName of Object.keys(fontsToLoad)) {
|
|
619
|
+
let { font, library } = fontsToLoad[fontName];
|
|
620
|
+
await loadFont(library, font);
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Writes the fonts defined in provides.fonts
|
|
626
|
+
*/
|
|
627
|
+
async __writeManifestFonts(application, appMeta, assets, bootPackage) {
|
|
628
|
+
let analyser = application.getAnalyser();
|
|
629
|
+
let rm = analyser.getResourceManager();
|
|
630
|
+
|
|
631
|
+
const addResourcesToBuild = resourcePaths => {
|
|
632
|
+
for (let asset of rm.getAssetsForPaths(resourcePaths)) {
|
|
633
|
+
bootPackage.addAsset(asset);
|
|
634
|
+
assets[asset.getFilename()] = asset.toString();
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
|
|
638
|
+
let fontNames = application.getFonts();
|
|
639
|
+
for (let fontName of fontNames) {
|
|
640
|
+
let font = analyser.getFont(fontName);
|
|
641
|
+
if (!font) {
|
|
642
|
+
return;
|
|
643
|
+
}
|
|
644
|
+
let resources = font.getApplicationFontData();
|
|
645
|
+
for (var key in resources) {
|
|
646
|
+
appMeta.addResource(key, resources[key]);
|
|
647
|
+
}
|
|
648
|
+
let fontFaces = font.getFontFaces() || [];
|
|
649
|
+
|
|
650
|
+
// Break out the CSS into local resource files and URLs
|
|
651
|
+
let fontCss = font.getCss() || [];
|
|
652
|
+
let cssUrls = [];
|
|
653
|
+
let cssResources = [];
|
|
654
|
+
for (let urlOrPath of fontCss) {
|
|
655
|
+
if (urlOrPath.match(/^https?:/)) {
|
|
656
|
+
cssUrls.push(urlOrPath);
|
|
657
|
+
} else {
|
|
658
|
+
cssResources.push(urlOrPath);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
// Exclude font files that we do not want to include
|
|
663
|
+
let types = this.getFontTypes();
|
|
664
|
+
let hasLocalFontResources = false;
|
|
665
|
+
let hasUrlFontResources = false;
|
|
666
|
+
if (types.length) {
|
|
667
|
+
for (let fontFace of fontFaces) {
|
|
668
|
+
fontFace.paths = fontFace.paths.filter(filename => {
|
|
669
|
+
let pos = filename.lastIndexOf(".");
|
|
670
|
+
if (pos > -1) {
|
|
671
|
+
let ext = filename.substring(pos + 1);
|
|
672
|
+
if (types.indexOf(ext) > -1) {
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (!filename.match(/^https?:/)) {
|
|
677
|
+
hasLocalFontResources = true;
|
|
678
|
+
} else {
|
|
679
|
+
hasUrlFontResources = true;
|
|
680
|
+
}
|
|
681
|
+
return false;
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// It is important to always prefer local fonts if we have them and are not instructed to prefer CDNs
|
|
687
|
+
let useLocalFonts = cssUrls.length == 0 && !hasUrlFontResources;
|
|
688
|
+
if (
|
|
689
|
+
this.isPreferLocalFonts() &&
|
|
690
|
+
(cssResources.length > 0 || hasLocalFontResources)
|
|
691
|
+
) {
|
|
692
|
+
useLocalFonts = true;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// Make sure we add any CSS and font resource files to the target output
|
|
696
|
+
if (useLocalFonts) {
|
|
697
|
+
addResourcesToBuild(cssResources);
|
|
698
|
+
|
|
699
|
+
for (let fontFace of fontFaces) {
|
|
700
|
+
addResourcesToBuild(fontFace.paths);
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
var code = font.getBootstrapCode(this, application, useLocalFonts);
|
|
705
|
+
|
|
706
|
+
if (code) {
|
|
707
|
+
appMeta.addPreBootCode(code);
|
|
708
|
+
}
|
|
587
709
|
}
|
|
588
|
-
await qx.Promise.all(promises);
|
|
589
|
-
await t._writeApplication();
|
|
590
|
-
this.__appMeta = null;
|
|
591
710
|
},
|
|
592
711
|
|
|
593
712
|
/**
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/* ************************************************************************
|
|
2
|
+
|
|
3
|
+
qooxdoo - the new era of web development
|
|
4
|
+
|
|
5
|
+
http://qooxdoo.org
|
|
6
|
+
|
|
7
|
+
Copyright:
|
|
8
|
+
2023 Zenesis Limited https://www.zenesis.com
|
|
9
|
+
|
|
10
|
+
License:
|
|
11
|
+
MIT: https://opensource.org/licenses/MIT
|
|
12
|
+
See the LICENSE file in the project's top-level directory for details.
|
|
13
|
+
|
|
14
|
+
Authors:
|
|
15
|
+
* John Spackman (@johnspackman)
|
|
16
|
+
|
|
17
|
+
************************************************************************ */
|
|
18
|
+
|
|
19
|
+
const process = require("process");
|
|
20
|
+
const path = require("upath");
|
|
21
|
+
const semver = require("semver");
|
|
22
|
+
const fs = qx.tool.utils.Promisify.fs;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Migration class for updating to v7.5.6
|
|
26
|
+
*/
|
|
27
|
+
qx.Class.define("qx.tool.migration.M7_5_6", {
|
|
28
|
+
extend: qx.tool.migration.BaseMigration,
|
|
29
|
+
members: {
|
|
30
|
+
async migrateManifest() {
|
|
31
|
+
let dryRun = this.getRunner().getDryRun();
|
|
32
|
+
let verbose = this.getRunner().getVerbose();
|
|
33
|
+
// Update all Manifests
|
|
34
|
+
let updateManifest = false;
|
|
35
|
+
for (const manifestModel of await qx.tool.config.Utils.getManifestModels()) {
|
|
36
|
+
manifestModel.set({ warnOnly: true });
|
|
37
|
+
await manifestModel.load();
|
|
38
|
+
let data = manifestModel.getData();
|
|
39
|
+
|
|
40
|
+
if (
|
|
41
|
+
data.provides?.webfonts !== undefined &&
|
|
42
|
+
data.provides?.fonts === undefined
|
|
43
|
+
) {
|
|
44
|
+
if (dryRun) {
|
|
45
|
+
this.markAsPending(
|
|
46
|
+
"provides.webfonts will be replaced with provides.fonts"
|
|
47
|
+
);
|
|
48
|
+
} else {
|
|
49
|
+
this.markAsApplied();
|
|
50
|
+
let fontsData = {};
|
|
51
|
+
data.provides.webfonts.forEach(data => {
|
|
52
|
+
let fontData = (fontsData[data.name] = {});
|
|
53
|
+
["defaultSize", "comparisonString"].forEach(name => {
|
|
54
|
+
let value = data[name];
|
|
55
|
+
if (value !== undefined) {
|
|
56
|
+
fontData[name] = value;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
if (data.resources !== undefined) {
|
|
60
|
+
fontData.sources = data.resources;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
data.provides.fonts = fontsData;
|
|
64
|
+
delete data.provides.webfonts;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// save Manifest file
|
|
69
|
+
if (!dryRun) {
|
|
70
|
+
await manifestModel.save();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/* ************************************************************************
|
|
2
|
+
|
|
3
|
+
qooxdoo - the new era of web development
|
|
4
|
+
|
|
5
|
+
http://qooxdoo.org
|
|
6
|
+
|
|
7
|
+
Copyright:
|
|
8
|
+
2023 Zenesis Limited https://www.zenesis.com
|
|
9
|
+
|
|
10
|
+
License:
|
|
11
|
+
MIT: https://opensource.org/licenses/MIT
|
|
12
|
+
See the LICENSE file in the project's top-level directory for details.
|
|
13
|
+
|
|
14
|
+
Authors:
|
|
15
|
+
* John Spackman (@johnspackman)
|
|
16
|
+
|
|
17
|
+
************************************************************************ */
|
|
18
|
+
|
|
19
|
+
const fs = require("fs");
|
|
20
|
+
const path = require("path");
|
|
21
|
+
const tmp = require("tmp");
|
|
22
|
+
const http = require("http");
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Helper methods for HTTP
|
|
26
|
+
*/
|
|
27
|
+
qx.Class.define("qx.tool.utils.Http", {
|
|
28
|
+
extend: qx.core.Object,
|
|
29
|
+
|
|
30
|
+
statics: {
|
|
31
|
+
/**
|
|
32
|
+
* Downloads a URL into a temporary file
|
|
33
|
+
*
|
|
34
|
+
* @param {String} url URL to download
|
|
35
|
+
* @param {RegEx?} contentTypeRegEx optional regex for the content type
|
|
36
|
+
* @return {String} temporary filename
|
|
37
|
+
*/
|
|
38
|
+
async downloadToTempfile(url, contentTypeRegEx) {
|
|
39
|
+
let tmpFilename = await qx.tool.utils.Promisify.call(cb =>
|
|
40
|
+
tmp.tmpName(cb)
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
await new Promise((resolve, reject) => {
|
|
44
|
+
http.get(url, res => {
|
|
45
|
+
let error;
|
|
46
|
+
const { statusCode } = res;
|
|
47
|
+
const contentType = res.headers["content-type"];
|
|
48
|
+
|
|
49
|
+
if (statusCode !== 200) {
|
|
50
|
+
error = new Error(`Request Failed.\nStatus Code: ${statusCode}`);
|
|
51
|
+
} else if (contentTypeRegEx && !contentTypeRegEx.test(contentType)) {
|
|
52
|
+
error = new Error(`Invalid content-type, received ${contentType}`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (error) {
|
|
56
|
+
res.resume();
|
|
57
|
+
reject(error);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let outFile = fs.createWriteStream(tmpFilename);
|
|
62
|
+
outFile.on("close", () => resolve(tmpFilename));
|
|
63
|
+
res.on("data", chunk => outFile.write(chunk));
|
|
64
|
+
res.on("end", () => outFile.end());
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
@@ -634,7 +634,8 @@ qx.Class.define("qx.ui.basic.Image", {
|
|
|
634
634
|
}
|
|
635
635
|
|
|
636
636
|
// Don't transfer background image when switching from image to icon font
|
|
637
|
-
|
|
637
|
+
var mode = this.__getMode();
|
|
638
|
+
if (mode === "font" || mode === "scaled") {
|
|
638
639
|
delete styles.backgroundImage;
|
|
639
640
|
}
|
|
640
641
|
|
|
@@ -785,7 +786,10 @@ qx.Class.define("qx.ui.basic.Image", {
|
|
|
785
786
|
if (this.getScale()) {
|
|
786
787
|
el.setStyle("fontSize", (width > height ? height : width) + "px");
|
|
787
788
|
} else {
|
|
788
|
-
var source = qx.util.AliasManager.getInstance().resolve(
|
|
789
|
+
var source = qx.util.AliasManager.getInstance().resolve(
|
|
790
|
+
this.getSource()
|
|
791
|
+
);
|
|
792
|
+
|
|
789
793
|
var sparts = source.split("/");
|
|
790
794
|
var font = this.__getFont(source);
|
|
791
795
|
var size = parseInt(sparts[2] || font.getSize());
|
|
@@ -318,15 +318,23 @@ qx.Class.define("qx.ui.basic.Label", {
|
|
|
318
318
|
// Apply
|
|
319
319
|
var styles;
|
|
320
320
|
if (value) {
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
321
|
+
if (qx.lang.Type.isString(value)) {
|
|
322
|
+
value = qx.theme.manager.Font.getInstance().resolve(value);
|
|
323
|
+
}
|
|
324
|
+
this.__font = value;
|
|
325
|
+
if (
|
|
326
|
+
this.__font instanceof qx.bom.webfonts.WebFont &&
|
|
327
|
+
!this.__font.isValid()
|
|
328
|
+
) {
|
|
329
|
+
this.__webfontListenerId = this.__font.addListener(
|
|
330
|
+
"changeStatus",
|
|
331
|
+
evt => {
|
|
332
|
+
if (evt.getData().valid) {
|
|
333
|
+
this.__invalidContentSize = true;
|
|
334
|
+
qx.ui.core.queue.Layout.add(this);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
);
|
|
330
338
|
}
|
|
331
339
|
styles = this.__font.getStyles();
|
|
332
340
|
} else {
|
|
@@ -462,10 +470,10 @@ qx.Class.define("qx.ui.basic.Label", {
|
|
|
462
470
|
|
|
463
471
|
// property apply
|
|
464
472
|
_applyBreakWithinWords(value, old) {
|
|
465
|
-
|
|
466
|
-
|
|
473
|
+
this.getContentElement().setStyle(
|
|
474
|
+
"wordBreak",
|
|
467
475
|
this.isRich() && value ? "break-all" : "normal"
|
|
468
|
-
|
|
476
|
+
);
|
|
469
477
|
},
|
|
470
478
|
|
|
471
479
|
/**
|
|
@@ -485,32 +493,6 @@ qx.Class.define("qx.ui.basic.Label", {
|
|
|
485
493
|
false: null
|
|
486
494
|
}),
|
|
487
495
|
|
|
488
|
-
/**
|
|
489
|
-
* Triggers layout recalculation after a web font was loaded
|
|
490
|
-
*
|
|
491
|
-
* @param ev {qx.event.type.Data} "changeStatus" event
|
|
492
|
-
*/
|
|
493
|
-
_onWebFontStatusChange(ev) {
|
|
494
|
-
if (ev.getData().valid === true) {
|
|
495
|
-
// safari has trouble resizing, adding it again fixed the issue [BUG #8786]
|
|
496
|
-
if (
|
|
497
|
-
qx.core.Environment.get("browser.name") == "safari" &&
|
|
498
|
-
parseFloat(qx.core.Environment.get("browser.version")) >= 8
|
|
499
|
-
) {
|
|
500
|
-
window.setTimeout(
|
|
501
|
-
function () {
|
|
502
|
-
this.__invalidContentSize = true;
|
|
503
|
-
qx.ui.core.queue.Layout.add(this);
|
|
504
|
-
}.bind(this),
|
|
505
|
-
0
|
|
506
|
-
);
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
this.__invalidContentSize = true;
|
|
510
|
-
qx.ui.core.queue.Layout.add(this);
|
|
511
|
-
}
|
|
512
|
-
},
|
|
513
|
-
|
|
514
496
|
// property apply
|
|
515
497
|
_applyValue: qx.core.Environment.select("qx.dynlocale", {
|
|
516
498
|
true(value, old) {
|