alloy 3.0.0 → 3.0.1
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/Alloy/builtins/string.js +1 -4
- package/Alloy/commands/compile/ast/controller.js +52 -27
- package/Alloy/commands/compile/parsers/Ti.UI.ActivityIndicator.js +9 -0
- package/Alloy/commands/compile/parsers/Ti.UI.Column.js +9 -0
- package/Alloy/commands/compile/parsers/Ti.UI.MaskedImage.js +9 -0
- package/Alloy/commands/compile/parsers/Ti.UI.Notification.js +9 -0
- package/Alloy/commands/compile/parsers/Ti.UI.ProgressBar.js +9 -0
- package/Alloy/commands/compile/parsers/Ti.UI.RefreshControl.js +9 -0
- package/Alloy/commands/compile/parsers/Ti.UI.Row.js +9 -0
- package/Alloy/commands/compile/parsers/Ti.UI.SearchBar.js +9 -0
- package/Alloy/commands/compile/parsers/Ti.UI.Shortcut.js +9 -0
- package/Alloy/commands/compile/parsers/Ti.UI.ShortcutItem.js +9 -0
- package/Alloy/commands/new/index.js +1 -1
- package/Alloy/common/constants.js +2 -11
- package/Alloy/lib/alloy/sync/localStorage.js +0 -8
- package/Alloy/lib/alloy/sync/sql.js +2 -2
- package/Alloy/plugin/plugin.py +1 -123
- package/Alloy/template/lib/alloy.js +0 -7
- package/package.json +1 -1
- package/platforms/windows/index.js +0 -4
- package/samples/apps/advanced/complex_styling/config.json +1 -4
- package/samples/apps/advanced/custom_tss_queries/styles/index.tss +0 -6
- package/samples/apps/advanced/device_query/specs/index.js +1 -12
- package/samples/apps/advanced/device_query/styles/index.tss +0 -12
- package/samples/apps/advanced/form_factor/views/index.xml +1 -7
- package/samples/apps/advanced/inheritance/controllers/index.js +4 -8
- package/samples/apps/advanced/inheritance/specs/baseDialog.js +2 -2
- package/samples/apps/advanced/master_detail/specs/row.js +3 -3
- package/samples/apps/advanced/proxy_property_requires/widgets/com.foo.widget/views/section.xml +3 -3
- package/samples/apps/advanced/proxy_property_requires/widgets/com.foo.widget/widget.json +2 -2
- package/samples/apps/advanced/require_children/widgets/alloy.container/widget.json +2 -2
- package/samples/apps/advanced/themes/specs/dialog.js +1 -18
- package/samples/apps/advanced/themes/specs/index.js +1 -45
- package/samples/apps/advanced/theming_widgets/widgets/starrating/widget.json +2 -2
- package/samples/apps/basics/builtins/specs/index.js +2 -2
- package/samples/apps/basics/config_json/config.json +1 -4
- package/samples/apps/basics/global_style/specs/item.js +2 -2
- package/samples/apps/basics/simple/specs/index.js +2 -2
- package/samples/apps/models/binding_tableview/controllers/tab_1.js +2 -2
- package/samples/apps/models/binding_tableview/controllers/tab_2.js +2 -2
- package/samples/apps/models/binding_tableview/controllers/tab_3.js +2 -2
- package/samples/apps/models/binding_tableview/controllers/tab_4.js +2 -2
- package/samples/apps/ui/buttonbar/views/index.xml +1 -1
- package/samples/apps/ui/switch/views/index.xml +2 -2
- package/samples/apps/widgets/basic/widgets/com.foo.widget/widget.json +2 -2
- package/samples/apps/widgets/complex/widgets/com.appcelerator.loading/widget.json +1 -1
- package/samples/apps/widgets/complex/widgets/com.testing.searchForBooks/widget.json +1 -1
- package/samples/apps/widgets/models/widgets/alloy.datatable/widget.json +1 -1
- package/samples/apps/widgets/wpath/widgets/com.test.hellobutton/widget.json +1 -1
- package/test/specs/new.js +0 -2
- package/test/specs/optimizer.js +0 -2
package/Alloy/builtins/string.js
CHANGED
|
@@ -64,10 +64,7 @@ exports.lcfirst = function (text) {
|
|
|
64
64
|
* @param {String} amount Amount to format.
|
|
65
65
|
* @return {String} Amount formatted as a currency value.
|
|
66
66
|
*/
|
|
67
|
-
exports.formatCurrency =
|
|
68
|
-
var num = isNaN(amount) || amount === '' || amount === null ? 0.00 : amount;
|
|
69
|
-
return '$' + parseFloat(num).toFixed(2);
|
|
70
|
-
};
|
|
67
|
+
exports.formatCurrency = String.formatCurrency;
|
|
71
68
|
|
|
72
69
|
|
|
73
70
|
/**
|
|
@@ -13,13 +13,22 @@ let GENCODE_OPTIONS = {
|
|
|
13
13
|
exports.processController = function(code, file, isProduction = false) {
|
|
14
14
|
var baseController = '',
|
|
15
15
|
moduleCodes = '',
|
|
16
|
-
newCode = ''
|
|
17
|
-
exportSpecifiers = [];
|
|
16
|
+
newCode = '';
|
|
18
17
|
|
|
19
18
|
if (isProduction) {
|
|
20
19
|
GENCODE_OPTIONS.retainLines = false;
|
|
21
20
|
}
|
|
22
21
|
|
|
22
|
+
function buildExportAssignment(exportedName, localName) {
|
|
23
|
+
return types.expressionStatement(
|
|
24
|
+
types.assignmentExpression(
|
|
25
|
+
'=',
|
|
26
|
+
types.memberExpression(types.identifier('exports'), types.identifier(exportedName)),
|
|
27
|
+
types.identifier(localName)
|
|
28
|
+
)
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
23
32
|
try {
|
|
24
33
|
var ast = babylon.parse(code, { sourceFilename: file, sourceType: 'unambiguous' });
|
|
25
34
|
|
|
@@ -55,38 +64,54 @@ exports.processController = function(code, file, isProduction = false) {
|
|
|
55
64
|
|
|
56
65
|
ExportNamedDeclaration: function(path) {
|
|
57
66
|
var node = path.node;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
67
|
+
|
|
68
|
+
// Re-exports from another module (e.g. `export { foo } from './bar'`) are true
|
|
69
|
+
// module-level constructs — hoist them out of the controller body.
|
|
70
|
+
if (node.source) {
|
|
71
|
+
moduleCodes += generate(node, GENCODE_OPTIONS).code;
|
|
72
|
+
path.remove();
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// `export function show() {}`, `export const show = ...`, `export class X {}`
|
|
77
|
+
if (node.declaration) {
|
|
78
|
+
var decl = node.declaration;
|
|
79
|
+
var replacements = [decl];
|
|
80
|
+
if (decl.type === 'FunctionDeclaration' || decl.type === 'ClassDeclaration') {
|
|
81
|
+
if (decl.id && decl.id.name) {
|
|
82
|
+
replacements.push(buildExportAssignment(decl.id.name, decl.id.name));
|
|
63
83
|
}
|
|
64
|
-
})
|
|
84
|
+
} else if (decl.type === 'VariableDeclaration') {
|
|
85
|
+
decl.declarations.forEach(function (d) {
|
|
86
|
+
if (d.id && d.id.name) {
|
|
87
|
+
replacements.push(buildExportAssignment(d.id.name, d.id.name));
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
path.replaceWithMultiple(replacements);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// `export { show }` or `export { show as displayShow }` — locally declared
|
|
96
|
+
// bindings get attached to the controller's local `exports` object.
|
|
97
|
+
if (node.specifiers && node.specifiers.length !== 0) {
|
|
98
|
+
var assignments = node.specifiers
|
|
99
|
+
.filter(function (specifier) { return specifier.local && specifier.local.name; })
|
|
100
|
+
.map(function (specifier) {
|
|
101
|
+
var localName = specifier.local.name;
|
|
102
|
+
var exportedName = (specifier.exported && specifier.exported.name) || localName;
|
|
103
|
+
return buildExportAssignment(exportedName, localName);
|
|
104
|
+
});
|
|
105
|
+
path.replaceWithMultiple(assignments);
|
|
106
|
+
return;
|
|
65
107
|
}
|
|
108
|
+
|
|
109
|
+
// Fallback: leave as-is at module level.
|
|
66
110
|
moduleCodes += generate(node, GENCODE_OPTIONS).code;
|
|
67
111
|
path.remove();
|
|
68
112
|
}
|
|
69
113
|
}, path.scope);
|
|
70
114
|
|
|
71
|
-
if (exportSpecifiers.length > 0) {
|
|
72
|
-
traverse(ast, {
|
|
73
|
-
enter: function(path) {
|
|
74
|
-
var node = path.node,
|
|
75
|
-
name;
|
|
76
|
-
if (node.type === 'VariableDeclaration') {
|
|
77
|
-
name = node.declarations[0].id.name;
|
|
78
|
-
} else if (node.type === 'FunctionDeclaration' || node.type === 'ClassDeclaration') {
|
|
79
|
-
name = node.id.name;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (exportSpecifiers.indexOf(name) !== -1) {
|
|
83
|
-
moduleCodes += generate(node, GENCODE_OPTIONS).code;
|
|
84
|
-
path.remove();
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
115
|
newCode = generate(ast, GENCODE_OPTIONS).code;
|
|
91
116
|
} catch (e) {
|
|
92
117
|
U.dieWithCodeFrame('Error generating AST for "' + file + '". Unexpected token at line ' + e.loc.line + ' column ' + e.loc.column, e.loc, code);
|
|
@@ -260,7 +260,7 @@ function getPaths(project, templateName, testapp) {
|
|
|
260
260
|
// alloy paths
|
|
261
261
|
alloy: alloy,
|
|
262
262
|
template: path.join(alloy, 'template'),
|
|
263
|
-
readme: fs.existsSync(readMeFile) ? readMeFile : path.join(template, 'README'),
|
|
263
|
+
readme: readMeFile != undefined && fs.existsSync(readMeFile) ? readMeFile : path.join(template, 'README'),
|
|
264
264
|
appTemplate: (!testapp) ? customAppDir || path.join(projectTemplates, templateName, 'app') : path.join(sampleAppsDir, testapp),
|
|
265
265
|
projectTemplate: (!testapp) ? customTemplateDir || path.join(projectTemplates, templateName) : path.join(sampleAppsDir, testapp),
|
|
266
266
|
|
|
@@ -152,9 +152,7 @@ var NS_ALLOY = 'Alloy',
|
|
|
152
152
|
NS_TI_MEDIA = 'Ti.Media',
|
|
153
153
|
NS_TI_UI_IOS = 'Ti.UI.iOS',
|
|
154
154
|
NS_TI_UI_IPAD = 'Ti.UI.iPad',
|
|
155
|
-
NS_TI_UI_IPHONE = 'Ti.UI.iPhone'
|
|
156
|
-
NS_TI_UI_MOBILEWEB = 'Ti.UI.MobileWeb',
|
|
157
|
-
NS_TI_UI_WINDOWS = 'Ti.UI.Windows';
|
|
155
|
+
NS_TI_UI_IPHONE = 'Ti.UI.iPhone';
|
|
158
156
|
|
|
159
157
|
exports.IMPLICIT_NAMESPACES = {
|
|
160
158
|
// Alloy
|
|
@@ -217,16 +215,9 @@ exports.IMPLICIT_NAMESPACES = {
|
|
|
217
215
|
Popover: NS_TI_UI_IPAD,
|
|
218
216
|
|
|
219
217
|
// Ti.UI.iPhone
|
|
220
|
-
NavigationGroup:
|
|
221
|
-
NS_TI_UI_MOBILEWEB : NS_TI_UI_IPHONE,
|
|
218
|
+
NavigationGroup: NS_TI_UI_IPHONE,
|
|
222
219
|
StatusBar: NS_TI_UI_IPHONE,
|
|
223
220
|
|
|
224
|
-
// Ti.UI.Windows
|
|
225
|
-
CommandBar: NS_TI_UI_WINDOWS,
|
|
226
|
-
AppBarButton: NS_TI_UI_WINDOWS,
|
|
227
|
-
AppBarToggleButton: NS_TI_UI_WINDOWS,
|
|
228
|
-
AppBarSeparator: NS_TI_UI_WINDOWS,
|
|
229
|
-
|
|
230
221
|
// Ti.UI.Window
|
|
231
222
|
LeftNavButton: 'Ti.UI.Window',
|
|
232
223
|
RightNavButton: 'Ti.UI.Window',
|
|
@@ -11,12 +11,6 @@ function guid() {
|
|
|
11
11
|
return (S4() + S4() + '-' + S4() + '-' + S4() + '-' + S4() + '-' + S4() + S4() + S4());
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
function InitAdapter() {
|
|
15
|
-
if (!OS_MOBILEWEB) {
|
|
16
|
-
throw 'localStorage persistence supported only with MobileWeb.';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
14
|
function Sync(method, model, opts) {
|
|
21
15
|
var name = model.config.adapter.collection_name,
|
|
22
16
|
data = model.config.data,
|
|
@@ -86,8 +80,6 @@ module.exports.beforeModelCreate = function(config) {
|
|
|
86
80
|
|
|
87
81
|
config.data = {}; // for localStorage or case where entire collection is needed to maintain store
|
|
88
82
|
|
|
89
|
-
InitAdapter();
|
|
90
|
-
|
|
91
83
|
return config;
|
|
92
84
|
};
|
|
93
85
|
|
|
@@ -471,8 +471,8 @@ module.exports.beforeModelCreate = function(config, name) {
|
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
// check platform compatibility
|
|
474
|
-
if (
|
|
475
|
-
throw 'No support for Titanium.Database
|
|
474
|
+
if (typeof Ti.Database === 'undefined') {
|
|
475
|
+
throw 'No support for Titanium.Database.';
|
|
476
476
|
}
|
|
477
477
|
|
|
478
478
|
// install database file, if specified
|
package/Alloy/plugin/plugin.py
CHANGED
|
@@ -1,123 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import subprocess
|
|
4
|
-
|
|
5
|
-
def check_output(*popenargs, **kwargs):
|
|
6
|
-
r"""Run command with arguments and return its output as a byte string.
|
|
7
|
-
|
|
8
|
-
Backported from Python 2.7 as it's implemented as pure python on stdlib.
|
|
9
|
-
|
|
10
|
-
>>> check_output(['/usr/bin/python', '--version'])
|
|
11
|
-
Python 2.6.2
|
|
12
|
-
"""
|
|
13
|
-
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
|
|
14
|
-
output, unused_err = process.communicate()
|
|
15
|
-
retcode = process.poll()
|
|
16
|
-
if retcode:
|
|
17
|
-
cmd = kwargs.get("args")
|
|
18
|
-
if cmd is None:
|
|
19
|
-
cmd = popenargs[0]
|
|
20
|
-
error = subprocess.CalledProcessError(retcode, cmd)
|
|
21
|
-
error.output = output
|
|
22
|
-
raise error
|
|
23
|
-
return output
|
|
24
|
-
|
|
25
|
-
def compile(config):
|
|
26
|
-
paths = {}
|
|
27
|
-
binaries = ["alloy","node"]
|
|
28
|
-
|
|
29
|
-
dotAlloy = os.path.abspath(os.path.join(config['project_dir'], 'build', '.alloynewcli'))
|
|
30
|
-
if os.path.exists(dotAlloy):
|
|
31
|
-
print "[DEBUG] build/.alloynewcli file found, skipping plugin..."
|
|
32
|
-
os.remove(dotAlloy)
|
|
33
|
-
else:
|
|
34
|
-
for binary in binaries:
|
|
35
|
-
try:
|
|
36
|
-
# see if the environment variable is defined
|
|
37
|
-
paths[binary] = os.environ["ALLOY_" + ("NODE_" if binary == "node" else "") + "PATH"]
|
|
38
|
-
except KeyError as ex:
|
|
39
|
-
# next try PATH, and then our guess paths
|
|
40
|
-
if sys.platform == "darwin" or sys.platform.startswith('linux'):
|
|
41
|
-
userPath = os.environ["HOME"]
|
|
42
|
-
guessPaths = [
|
|
43
|
-
"/usr/local/bin/"+binary,
|
|
44
|
-
"/opt/local/bin/"+binary,
|
|
45
|
-
userPath+"/local/bin/"+binary,
|
|
46
|
-
"/opt/bin/"+binary,
|
|
47
|
-
"/usr/bin/"+binary,
|
|
48
|
-
"/usr/local/share/npm/bin/"+binary
|
|
49
|
-
]
|
|
50
|
-
|
|
51
|
-
try:
|
|
52
|
-
binaryPath = check_output(["which",binary], stderr=subprocess.STDOUT).strip()
|
|
53
|
-
print "[DEBUG] %s installed at '%s'" % (binary,binaryPath)
|
|
54
|
-
except:
|
|
55
|
-
print "[WARN] Couldn't find %s on your PATH:" % binary
|
|
56
|
-
print "[WARN] %s" % os.environ["PATH"]
|
|
57
|
-
print "[WARN]"
|
|
58
|
-
print "[WARN] Checking for %s in a few default locations:" % binary
|
|
59
|
-
for p in guessPaths:
|
|
60
|
-
sys.stdout.write("[WARN] %s -> " % p)
|
|
61
|
-
if os.path.exists(p):
|
|
62
|
-
binaryPath = p
|
|
63
|
-
print "FOUND"
|
|
64
|
-
break
|
|
65
|
-
else:
|
|
66
|
-
print "not found"
|
|
67
|
-
binaryPath = None
|
|
68
|
-
|
|
69
|
-
if binaryPath is None:
|
|
70
|
-
print "[ERROR] Couldn't find %s" % binary
|
|
71
|
-
sys.exit(1)
|
|
72
|
-
else:
|
|
73
|
-
paths[binary] = binaryPath
|
|
74
|
-
|
|
75
|
-
# no guesses on windows, just use the PATH
|
|
76
|
-
elif sys.platform == "win32":
|
|
77
|
-
paths["alloy"] = "alloy.cmd"
|
|
78
|
-
|
|
79
|
-
f = os.path.abspath(os.path.join(config['project_dir'], 'app'))
|
|
80
|
-
if os.path.exists(f):
|
|
81
|
-
print "[INFO] alloy app found at %s" % f
|
|
82
|
-
rd = os.path.abspath(os.path.join(config['project_dir'], 'Resources'))
|
|
83
|
-
|
|
84
|
-
devicefamily = 'none'
|
|
85
|
-
simtype = 'none'
|
|
86
|
-
version = '0'
|
|
87
|
-
deploytype = 'development'
|
|
88
|
-
|
|
89
|
-
if config['platform']==u'ios':
|
|
90
|
-
version = config['iphone_version']
|
|
91
|
-
devicefamily = config['devicefamily']
|
|
92
|
-
deploytype = config['deploytype']
|
|
93
|
-
if config['platform']==u'android':
|
|
94
|
-
builder = config['android_builder']
|
|
95
|
-
version = builder.tool_api_level
|
|
96
|
-
deploytype = config['deploy_type']
|
|
97
|
-
if config['platform']==u'mobileweb':
|
|
98
|
-
builder = config['mobileweb_builder']
|
|
99
|
-
deploytype = config['deploytype']
|
|
100
|
-
|
|
101
|
-
cfg = "platform=%s,version=%s,simtype=%s,devicefamily=%s,deploytype=%s," % (config['platform'],version,simtype,devicefamily,deploytype)
|
|
102
|
-
|
|
103
|
-
if sys.platform == "win32":
|
|
104
|
-
cmd = [paths["alloy"], "compile", f, "--no-colors", "--config", cfg]
|
|
105
|
-
else:
|
|
106
|
-
cmd = [paths["node"], paths["alloy"], "compile", f, "--no-colors", "--config", cfg]
|
|
107
|
-
|
|
108
|
-
print "[INFO] Executing Alloy compile:"
|
|
109
|
-
print "[INFO] %s" % " ".join(cmd)
|
|
110
|
-
|
|
111
|
-
try:
|
|
112
|
-
print check_output(cmd, stderr=subprocess.STDOUT)
|
|
113
|
-
except subprocess.CalledProcessError as ex:
|
|
114
|
-
if hasattr(ex, 'output'):
|
|
115
|
-
print ex.output
|
|
116
|
-
print "[ERROR] Alloy compile failed"
|
|
117
|
-
retcode = 1
|
|
118
|
-
if hasattr(ex, 'returncode'):
|
|
119
|
-
retcode = ex.returncode
|
|
120
|
-
sys.exit(retcode)
|
|
121
|
-
except EnvironmentError as ex:
|
|
122
|
-
print "[ERROR] Unexpected error with Alloy compiler plugin: %s" % ex.strerror
|
|
123
|
-
sys.exit(2)
|
|
1
|
+
#
|
|
@@ -32,7 +32,6 @@ exports._ = _;
|
|
|
32
32
|
exports.Backbone = Backbone;
|
|
33
33
|
|
|
34
34
|
var DEFAULT_WIDGET = 'widget';
|
|
35
|
-
var MW320_CHECK = OS_MOBILEWEB;
|
|
36
35
|
var IDENTITY_TRANSFORM = OS_ANDROID ? (Ti.UI.createMatrix2D ? Ti.UI.createMatrix2D() : Ti.UI.create2DMatrix()) : undefined;
|
|
37
36
|
var RESET = {
|
|
38
37
|
bottom: null,
|
|
@@ -318,8 +317,6 @@ exports.createStyle = function(controller, opts, defaults) {
|
|
|
318
317
|
styleFinal[CONST.CLASS_PROPERTY] = classes;
|
|
319
318
|
styleFinal[CONST.APINAME_PROPERTY] = apiName;
|
|
320
319
|
|
|
321
|
-
if (MW320_CHECK) { delete styleFinal[CONST.APINAME_PROPERTY]; }
|
|
322
|
-
|
|
323
320
|
return defaults ? _.defaults(styleFinal, defaults) : styleFinal;
|
|
324
321
|
};
|
|
325
322
|
|
|
@@ -337,7 +334,6 @@ exports.addClass = function(controller, proxy, classes, opts) {
|
|
|
337
334
|
// make sure we actually have classes to add
|
|
338
335
|
if (!classes) {
|
|
339
336
|
if (opts) {
|
|
340
|
-
if (MW320_CHECK) { delete opts.apiName; }
|
|
341
337
|
proxy.applyProperties(opts);
|
|
342
338
|
}
|
|
343
339
|
return;
|
|
@@ -351,7 +347,6 @@ exports.addClass = function(controller, proxy, classes, opts) {
|
|
|
351
347
|
// make sure we actually added classes before processing styles
|
|
352
348
|
if (beforeLen === newClasses.length) {
|
|
353
349
|
if (opts) {
|
|
354
|
-
if (MW320_CHECK) { delete opts.apiName; }
|
|
355
350
|
proxy.applyProperties(opts);
|
|
356
351
|
}
|
|
357
352
|
return;
|
|
@@ -369,7 +364,6 @@ exports.removeClass = function(controller, proxy, classes, opts) {
|
|
|
369
364
|
// make sure there's classes to remove before processing
|
|
370
365
|
if (!beforeLen || !classes.length) {
|
|
371
366
|
if (opts) {
|
|
372
|
-
if (MW320_CHECK) { delete opts.apiName; }
|
|
373
367
|
proxy.applyProperties(opts);
|
|
374
368
|
}
|
|
375
369
|
return;
|
|
@@ -381,7 +375,6 @@ exports.removeClass = function(controller, proxy, classes, opts) {
|
|
|
381
375
|
// make sure there was actually a difference before processing
|
|
382
376
|
if (beforeLen === newClasses.length) {
|
|
383
377
|
if (opts) {
|
|
384
|
-
if (MW320_CHECK) { delete opts.apiName; }
|
|
385
378
|
proxy.applyProperties(opts);
|
|
386
379
|
}
|
|
387
380
|
return;
|
package/package.json
CHANGED
|
@@ -37,12 +37,6 @@
|
|
|
37
37
|
"#title2[platform=ios if=Alloy.Globals.someProperty]": {
|
|
38
38
|
text: "Platform: iOS, Alloy.Globals.someProperty==true"
|
|
39
39
|
}
|
|
40
|
-
"#title2[platform=mobileweb if=Alloy.Globals.someProperty]": {
|
|
41
|
-
text: "Platform: MobileWeb, Alloy.Globals.someProperty==true"
|
|
42
|
-
}
|
|
43
|
-
"#title2[platform=windows if=Alloy.Globals.someProperty]": {
|
|
44
|
-
text: "Platform: Windows, Alloy.Globals.someProperty==true"
|
|
45
|
-
}
|
|
46
40
|
|
|
47
41
|
/* ID selector overrides other selectors if platform is iOS */
|
|
48
42
|
"#title3":{
|
|
@@ -9,12 +9,7 @@ module.exports = function($) {
|
|
|
9
9
|
bgColor = '#0f0';
|
|
10
10
|
} else if (OS_IOS) {
|
|
11
11
|
bgColor = '#f00';
|
|
12
|
-
} else if (OS_MOBILEWEB) {
|
|
13
|
-
bgColor = '#00f';
|
|
14
12
|
}
|
|
15
|
-
// else if (OS_BLACKBERRY) {
|
|
16
|
-
// bgColor = '#0ff';
|
|
17
|
-
// }
|
|
18
13
|
|
|
19
14
|
validateUiComponent($, 'win', {
|
|
20
15
|
api: 'Ti.UI.Window',
|
|
@@ -34,12 +29,6 @@ module.exports = function($) {
|
|
|
34
29
|
color = '#000';
|
|
35
30
|
} else if (OS_IOS) {
|
|
36
31
|
text = Alloy.isTablet ? 'iPad' : 'iPhone';
|
|
37
|
-
} else if (OS_MOBILEWEB) {
|
|
38
|
-
text = 'Mobileweb';
|
|
39
|
-
// } else if (OS_BLACKBERRY) {
|
|
40
|
-
// text = 'Blackberry';
|
|
41
|
-
} else if (OS_WINDOWS) {
|
|
42
|
-
text = 'Windows';
|
|
43
32
|
}
|
|
44
33
|
|
|
45
34
|
validateUiComponent($, 'osLabel', {
|
|
@@ -50,7 +39,7 @@ module.exports = function($) {
|
|
|
50
39
|
width: Ti.UI.SIZE,
|
|
51
40
|
textAlign: 'center',
|
|
52
41
|
font: {
|
|
53
|
-
fontSize: (Alloy.isTablet ? 96 : 48)
|
|
42
|
+
fontSize: (Alloy.isTablet ? 96 : 48),
|
|
54
43
|
fontWeight: 'bold'
|
|
55
44
|
},
|
|
56
45
|
text: text,
|
|
@@ -13,12 +13,6 @@
|
|
|
13
13
|
<Label id="platformLabel" platform="android" formFactor="handheld">android handheld</Label>
|
|
14
14
|
<Label id="platformLabel" platform="ios" formFactor="tablet">ipad</Label>
|
|
15
15
|
<Label id="platformLabel" platform="ios" formFactor="handheld">iphone</Label>
|
|
16
|
-
<Label id="platformLabel" platform="blackberry" formFactor="tablet">blackberry tablet</Label>
|
|
17
|
-
<Label id="platformLabel" platform="blackberry" formFactor="handheld">blackberry handheld</Label>
|
|
18
|
-
<Label id="platformLabel" platform="mobileweb" formFactor="tablet">mobileweb tablet</Label>
|
|
19
|
-
<Label id="platformLabel" platform="mobileweb" formFactor="handheld">mobileweb handheld</Label>
|
|
20
|
-
<Label id="platformLabel" platform="windows" formFactor="handheld">windows handheld</Label>
|
|
21
|
-
<Label id="platformLabel" platform="windows" formFactor="tablet">windows tablet</Label>
|
|
22
16
|
</View>
|
|
23
17
|
</Window>
|
|
24
|
-
</Alloy>
|
|
18
|
+
</Alloy>
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
function openDialog(e) {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
Alloy.createController(e.source.title, {
|
|
6
|
-
message: 'Opened ' + e.source.title
|
|
7
|
-
}).openDialog($.index);
|
|
8
|
-
}
|
|
2
|
+
Alloy.createController(e.source.title, {
|
|
3
|
+
message: 'Opened ' + e.source.title
|
|
4
|
+
}).openDialog($.index);
|
|
9
5
|
}
|
|
10
6
|
|
|
11
7
|
$.index.open();
|
|
@@ -13,4 +9,4 @@ $.index.open();
|
|
|
13
9
|
// runtime unit tests
|
|
14
10
|
if (!ENV_PROD) {
|
|
15
11
|
require('specs/index')($);
|
|
16
|
-
}
|
|
12
|
+
}
|
|
@@ -41,7 +41,7 @@ module.exports = function($, opts) {
|
|
|
41
41
|
top: 10,
|
|
42
42
|
height: Ti.UI.SIZE,
|
|
43
43
|
font: {
|
|
44
|
-
fontSize:
|
|
44
|
+
fontSize: '16dp'
|
|
45
45
|
},
|
|
46
46
|
textAlign: 'center',
|
|
47
47
|
text: opts.message,
|
|
@@ -60,4 +60,4 @@ module.exports = function($, opts) {
|
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
launchTests();
|
|
63
|
-
};
|
|
63
|
+
};
|
|
@@ -22,7 +22,7 @@ module.exports = function($, opts) {
|
|
|
22
22
|
top: '5dp',
|
|
23
23
|
left: '10dp',
|
|
24
24
|
font: {
|
|
25
|
-
fontSize:
|
|
25
|
+
fontSize: '24dp',
|
|
26
26
|
fontWeight: 'bold'
|
|
27
27
|
},
|
|
28
28
|
id: 'name'
|
|
@@ -38,7 +38,7 @@ module.exports = function($, opts) {
|
|
|
38
38
|
bottom: '5dp',
|
|
39
39
|
left: '20dp',
|
|
40
40
|
font: {
|
|
41
|
-
fontSize:
|
|
41
|
+
fontSize: '16dp',
|
|
42
42
|
fontWeight: 'normal'
|
|
43
43
|
},
|
|
44
44
|
id: 'nickname'
|
|
@@ -50,4 +50,4 @@ module.exports = function($, opts) {
|
|
|
50
50
|
expect($.nickname.text).toEqual(opts.nickname);
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
|
-
};
|
|
53
|
+
};
|
package/samples/apps/advanced/proxy_property_requires/widgets/com.foo.widget/views/section.xml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<Alloy>
|
|
2
|
-
<TableViewSection platform="android
|
|
2
|
+
<TableViewSection platform="android">
|
|
3
3
|
<HeaderView>
|
|
4
4
|
<Label>Test</Label>
|
|
5
5
|
</HeaderView>
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
<TableViewRow title="android row"/>
|
|
8
8
|
<TableViewRow title="android row"/>
|
|
9
9
|
</TableViewSection>
|
|
10
|
-
<TableViewSection platform="ios
|
|
10
|
+
<TableViewSection platform="ios" headerTitle="Test">
|
|
11
11
|
<TableViewRow title="table row"/>
|
|
12
12
|
<TableViewRow title="table row"/>
|
|
13
13
|
<TableViewRow title="table row"/>
|
|
14
14
|
</TableViewSection>
|
|
15
|
-
</Alloy>
|
|
15
|
+
</Alloy>
|
|
@@ -47,23 +47,6 @@ module.exports = function($, opts) {
|
|
|
47
47
|
backgroundImage: '/button_green.png'
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
} else if (OS_MOBILEWEB) {
|
|
51
|
-
styler = {
|
|
52
|
-
mainView: {
|
|
53
|
-
backgroundImage: '/bg_gray.png',
|
|
54
|
-
borderColor: '#1e99fd'
|
|
55
|
-
},
|
|
56
|
-
progressBack: {
|
|
57
|
-
backgroundColor: '#333'
|
|
58
|
-
},
|
|
59
|
-
progressFront: {
|
|
60
|
-
backgroundImage: '/title_blue.png'
|
|
61
|
-
},
|
|
62
|
-
button: {
|
|
63
|
-
backgroundImage: '/button_blue.png',
|
|
64
|
-
color: '#fff'
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
50
|
}
|
|
68
51
|
|
|
69
52
|
$.__styler = styler;
|
|
@@ -144,4 +127,4 @@ module.exports = function($, opts) {
|
|
|
144
127
|
});
|
|
145
128
|
|
|
146
129
|
launchTests();
|
|
147
|
-
};
|
|
130
|
+
};
|
|
@@ -67,50 +67,6 @@ module.exports = function($) {
|
|
|
67
67
|
right: 15
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
-
} else if (OS_MOBILEWEB) {
|
|
71
|
-
styler = {
|
|
72
|
-
index: {
|
|
73
|
-
backgroundImage: '/bg_gray.png'
|
|
74
|
-
},
|
|
75
|
-
title: {
|
|
76
|
-
color: '#fff',
|
|
77
|
-
backgroundImage: '/title_blue.png',
|
|
78
|
-
font: {
|
|
79
|
-
fontSize: '24px',
|
|
80
|
-
fontWeight: 'bold'
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
container: {
|
|
84
|
-
backgroundGradient: {
|
|
85
|
-
type: 'linear',
|
|
86
|
-
startPoint: {
|
|
87
|
-
x: '0%',
|
|
88
|
-
y: '0%'
|
|
89
|
-
},
|
|
90
|
-
endPoint: {
|
|
91
|
-
x: '0%',
|
|
92
|
-
y: '100%'
|
|
93
|
-
},
|
|
94
|
-
colors: [ '#39abfb', '#0285ff' ]
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
label: {
|
|
98
|
-
color: '#fff',
|
|
99
|
-
font: {
|
|
100
|
-
fontSize: '140px',
|
|
101
|
-
fontWeight: 'bold'
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
slider: {
|
|
105
|
-
leftTrackImage: '/title_blue.png',
|
|
106
|
-
bottom: 100,
|
|
107
|
-
width: 250
|
|
108
|
-
},
|
|
109
|
-
testButton: {
|
|
110
|
-
color: '#fff',
|
|
111
|
-
backgroundImage: '/button_blue.png'
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
70
|
}
|
|
115
71
|
|
|
116
72
|
// add the styer as a hidden argument to the controller to
|
|
@@ -194,4 +150,4 @@ module.exports = function($) {
|
|
|
194
150
|
});
|
|
195
151
|
|
|
196
152
|
launchTests();
|
|
197
|
-
};
|
|
153
|
+
};
|
|
@@ -27,7 +27,7 @@ module.exports = function($) {
|
|
|
27
27
|
style: {
|
|
28
28
|
color: '#eee',
|
|
29
29
|
font: {
|
|
30
|
-
fontSize:
|
|
30
|
+
fontSize: '28dp',
|
|
31
31
|
fontWeight: 'bold'
|
|
32
32
|
},
|
|
33
33
|
text: 'Trimmable String',
|
|
@@ -72,4 +72,4 @@ module.exports = function($) {
|
|
|
72
72
|
});
|
|
73
73
|
|
|
74
74
|
launchTests();
|
|
75
|
-
};
|
|
75
|
+
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"global": { "someValue": "unknown" },
|
|
3
3
|
"os:android": { "someValue": "Android" },
|
|
4
|
-
"os:blackberry": { "someValue": "Blackberry" },
|
|
5
4
|
"os:ios": { "someValue": "iOS" },
|
|
6
|
-
"os:mobileweb": { "someValue": "Mobileweb" },
|
|
7
|
-
"os:windows": { "someValue": "Windows" },
|
|
8
5
|
"sourcemap": false,
|
|
9
6
|
"adapters": []
|
|
10
|
-
}
|
|
7
|
+
}
|
|
@@ -17,7 +17,7 @@ module.exports = function($) {
|
|
|
17
17
|
style: {
|
|
18
18
|
color: '#f00',
|
|
19
19
|
font: {
|
|
20
|
-
fontSize:
|
|
20
|
+
fontSize: 24,
|
|
21
21
|
fontWeight: 'bold'
|
|
22
22
|
},
|
|
23
23
|
textAlign: 'center',
|
|
@@ -26,4 +26,4 @@ module.exports = function($) {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
|
-
};
|
|
29
|
+
};
|
|
@@ -19,7 +19,7 @@ module.exports = function($) {
|
|
|
19
19
|
style: {
|
|
20
20
|
color: '#000',
|
|
21
21
|
font: {
|
|
22
|
-
fontSize:
|
|
22
|
+
fontSize: '18dp',
|
|
23
23
|
fontWeight: 'bold'
|
|
24
24
|
},
|
|
25
25
|
height: Ti.UI.SIZE,
|
|
@@ -37,4 +37,4 @@ module.exports = function($) {
|
|
|
37
37
|
});
|
|
38
38
|
|
|
39
39
|
launchTests();
|
|
40
|
-
};
|
|
40
|
+
};
|
|
@@ -13,9 +13,9 @@ function removeItem(e) {
|
|
|
13
13
|
common.removeItem(myModels, e.index);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
if (OS_IOS
|
|
16
|
+
if (OS_IOS) {
|
|
17
17
|
common.prepNavBar($.window, addItem);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
myModels.comparator = common.comparator;
|
|
21
|
-
myModels.fetch();
|
|
21
|
+
myModels.fetch();
|
|
@@ -14,9 +14,9 @@ function removeItem(e) {
|
|
|
14
14
|
common.removeItem(myModels, e.index);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
if (OS_IOS
|
|
17
|
+
if (OS_IOS) {
|
|
18
18
|
common.prepNavBar($.window, addItem);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
myModels.comparator = common.comparator;
|
|
22
|
-
myModels.fetch();
|
|
22
|
+
myModels.fetch();
|
|
@@ -14,9 +14,9 @@ function removeItem(e) {
|
|
|
14
14
|
common.removeItem(myModels, e.index);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
if (OS_IOS
|
|
17
|
+
if (OS_IOS) {
|
|
18
18
|
common.prepNavBar($.window, addItem);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
myModels.comparator = common.comparator;
|
|
22
|
-
myModels.fetch();
|
|
22
|
+
myModels.fetch();
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
-->
|
|
24
24
|
<!-- <View opacity="0.25" backgroundColor="#a00" width="50%"/> -->
|
|
25
25
|
</ButtonBar>
|
|
26
|
-
<Label platform="android
|
|
26
|
+
<Label platform="android">Ti.UI.ButtonBar only supported on iOS</Label>
|
|
27
27
|
</Window>
|
|
28
28
|
</Alloy>
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
<Switch/>
|
|
5
5
|
|
|
6
6
|
<!-- switch with some platform-specific styling -->
|
|
7
|
-
<Switch class="titles" platform="android
|
|
7
|
+
<Switch class="titles" platform="android"/>
|
|
8
8
|
|
|
9
9
|
<!-- an android checkbox -->
|
|
10
10
|
<Switch class="checkbox" platform="android"/>
|
|
11
11
|
</Window>
|
|
12
|
-
</Alloy>
|
|
12
|
+
</Alloy>
|
package/test/specs/new.js
CHANGED
|
@@ -56,10 +56,8 @@ var TO_BE_CREATED = [
|
|
|
56
56
|
path.join('app','assets'),
|
|
57
57
|
path.join('app','assets','android'),
|
|
58
58
|
path.join('app','assets','iphone'),
|
|
59
|
-
path.join('app','assets','mobileweb'),
|
|
60
59
|
path.join('plugins'),
|
|
61
60
|
path.join('plugins','ti.alloy'),
|
|
62
|
-
path.join('plugins','ti.alloy','plugin.py'),
|
|
63
61
|
path.join('plugins','ti.alloy','hooks'),
|
|
64
62
|
path.join('plugins','ti.alloy','hooks','alloy.js'),
|
|
65
63
|
path.join('tiapp.xml')
|
package/test/specs/optimizer.js
CHANGED
|
@@ -88,9 +88,7 @@ var tests = [
|
|
|
88
88
|
var platforms = {};
|
|
89
89
|
var platformsDir = path.join(__dirname,'..','..','platforms');
|
|
90
90
|
_.each(CONST.PLATFORMS, function(p) {
|
|
91
|
-
if (p != "mobileweb" && p != "windows") {
|
|
92
91
|
platforms[p] = require(path.join(platformsDir,p,'index'));
|
|
93
|
-
}
|
|
94
92
|
});
|
|
95
93
|
// The alloy command test suite
|
|
96
94
|
describe('optimizer.js', function() {
|