Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better CSS build #2451

Merged
merged 6 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions cpp/perspective/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,6 @@ if(PSP_WASM_BUILD)
-g0 \
-flto \
")

# TODO: -flto
endif()

set(ASYNC_MODE_FLAGS "")
Expand Down
6 changes: 2 additions & 4 deletions cpp/perspective/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ try {

execSync(`cpy web/**/* ../web`, { cwd, stdio });
execSync(`cpy node/**/* ../node`, { cwd, stdio });
if (!process.env.PSP_DEBUG) {
bootstrap(`../../cpp/perspective/dist/web/perspective.cpp.wasm`);
bootstrap(`../../cpp/perspective/dist/node/perspective.cpp.wasm`);
}
bootstrap(`../../cpp/perspective/dist/web/perspective.cpp.wasm`);
bootstrap(`../../cpp/perspective/dist/node/perspective.cpp.wasm`);
} catch (e) {
console.error(e);
process.exit(1);
Expand Down
3 changes: 2 additions & 1 deletion docs/src/components/Demo/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@
.timecontrols span {
text-align: end;
width: 80px;
font-family: "Roboto Mono";
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo",
"Consolas", "Liberation Mono", monospace;
opacity: 0.5;
font-size: 12px;
}
Expand Down
3 changes: 2 additions & 1 deletion docs/src/css/regular_table_reset.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ tbody,
table thead {
border: 0;
font-size: 12px;
font-family: "Roboto Mono";
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo",
"Consolas", "Liberation Mono", monospace;
margin: 0;
padding: 0;
vertical-align: middle;
Expand Down
3 changes: 3 additions & 0 deletions examples/blocks/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const replacements = {
"perspective-viewer-datagrid/dist/cdn/perspective-viewer-datagrid.js": `perspective-viewer-datagrid@${version}/dist/cdn/perspective-viewer-datagrid.js`,
"perspective-viewer-d3fc/dist/cdn/perspective-viewer-d3fc.js": `perspective-viewer-d3fc@${version}/dist/cdn/perspective-viewer-d3fc.js`,
"perspective-workspace/dist/cdn/perspective-workspace.js": `perspective-workspace@${version}/dist/cdn/perspective-workspace.js`,
"perspective/dist/cdn/perspective.cpp.wasm": `perspective@${version}/dist/cdn/perspective.cpp.wasm`,
"perspective-viewer/dist/cdn/perspective_bg.wasm": `perspective-viewer@${version}/dist/cdn/perspective_bg.wasm`,
"perspective/dist/cdn/perspective.worker.js": `perspective@${version}/dist/cdn/perspective.worker.js`,
};

export async function dist_examples(
Expand Down
6 changes: 4 additions & 2 deletions examples/blocks/src/fractal/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ perspective-viewer[theme="Pro Dark"] {
span,
input,
button {
font-family: "Roboto Mono";
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo",
"Consolas", "Liberation Mono", monospace;
font-size: 12px;
background: none;
margin: 0px;
Expand All @@ -103,7 +104,8 @@ input {
}

input[type="number"] {
font-family: "Roboto Mono";
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo",
"Consolas", "Liberation Mono", monospace;
}

input:focus {
Expand Down
16 changes: 10 additions & 6 deletions examples/blocks/src/market/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
body {
background: #242526;
color: white;
font-family: "Roboto Mono";
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo",
"Consolas", "Liberation Mono", monospace;
touch-action: none;
}

Expand Down Expand Up @@ -63,8 +64,10 @@ img {
margin-left: 14px;
}

select, button {
font-family: "Roboto Mono";
select,
button {
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo",
"Consolas", "Liberation Mono", monospace;
font-size: 12px;
appearance: none;
background-color: transparent;
Expand All @@ -78,12 +81,13 @@ select, button {
outline: none;
user-select: none;
height: 32px;
margin-top: 8px;
margin-top: 8px;
margin-bottom: 8px;
}

select:hover, button:hover {
select:hover,
button:hover {
color: #242526;
background-color: #f4f5f6;
border-color: #f4f5f6;
}
}
16 changes: 10 additions & 6 deletions examples/blocks/src/webcam/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
body {
background: #242526;
color: white;
font-family: "Roboto Mono";
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo",
"Consolas", "Liberation Mono", monospace;
touch-action: none;
}

Expand Down Expand Up @@ -63,8 +64,10 @@ img {
margin-left: 14px;
}

select, button {
font-family: "Roboto Mono";
select,
button {
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo",
"Consolas", "Liberation Mono", monospace;
font-size: 12px;
appearance: none;
background-color: transparent;
Expand All @@ -78,12 +81,13 @@ select, button {
outline: none;
user-select: none;
height: 32px;
margin-top: 8px;
margin-top: 8px;
margin-bottom: 8px;
}

select:hover, button:hover {
select:hover,
button:hover {
color: #242526;
background-color: #f4f5f6;
border-color: #f4f5f6;
}
}
2 changes: 1 addition & 1 deletion packages/perspective-jupyterlab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@finos/perspective-esbuild-plugin": "^2.7.0",
"@finos/perspective-test": "^2.7.0",
"@jupyterlab/builder": "^3.4.0",
"@prospective.co/procss": "^0.1.13",
"@prospective.co/procss": "^0.1.14",
"cpy": "^9.0.1"
},
"jupyterlab": {
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective-viewer-d3fc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
"devDependencies": {
"@finos/perspective-esbuild-plugin": "^2.7.0",
"@finos/perspective-test": "^2.7.0",
"@prospective.co/procss": "^0.1.13"
"@prospective.co/procss": "^0.1.14"
}
}
3 changes: 2 additions & 1 deletion packages/perspective-viewer-d3fc/src/js/plugin/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,8 @@ export function register(...plugins) {
if (settings) {
delete settings["colorStyles"];
delete settings["textStyles"];
await this.draw(...args);
initialiseStyles(this._container, this._settings);
this.resize(...args);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/perspective-viewer-datagrid/src/less/pro.less
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@ regular-table {
span.rt-row-header-icon {
color: #aaa;
padding-right: 4px;
font-family: var(--button--font-family, "Material Icons");
font-family: var(--button--font-family);
}

span.rt-column-header-icon {
font-size: 10px;
padding-left: 3px;
display: inline-block;
width: 10px;
font-family: var(--button--font-family, "Material Icons");
font-family: var(--button--font-family);
}

span.rt-row-header-icon:hover {
Expand Down
34 changes: 12 additions & 22 deletions packages/perspective-workspace/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,37 +112,27 @@ async function build_all() {
const builder = new BuildCss("./src/themes");
add(
builder,
"fonts.less",
"@finos/perspective-viewer/src/themes/fonts.less"
"icons.less",
"@finos/perspective-viewer/src/themes/icons.less"
);

add(builder, "@finos/perspective-viewer/src/themes/pro.less");
add(builder, "pro.scss", "./src/themes/pro.less");
add(builder, "pro2.scss", "./src/themes/pro.less");
fs.writeFileSync("dist/css/pro.css", builder.compile().get("pro2.css"));
add(builder, "pro.less", "@finos/perspective-viewer/src/themes/pro.less");
add(builder, "output.scss", "./src/themes/pro.less");
fs.writeFileSync("dist/css/pro.css", builder.compile().get("output.css"));

const builder2 = new BuildCss("./src/themes");
add(
builder2,
"fonts.less",
"@finos/perspective-viewer/src/themes/fonts.less"
"icons.less",
"@finos/perspective-viewer/src/themes/icons.less"
);
add(builder2, "@finos/perspective-viewer/src/themes/pro.less");
add(builder2, "pro.less", "@finos/perspective-viewer/src/themes/pro.less");
add(builder2, "@finos/perspective-viewer/src/themes/pro-dark.less");
add(builder2, "pro-workspace.less", "./src/themes/pro.less");
add(builder2, "@finos/perspective-viewer/src/themes/variables.less");
add(
builder2,
"pro.less",
"@finos/perspective-workspace/src/themes/pro.less"
);
add(
builder2,
"pro-dark-viewer.less",
"@finos/perspective-viewer/src/themes/pro-dark.less"
);
add(builder2, "pro-dark2.scss", "./src/themes/pro-dark.less");
add(builder2, "output.scss", "./src/themes/pro-dark.less");
fs.writeFileSync(
"dist/css/pro-dark.css",
builder2.compile().get("pro-dark2.css")
builder2.compile().get("output.css")
);

await Promise.all(BUILD.map(build)).catch(() => process.exit(1));
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective-workspace/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"lodash": "^4.17.4"
},
"devDependencies": {
"@prospective.co/procss": "^0.1.13",
"@prospective.co/procss": "^0.1.14",
"@finos/perspective-esbuild-plugin": "^2.7.0",
"@finos/perspective-test": "^2.7.0"
}
Expand Down
11 changes: 4 additions & 7 deletions packages/perspective-workspace/src/less/menu.less
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@
border-top: 1px solid #dddddd;
}

.p-Menu-itemIcon::before,
.p-Menu-itemSubmenuIcon::before {
font-family: "Material Icons";
}

.p-MenuBar-menu {
transform: translateY(-1px);
}
Expand All @@ -113,12 +108,14 @@

.p-Menu-itemIcon:before {
content: attr(content);
font-family: "Roboto Mono";
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo",
"Consolas", "Liberation Mono", monospace;
}

[data-type="submenu"] .lm-Menu-itemSubmenuIcon:before {
content: ">";
font-family: "Roboto Mono";
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo",
"Consolas", "Liberation Mono", monospace;
height: 18px;
}

Expand Down
10 changes: 4 additions & 6 deletions packages/perspective-workspace/src/themes/pro-dark.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

@import url("ref://pro-workspace.less");
@import url("ref://@finos/perspective-viewer/src/themes/pro-dark.less");
@import url("ref://@finos/perspective-viewer/src/themes/variables.less");
// @import "@finos/perspective-viewer/dist/css/pro-dark.css";

@import url("ref://pro.less");
@import url("ref://pro-dark-viewer.less");

perspective-workspace,
perspective-workspace[theme="Pro Dark"],
Expand Down Expand Up @@ -65,12 +63,12 @@ perspective-viewer[theme="Pro Dark"].workspace-master-widget {
}

.p-Menu {
// font-family: "Roboto Mono";
// font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
// font-weight: 300 !important;
background: @grey700 !important;
color: white !important;
border: 1px solid @grey500 !important;

font-family: "Roboto Mono";
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
font-weight: 300;
}
9 changes: 3 additions & 6 deletions packages/perspective-workspace/src/themes/pro.less
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

// @import "@finos/perspective-viewer/dist/css/pro.css";
// @import "@finos/perspective-viewer/src/themes/variables.less";
@import url("ref://@finos/perspective-viewer/src/themes/pro.less");
@import url("ref://pro.less");

perspective-workspace,
perspective-workspace[theme="Pro Light"],
Expand Down Expand Up @@ -58,11 +56,10 @@ perspective-viewer[theme="Pro Light"].workspace-master-widget {
}

@mixin perspective-workspace-pro-base {
font-family: "Roboto Mono";
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
--open-settings-button--content: "expand_more";
--close-settings-button--content: "expand_less";
--close-button--content: "\2715";
--settings--font-family: "Material Icons";
--master-divider--background-color: #243136;
--menu-maximize--content: "fullscreen";
--menu-minimize--content: "fullscreen_exit";
Expand All @@ -87,7 +84,7 @@ perspective-viewer[theme="Pro Light"].workspace-master-widget {
}

.p-Menu {
font-family: "Roboto Mono";
font-family: "ui-monospace", "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
font-weight: 300;
color: #161616;
}
13 changes: 7 additions & 6 deletions packages/perspective/src/js/perspective.js
Original file line number Diff line number Diff line change
Expand Up @@ -1421,12 +1421,6 @@ export default function (Module) {
let validated_expressions = [];
const expression_idx_map = {};
const is_new_format = !Array.isArray(expressions);
if (!is_new_format) {
console.warn(
"Legacy `expressions` format: " + JSON.stringify(expressions)
);
}

for (let expression of is_new_format
? Object.keys(expressions)
: expressions) {
Expand Down Expand Up @@ -1773,6 +1767,13 @@ export default function (Module) {
const table_schema = this.schema();

if (config.expressions !== undefined) {
if (Array.isArray(config.expressions)) {
console.warn(
"Legacy `expressions` format: " +
JSON.stringify(config.expressions)
);
}

config.expressions = parse_expression_strings(config.expressions);
}

Expand Down
5 changes: 3 additions & 2 deletions rust/perspective-viewer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading