Skip to content

Commit

Permalink
Merge pull request #565 from cocopon/v4
Browse files Browse the repository at this point in the history
Version 4.0.0
  • Loading branch information
cocopon authored Aug 6, 2023
2 parents 3d78f6b + 049bb64 commit aae3842
Show file tree
Hide file tree
Showing 476 changed files with 14,962 additions and 9,674 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: CI
on:
pull_request:
branches:
- main
release:
types: [released]
workflow_dispatch:
Expand Down
16 changes: 12 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ value changes, inspired by [dat.GUI][].
See the [official page][documents] for details.


### [Input bindings](https://cocopon.github.io/tweakpane/input-bindings/)
### [Bindings](https://cocopon.github.io/tweakpane/input-bindings/)
Number, String, Boolean, Color, Point 2D/3D/4D

![Input bindings](https://user-images.githubusercontent.com/602961/184479032-38f50be3-e235-4914-85c0-dce316b33ed2.png)
![Bindings](https://user-images.githubusercontent.com/602961/184479032-38f50be3-e235-4914-85c0-dce316b33ed2.png)


### [Monitor bindings](https://cocopon.github.io/tweakpane/monitor-bindings/)
### [Readonly bindings](https://cocopon.github.io/tweakpane/monitor-bindings/)
Number, String, Boolean

![Monitor bindings](https://user-images.githubusercontent.com/602961/184479060-44fda993-9f40-4ef1-b363-18e9f9deff7f.png)
![Readonly bindings](https://user-images.githubusercontent.com/602961/184479060-44fda993-9f40-4ef1-b363-18e9f9deff7f.png)


### [UI components](https://cocopon.github.io/tweakpane/ui-components/)
Expand All @@ -53,6 +53,14 @@ Folder, Tab, Button, Separator


## Development


### CommonJS and ES modules
From version 4, Tweakpane has been migrated to ES modules. If you are looking for a CommonJS version of the package, use version 3.x.


### Build your own Tweakpane

```
$ npm install
$ npm run setup
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tweakpane-monorepo",
"version": "3.1.10",
"version": "4.0.0-beta.2",
"private": true,
"description": "Tweakpane monorepo",
"author": "cocopon",
Expand Down Expand Up @@ -41,15 +41,15 @@
"eslint-plugin-simple-import-sort": "^7.0.0",
"jsdom": "^16.7.0",
"mkdirp": "^1.0.4",
"mocha": "^10.0.0",
"mocha": "^10.2.0",
"npm-run-all": "^4.1.5",
"nyc": "^15.1.0",
"onchange": "^7.1.0",
"prettier": "^2.4.0",
"rimraf": "^3.0.2",
"sass": "^1.49.9",
"ts-node": "^7.0.1",
"sass": "^1.58.0",
"ts-node": "^10.9.1",
"tslib": "^2.1.0",
"typescript": "^4.1.5"
"typescript": "^4.9.5"
}
}
33 changes: 0 additions & 33 deletions packages/core/lib/sass/_full.scss

This file was deleted.

14 changes: 8 additions & 6 deletions packages/core/lib/sass/_plugin-test.scss
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
@import './plugin';
@use './tp';

.#{$prefix}-test {
@extend %button;
@extend %input;
@extend %monitor;
.#{tp.$prefix}-test {
@extend %tp-button;
@extend %tp-input;
@extend %tp-monitor;

transition-duration: $fold-transition-duration;
background-color: tp.cssVar('input-bg');
color: tp.cssVar('input-fg');
transition-duration: tp.$fold-transition-duration;
}
22 changes: 0 additions & 22 deletions packages/core/lib/sass/_plugin.scss

This file was deleted.

12 changes: 12 additions & 0 deletions packages/core/lib/sass/_tp.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Entry point for plugins

@forward './common/defs';

@forward './view/placeholder/button';
@forward './view/placeholder/container';
@forward './view/placeholder/folder';
@forward './view/placeholder/input';
@forward './view/placeholder/list';
@forward './view/placeholder/monitor';
@forward './view/placeholder/texts';
@forward './view/placeholder/theme';
188 changes: 67 additions & 121 deletions packages/core/lib/sass/common/_defs.scss
Original file line number Diff line number Diff line change
@@ -1,128 +1,74 @@
// Geometry
$separator-width: 2px;
$slider-knob-size: 12px;

// Z-index
$z-index-picker: 1000;

@mixin themeVariable($in-name, $ex-name, $value) {
--#{$in-name}: var(--#{$prefix}-#{$ex-name}, #{$value});
}

%themeVariables {
$base-hue: 230;
$color-exdark: hsl($base-hue, 7%, 0%);
$color-dark: hsl($base-hue, 7%, 17%);
$color-light: hsl($base-hue, 7%, 70%);
$color-exlight: hsl($base-hue, 7%, 75%);
$bg-color: $color-dark;
$fg-color: $color-exlight;
@use 'sass:map';
@use 'sass:string';

@include themeVariable(
'font-family',
'font-family',
('Roboto Mono', 'Source Code Pro', Menlo, Courier, monospace)
);
// TODO: Rename
@include themeVariable('bs-br', 'base-border-radius', 6px);
@include themeVariable('cnt-h-p', 'container-horizontal-padding', 4px);
@include themeVariable('cnt-v-p', 'container-vertical-padding', 4px);
@include themeVariable('elm-br', 'element-border-radius', 2px);
@include themeVariable('bld-s', 'blade-spacing', 4px);
@include themeVariable('bld-us', 'blade-unit-size', 20px);
$prefix: 'tp';

// Base
@include themeVariable('bs-bg', 'base-background-color', $bg-color);
@include themeVariable('bs-sh', 'base-shadow-color', rgba(black, 0.2));
// Classes for view states
$disabled: #{$prefix}-v-disabled;
$first: #{$prefix}-v-fst;
$hidden: #{$prefix}-v-hidden;
$last: #{$prefix}-v-lst;
$very-first: #{$prefix}-v-vfst;
$very-last: #{$prefix}-v-vlst;

// Button
@include themeVariable('btn-bg', 'button-background-color', $color-light);
@include themeVariable(
'btn-bg-a',
'button-background-color-active',
lighten($color-light, 15%)
);
@include themeVariable(
'btn-bg-f',
'button-background-color-focus',
lighten($color-light, 10%)
);
@include themeVariable(
'btn-bg-h',
'button-background-color-hover',
lighten($color-light, 5%)
);
@include themeVariable('btn-fg', 'button-foreground-color', $bg-color);

// Container
@include themeVariable(
'cnt-bg',
'container-background-color',
rgba($fg-color, 0.1)
);
@include themeVariable(
'cnt-bg-a',
'container-background-color-active',
rgba($fg-color, 0.25)
);
@include themeVariable(
'cnt-bg-f',
'container-background-color-focus',
rgba($fg-color, 0.2)
);
@include themeVariable(
'cnt-bg-h',
'container-background-color-hover',
rgba($fg-color, 0.15)
);
@include themeVariable('cnt-fg', 'container-foreground-color', $fg-color);

// Input
@include themeVariable(
'in-bg',
'input-background-color',
rgba($fg-color, 0.1)
);
@include themeVariable(
'in-bg-a',
'input-background-color-active',
rgba($fg-color, 0.25)
);
@include themeVariable(
'in-bg-f',
'input-background-color-focus',
rgba($fg-color, 0.2)
);
@include themeVariable(
'in-bg-h',
'input-background-color-hover',
rgba($fg-color, 0.15)
);
@include themeVariable('in-fg', 'input-foreground-color', $fg-color);
// Common Sass variables
$fold-transition-duration: 0.2s;
$separator-width: 2px;
$slider-knob-size: 12px;
$z-index-picker: 1000;

// Label
@include themeVariable(
'lbl-fg',
'label-foreground-color',
rgba($fg-color, 0.7)
);
// CSS variables
// Use short names to reduce file size
$css-vars: (
'base-bg': 'bs-bg',
'base-border-radius': 'bs-br',
'base-font': 'bs-ff',
'base-shadow': 'bs-sh',
'blade-border-radius': 'bld-br',
'blade-h-padding': 'bld-hp',
'blade-value-width': 'bld-vw',
'button-bg': 'btn-bg',
'button-bg-active': 'btn-bg-a',
'button-bg-focus': 'btn-bg-f',
'button-bg-hover': 'btn-bg-h',
'button-fg': 'btn-fg',
'container-bg': 'cnt-bg',
'container-bg-active': 'cnt-bg-a',
'container-bg-focus': 'cnt-bg-f',
'container-bg-hover': 'cnt-bg-h',
'container-fg': 'cnt-fg',
'container-h-padding': 'cnt-hp',
'container-unit-size': 'cnt-usz',
'container-unit-spacing': 'cnt-usp',
'container-v-padding': 'cnt-vp',
'groove-fg': 'grv-fg',
'input-bg': 'in-bg',
'input-bg-active': 'in-bg-a',
'input-bg-focus': 'in-bg-f',
'input-bg-hover': 'in-bg-h',
'input-fg': 'in-fg',
'label-fg': 'lbl-fg',
'monitor-bg': 'mo-bg',
'monitor-fg': 'mo-fg',
);

// Monitor
@include themeVariable(
'mo-bg',
'monitor-background-color',
rgba($color-exdark, 0.2)
);
@include themeVariable(
'mo-fg',
'monitor-foreground-color',
rgba($fg-color, 0.7)
);
@function cssVar($name) {
$short-name: map.get($css-vars, $name);
@if $short-name == null {
@error 'Short CSS variable for \'#{$name}\' not found.';
}
@return string.unquote('var(--' + $short-name + ')');
}

// Groove
@include themeVariable(
'grv-fg',
'groove-foreground-color',
rgba($fg-color, 0.1)
);
// Reset user agent style
%tp-resetUserAgent {
appearance: none;
background-color: transparent;
border-width: 0;
font-family: inherit;
font-size: inherit;
font-weight: inherit;
margin: 0;
outline: none;
padding: 0;
}
6 changes: 4 additions & 2 deletions packages/core/lib/sass/view/_button.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.#{$prefix}-btnv {
@use '../tp';

.#{tp.$prefix}-btnv {
&_b {
@extend %button;
@extend %tp-button;

width: 100%;
}
Expand Down
Loading

0 comments on commit aae3842

Please sign in to comment.