Skip to content

Commit

Permalink
1.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
mgmeyers committed Sep 4, 2023
1 parent 0d8f724 commit cb07f16
Show file tree
Hide file tree
Showing 27 changed files with 448 additions and 225 deletions.
78 changes: 21 additions & 57 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,34 @@
name: Release Obsidian Plugin
name: Release Obsidian plugin

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
- uses: actions/checkout@v3

- name: Use Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '14.x'
- name: Get Version
id: version
run: |
echo "::set-output name=tag::$(git describe --abbrev=0)"
- name: Build
id: build
node-version: '18.x'

- name: Build plugin
run: |
yarn
yarn run build
# Create the release on github
- name: Create Release
id: create_release
uses: actions/create-release@v1
npm install
npm run build
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.ref }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
# Upload the main.js
- name: Upload main.js
id: upload-main
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./main.js
asset_name: main.js
asset_content_type: text/javascript
# Upload the manifest.json
- name: Upload manifest.json
id: upload-manifest
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./manifest.json
asset_name: manifest.json
asset_content_type: application/json
# Upload the style.css
- name: Upload styles.css
id: upload-css
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./styles.css
asset_name: styles.css
asset_content_type: text/css
run: |
tag="${GITHUB_REF#refs/tags/}"
gh release create "$tag" \
--title="$tag" \
--notes-file="release-notes.md" \
main.js manifest.json styles.css
20 changes: 10 additions & 10 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"id": "obsidian-style-settings",
"name": "Style Settings",
"version": "1.0.6",
"minAppVersion": "0.11.5",
"description": "Offers controls for adjusting theme, plugin, and snippet CSS variables.",
"author": "mgmeyers",
"authorUrl": "https://github.com/mgmeyers/obsidian-style-settings",
"isDesktopOnly": false
}
{
"id": "obsidian-style-settings",
"name": "Style Settings",
"version": "1.0.7",
"minAppVersion": "0.11.5",
"description": "Offers controls for adjusting theme, plugin, and snippet CSS variables.",
"author": "mgmeyers",
"authorUrl": "https://github.com/mgmeyers/obsidian-style-settings",
"isDesktopOnly": false
}
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-style-settings",
"version": "0.0.1",
"version": "1.0.7",
"description": "Offers controls for adjusting theme, plugin, and CSS snippet styles.",
"main": "main.js",
"scripts": {
Expand All @@ -9,7 +9,10 @@
"prettier": "prettier --write \"./src/**/*.{ts,tsx}\"",
"lint": "eslint ./src",
"lint:fix": "eslint ./src --fix",
"clean": "yarn prettier && yarn lint:fix"
"clean": "yarn prettier && yarn lint:fix",
"rlnotes": "git log $(git describe --tags --abbrev=0)..HEAD --oneline > release-notes.md && git add release-notes.md",
"bump": "node version-bump.mjs && git add manifest.json versions.json && yarn rlnotes",
"release": "git commit -m $npm_package_version && git tag $npm_package_version && git push && git push --tags"
},
"keywords": [],
"author": "",
Expand All @@ -18,6 +21,7 @@
"@rollup/plugin-commonjs": "^15.1.0",
"@rollup/plugin-node-resolve": "^9.0.0",
"@rollup/plugin-typescript": "^6.0.0",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@types/node": "^14.14.2",
"eslint": "^8.33.0",
"obsidian": "^1.1.1",
Expand Down
21 changes: 21 additions & 0 deletions prettier.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable no-undef */
module.exports = {
arrowParens: 'always',
bracketSpacing: true,
endOfLine: 'lf',
htmlWhitespaceSensitivity: 'css',
bracketSameLine: false,
jsxSingleQuote: false,
printWidth: 80,
proseWrap: 'preserve',
quoteProps: 'as-needed',
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
useTabs: false,
importOrder: ['^[./]'],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
plugins: ["@trivago/prettier-plugin-sort-imports"]
};
2 changes: 2 additions & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0d8f724 Merge pull request #136 from ebullient/commented
7035a31 Include "/*! @settings" when looking for settings
4 changes: 2 additions & 2 deletions src/ExportModal.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { App, Modal, Setting, TextAreaComponent } from 'obsidian';
import CSSSettingsPlugin from './main';
import { SettingValue } from './SettingsManager';
import CSSSettingsPlugin from './main';
import { App, Modal, Setting, TextAreaComponent } from 'obsidian';

export class ExportModal extends Modal {
plugin: CSSSettingsPlugin;
Expand Down
4 changes: 2 additions & 2 deletions src/ImportModal.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { SettingValue } from './SettingsManager';
import CSSSettingsPlugin from './main';
import {
App,
ButtonComponent,
Modal,
Setting,
TextAreaComponent,
} from 'obsidian';
import CSSSettingsPlugin from './main';
import { SettingValue } from './SettingsManager';

export class ImportModal extends Modal {
plugin: CSSSettingsPlugin;
Expand Down
23 changes: 12 additions & 11 deletions src/SettingsManager.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ExportModal } from './ExportModal';
import { ImportModal } from './ImportModal';
import {
AltFormatList,
ClassMultiToggle,
Expand All @@ -13,12 +15,9 @@ import {
VariableText,
VariableThemedColor,
} from './SettingHandlers';

import CSSSettingsPlugin from './main';
import chroma from 'chroma-js';
import { ImportModal } from './ImportModal';
import { ExportModal } from './ExportModal';
import { SettingType } from './settingsView/SettingComponents/types';
import chroma from 'chroma-js';

type VariableKV = Array<{ key: string; value: string }>;

Expand Down Expand Up @@ -472,26 +471,28 @@ export class CSSSettingsManager {
this.styleTag.innerText = `
body.css-settings-manager {
${vars.reduce((combined, current) => {
return combined + `--${current.key}: ${current.value}; `;
}, '')}
return combined + `--${current.key}: ${current.value}; `;
}, '')}
}
body.theme-light.css-settings-manager {
${themedLight.reduce((combined, current) => {
return combined + `--${current.key}: ${current.value}; `;
}, '')}
return combined + `--${current.key}: ${current.value}; `;
}, '')}
}
body.theme-dark.css-settings-manager {
${themedDark.reduce((combined, current) => {
return combined + `--${current.key}: ${current.value}; `;
}, '')}
return combined + `--${current.key}: ${current.value}; `;
}, '')}
}
`
.trim()
.replace(/[\r\n\s]+/g, ' ');

this.plugin.app.workspace.trigger('css-change', { source: 'style-settings' });
this.plugin.app.workspace.trigger('css-change', {
source: 'style-settings',
});
}

setConfig(settings: ParsedCSSSettings[]) {
Expand Down
2 changes: 1 addition & 1 deletion src/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { lang, t } from './lang/helpers';
import { Meta, WithDescription, WithTitle } from './SettingHandlers';
import { lang, t } from './lang/helpers';
import Pickr from '@simonwep/pickr';

export const settingRegExp = /\/\*!?\s*@settings[\r\n]+?([\s\S]+?)\*\//g;
Expand Down
31 changes: 16 additions & 15 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
import '@simonwep/pickr/dist/themes/nano.min.css';
import './css/pickerOverrides.css';
import './css/settings.css';

import { Command, Plugin } from 'obsidian';
import { CSSSettingsManager } from './SettingsManager';
import { ClassToggle, ParsedCSSSettings } from './SettingHandlers';
import yaml from 'js-yaml';
import detectIndent from 'detect-indent';

import { CSSSettingsTab } from './settingsView/CSSSettingsTab';
import { SettingsView, viewType } from './settingsView/SettingsView';
import { CSSSettingsManager } from './SettingsManager';
import {
ErrorList,
getDescription,
Expand All @@ -18,7 +8,15 @@ import {
settingRegExp,
SettingsSeachResource,
} from './Utils';
import './css/pickerOverrides.css';
import './css/settings.css';
import { CSSSettingsTab } from './settingsView/CSSSettingsTab';
import { SettingType } from './settingsView/SettingComponents/types';
import { SettingsView, viewType } from './settingsView/SettingsView';
import '@simonwep/pickr/dist/themes/nano.min.css';
import detectIndent from 'detect-indent';
import yaml from 'js-yaml';
import { Command, Plugin } from 'obsidian';

export default class CSSSettingsPlugin extends Plugin {
settingsManager: CSSSettingsManager;
Expand Down Expand Up @@ -49,11 +47,14 @@ export default class CSSSettingsPlugin extends Plugin {
});

this.registerEvent(
(this.app.workspace as any).on('css-change', (data?: { source: string }) => {
if (data?.source !== 'style-settings') {
this.parseCSS();
(this.app.workspace as any).on(
'css-change',
(data?: { source: string }) => {
if (data?.source !== 'style-settings') {
this.parseCSS();
}
}
})
)
);

this.registerEvent(
Expand Down
6 changes: 3 additions & 3 deletions src/settingsView/CSSSettingsTab.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { App, PluginSettingTab } from 'obsidian';
import { SettingsMarkup } from './SettingsMarkup';
import CSSSettingsPlugin from '../main';
import { ErrorList } from 'src/Utils';
import { SettingsMarkup } from './SettingsMarkup';
import { App, PluginSettingTab } from 'obsidian';
import { ParsedCSSSettings } from 'src/SettingHandlers';
import { ErrorList } from 'src/Utils';

export class CSSSettingsTab extends PluginSettingTab {
settingsMarkup: SettingsMarkup;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CSSSettingsManager } from '../../SettingsManager';
import { CSSSetting } from '../../SettingHandlers';
import { CSSSettingsManager } from '../../SettingsManager';
import { getDescription, getTitle } from '../../Utils';
import fuzzysort from 'fuzzysort';
import { Component } from 'obsidian';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { AbstractSettingComponent } from './AbstractSettingComponent';
import { DropdownComponent, Setting } from 'obsidian';
import {
ClassMultiToggle,
resetTooltip,
SelectOption,
} from '../../SettingHandlers';
import { t } from '../../lang/helpers';
import { createDescription, getDescription, getTitle } from '../../Utils';
import { t } from '../../lang/helpers';
import { AbstractSettingComponent } from './AbstractSettingComponent';
import { DropdownComponent, Setting } from 'obsidian';

export class ClassMultiToggleSettingComponent extends AbstractSettingComponent {
settingEl: Setting;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AbstractSettingComponent } from './AbstractSettingComponent';
import { Setting, ToggleComponent } from 'obsidian';
import { ClassToggle, resetTooltip } from '../../SettingHandlers';
import { getDescription, getTitle } from '../../Utils';
import { AbstractSettingComponent } from './AbstractSettingComponent';
import { Setting, ToggleComponent } from 'obsidian';

export class ClassToggleSettingComponent extends AbstractSettingComponent {
settingEl: Setting;
Expand Down
18 changes: 9 additions & 9 deletions src/settingsView/SettingComponents/HeadingSettingComponent.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { AbstractSettingComponent } from './AbstractSettingComponent';
import { setIcon, Setting } from 'obsidian';
import { getDescription, getTitle } from '../../Utils';
import { CSSSetting, Heading } from '../../SettingHandlers';
import { SettingType } from './types';
import { CSSSettingsManager } from 'src/SettingsManager';
import { ClassToggleSettingComponent } from './ClassToggleSettingComponent';
import { getDescription, getTitle } from '../../Utils';
import { AbstractSettingComponent } from './AbstractSettingComponent';
import { ClassMultiToggleSettingComponent } from './ClassMultiToggleSettingComponent';
import { VariableTextSettingComponent } from './VariableTextSettingComponent';
import { ClassToggleSettingComponent } from './ClassToggleSettingComponent';
import { InfoTextSettingComponent } from './InfoTextSettingComponent';
import { VariableColorSettingComponent } from './VariableColorSettingComponent';
import { VariableNumberSettingComponent } from './VariableNumberSettingComponent';
import { VariableNumberSliderSettingComponent } from './VariableNumberSliderSettingComponent';
import { VariableSelectSettingComponent } from './VariableSelectSettingComponent';
import { VariableColorSettingComponent } from './VariableColorSettingComponent';
import { VariableTextSettingComponent } from './VariableTextSettingComponent';
import { VariableThemedColorSettingComponent } from './VariableThemedColorSettingComponent';
import { InfoTextSettingComponent } from './InfoTextSettingComponent';
import { SettingType } from './types';
import { setIcon, Setting } from 'obsidian';
import { CSSSettingsManager } from 'src/SettingsManager';

export function createSettingComponent(
parent: AbstractSettingComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { AbstractSettingComponent } from './AbstractSettingComponent';
import { MarkdownRenderer, Setting } from 'obsidian';
import { InfoText } from '../../SettingHandlers';
import { getDescription, getTitle } from '../../Utils';
import { AbstractSettingComponent } from './AbstractSettingComponent';
import { MarkdownRenderer, Setting } from 'obsidian';

export class InfoTextSettingComponent extends AbstractSettingComponent {
settingEl: Setting;
Expand Down
Loading

0 comments on commit cb07f16

Please sign in to comment.