Skip to content

Commit

Permalink
use tabs instead of spaces because https://www.reddit.com/r/javascrip…
Browse files Browse the repository at this point in the history
  • Loading branch information
zoreet committed Dec 27, 2023
1 parent 6c3089d commit 2457dde
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 138 deletions.
20 changes: 10 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# top-most EditorConfig file
rootElement = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 4
tab_width = 4
# top-most EditorConfig file
rootElement = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 2
tab_width = 2
44 changes: 22 additions & 22 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
{
"rootElement": true,
"parser": "@typescript-eslint/parser",
"env": { "node": true },
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
}
}
"rootElement": true,
"parser": "@typescript-eslint/parser",
"env": { "node": true },
"plugins": [
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parserOptions": {
"sourceType": "module"
},
"rules": {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off"
}
}
21 changes: 21 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": false,
"semi": true,
"experimentalTernaries": false,
"singleQuote": false,
"jsxSingleQuote": false,
"quoteProps": "as-needed",
"trailingComma": "all",
"singleAttributePerLine": true,
"htmlWhitespaceSensitivity": "css",
"vueIndentScriptAndStyle": false,
"proseWrap": "preserve",
"insertPragma": false,
"printWidth": 80,
"requirePragma": false,
"tabWidth": 2,
"useTabs": true,
"embeddedLanguageFormatting": "auto"
}
6 changes: 3 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const PLUGIN_NAME = "Habit Tracker 21"

export default class HabitTracker21 extends Plugin {

async onload() {
async onload() {
console.log(`${PLUGIN_NAME}: loading...`);
this.registerMarkdownCodeBlockProcessor("habittracker", async (src, el, ctx) => {
new HabitTracker(src, el, ctx, this.app);
});
}
}
}
}
157 changes: 76 additions & 81 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,139 +7,134 @@ If your plugin does not need CSS, delete this file.
*/
.habit_tracker {
container-type: inline-size;
container-name: habit_tracker;
min-width: 200px;
container-type: inline-size;
container-name: habit_tracker;
min-width: 200px;
}

.block-language-habittracker {
font-family: monospace;
font-size: 14px;
line-height: var(--checkbox-size);
font-family: monospace;
font-size: 14px;
line-height: var(--checkbox-size);
}

.habit-tracker__row {
display: flex;
width: 100%
display: flex;
width: 100%;
}

.habit-tracker__row:hover {
background-color: var(--color-base-10);
background-color: var(--color-base-10);
}

.habit-tracker__row+.habit-tracker__row {
border-top: 1px solid var(--color-base-50);
.habit-tracker__row + .habit-tracker__row {
border-top: 1px solid var(--color-base-50);
}


.habit-cell {
box-sizing: content-box;
display: inline-block;
font-size: 11px;
height: 16px;
overflow: hidden;
padding: 8px 4px;
text-align: center;
width: 16px;
box-sizing: content-box;
display: inline-block;
font-size: 11px;
height: 16px;
overflow: hidden;
padding: 8px 4px;
text-align: center;
width: 16px;
}

.habit-cell+.habit-cell {
border-left: 1px solid var(--color-base-30);
.habit-cell + .habit-cell {
border-left: 1px solid var(--color-base-30);
}

.habit-tracker__header .habit-cell {
text-align: end;
text-align: end;
}

/* today */
.habit-cell:last-child {
background-color: var(--color-base-20);
background-color: var(--color-base-20);
}



.habit-cell__name {
flex: auto 1 0;
text-align: start !important;
letter-spacing: 0.05em;
white-space: nowrap;
text-overflow: ellipsis;
flex: auto 1 0;
text-align: start !important;
letter-spacing: 0.05em;
white-space: nowrap;
text-overflow: ellipsis;
}



.habit-cell__name:hover,
.habit-tick:hover {
background-color: var(--color-base-30);
cursor: pointer;
background-color: var(--color-base-30);
cursor: pointer;
}

@container habit_tracker (min-width:461px) and (max-width: 640px) {
.habit-cell__name~.habit-cell {
display: none;
}
.habit-cell__name ~ .habit-cell {
display: none;
}

.habit-cell__name~.habit-cell:nth-child(n + 9) {
display: block;
}
.habit-cell__name ~ .habit-cell:nth-child(n + 9) {
display: block;
}
}

@container habit_tracker (min-width:281px) and (max-width: 460px) {
.habit-cell__name~.habit-cell {
display: none;
}
.habit-cell__name ~ .habit-cell {
display: none;
}

.habit-cell__name~.habit-cell:nth-child(n + 16) {
display: block;
}
.habit-cell__name ~ .habit-cell:nth-child(n + 16) {
display: block;
}
}

@container habit_tracker (max-width: 280px) {
.habit-cell__name~.habit-cell {
display: none;
}
.habit-cell__name ~ .habit-cell {
display: none;
}

.habit-cell__name~.habit-cell:nth-child(n + 20) {
display: block;
}
.habit-cell__name ~ .habit-cell:nth-child(n + 20) {
display: block;
}
}

.habit-tick--true {
overflow: hidden;
white-space: nowrap;
padding-left: 0;
padding-right: 0;
width: 24px;
overflow: hidden;
white-space: nowrap;
padding-left: 0;
padding-right: 0;
width: 24px;
}

.habit-tick--true:before {
background: var(--checkbox-color);
border-radius: 10px;
content: "";
display: inline-block;
height: 16px;
margin-bottom: 100px;
margin-left: 4px;
margin-right: 100px;
width: 16px;
transition: all .3s ease;
background: var(--checkbox-color);
border-radius: 10px;
content: "";
display: inline-block;
height: 16px;
margin-bottom: 100px;
margin-left: 4px;
margin-right: 100px;
width: 16px;
transition: all 0.3s ease;
}

.habit-tick--true+.habit-tick--true:before {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
margin-left: 0;
width: 20px;
.habit-tick--true + .habit-tick--true:before {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
margin-left: 0;
width: 20px;
}

.habit-tick--true:has(+ .habit-tick--true):before {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
width: 100%;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
width: 100%;
}

.habit-cell__name+* {
/* i want to show that a streak is already ongoing even if the previous dates are not rendered
so I load an extra date in the range, but never display it in the UI */
display: none;
}
.habit-cell__name + * {
/* i want to show that a streak is already ongoing even if the previous dates are not rendered
so I load an extra date in the range, but never display it in the UI */
display: none;
}
44 changes: 22 additions & 22 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{
"compilerOptions": {
"baseUrl": ".",
"inlineSourceMap": true,
"inlineSources": true,
"module": "ESNext",
"target": "ES6",
"allowJs": true,
"noImplicitAny": false,
"moduleResolution": "node",
"importHelpers": true,
"isolatedModules": true,
"strictNullChecks": true,
"lib": [
"DOM",
"ES5",
"ES6",
"ES7"
]
},
"include": [
"**/*.ts"
]
"compilerOptions": {
"baseUrl": ".",
"inlineSourceMap": true,
"inlineSources": true,
"module": "ESNext",
"target": "ES6",
"allowJs": true,
"noImplicitAny": false,
"moduleResolution": "node",
"importHelpers": true,
"isolatedModules": true,
"strictNullChecks": true,
"lib": [
"DOM",
"ES5",
"ES6",
"ES7"
]
},
"include": [
"**/*.ts"
]
}

0 comments on commit 2457dde

Please sign in to comment.