tungsten 0.3.10 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-complete +1 -1
- package/dist/CssNames.d.ts +1 -0
- package/dist/CssNames.d.ts.map +1 -1
- package/dist/CssNames.js +3 -0
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.js +7 -10
- package/dist/bin/commands/dev.d.ts.map +1 -1
- package/dist/bin/commands/dev.js +0 -1
- package/dist/bin/commands/speed.d.ts +2 -0
- package/dist/bin/commands/speed.d.ts.map +1 -0
- package/dist/bin/commands/speed.js +2 -0
- package/dist/bin/index.d.ts.map +1 -1
- package/dist/bin/index.js +10 -6
- package/dist/build/compileJavascript.d.ts +1 -0
- package/dist/build/compileJavascript.d.ts.map +1 -1
- package/dist/build/compileJavascript.js +1 -1
- package/dist/build/compileUserApp.d.ts.map +1 -1
- package/dist/build/compileUserApp.js +1 -0
- package/dist/build/makeBabelUserDevConfig.d.ts +1 -1
- package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserDevConfig.js +7 -1
- package/dist/components/library/RichTextEditor/RichTextEditor.js +2 -1
- package/dist/components/library/__StatefulMessage/StatefulMessage.js +2 -1
- package/dist/postcssPlugins/TransformCssNames.d.ts.map +1 -1
- package/dist/postcssPlugins/TransformCssNames.js +33 -1
- package/dist/postcssPlugins/scopeAnimationValue.d.ts +2 -0
- package/dist/postcssPlugins/scopeAnimationValue.d.ts.map +1 -0
- package/dist/postcssPlugins/scopeAnimationValue.js +37 -0
- package/dist/postcssPlugins/splitCssValue.d.ts +2 -0
- package/dist/postcssPlugins/splitCssValue.d.ts.map +1 -0
- package/dist/postcssPlugins/splitCssValue.js +44 -0
- package/dist/throwError.d.ts +1 -0
- package/dist/throwError.d.ts.map +1 -1
- package/dist/throwError.js +3 -0
- package/package.json +2 -2
package/dist/.build-complete
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1786886454316
|
package/dist/CssNames.d.ts
CHANGED
package/dist/CssNames.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CssNames.d.ts","sourceRoot":"","sources":["../src/CssNames.ts"],"names":[],"mappings":"AACA,qBAAa,QAAQ;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAK;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAK;
|
|
1
|
+
{"version":3,"file":"CssNames.d.ts","sourceRoot":"","sources":["../src/CssNames.ts"],"names":[],"mappings":"AACA,qBAAa,QAAQ;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAK;IACjC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAK;IAGpC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAK;gBAC1B,UAAU,EAAE,MAAM;CAGjC;AAsBD,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAA"}
|
package/dist/CssNames.js
CHANGED
|
@@ -6,6 +6,9 @@ export class CssNames {
|
|
|
6
6
|
_defineProperty(this, "moduleName", void 0);
|
|
7
7
|
_defineProperty(this, "tags", {});
|
|
8
8
|
_defineProperty(this, "classes", {});
|
|
9
|
+
// animation names, in their css form - they are referenced from css text (a style= or
|
|
10
|
+
// css= attribute) rather than from a class attribute, so they stay escaped
|
|
11
|
+
_defineProperty(this, "keyframes", {});
|
|
9
12
|
this.moduleName = moduleName;
|
|
10
13
|
}
|
|
11
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BabelTransformComponentStyles.d.ts","sourceRoot":"","sources":["../../src/babelPlugins/BabelTransformComponentStyles.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAc,MAAM,iBAAiB,CAAA;AAa7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"BabelTransformComponentStyles.d.ts","sourceRoot":"","sources":["../../src/babelPlugins/BabelTransformComponentStyles.ts"],"names":[],"mappings":"AAwCA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAc,MAAM,iBAAiB,CAAA;AAa7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAmQvD,KAAK,IAAI,GAAG;IACR,iBAAiB,EAAE,MAAM,CAAA;IACzB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,wBAAwB,EAAE,MAAM,CAAA;IAChC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IAKxB,YAAY,CAAC,EAAE,MAAM,CAAA;IAIrB,KAAK,CAAC,EAAE,OAAO,CAAA;CAClB,CAAA;AAID,wBAAgB,iCAAiC,CAAC,IAAI,EAAE,IAAI,IAkMV,OAAO,KAAK;;;;6BAMjC,MAAM;;mBAIZ,MAAM;;;uCAkBkB,QAAQ,CAAC,wBAAwB,CAAC;sBAf3D,MAAM;kBACV;gBACF,IAAI;qCATS,MAAM;kBASL;aACjB;+BACkB,MAAM;;;EAyJpC"}
|
|
@@ -146,6 +146,12 @@ function triggerDependers(styleDependers, dependers) {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
+
// one `name: { source: transformed, ... }` property of the component's $style object
|
|
150
|
+
function namesProperty(t, property, names) {
|
|
151
|
+
return t.objectProperty(t.stringLiteral(property), t.objectExpression(objectMapToArray(
|
|
152
|
+
// from sxy-standard library
|
|
153
|
+
names, (key, value) => t.objectProperty(t.stringLiteral(key), t.stringLiteral(value)))));
|
|
154
|
+
}
|
|
149
155
|
function cssToLocalClassNames(data, file, moduleName) {
|
|
150
156
|
//console.log('cssToLocalClassNames')
|
|
151
157
|
const names = new CssNames(moduleName);
|
|
@@ -435,16 +441,7 @@ export function MakeBabelTransformComponentStyles(opts) {
|
|
|
435
441
|
// path.parentPath.remove()// replaceWith(t.identifier('undefined'))
|
|
436
442
|
// return
|
|
437
443
|
// }
|
|
438
|
-
const
|
|
439
|
-
//if (names.tags !== undefined)
|
|
440
|
-
props.push(t.objectProperty(t.stringLiteral('tags'), t.objectExpression(objectMapToArray(
|
|
441
|
-
// from sxy-standard library
|
|
442
|
-
names.tags, (key, value) => t.objectProperty(t.stringLiteral(key), t.stringLiteral(value))))));
|
|
443
|
-
//if (names.classes !== undefined)
|
|
444
|
-
props.push(t.objectProperty(t.stringLiteral('classes'), t.objectExpression(objectMapToArray(
|
|
445
|
-
// from sxy-standard library
|
|
446
|
-
names.classes, (key, value) => t.objectProperty(t.stringLiteral(key), t.stringLiteral(value))))));
|
|
447
|
-
const obj = t.objectExpression(props);
|
|
444
|
+
const obj = t.objectExpression([t.objectProperty(t.stringLiteral('moduleName'), t.stringLiteral(names.moduleName)), namesProperty(t, 'tags', names.tags), namesProperty(t, 'classes', names.classes), namesProperty(t, 'keyframes', names.keyframes)]);
|
|
448
445
|
path.replaceWith(obj);
|
|
449
446
|
}
|
|
450
447
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/dev.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/dev.ts"],"names":[],"mappings":"AAsDA,OAAO,EAAE,CAAA"}
|
package/dist/bin/commands/dev.js
CHANGED
|
@@ -8,7 +8,6 @@ import { createTimeProfiler } from "../../timeProfiler.js";
|
|
|
8
8
|
const args = process.argv.slice(3);
|
|
9
9
|
const boot = !args.includes('--no-boot');
|
|
10
10
|
const profile = args.includes('--profile');
|
|
11
|
-
cliOut(`Starting dev mode`);
|
|
12
11
|
//// prep the app
|
|
13
12
|
const sxyFramework = new Framework();
|
|
14
13
|
sxyFramework.profiler = createTimeProfiler(profile);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"speed.d.ts","sourceRoot":"","sources":["../../../src/bin/commands/speed.ts"],"names":[],"mappings":""}
|
package/dist/bin/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bin/index.ts"],"names":[],"mappings":"AA4DA,OAAO,EAAE,CAAA"}
|
package/dist/bin/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
import { cliWarn } from "../cliOutput.js";
|
|
1
|
+
import { cliOut, cliWarn } from "../cliOutput.js";
|
|
2
2
|
// get command line args
|
|
3
3
|
const args = process.argv.slice(2);
|
|
4
4
|
const command = args[0];
|
|
5
|
+
if (command === undefined || command === '') {
|
|
6
|
+
cliWarn(`Please choose a command, e.g. "tungsten dev"`);
|
|
7
|
+
}
|
|
5
8
|
switch (command) {
|
|
6
9
|
case 'dev':
|
|
7
10
|
{
|
|
11
|
+
cliOut(`Starting Tungsten dev mode`);
|
|
8
12
|
// set env before loading the next file, to set the env before file imports
|
|
9
13
|
process.env.__TUNGSTEN_ENV = 'development';
|
|
10
14
|
await import("./commands/dev.js");
|
|
@@ -12,12 +16,14 @@ switch (command) {
|
|
|
12
16
|
}
|
|
13
17
|
case 'devmon':
|
|
14
18
|
{
|
|
19
|
+
cliOut(`Starting Tungsten auto-restart dev mode`);
|
|
15
20
|
process.env.__TUNGSTEN_ENV = 'development';
|
|
16
21
|
await import("./commands/devmon.js");
|
|
17
22
|
break;
|
|
18
23
|
}
|
|
19
24
|
case 'build':
|
|
20
25
|
{
|
|
26
|
+
cliOut(`Starting Tungsten production build`);
|
|
21
27
|
process.env.__TUNGSTEN_ENV = 'production';
|
|
22
28
|
process.env.__TUNGSTEN_DEBUG = 'true';
|
|
23
29
|
await import("./commands/build.js");
|
|
@@ -25,12 +31,14 @@ switch (command) {
|
|
|
25
31
|
}
|
|
26
32
|
case 'start':
|
|
27
33
|
{
|
|
34
|
+
cliOut(`Starting Tungsten server`);
|
|
28
35
|
process.env.__TUNGSTEN_ENV = 'production';
|
|
29
36
|
await import("./commands/start.js");
|
|
30
37
|
break;
|
|
31
38
|
}
|
|
32
39
|
case 'static':
|
|
33
40
|
{
|
|
41
|
+
cliOut(`Starting Tungsten static site preview`);
|
|
34
42
|
//process.env.__TUNGSTEN_ENV = 'production'
|
|
35
43
|
await import("./commands/static.js");
|
|
36
44
|
break;
|
|
@@ -53,10 +61,6 @@ switch (command) {
|
|
|
53
61
|
}
|
|
54
62
|
default:
|
|
55
63
|
{
|
|
56
|
-
|
|
57
|
-
cliWarn(`Please choose a command, e.g. "tungsten dev"`);
|
|
58
|
-
} else {
|
|
59
|
-
cliWarn(`tungsten: unknown command "${command}"`);
|
|
60
|
-
}
|
|
64
|
+
cliWarn(`tungsten: unknown command "${command}"`);
|
|
61
65
|
}
|
|
62
66
|
}
|
|
@@ -15,6 +15,7 @@ export type JavascriptCompilationCycle = {
|
|
|
15
15
|
export type CompileJavascriptOptions = {
|
|
16
16
|
quiet?: boolean;
|
|
17
17
|
packagesCacheLocation?: string;
|
|
18
|
+
hmr?: boolean;
|
|
18
19
|
onCycleComplete?: ((cycle: JavascriptCompilationCycle) => void | Promise<void>) | undefined;
|
|
19
20
|
};
|
|
20
21
|
export declare function compileJavascript(projectDir: string, appConfig: FrameworkConfigComplete, codeLocation: string, sourceLocation: string, styleImportBase: string, buildLocation: string, buildCodeLocation: string, mode: Mode, watch?: boolean, options?: CompileJavascriptOptions): Promise<CompileJavascriptResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileJavascript.d.ts","sourceRoot":"","sources":["../../src/build/compileJavascript.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAO/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAetC,KAAK,uBAAuB,GAAG;IAC3B,OAAO,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IAClC,WAAW,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IACtC,aAAa,EAAE,aAAa,CAAA;IAC5B,cAAc,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,eAAe,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAA;CAC9F,CAAA;AAKD,wBAAsB,iBAAiB,CACnC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,uBAAuB,EACtD,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EACrE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,UAAO,EAC1E,OAAO,GAAE,wBAA6B,GACvC,OAAO,CAAC,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"compileJavascript.d.ts","sourceRoot":"","sources":["../../src/build/compileJavascript.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAO/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAetC,KAAK,uBAAuB,GAAG;IAC3B,OAAO,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IAClC,WAAW,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAA;IACtC,aAAa,EAAE,aAAa,CAAA;IAC5B,cAAc,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACrC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,wBAAwB,GAAG;IACnC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,eAAe,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,SAAS,CAAA;CAC9F,CAAA;AAKD,wBAAsB,iBAAiB,CACnC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,uBAAuB,EACtD,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EACrE,aAAa,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,UAAO,EAC1E,OAAO,GAAE,wBAA6B,GACvC,OAAO,CAAC,uBAAuB,CAAC,CA+YlC"}
|
|
@@ -40,7 +40,7 @@ export async function compileJavascript(projectDir, appConfig, codeLocation, sou
|
|
|
40
40
|
dependencyGraph = {};
|
|
41
41
|
importAliases = {};
|
|
42
42
|
promises = [];
|
|
43
|
-
config = makeBabelUserDevConfig(projectDir, codeLocation, sourceLocation, styleImportBase, buildLocation, buildCodeLocation, dependencyGraphDir, skipPackageCompilationFiles, oldDependencyGraph, dependencyGraph, importAliases, promises, watch);
|
|
43
|
+
config = makeBabelUserDevConfig(projectDir, codeLocation, sourceLocation, styleImportBase, buildLocation, buildCodeLocation, dependencyGraphDir, skipPackageCompilationFiles, oldDependencyGraph, dependencyGraph, importAliases, promises, watch, options.hmr === true);
|
|
44
44
|
} else {
|
|
45
45
|
config = makeBabelUserProdConfig(projectDir, codeLocation, sourceLocation, styleImportBase, watch);
|
|
46
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compileUserApp.d.ts","sourceRoot":"","sources":["../../src/build/compileUserApp.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAWtC,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAI1E,wBAAsB,cAAc,CAChC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,EAClE,QAAQ,GAAE,YAAwC,GACnD,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"compileUserApp.d.ts","sourceRoot":"","sources":["../../src/build/compileUserApp.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AACpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAWtC,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAI1E,wBAAsB,cAAc,CAChC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,uBAAuB,EAAE,IAAI,EAAE,IAAI,EAClE,QAAQ,GAAE,YAAwC,GACnD,OAAO,CAAC,eAAe,CAAC,CAyE1B"}
|
|
@@ -21,6 +21,7 @@ export async function compileUserApp(projectDir, appConfig, mode, profiler = cre
|
|
|
21
21
|
// open, so the command could only ever end by hard-exiting
|
|
22
22
|
const watch = mode === 'dev';
|
|
23
23
|
const compileJavascriptPromise = profiler.timeProfileAsync('compile javascript', () => compileJavascript(projectDir, appConfig, codeLocation, sourceLocation, styleImportBase, buildLocation, buildCodeLocation, mode, watch, mode === 'dev' ? {
|
|
24
|
+
hmr: appConfig.hmr === true,
|
|
24
25
|
onCycleComplete: cycle => {
|
|
25
26
|
if (cycle.success) emitReloadEvent('js', cycle.file);
|
|
26
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TransformOptions } from '@babel/core';
|
|
2
2
|
import type { ImportAliases } from './ImportAliases.js';
|
|
3
3
|
import { DependencyGraph } from '../babelPlugins/BabelTransformPackageImports.js';
|
|
4
|
-
export declare function makeBabelUserDevConfig(projectDir: string, absCodeDir: string, absSourceDir: string, absStyleImportBase: string, buildLocation: string, buildCodeLocation: string, packagesCacheLocation: string, skipPackageCompilationFiles: ReadonlySet<string>, oldDependencyGraph: DependencyGraph, dependencyGraph: DependencyGraph, importAliases: ImportAliases, promises: Promise<any>[], watchStyles?: boolean): TransformOptions;
|
|
4
|
+
export declare function makeBabelUserDevConfig(projectDir: string, absCodeDir: string, absSourceDir: string, absStyleImportBase: string, buildLocation: string, buildCodeLocation: string, packagesCacheLocation: string, skipPackageCompilationFiles: ReadonlySet<string>, oldDependencyGraph: DependencyGraph, dependencyGraph: DependencyGraph, importAliases: ImportAliases, promises: Promise<any>[], watchStyles?: boolean, hmr?: boolean): TransformOptions;
|
|
5
5
|
//# sourceMappingURL=makeBabelUserDevConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"makeBabelUserDevConfig.d.ts","sourceRoot":"","sources":["../../src/build/makeBabelUserDevConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAKnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAoC,eAAe,EAAE,MAAM,iDAAiD,CAAA;AAOnH,wBAAgB,sBAAsB,CAClC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,MAAM,EACzB,qBAAqB,EAAE,MAAM,EAC7B,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAAC,EAChD,kBAAkB,EAAE,eAAe,EACnC,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,EACxB,WAAW,UAAO,
|
|
1
|
+
{"version":3,"file":"makeBabelUserDevConfig.d.ts","sourceRoot":"","sources":["../../src/build/makeBabelUserDevConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAKnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD,OAAO,EAAoC,eAAe,EAAE,MAAM,iDAAiD,CAAA;AAOnH,wBAAgB,sBAAsB,CAClC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,kBAAkB,EAAE,MAAM,EAC1B,aAAa,EAAE,MAAM,EACrB,iBAAiB,EAAE,MAAM,EACzB,qBAAqB,EAAE,MAAM,EAC7B,2BAA2B,EAAE,WAAW,CAAC,MAAM,CAAC,EAChD,kBAAkB,EAAE,eAAe,EACnC,eAAe,EAAE,eAAe,EAChC,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,EACxB,WAAW,UAAO,EAClB,GAAG,UAAQ,GACZ,gBAAgB,CAmClB"}
|
|
@@ -6,7 +6,8 @@ import { MakeBabelTransformPackageImports } from "../babelPlugins/BabelTransform
|
|
|
6
6
|
import { componentCssFolder, componentCssFile } from "../settings.js";
|
|
7
7
|
import userCommonConfig from "./babel.user.common.config.js";
|
|
8
8
|
import { MakeBabelTransformCssImports } from "../babelPlugins/BabelTransformCssImports.js";
|
|
9
|
-
|
|
9
|
+
import { MakeBabelAddDevCacheBust } from "../babelPlugins/BabelAddDevCacheBust.js";
|
|
10
|
+
export function makeBabelUserDevConfig(projectDir, absCodeDir, absSourceDir, absStyleImportBase, buildLocation, buildCodeLocation, packagesCacheLocation, skipPackageCompilationFiles, oldDependencyGraph, dependencyGraph, importAliases, promises, watchStyles = true, hmr = false) {
|
|
10
11
|
const userDevConfig = objectCopy(userCommonConfig);
|
|
11
12
|
userDevConfig.plugins.push(MakeBabelTransformPackageImports({
|
|
12
13
|
projectDir: projectDir,
|
|
@@ -31,5 +32,10 @@ export function makeBabelUserDevConfig(projectDir, absCodeDir, absSourceDir, abs
|
|
|
31
32
|
cssOutputFile: join(buildLocation, componentCssFolder, componentCssFile),
|
|
32
33
|
watch: watchStyles
|
|
33
34
|
}));
|
|
35
|
+
if (hmr) userDevConfig.plugins.push(
|
|
36
|
+
// Dev-only: keeps every relative import's browser-cached URL in sync with the
|
|
37
|
+
// imported file's own on-disk mtime - see BabelAddDevCacheBust.ts and
|
|
38
|
+
// docs/hmr.md's "stale-module-cache SyntaxError" finding.
|
|
39
|
+
MakeBabelAddDevCacheBust());
|
|
34
40
|
return userDevConfig;
|
|
35
41
|
}
|
|
@@ -451,7 +451,8 @@ export class RichTextEditor extends TungstenStatefulComponent {
|
|
|
451
451
|
"source-toggle": "T#-components-library-RichTextEditor-RichTextEditor_source-toggle",
|
|
452
452
|
"surface": "T#-components-library-RichTextEditor-RichTextEditor_surface",
|
|
453
453
|
"source": "T#-components-library-RichTextEditor-RichTextEditor_source"
|
|
454
|
-
}
|
|
454
|
+
},
|
|
455
|
+
"keyframes": {}
|
|
455
456
|
});
|
|
456
457
|
}
|
|
457
458
|
static $stylesheet = "i/T-components-library-RichTextEditor-RichTextEditor.css";
|
|
@@ -81,7 +81,8 @@ export class StatefulMessage extends TungstenStatefulComponent {
|
|
|
81
81
|
"warning": "T#-components-library-__StatefulMessage-StatefulMessage_warning",
|
|
82
82
|
"error": "T#-components-library-__StatefulMessage-StatefulMessage_error",
|
|
83
83
|
"exception": "T#-components-library-__StatefulMessage-StatefulMessage_exception"
|
|
84
|
-
}
|
|
84
|
+
},
|
|
85
|
+
"keyframes": {}
|
|
85
86
|
});
|
|
86
87
|
}
|
|
87
88
|
static $stylesheet = "i/T-components-library-__StatefulMessage-StatefulMessage.css";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransformCssNames.d.ts","sourceRoot":"","sources":["../../src/postcssPlugins/TransformCssNames.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,IAAI,EAAQ,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"TransformCssNames.d.ts","sourceRoot":"","sources":["../../src/postcssPlugins/TransformCssNames.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,IAAI,EAAQ,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAoE9C,KAAK,IAAI,GAAG;IACR,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;CACrB,CAAA;AAYD,eAAO,MAAM,iBAAiB;WAAU,IAAI;;mBAezB,IAAI;;;CAqJtB,CAAA"}
|
|
@@ -10,8 +10,10 @@ extract classes -> localise
|
|
|
10
10
|
.span -> NavItem_span
|
|
11
11
|
*/
|
|
12
12
|
import { parseSelectorsRich } from "./parseSelectorsRich.js";
|
|
13
|
+
import { scopeAnimationValue } from "./scopeAnimationValue.js";
|
|
13
14
|
import { componentBumpClass } from "../componentClassName.js";
|
|
14
|
-
import { throwError } from "../throwError.js";
|
|
15
|
+
import { throwError, warnMessage } from "../throwError.js";
|
|
16
|
+
import { warn } from "../output.js";
|
|
15
17
|
function debug(...texts) {
|
|
16
18
|
//console.log(...texts)
|
|
17
19
|
}
|
|
@@ -56,6 +58,11 @@ function separatePseudo(selector) {
|
|
|
56
58
|
const colonIndex = selector.indexOf(':');
|
|
57
59
|
if (colonIndex === -1) return [selector, ''];else return [selector.slice(0, colonIndex), selector.slice(colonIndex)];
|
|
58
60
|
}
|
|
61
|
+
// matches @keyframes and its vendor prefixed forms, e.g. @-webkit-keyframes
|
|
62
|
+
// at-rule and property names are case insensitive in css, hence the i flag on both
|
|
63
|
+
const keyframesAtRule = /(^|-)keyframes$/i;
|
|
64
|
+
// the declarations that name an animation, e.g. `animation: fade 2s` / `animation-name: fade`
|
|
65
|
+
const animationDecl = /^animation(-name)?$/i;
|
|
59
66
|
const bump = '.' + componentBumpClass + '.' + componentBumpClass + '.' + componentBumpClass;
|
|
60
67
|
export const TransformCssNames = opts => {
|
|
61
68
|
//console.log('TransformCssNames')
|
|
@@ -70,11 +77,36 @@ export const TransformCssNames = opts => {
|
|
|
70
77
|
Once(root) {
|
|
71
78
|
const moduleName = opts.moduleName;
|
|
72
79
|
const names = opts.outNames;
|
|
80
|
+
const sourceFile = root.source?.input.file;
|
|
73
81
|
names.moduleName = moduleName;
|
|
74
82
|
names.tags = {};
|
|
75
83
|
names.classes = {};
|
|
84
|
+
names.keyframes = {};
|
|
85
|
+
// keyframe offsets (0%, from, to) are Rules within the at-rule, but they are positions
|
|
86
|
+
// rather than selectors, so they are collected here and passed over by the selector walk
|
|
87
|
+
const keyframeOffsets = new Set();
|
|
88
|
+
// the animation name is scoped like a class, so two modules can each define `fade`
|
|
89
|
+
root.walkAtRules(keyframesAtRule, atRule => {
|
|
90
|
+
const name = atRule.params.trim();
|
|
91
|
+
if (name === '') return;
|
|
92
|
+
const newName = transformClass(escapeModuleName(moduleName), name);
|
|
93
|
+
names.keyframes[name] = newName;
|
|
94
|
+
atRule.params = newName;
|
|
95
|
+
atRule.walkRules(offset => {
|
|
96
|
+
keyframeOffsets.add(offset);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
// an animation name is module scoped wherever it appears, exactly as a class is. A name
|
|
100
|
+
// with no @keyframes in the module cannot resolve to anything, so it is warned about
|
|
101
|
+
root.walkDecls(animationDecl, decl => {
|
|
102
|
+
decl.value = scopeAnimationValue(decl.value, name => {
|
|
103
|
+
if (!(name in names.keyframes)) warn(warnMessage('TransformCssNames', `animation '${name}' in module '${moduleName}' has no @keyframes of that` + ` name in the module, so it will not run` + (sourceFile === undefined ? '' : ` (${sourceFile})`)));
|
|
104
|
+
return transformClass(escapeModuleName(moduleName), name);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
76
107
|
// Transform CSS AST here
|
|
77
108
|
root.walkRules(rule => {
|
|
109
|
+
if (keyframeOffsets.has(rule)) return;
|
|
78
110
|
const selectorLine = rule.selector;
|
|
79
111
|
const selectorGroups = selectorLine.split(',').map(x => x.trim());
|
|
80
112
|
const newSelectorGroups = [];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scopeAnimationValue.d.ts","sourceRoot":"","sources":["../../src/postcssPlugins/scopeAnimationValue.ts"],"names":[],"mappings":"AA2BA,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAW9F"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { splitCssValue } from "./splitCssValue.js";
|
|
2
|
+
// every keyword the animation shorthand accepts. A word that is none of these, and does not
|
|
3
|
+
// read as a time, a number or a function, is the animation name
|
|
4
|
+
const animationKeywords = new Set(['none', 'forwards', 'backwards', 'both',
|
|
5
|
+
// fill mode
|
|
6
|
+
'normal', 'reverse', 'alternate', 'alternate-reverse',
|
|
7
|
+
// direction
|
|
8
|
+
'running', 'paused',
|
|
9
|
+
// play state
|
|
10
|
+
'infinite',
|
|
11
|
+
// iteration count
|
|
12
|
+
'linear', 'ease', 'ease-in', 'ease-out', 'ease-in-out',
|
|
13
|
+
// timing function
|
|
14
|
+
'step-start', 'step-end', 'initial', 'inherit', 'unset', 'revert', 'revert-layer' // css wide keywords
|
|
15
|
+
]);
|
|
16
|
+
// an identifier starts with a letter, _, - or an escape - which rules out `2s`, `-1s` and `0.5`
|
|
17
|
+
const identifierStart = /^-?[a-zA-Z_\\]/;
|
|
18
|
+
function isAnimationName(word) {
|
|
19
|
+
if (word.includes('(')) return false; // a function, e.g. steps(4, end)
|
|
20
|
+
if (animationKeywords.has(word.toLowerCase())) return false;
|
|
21
|
+
return identifierStart.test(word);
|
|
22
|
+
}
|
|
23
|
+
// Scopes the animation names in an `animation` or `animation-name` value, e.g.
|
|
24
|
+
// `fade 2s linear, slide 1s` -> `Card_fade 2s linear, Card_slide 1s`.
|
|
25
|
+
// A value may list several animations, separated by commas, but names only one per list entry.
|
|
26
|
+
export function scopeAnimationValue(value, scopeName) {
|
|
27
|
+
let named = false;
|
|
28
|
+
return splitCssValue(value).map(part => {
|
|
29
|
+
if (part === ',') {
|
|
30
|
+
named = false;
|
|
31
|
+
return part;
|
|
32
|
+
}
|
|
33
|
+
if (named || !isAnimationName(part)) return part;
|
|
34
|
+
named = true;
|
|
35
|
+
return scopeName(part);
|
|
36
|
+
}).join('');
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"splitCssValue.d.ts","sourceRoot":"","sources":["../../src/postcssPlugins/splitCssValue.ts"],"names":[],"mappings":"AAIA,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CA2CrD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// splits a css value into its top level words, whitespace and commas, so it can be rebuilt
|
|
2
|
+
// exactly by joining the parts back together. Brackets, quotes and escapes are opaque, so
|
|
3
|
+
// `steps(4, end)` stays one word rather than becoming three parts
|
|
4
|
+
export function splitCssValue(value) {
|
|
5
|
+
const parts = [];
|
|
6
|
+
let word = '';
|
|
7
|
+
let depth = 0;
|
|
8
|
+
let quote = '';
|
|
9
|
+
let escaped = false;
|
|
10
|
+
function endWord() {
|
|
11
|
+
if (word !== '') parts.push(word);
|
|
12
|
+
word = '';
|
|
13
|
+
}
|
|
14
|
+
for (const char of value) {
|
|
15
|
+
if (escaped) {
|
|
16
|
+
word += char;
|
|
17
|
+
escaped = false;
|
|
18
|
+
} else if (char === '\\') {
|
|
19
|
+
word += char;
|
|
20
|
+
escaped = true;
|
|
21
|
+
} else if (quote !== '') {
|
|
22
|
+
word += char;
|
|
23
|
+
if (char === quote) quote = '';
|
|
24
|
+
} else if (char === '"' || char === '\'') {
|
|
25
|
+
word += char;
|
|
26
|
+
quote = char;
|
|
27
|
+
} else if (char === '(') {
|
|
28
|
+
word += char;
|
|
29
|
+
depth += 1;
|
|
30
|
+
} else if (char === ')') {
|
|
31
|
+
word += char;
|
|
32
|
+
if (depth > 0) depth -= 1;
|
|
33
|
+
} else if (depth > 0) {
|
|
34
|
+
word += char;
|
|
35
|
+
} else if (char === ',' || /\s/.test(char)) {
|
|
36
|
+
endWord();
|
|
37
|
+
parts.push(char);
|
|
38
|
+
} else {
|
|
39
|
+
word += char;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
endWord();
|
|
43
|
+
return parts;
|
|
44
|
+
}
|
package/dist/throwError.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare function throwError(location: string, message: string): never;
|
|
2
2
|
export declare function errorMessage(location: string, message: string): string;
|
|
3
|
+
export declare function warnMessage(location: string, message: string): string;
|
|
3
4
|
//# sourceMappingURL=throwError.d.ts.map
|
package/dist/throwError.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throwError.d.ts","sourceRoot":"","sources":["../src/throwError.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAEnE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtE"}
|
|
1
|
+
{"version":3,"file":"throwError.d.ts","sourceRoot":"","sources":["../src/throwError.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAEnE;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAErE"}
|
package/dist/throwError.js
CHANGED
|
@@ -5,4 +5,7 @@ export function throwError(location, message) {
|
|
|
5
5
|
}
|
|
6
6
|
export function errorMessage(location, message) {
|
|
7
7
|
return `${packageNameCapitalized} ${location} error: ${message}`;
|
|
8
|
+
}
|
|
9
|
+
export function warnMessage(location, message) {
|
|
10
|
+
return `${packageNameCapitalized} ${location} warning: ${message}`;
|
|
8
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tungsten",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"prop-types": "^15.8.1",
|
|
116
116
|
"rimraf": "^5.0.10",
|
|
117
117
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
118
|
-
"sxy-test-runner": "^2.3
|
|
118
|
+
"sxy-test-runner": "^2.4.3",
|
|
119
119
|
"sxy-types": "^1.0.23",
|
|
120
120
|
"typescript": "^6.0.3"
|
|
121
121
|
},
|