mirror of
https://github.com/jalad25/contact-note.git
synced 2026-07-22 06:53:06 +00:00
Initial commit
This commit is contained in:
commit
5d34ae9d62
25 changed files with 4858 additions and 0 deletions
10
.editorconfig
Normal file
10
.editorconfig
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
tab_width = 4
|
||||
3
.eslintignore
Normal file
3
.eslintignore
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
node_modules/
|
||||
|
||||
main.js
|
||||
24
.eslintrc
Normal file
24
.eslintrc
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"root": 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",
|
||||
"no-case-declarations": "off"
|
||||
}
|
||||
}
|
||||
46
.github/workflows/release.yml
vendored
Normal file
46
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Validate tag matches manifest version
|
||||
run: |
|
||||
tag="${GITHUB_REF#refs/tags/}"
|
||||
manifest_version=$(node -e "console.log(require('./manifest.json').version)")
|
||||
|
||||
if [ "$tag" != "$manifest_version" ]; then
|
||||
echo "Tag ($tag) does not match manifest.json version ($manifest_version)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "24.x"
|
||||
|
||||
- name: Build plugin
|
||||
run: |
|
||||
npm install
|
||||
npm run build
|
||||
|
||||
- name: Create release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
tag="${GITHUB_REF#refs/tags/}"
|
||||
|
||||
gh release create "$tag" \
|
||||
--title "$tag" \
|
||||
--generate-notes \
|
||||
main.js manifest.json styles.css
|
||||
66
.github/workflows/version-bump.yml
vendored
Normal file
66
.github/workflows/version-bump.yml
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
name: Bump version
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "New version (e.g. 1.1.0)"
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
bump:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Validate version format
|
||||
run: |
|
||||
if ! echo "${{ github.event.inputs.version }}" | grep -qE '^\d+\.\d+\.\d+$'; then
|
||||
echo "Invalid version format. Expected x.y.z (e.g. 1.1.0)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Validate version is not already released
|
||||
run: |
|
||||
version="${{ github.event.inputs.version }}"
|
||||
if node -e "const v = require('./versions.json'); if (v['$version']) process.exit(1);"; then
|
||||
echo "versions.json already contains an entry for $version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Update manifest.json, package.json, and versions.json
|
||||
run: |
|
||||
version="${{ github.event.inputs.version }}"
|
||||
min_app_version=$(node -e "console.log(require('./manifest.json').minAppVersion)")
|
||||
|
||||
node -e "
|
||||
const fs = require('fs');
|
||||
|
||||
const manifest = JSON.parse(fs.readFileSync('manifest.json', 'utf8'));
|
||||
manifest.version = '$version';
|
||||
fs.writeFileSync('manifest.json', JSON.stringify(manifest, null, 2) + '\n');
|
||||
|
||||
const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
||||
pkg.version = '$version';
|
||||
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
|
||||
|
||||
const versions = JSON.parse(fs.readFileSync('versions.json', 'utf8'));
|
||||
versions['$version'] = '$min_app_version';
|
||||
fs.writeFileSync('versions.json', JSON.stringify(versions, null, 2) + '\n');
|
||||
"
|
||||
|
||||
- name: Commit and push tag
|
||||
run: |
|
||||
version="${{ github.event.inputs.version }}"
|
||||
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
git add manifest.json package.json versions.json
|
||||
git commit -m "Release $version"
|
||||
git tag -a "$version" -m "$version"
|
||||
git push
|
||||
git push origin "$version"
|
||||
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
# vscode
|
||||
.vscode
|
||||
|
||||
# Intellij
|
||||
*.iml
|
||||
.idea
|
||||
|
||||
# npm
|
||||
node_modules
|
||||
|
||||
# Don't include the compiled main.js file in the repo.
|
||||
# They should be uploaded to GitHub releases instead.
|
||||
main.js
|
||||
|
||||
# Exclude sourcemaps
|
||||
*.map
|
||||
|
||||
# obsidian
|
||||
data.json
|
||||
|
||||
# Exclude macOS Finder (System Explorer) View States
|
||||
.DS_Store
|
||||
1
.npmrc
Normal file
1
.npmrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
tag-version-prefix=""
|
||||
661
LICENSE
Normal file
661
LICENSE
Normal file
|
|
@ -0,0 +1,661 @@
|
|||
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero General Public License from time to time. Such new versions
|
||||
will be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU Affero General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU Affero General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU Affero General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
239
README.md
Normal file
239
README.md
Normal file
|
|
@ -0,0 +1,239 @@
|
|||
# Contact Note
|
||||
|
||||
An [Obsidian](https://obsidian.md/) plugin that renders visual contact cards from frontmatter in designated contact notes, with a searchable and filterable contact list view.
|
||||
|
||||

|
||||
|
||||
## Features
|
||||
|
||||
- Renders a contact card in reading mode for any note identified as a contact
|
||||
- Sidebar contact list view with search, alphabet filter, and condensed mode
|
||||
- Create new contacts from the list view with an auto-generated frontmatter template
|
||||
- Enforces file naming in `First [Middle] Last` format automatically
|
||||
- Supports multiple emails, phone numbers, and social media profiles per contact
|
||||
- Default list filters based on any frontmatter property
|
||||
- Contacts identified by folder or tag
|
||||
|
||||
## Manual Installation
|
||||
|
||||
1. Download `main.js`, `manifest.json`, and `styles.css` from the latest release.
|
||||
2. In your vault, create the folder `.obsidian/plugins/contact-note/` if it does not already exist.
|
||||
3. Copy the downloaded files into that folder.
|
||||
4. Open Obsidian, go to **Settings → Community plugins**, and enable **Contact Note**.
|
||||
|
||||
## Usage
|
||||
|
||||
### Identifying contact notes
|
||||
|
||||
A note is treated as a contact note in one of two ways, configured in settings:
|
||||
|
||||
- **By folder**: any note inside a specified folder (e.g. `Contacts/`) is a contact note.
|
||||
- **By tag**: any note tagged with a specified tag (e.g. `#contact`) is a contact note.
|
||||
|
||||
### Creating a contact
|
||||
|
||||
To manually create a new contact, create a new note with at least the `firstName` and `lastName` frontmatter properties in either the path of contact notes or with the contact tag specified in the plugin settings. For a list of all frontmatter properties recognized by the plugin, see [Frontmatter reference](#frontmatter-reference) below.
|
||||
|
||||
To create a new contact using the plugin's template, click the **+** button in the top-right corner of the contact list view to open the new contact dialog. Enter a first and last name and click **Create**.
|
||||
|
||||
A new note will be created with a pre-populated frontmatter template and opened automatically.
|
||||
|
||||
### Contact card
|
||||
|
||||

|
||||
|
||||
In reading mode, any contact note with a valid `firstName` and `lastName` frontmatter renders a contact card in place of the frontmatter block. The card displays the contact's photo, name, title, company, email addresses, phone numbers, and social media profiles.
|
||||
|
||||
## Frontmatter reference
|
||||
|
||||
All fields are optional except `firstName` and `lastName`.
|
||||
|
||||
| Field | Type | Description |
|
||||
|---|---|---|
|
||||
| `firstName` | string | **Required.** The contact's first name. |
|
||||
| `lastName` | string | **Required.** The contact's last name. |
|
||||
| `middleName` | string | Middle name or initial. Used in the display name and file name. |
|
||||
| `displayName` | string | Overrides the resolved display name everywhere if set. |
|
||||
| `title` | string | Job title or role. |
|
||||
| `company` | string | Company or organization name. |
|
||||
| `email` | string or list | One or more email addresses. |
|
||||
| `phone` | string or list | One or more phone numbers. |
|
||||
| `photo` | string | Vault path to a photo file (e.g. `Attachments/jane.jpg`). |
|
||||
| `aliases` | list | Obsidian aliases for the note. Pre-populated with `firstName` on creation. Not used directly by plugin for contact list view. |
|
||||
| `socials` | list | List of social media handles. See [Socials](#socials) below. |
|
||||
|
||||
**Example:**
|
||||
|
||||
```yaml
|
||||
---
|
||||
firstName: Jane
|
||||
middleName: A.
|
||||
lastName: Smith
|
||||
displayName:
|
||||
company: Acme Corp
|
||||
title: Engineer
|
||||
email:
|
||||
- jane@example.com
|
||||
phone:
|
||||
- +1 555 000 0000
|
||||
photo: Attachments/jane.jpg
|
||||
aliases:
|
||||
- Jane
|
||||
socials:
|
||||
- github: janesmith
|
||||
- linkedin: jane-smith
|
||||
---
|
||||
```
|
||||
|
||||
### Display name resolution
|
||||
|
||||
The display name is resolved in the following order:
|
||||
|
||||
1. `displayName` if set
|
||||
2. `firstName` + `middleName` + `lastName`
|
||||
|
||||
### File naming
|
||||
|
||||
The plugin automatically renames contact notes to match the format `First [Middle] Last` whenever the `firstName`, `middleName`, or `lastName` frontmatter values change. Manual renames are also corrected.
|
||||
|
||||
If a file with the target name already exists, the rename is skipped and a notice is shown. Add a middle name to disambiguate.
|
||||
|
||||
### Socials
|
||||
|
||||
Social profiles are defined as a list of single-key objects under the `socials` frontmatter field. The key is the platform name and the value is the handle (the `@` prefix is optional).
|
||||
|
||||
```yaml
|
||||
socials:
|
||||
- twitter: janesmith
|
||||
- github: janesmith
|
||||
- linkedin: jane-smith
|
||||
```
|
||||
|
||||
Supported platforms:
|
||||
|
||||
| Platform | Key |
|
||||
|---|---|
|
||||
| Bluesky | `bluesky` |
|
||||
| Discord | `discord` |
|
||||
| Facebook | `facebook` |
|
||||
| GitHub | `github` |
|
||||
| Instagram | `instagram` |
|
||||
| LinkedIn | `linkedin` |
|
||||
| Pinterest | `pinterest` |
|
||||
| Reddit | `reddit` |
|
||||
| Snapchat | `snapchat` |
|
||||
| Telegram | `telegram` |
|
||||
| TikTok | `tiktok` |
|
||||
| Twitch | `twitch` |
|
||||
| Twitter / X | `twitter` |
|
||||
| YouTube | `youtube` |
|
||||
|
||||
Platforms not in this list will still display the handle as plain text without a link.
|
||||
|
||||
## Contact list view
|
||||
|
||||

|
||||
|
||||
Open the contact list view from the ribbon icon or the **Open contact list** command.
|
||||
|
||||
### Search
|
||||
|
||||
Click the **search icon** in the header to show the search bar. The search filters by first name, last name, middle name, and display name.
|
||||
|
||||
### Alphabet filter
|
||||
|
||||
Click any letter in the alphabet bar to filter contacts whose last name starts with that letter. Click the same letter again to clear the filter.
|
||||
|
||||
## Settings reference
|
||||
|
||||

|
||||
|
||||
### Contact Note
|
||||
|
||||
| Setting | Description | Default |
|
||||
|---|---|---|
|
||||
| Identify contacts by folder | When enabled, notes inside the specified folder are treated as contacts. When disabled, notes with the specified tag are used instead. | Enabled |
|
||||
| Contacts folder path | Path to the contacts folder, relative to the vault root. | `Contacts` |
|
||||
| Contact tag | Tag used to identify contact notes (without the `#`). Only shown when folder mode is disabled. | `contact` |
|
||||
|
||||
### Contact List
|
||||
|
||||
| Setting | Description | Default |
|
||||
|---|---|---|
|
||||
| Contact list title | Title shown at the top of the contact list view. | `Contacts` |
|
||||
| Show last name first in list | When enabled, names in the list are shown as `Last, First Middle`. Does not affect the contact card. | Enabled |
|
||||
| Condensed list view | When enabled, each card in the list shows only the photo and name. | Enabled |
|
||||
|
||||
### Default list filters
|
||||
|
||||
Add one or more filter conditions to limit which contacts appear in the list view. All conditions must match for a contact to be shown (AND logic).
|
||||
|
||||
Each condition targets a frontmatter property by key and supports the following operators:
|
||||
|
||||
| Operator | Value required | Description |
|
||||
|---|---|---|
|
||||
| `contains` | Yes | Property value contains the given string, or array includes a matching item. |
|
||||
| `is` | Yes | Property value exactly equals the given string. |
|
||||
| `exists` | No | Property is present and has a non-empty value. |
|
||||
| `is true` | No | Property value is `true` (boolean or string). |
|
||||
| `is false` | No | Property value is `false` (boolean or string). |
|
||||
|
||||
Filters apply to any frontmatter property, including custom fields not used by the plugin.
|
||||
|
||||
## Contributing
|
||||
|
||||
Contributions are welcome. Please open an issue to discuss significant changes before submitting a pull request.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- [Node.js](https://nodejs.org/) (v24 or later recommended)
|
||||
- A local Obsidian vault for testing
|
||||
|
||||
### Setup
|
||||
|
||||
1. Clone or fork the repository into your vault's plugin folder:
|
||||
```
|
||||
<vault>/.obsidian/plugins/contact-note/
|
||||
```
|
||||
2. Install dependencies:
|
||||
```
|
||||
npm install
|
||||
```
|
||||
3. Start the development build (watches for changes and rebuilds automatically):
|
||||
```
|
||||
npm run dev
|
||||
```
|
||||
4. In Obsidian, go to **Settings → Community plugins**, disable and re-enable **Contact Note** to pick up the rebuilt `main.js`.
|
||||
|
||||
> Tip: The [Hot Reload](https://github.com/pjeby/hot-reload) community plugin can reload the plugin automatically on file change.
|
||||
|
||||
### Linting
|
||||
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
ESLint with `@typescript-eslint` is configured via `.eslintrc`. Run lint before submitting a pull request. The `node_modules/` directory and built `main.js` are excluded via `.eslintignore`.
|
||||
|
||||
### Production build
|
||||
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
This runs a TypeScript type-check (`tsc`) followed by an optimized esbuild bundle. The output is `main.js` in the project root. The files needed for a release are `main.js`, `manifest.json`, and `styles.css`.
|
||||
|
||||
### Project structure
|
||||
|
||||
| Path | Description |
|
||||
|---|---|
|
||||
| `src/main.ts` | Plugin entry point: settings, commands, event handlers |
|
||||
| `src/Contact.ts` | `Contact` data model parsed from note frontmatter |
|
||||
| `src/ContactCard.ts` | Builds the contact card DOM element |
|
||||
| `src/ContactListView.ts` | Sidebar list view |
|
||||
| `src/ContactNoteSettingTab.ts` | Settings tab UI |
|
||||
| `styles.css` | All plugin styles |
|
||||
|
||||
## License
|
||||
|
||||
GNU Affero General Public License v3.0. See [LICENSE](LICENSE) for details.
|
||||
39
esbuild.config.mjs
Normal file
39
esbuild.config.mjs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
import esbuild from "esbuild";
|
||||
import process from "process";
|
||||
import builtins from "builtin-modules";
|
||||
|
||||
const prod = process.argv[2] === "production";
|
||||
|
||||
const context = await esbuild.context({
|
||||
entryPoints: ["src/main.ts"],
|
||||
bundle: true,
|
||||
external: [
|
||||
"obsidian",
|
||||
"electron",
|
||||
"@codemirror/autocomplete",
|
||||
"@codemirror/collab",
|
||||
"@codemirror/commands",
|
||||
"@codemirror/language",
|
||||
"@codemirror/lint",
|
||||
"@codemirror/search",
|
||||
"@codemirror/state",
|
||||
"@codemirror/view",
|
||||
"@lezer/common",
|
||||
"@lezer/highlight",
|
||||
"@lezer/lr",
|
||||
...builtins,
|
||||
],
|
||||
format: "cjs",
|
||||
target: "es2018",
|
||||
logLevel: "info",
|
||||
sourcemap: prod ? false : "inline",
|
||||
treeShaking: true,
|
||||
outfile: "main.js",
|
||||
});
|
||||
|
||||
if (prod) {
|
||||
await context.rebuild();
|
||||
process.exit(0);
|
||||
} else {
|
||||
await context.watch();
|
||||
}
|
||||
10
manifest.json
Normal file
10
manifest.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"id": "contact-note",
|
||||
"name": "Contact Note",
|
||||
"version": "1.0.0",
|
||||
"minAppVersion": "1.12.7",
|
||||
"description": "Manage and browse contacts stored as notes, with auto-generated contact cards and a searchable list view.",
|
||||
"author": "Jalad",
|
||||
"authorUrl": "https://jalad.ncc-1701.enterprises",
|
||||
"isDesktopOnly": false
|
||||
}
|
||||
2338
package-lock.json
generated
Normal file
2338
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
25
package.json
Normal file
25
package.json
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "contact-note",
|
||||
"version": "1.0.0",
|
||||
"description": "Manage and browse contacts stored as notes, with auto-generated contact cards and a searchable list view.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"dev": "node esbuild.config.mjs",
|
||||
"build": "tsc -skipLibCheck && node esbuild.config.mjs production",
|
||||
"lint": "eslint src --ext .ts"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Jalad",
|
||||
"license": "GNU AGPLv3",
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||
"@typescript-eslint/parser": "^7.18.0",
|
||||
"builtin-modules": "3.3.0",
|
||||
"eslint": "^8.57.1",
|
||||
"esbuild": "0.21.5",
|
||||
"obsidian": "latest",
|
||||
"tslib": "2.6.3",
|
||||
"typescript": "5.5.4"
|
||||
}
|
||||
}
|
||||
BIN
screenshots/Preview.gif
Normal file
BIN
screenshots/Preview.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
BIN
screenshots/contact-card.png
Normal file
BIN
screenshots/contact-card.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 56 KiB |
BIN
screenshots/contact-list.png
Normal file
BIN
screenshots/contact-list.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
BIN
screenshots/settings.png
Normal file
BIN
screenshots/settings.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
152
src/Contact.ts
Normal file
152
src/Contact.ts
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
import { TFile } from "obsidian";
|
||||
|
||||
//#region Social
|
||||
|
||||
export class Social {
|
||||
name: string;
|
||||
handle: string;
|
||||
|
||||
constructor(name: string, handle: string) {
|
||||
this.name = name;
|
||||
this.handle = handle;
|
||||
}
|
||||
|
||||
private static readonly URLS: Record<string, string> = {
|
||||
twitter: "https://twitter.com",
|
||||
instagram: "https://instagram.com",
|
||||
linkedin: "https://linkedin.com",
|
||||
github: "https://github.com",
|
||||
facebook: "https://facebook.com",
|
||||
youtube: "https://youtube.com",
|
||||
tiktok: "https://tiktok.com",
|
||||
bluesky: "https://bsky.app",
|
||||
reddit: "https://reddit.com",
|
||||
telegram: "https://t.me",
|
||||
twitch: "https://twitch.tv",
|
||||
snapchat: "https://snapchat.com",
|
||||
pinterest: "https://pinterest.com",
|
||||
};
|
||||
|
||||
get url(): string | null {
|
||||
const h = this.handle.replace(/^@/, "");
|
||||
switch (this.name) {
|
||||
case "twitter":
|
||||
case "instagram":
|
||||
case "github":
|
||||
case "facebook":
|
||||
case "telegram":
|
||||
case "twitch":
|
||||
case "pinterest":
|
||||
return `${Social.URLS[this.name]}/${h}`;
|
||||
case "youtube":
|
||||
case "tiktok":
|
||||
return `${Social.URLS[this.name]}/@${h}`;
|
||||
case "linkedin": return `${Social.URLS.linkedin}/in/${h}`;
|
||||
case "bluesky": return `${Social.URLS.bluesky}/profile/${h}`;
|
||||
case "reddit": return `${Social.URLS.reddit}/user/${h}`;
|
||||
case "snapchat": return `${Social.URLS.snapchat}/add/${h}`;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Contact
|
||||
|
||||
export class Contact {
|
||||
readonly file: TFile;
|
||||
firstName: string;
|
||||
middleName: string;
|
||||
lastName: string;
|
||||
displayName: string;
|
||||
title: string;
|
||||
company: string;
|
||||
emails: string[];
|
||||
phones: string[];
|
||||
photo: string;
|
||||
socials: Social[];
|
||||
rawFrontmatter: Record<string, unknown>;
|
||||
|
||||
private constructor(file: TFile) {
|
||||
this.file = file;
|
||||
this.firstName = "";
|
||||
this.middleName = "";
|
||||
this.lastName = "";
|
||||
this.displayName = "";
|
||||
this.title = "";
|
||||
this.company = "";
|
||||
this.photo = "";
|
||||
this.emails = [];
|
||||
this.phones = [];
|
||||
this.socials = [];
|
||||
this.rawFrontmatter = {};
|
||||
}
|
||||
|
||||
static fromCache(file: TFile, frontmatter: Record<string, unknown>): Contact {
|
||||
const contact = new Contact(file);
|
||||
contact.update(frontmatter);
|
||||
return contact;
|
||||
}
|
||||
|
||||
update(frontmatter: Record<string, unknown>): void {
|
||||
this.rawFrontmatter = frontmatter;
|
||||
this.firstName = trimStr(frontmatter.firstName);
|
||||
this.middleName = trimStr(frontmatter.middleName);
|
||||
this.lastName = trimStr(frontmatter.lastName);
|
||||
this.displayName = trimStr(frontmatter.displayName);
|
||||
this.title = trimStr(frontmatter.title);
|
||||
this.company = trimStr(frontmatter.company);
|
||||
this.photo = trimStr(frontmatter.photo);
|
||||
|
||||
this.emails = parseStrArr(frontmatter.email);
|
||||
this.phones = parseStrArr(frontmatter.phone);
|
||||
|
||||
this.socials = [];
|
||||
if (Array.isArray(frontmatter.socials)) {
|
||||
for (const item of frontmatter.socials) {
|
||||
if (item && typeof item === "object") {
|
||||
for (const [name, handle] of Object.entries(item as Record<string, unknown>)) {
|
||||
const h = handle == null ? "" : String(handle).trim();
|
||||
if (!h) continue;
|
||||
this.socials.push(new Social(name.toLowerCase(), h));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get resolvedDisplayName(): string {
|
||||
if (this.displayName) return this.displayName;
|
||||
return [this.firstName, this.middleName, this.lastName].filter(Boolean).join(" ");
|
||||
}
|
||||
|
||||
get sortKey(): string {
|
||||
if (this.lastName && this.firstName) {
|
||||
return `${this.lastName} ${this.firstName}`.toLowerCase();
|
||||
}
|
||||
if (this.displayName) return this.displayName.toLowerCase();
|
||||
return this.file.basename.toLowerCase();
|
||||
}
|
||||
|
||||
get isValid(): boolean {
|
||||
return !!(this.firstName && this.lastName);
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Utilities
|
||||
|
||||
function trimStr(v: unknown): string {
|
||||
if (v == null) return "";
|
||||
const s = String(v).trim();
|
||||
return s;
|
||||
}
|
||||
|
||||
function parseStrArr(v: unknown): string[] {
|
||||
if (!v) return [];
|
||||
return Array.isArray(v) ? v.map(String) : [String(v)];
|
||||
}
|
||||
|
||||
//#endregion
|
||||
148
src/ContactCard.ts
Normal file
148
src/ContactCard.ts
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
import { App, setIcon, TFile } from "obsidian";
|
||||
import { Contact } from "./Contact";
|
||||
|
||||
//#region Constants
|
||||
|
||||
const SOCIAL_SVG_PATHS: Record<string, string> = {
|
||||
twitter: "M21.543 7.104c.015.211.015.423.015.636 0 6.507-4.954 14.01-14.01 14.01v-.003A13.94 13.94 0 0 1 0 19.539a9.88 9.88 0 0 0 7.287-2.041 4.93 4.93 0 0 1-4.6-3.42 4.916 4.916 0 0 0 2.223-.084A4.926 4.926 0 0 1 .96 9.167v-.062a4.887 4.887 0 0 0 2.235.616A4.928 4.928 0 0 1 1.67 3.148 13.98 13.98 0 0 0 11.82 8.292a4.929 4.929 0 0 1 8.39-4.49 9.868 9.868 0 0 0 3.128-1.196 4.941 4.941 0 0 1-2.165 2.724A9.828 9.828 0 0 0 24 4.555a10.019 10.019 0 0 1-2.457 2.549z",
|
||||
instagram: "M7.0301.084c-1.2768.0602-2.1487.264-2.911.5634-.7888.3075-1.4575.72-2.1228 1.3877-.6652.6677-1.075 1.3368-1.3802 2.127-.2954.7638-.4956 1.6365-.552 2.914-.0564 1.2775-.0689 1.6882-.0626 4.947.0062 3.2586.0206 3.6671.0825 4.9473.061 1.2765.264 2.1482.5635 2.9107.308.7889.72 1.4573 1.388 2.1228.6679.6655 1.3365 1.0743 2.1285 1.38.7632.295 1.6361.4961 2.9134.552 1.2773.056 1.6884.069 4.9462.0627 3.2578-.0062 3.668-.0207 4.9478-.0814 1.28-.0607 2.147-.2652 2.9098-.5633.7889-.3086 1.4578-.72 2.1228-1.3881.665-.6682 1.0745-1.3378 1.3795-2.1284.2957-.7632.4966-1.636.552-2.9124.056-1.2809.0692-1.6898.063-4.948-.0063-3.2583-.021-3.6668-.0817-4.9465-.0607-1.2797-.264-2.1487-.5633-2.9117-.3084-.7889-.72-1.4568-1.3876-2.1228C21.2982 1.33 20.628.9208 19.8378.6165 19.074.321 18.2017.1197 16.9244.0645 15.6471.0093 15.236-.005 11.977.0014 8.718.0076 8.31.0215 7.0301.0839m.1402 21.6932c-1.17-.0509-1.8053-.2453-2.2287-.408-.5606-.216-.96-.4771-1.3819-.895-.422-.4178-.6811-.8186-.9-1.378-.1644-.4234-.3624-1.058-.4171-2.228-.0595-1.2645-.072-1.6442-.079-4.848-.007-3.2037.0053-3.583.0607-4.848.05-1.169.2456-1.805.408-2.2282.216-.5613.4762-.96.895-1.3816.4188-.4217.8184-.6814 1.3783-.9003.423-.1651 1.0575-.3614 2.227-.4171 1.2655-.06 1.6447-.072 4.848-.079 3.2033-.007 3.5835.005 4.8495.0608 1.169.0508 1.8053.2445 2.228.408.5608.216.96.4754 1.3816.895.4217.4194.6816.8176.9005 1.3787.1653.4217.3617 1.056.4169 2.2263.0602 1.2655.0739 1.645.0796 4.848.0058 3.203-.0055 3.5834-.061 4.848-.051 1.17-.245 1.8055-.408 2.2294-.216.5604-.4763.96-.8954 1.3814-.419.4215-.8181.6811-1.3783.9-.4224.1649-1.0577.3617-2.2262.4174-1.2656.0595-1.6448.072-4.8493.079-3.2045.007-3.5825-.006-4.848-.0608M16.953 5.5864A1.44 1.44 0 1 0 18.39 4.144a1.44 1.44 0 0 0-1.437 1.4424M5.8385 12.012c.0067 3.4032 2.7706 6.1557 6.173 6.1493 3.4026-.0065 6.157-2.7701 6.1506-6.1733-.0065-3.4032-2.771-6.1565-6.174-6.1498-3.403.0067-6.156 2.771-6.1496 6.1738M8 12.0077a4 4 0 1 1 4.008 3.9921A3.9996 3.9996 0 0 1 8 12.0077",
|
||||
linkedin: "M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 23.2 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z",
|
||||
github: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12",
|
||||
facebook: "M9.101 23.691v-7.98H6.627v-3.667h2.474v-1.58c0-4.085 1.848-5.978 5.858-5.978.401 0 .955.042 1.468.103a8.68 8.68 0 0 1 1.141.195v3.325a8.623 8.623 0 0 0-.653-.036 26.805 26.805 0 0 0-.733-.009c-.707 0-1.259.096-1.675.309a1.686 1.686 0 0 0-.679.622c-.258.42-.374.995-.374 1.752v1.297h3.919l-.386 2.103-.287 1.564h-3.246v8.245C19.396 23.238 24 18.179 24 12.044c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.628 3.874 10.35 9.101 11.647Z",
|
||||
youtube: "M23.498 6.186a3.016 3.016 0 0 0-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 0 0 .502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 0 0 2.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 0 0 2.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z",
|
||||
tiktok: "M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z",
|
||||
bluesky: "M5.202 2.857C7.954 4.922 10.913 9.11 12 11.358c1.087-2.247 4.046-6.436 6.798-8.501C20.783 1.366 24 .213 24 3.883c0 .732-.42 6.156-.667 7.037-.856 3.061-3.978 3.842-6.755 3.37 4.854.826 6.089 3.562 3.422 6.299-5.065 5.196-7.28-1.304-7.847-2.97-.104-.305-.152-.448-.153-.327 0-.121-.05.022-.153.327-.568 1.666-2.782 8.166-7.847 2.97-2.667-2.737-1.432-5.473 3.422-6.3-2.777.473-5.899-.308-6.755-3.369C.42 10.04 0 4.615 0 3.883c0-3.67 3.217-2.517 5.202-1.026",
|
||||
reddit: "M12 0C5.373 0 0 5.373 0 12c0 3.314 1.343 6.314 3.515 8.485l-2.286 2.286C.775 23.225 1.097 24 1.738 24H12c6.627 0 12-5.373 12-12S18.627 0 12 0Zm4.388 3.199c1.104 0 1.999.895 1.999 1.999 0 1.105-.895 2-1.999 2-.946 0-1.739-.657-1.947-1.539v.002c-1.147.162-2.032 1.15-2.032 2.341v.007c1.776.067 3.4.567 4.686 1.363.473-.363 1.064-.58 1.707-.58 1.547 0 2.802 1.254 2.802 2.802 0 1.117-.655 2.081-1.601 2.531-.088 3.256-3.637 5.876-7.997 5.876-4.361 0-7.905-2.617-7.998-5.87-.954-.447-1.614-1.415-1.614-2.538 0-1.548 1.255-2.802 2.803-2.802.645 0 1.239.218 1.712.585 1.275-.79 2.881-1.291 4.64-1.365v-.01c0-1.663 1.263-3.034 2.88-3.207.188-.911.993-1.595 1.959-1.595Zm-8.085 8.376c-.784 0-1.459.78-1.506 1.797-.047 1.016.64 1.429 1.426 1.429.786 0 1.371-.369 1.418-1.385.047-1.017-.553-1.841-1.338-1.841Zm7.406 0c-.786 0-1.385.824-1.338 1.841.047 1.017.634 1.385 1.418 1.385.785 0 1.473-.413 1.426-1.429-.046-1.017-.721-1.797-1.506-1.797Zm-3.703 4.013c-.974 0-1.907.048-2.77.135-.147.015-.241.168-.183.305.483 1.154 1.622 1.964 2.953 1.964 1.33 0 2.47-.81 2.953-1.964.057-.137-.037-.29-.184-.305-.863-.087-1.795-.135-2.769-.135Z",
|
||||
discord: "M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z",
|
||||
telegram: "M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z",
|
||||
twitch: "M11.571 4.714h1.715v5.143H11.57zm4.715 0H18v5.143h-1.714zM6 0L1.714 4.286v15.428h5.143V24l4.286-4.286h3.428L22.286 12V0zm14.571 11.143l-3.428 3.428h-3.429l-3 3v-3H6.857V1.714h13.714Z",
|
||||
snapchat: "M12.206.793c.99 0 4.347.276 5.93 3.821.529 1.193.403 3.219.299 4.847l-.003.06c-.012.18-.022.345-.03.51.075.045.203.09.401.09.3-.016.659-.12 1.033-.301.165-.088.344-.104.464-.104.182 0 .359.029.509.09.45.149.734.479.734.838.015.449-.39.839-1.213 1.168-.089.029-.209.075-.344.119-.45.135-1.139.36-1.333.81-.09.224-.061.524.12.868l.015.015c.06.136 1.526 3.475 4.791 4.014.255.044.435.27.42.509 0 .075-.015.149-.045.225-.24.569-1.273.988-3.146 1.271-.059.091-.12.375-.164.57-.029.179-.074.36-.134.553-.076.271-.27.405-.555.405h-.03c-.135 0-.313-.031-.538-.074-.36-.075-.765-.135-1.273-.135-.3 0-.599.015-.913.074-.6.104-1.123.464-1.723.884-.853.599-1.826 1.288-3.294 1.288-.06 0-.119-.015-.18-.015h-.149c-1.468 0-2.427-.675-3.279-1.288-.599-.42-1.107-.779-1.707-.884-.314-.045-.629-.074-.928-.074-.54 0-.958.089-1.272.149-.211.043-.391.074-.54.074-.374 0-.523-.224-.583-.42-.061-.192-.09-.389-.135-.567-.046-.181-.105-.494-.166-.57-1.918-.222-2.95-.642-3.189-1.226-.031-.063-.052-.15-.055-.225-.015-.243.165-.465.42-.509 3.264-.54 4.73-3.879 4.791-4.02l.016-.029c.18-.345.224-.645.119-.869-.195-.434-.884-.658-1.332-.809-.121-.029-.24-.074-.346-.119-1.107-.435-1.257-.93-1.197-1.273.09-.479.674-.793 1.168-.793.146 0 .27.029.383.074.42.194.789.3 1.104.3.234 0 .384-.06.465-.105l-.046-.569c-.098-1.626-.225-3.651.307-4.837C7.392 1.077 10.739.807 11.727.807l.419-.015h.06z",
|
||||
pinterest: "M12.017 0C5.396 0 .029 5.367.029 11.987c0 5.079 3.158 9.417 7.618 11.162-.105-.949-.199-2.403.041-3.439.219-.937 1.406-5.957 1.406-5.957s-.359-.72-.359-1.781c0-1.663.967-2.911 2.168-2.911 1.024 0 1.518.769 1.518 1.688 0 1.029-.653 2.567-.992 3.992-.285 1.193.6 2.165 1.775 2.165 2.128 0 3.768-2.245 3.768-5.487 0-2.861-2.063-4.869-5.008-4.869-3.41 0-5.409 2.562-5.409 5.199 0 1.033.394 2.143.889 2.741.099.12.112.225.085.345-.09.375-.293 1.199-.334 1.363-.053.225-.172.271-.401.165-1.495-.69-2.433-2.878-2.433-4.646 0-3.776 2.748-7.252 7.92-7.252 4.158 0 7.392 2.967 7.392 6.923 0 4.135-2.607 7.462-6.233 7.462-1.214 0-2.354-.629-2.758-1.379l-.749 2.848c-.269 1.045-1.004 2.352-1.498 3.146 1.123.345 2.306.535 3.55.535 6.607 0 11.985-5.365 11.985-11.987C23.97 5.39 18.592.026 11.985.026L12.017 0z",
|
||||
};
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Card Builder
|
||||
|
||||
export interface ContactCardOptions {
|
||||
condensed?: boolean;
|
||||
clickable?: boolean;
|
||||
showDetails?: boolean;
|
||||
nameOverride?: string;
|
||||
}
|
||||
|
||||
export function buildContactCard(
|
||||
app: App,
|
||||
container: HTMLElement,
|
||||
contact: Contact,
|
||||
options: ContactCardOptions = {}
|
||||
): HTMLElement {
|
||||
const { condensed = false, clickable = false, showDetails = true, nameOverride } = options;
|
||||
const displayName = nameOverride ?? contact.resolvedDisplayName;
|
||||
|
||||
const card = container.createDiv({ cls: "contact-note-card" });
|
||||
|
||||
if (clickable) {
|
||||
card.addClass("is-clickable");
|
||||
card.addEventListener("click", () => {
|
||||
app.workspace.getLeaf(false).openFile(contact.file);
|
||||
});
|
||||
}
|
||||
|
||||
// Photo
|
||||
if (contact.photo) {
|
||||
const photoFile = app.vault.getAbstractFileByPath(contact.photo);
|
||||
if (photoFile instanceof TFile) {
|
||||
const photoContainer = card.createDiv({ cls: "contact-note-photo" });
|
||||
const img = photoContainer.createEl("img", { cls: "contact-note-photo-img" });
|
||||
img.src = app.vault.getResourcePath(photoFile);
|
||||
img.alt = displayName || "Contact photo";
|
||||
}
|
||||
} else {
|
||||
const photoContainer = card.createDiv({ cls: "contact-note-photo" });
|
||||
setIcon(photoContainer, "user-round");
|
||||
photoContainer.children[0].classList.add("contact-note-photo-default");
|
||||
}
|
||||
|
||||
// Name, Company, and Title
|
||||
const infoEl = card.createDiv({ cls: "contact-note-info" });
|
||||
|
||||
if (displayName) {
|
||||
infoEl.createEl("div", { cls: "contact-note-name", text: displayName });
|
||||
}
|
||||
|
||||
if (!condensed && contact.title) {
|
||||
infoEl.createEl("div", { cls: "contact-note-title", text: contact.title });
|
||||
}
|
||||
|
||||
if (!condensed && contact.company) {
|
||||
infoEl.createEl("div", { cls: "contact-note-company", text: contact.company });
|
||||
}
|
||||
|
||||
// Details: Socials, Emails, and Phones
|
||||
if (!showDetails) return card;
|
||||
|
||||
if (contact.emails.length > 0 || contact.phones.length > 0 || contact.socials.length > 0) {
|
||||
const detailsEl = card.createDiv({ cls: "contact-note-details" });
|
||||
|
||||
// Socials
|
||||
if (contact.socials.length > 0) {
|
||||
const socialsEl = detailsEl.createDiv({ cls: "contact-note-socials" });
|
||||
for (const social of contact.socials) {
|
||||
const row = socialsEl.createDiv({ cls: "contact-note-detail-row" });
|
||||
const iconEl = row.createEl("span", { cls: "contact-note-detail-icon" });
|
||||
const svgPath = getSocialIcon(social.name);
|
||||
if (svgPath) {
|
||||
const svg = iconEl.createSvg("svg", { attr: { role: "img", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" } });
|
||||
svg.createSvg("path", { attr: { d: svgPath } });
|
||||
} else {
|
||||
setIcon(iconEl, "link");
|
||||
}
|
||||
const url = social.url;
|
||||
if (url) {
|
||||
row.createEl("a", { cls: "contact-note-detail-value", text: social.handle, href: url });
|
||||
} else {
|
||||
row.createEl("span", { cls: "contact-note-detail-value", text: social.handle });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Emails
|
||||
if (contact.emails.length > 0) {
|
||||
const emailsEl = detailsEl.createDiv({ cls: "contact-note-emails" });
|
||||
for (const email of contact.emails) {
|
||||
const row = emailsEl.createDiv({ cls: "contact-note-detail-row" });
|
||||
const emailIcon = row.createEl("span", { cls: "contact-note-detail-icon" });
|
||||
setIcon(emailIcon, "mail");
|
||||
row.createEl("a", { cls: "contact-note-detail-value", text: email, href: `mailto:${email}` });
|
||||
}
|
||||
}
|
||||
|
||||
// Phones
|
||||
if (contact.phones.length > 0) {
|
||||
const phonesEl = detailsEl.createDiv({ cls: "contact-note-phones" });
|
||||
for (const phone of contact.phones) {
|
||||
const row = phonesEl.createDiv({ cls: "contact-note-detail-row" });
|
||||
const phoneIcon = row.createEl("span", { cls: "contact-note-detail-icon" });
|
||||
setIcon(phoneIcon, "phone");
|
||||
row.createEl("a", {
|
||||
cls: "contact-note-detail-value",
|
||||
text: phone,
|
||||
href: `tel:${phone.replace(/[\s\-().]/g, "")}`,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return card;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Utilities
|
||||
|
||||
function getSocialIcon(name: string): string | null {
|
||||
return SOCIAL_SVG_PATHS[name] ?? null;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
289
src/ContactListView.ts
Normal file
289
src/ContactListView.ts
Normal file
|
|
@ -0,0 +1,289 @@
|
|||
import { CachedMetadata, ItemView, Modal, Setting, setIcon, TFile, WorkspaceLeaf } from "obsidian";
|
||||
import ContactNotePlugin, { FrontmatterFilter } from "./main";
|
||||
import { VIEW_TYPE_CONTACT_LIST } from "./main";
|
||||
import { Contact } from "./Contact";
|
||||
import { buildContactCard } from "./ContactCard";
|
||||
|
||||
//#region Contact List View
|
||||
|
||||
export class ContactListView extends ItemView {
|
||||
plugin: ContactNotePlugin;
|
||||
private contacts = new Map<string, Contact>();
|
||||
private searchQuery = "";
|
||||
private showSearch = false;
|
||||
private letterFilter = "";
|
||||
|
||||
constructor(leaf: WorkspaceLeaf, plugin: ContactNotePlugin) {
|
||||
super(leaf);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
getViewType(): string {
|
||||
return VIEW_TYPE_CONTACT_LIST;
|
||||
}
|
||||
|
||||
getDisplayText(): string {
|
||||
return this.plugin.settings.listTitle || "Contacts";
|
||||
}
|
||||
|
||||
getIcon(): string {
|
||||
return "book-user";
|
||||
}
|
||||
|
||||
async onOpen(): Promise<void> {
|
||||
this.initContacts();
|
||||
|
||||
this.registerEvent(
|
||||
this.app.metadataCache.on("changed", (file: TFile, _data: string, cache: CachedMetadata) => {
|
||||
const isContact = this.plugin.isContactFile(file);
|
||||
const wasContact = this.contacts.has(file.path);
|
||||
|
||||
if (!isContact) {
|
||||
if (wasContact) {
|
||||
this.contacts.delete(file.path);
|
||||
this.renderCards();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const fm = cache.frontmatter;
|
||||
if (!fm) {
|
||||
if (wasContact) {
|
||||
this.contacts.delete(file.path);
|
||||
this.renderCards();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
const existing = this.contacts.get(file.path);
|
||||
if (existing) {
|
||||
existing.update(fm);
|
||||
} else {
|
||||
this.contacts.set(file.path, Contact.fromCache(file, fm));
|
||||
}
|
||||
this.renderCards();
|
||||
})
|
||||
);
|
||||
|
||||
this.registerEvent(
|
||||
this.app.vault.on("delete", (file) => {
|
||||
if (this.contacts.delete(file.path)) {
|
||||
this.renderCards();
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
this.registerEvent(
|
||||
this.app.vault.on("rename", (file, oldPath) => {
|
||||
this.contacts.delete(oldPath);
|
||||
if (!(file instanceof TFile) || !this.plugin.isContactFile(file)) return;
|
||||
const fm = this.app.metadataCache.getFileCache(file)?.frontmatter;
|
||||
if (!fm) return;
|
||||
this.contacts.set(file.path, Contact.fromCache(file, fm));
|
||||
this.renderCards();
|
||||
})
|
||||
);
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
async onClose(): Promise<void> {}
|
||||
|
||||
reinit(): void {
|
||||
this.initContacts();
|
||||
this.render();
|
||||
}
|
||||
|
||||
private initContacts(): void {
|
||||
this.contacts.clear();
|
||||
for (const file of this.app.vault.getMarkdownFiles()) {
|
||||
if (!this.plugin.isContactFile(file)) continue;
|
||||
const fm = this.app.metadataCache.getFileCache(file)?.frontmatter;
|
||||
if (!fm) continue;
|
||||
this.contacts.set(file.path, Contact.fromCache(file, fm));
|
||||
}
|
||||
}
|
||||
|
||||
render(): void {
|
||||
const container = this.contentEl as HTMLElement;
|
||||
container.empty();
|
||||
container.addClass("contact-note-list-view");
|
||||
if (this.plugin.settings.condensedList) {
|
||||
container.addClass("contact-note-list-condensed");
|
||||
} else {
|
||||
container.removeClass("contact-note-list-condensed");
|
||||
}
|
||||
|
||||
// Header
|
||||
const headerEl = container.createDiv({ cls: "contact-note-list-header" });
|
||||
headerEl.createEl("h1", {
|
||||
cls: "contact-note-list-title",
|
||||
text: this.plugin.settings.listTitle || "Contacts",
|
||||
});
|
||||
const btnGroup = headerEl.createDiv({ cls: "contact-note-header-btns" });
|
||||
|
||||
const newBtn = btnGroup.createEl("button", { cls: "contact-note-header-btn" });
|
||||
setIcon(newBtn, "user-plus");
|
||||
newBtn.setAttribute("aria-label", "New contact");
|
||||
newBtn.addEventListener("click", () => new NewContactModal(this.plugin).open());
|
||||
|
||||
// Search
|
||||
const searchBtn = btnGroup.createEl("button", { cls: "contact-note-header-btn" });
|
||||
setIcon(searchBtn, "search");
|
||||
searchBtn.setAttribute("aria-label", "Search contacts");
|
||||
if (this.showSearch) searchBtn.addClass("is-active");
|
||||
searchBtn.addEventListener("click", () => {
|
||||
this.showSearch = !this.showSearch;
|
||||
if (!this.showSearch) this.searchQuery = "";
|
||||
this.render();
|
||||
});
|
||||
|
||||
if (this.showSearch) {
|
||||
const searchInput = container.createEl("input", {
|
||||
cls: "contact-note-search",
|
||||
attr: { type: "text", placeholder: "Search contacts…" },
|
||||
});
|
||||
searchInput.value = this.searchQuery;
|
||||
searchInput.addEventListener("input", () => {
|
||||
this.searchQuery = searchInput.value;
|
||||
this.renderCards();
|
||||
});
|
||||
searchInput.focus();
|
||||
}
|
||||
|
||||
// Alphabet filter bar
|
||||
const alphaBar = container.createDiv({ cls: "nav-header contact-note-alpha-bar" });
|
||||
const alphaBtns = alphaBar.createDiv({ cls: "nav-buttons-container" });
|
||||
|
||||
for (const letter of "ABCDEFGHIJKLMNOPQRSTUVWXYZ") {
|
||||
const btn = alphaBtns.createDiv({ cls: "clickable-icon contact-note-alpha-btn" });
|
||||
btn.setText(letter);
|
||||
if (this.letterFilter === letter) btn.addClass("is-active");
|
||||
btn.addEventListener("click", () => {
|
||||
this.letterFilter = this.letterFilter === letter ? "" : letter;
|
||||
this.render();
|
||||
});
|
||||
}
|
||||
|
||||
this.renderCards();
|
||||
}
|
||||
|
||||
private renderCards(): void {
|
||||
const container = this.contentEl as HTMLElement;
|
||||
container.querySelectorAll(".contact-note-card, .contact-note-list-empty")
|
||||
.forEach((el) => el.remove());
|
||||
|
||||
const query = this.searchQuery.toLowerCase().trim();
|
||||
const letter = this.letterFilter;
|
||||
|
||||
const defaultFilters = this.plugin.settings.defaultFilters.filter(
|
||||
(f) => f.property.trim() !== ""
|
||||
);
|
||||
|
||||
const filtered = [...this.contacts.values()]
|
||||
.filter((contact) => {
|
||||
if (defaultFilters.some((f) => !matchesFilter(contact.rawFrontmatter, f))) return false;
|
||||
if (letter && !contact.lastName.toUpperCase().startsWith(letter)) return false;
|
||||
if (!query) return true;
|
||||
return [contact.firstName, contact.lastName, contact.middleName, contact.resolvedDisplayName]
|
||||
.some((v) => v.toLowerCase().includes(query));
|
||||
})
|
||||
.sort((a, b) => a.sortKey.localeCompare(b.sortKey));
|
||||
|
||||
if (filtered.length === 0) {
|
||||
container.createEl("p", {
|
||||
cls: "contact-note-list-empty",
|
||||
text: query || letter ? "No contacts match your filter." : "No contact notes found.",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const condensed = this.plugin.settings.condensedList;
|
||||
const lastNameFirst = this.plugin.settings.lastNameFirst;
|
||||
for (const contact of filtered) {
|
||||
const nameOverride = lastNameFirst
|
||||
? [contact.lastName + ",", contact.firstName, contact.middleName].filter(Boolean).join(" ")
|
||||
: undefined;
|
||||
buildContactCard(this.plugin.app, container, contact, { condensed, clickable: true, showDetails: false, nameOverride });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region New Contact Modal
|
||||
|
||||
export class NewContactModal extends Modal {
|
||||
plugin: ContactNotePlugin;
|
||||
|
||||
constructor(plugin: ContactNotePlugin) {
|
||||
super(plugin.app);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
onOpen(): void {
|
||||
const { contentEl } = this;
|
||||
contentEl.createEl("h2", { text: "New contact" });
|
||||
|
||||
let firstName = "";
|
||||
let lastName = "";
|
||||
|
||||
new Setting(contentEl)
|
||||
.setName("First name")
|
||||
.addText((text) =>
|
||||
text.onChange((value) => { firstName = value; })
|
||||
);
|
||||
|
||||
new Setting(contentEl)
|
||||
.setName("Last name")
|
||||
.addText((text) =>
|
||||
text.onChange((value) => { lastName = value; })
|
||||
);
|
||||
|
||||
new Setting(contentEl)
|
||||
.addButton((btn) =>
|
||||
btn
|
||||
.setButtonText("Create")
|
||||
.setCta()
|
||||
.onClick(() => {
|
||||
this.close();
|
||||
this.plugin.createNewContact(firstName.trim(), lastName.trim());
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
onClose(): void {
|
||||
this.contentEl.empty();
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Utilities
|
||||
|
||||
function matchesFilter(fm: Record<string, unknown>, filter: FrontmatterFilter): boolean {
|
||||
const raw = fm[filter.property];
|
||||
|
||||
switch (filter.operator) {
|
||||
case "exists":
|
||||
return raw !== undefined && raw !== null && raw !== "";
|
||||
case "is true":
|
||||
return raw === true || String(raw).toLowerCase() === "true";
|
||||
case "is false":
|
||||
return raw === false || String(raw).toLowerCase() === "false";
|
||||
default: {
|
||||
if (raw === undefined || raw === null) return false;
|
||||
const val = filter.value.toLowerCase();
|
||||
if (Array.isArray(raw)) {
|
||||
return raw.some((item) => {
|
||||
const s = String(item).toLowerCase();
|
||||
return filter.operator === "is" ? s === val : s.includes(val);
|
||||
});
|
||||
}
|
||||
const s = String(raw).toLowerCase();
|
||||
return filter.operator === "is" ? s === val : s.includes(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
191
src/ContactNoteSettingTab.ts
Normal file
191
src/ContactNoteSettingTab.ts
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
import { App, PluginSettingTab, Setting } from "obsidian";
|
||||
import ContactNotePlugin, { FrontmatterFilter } from "./main";
|
||||
|
||||
//#region Settings Tab
|
||||
|
||||
export class ContactNoteSettingTab extends PluginSettingTab {
|
||||
plugin: ContactNotePlugin;
|
||||
|
||||
constructor(app: App, plugin: ContactNotePlugin) {
|
||||
super(app, plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
display(): void {
|
||||
const { containerEl } = this;
|
||||
containerEl.empty();
|
||||
|
||||
// Contact Note Settings
|
||||
new Setting(containerEl).setName("Contact Note").setHeading();
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Identify contacts by folder")
|
||||
.setDesc(
|
||||
"When enabled, any note inside the specified folder is treated as a contact note. " +
|
||||
"When disabled, notes tagged with the specified tag are used instead."
|
||||
)
|
||||
.addToggle((toggle) =>
|
||||
toggle.setValue(this.plugin.settings.useFolder).onChange(async (value) => {
|
||||
this.plugin.settings.useFolder = value;
|
||||
await this.plugin.saveSettings();
|
||||
this.display();
|
||||
})
|
||||
);
|
||||
|
||||
if (this.plugin.settings.useFolder) {
|
||||
new Setting(containerEl)
|
||||
.setName("Contacts folder path")
|
||||
.setDesc(
|
||||
'Path to the folder containing contact notes, relative to the vault root (e.g. "Contacts" or "People/Contacts").'
|
||||
)
|
||||
.addText((text) =>
|
||||
text
|
||||
.setPlaceholder("Contacts")
|
||||
.setValue(this.plugin.settings.folderPath)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.folderPath = value;
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
} else {
|
||||
new Setting(containerEl)
|
||||
.setName("Contact tag")
|
||||
.setDesc('Tag used to identify contact notes. Omit the leading "#" (e.g. "contact").')
|
||||
.addText((text) =>
|
||||
text
|
||||
.setPlaceholder("contact")
|
||||
.setValue(this.plugin.settings.tag)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.tag = value;
|
||||
await this.plugin.saveSettings();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
// Contact List view settings
|
||||
new Setting(containerEl).setName("Contact List").setHeading();
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Contact list title")
|
||||
.setDesc("Title displayed at the top of the contact list view.")
|
||||
.addText((text) =>
|
||||
text
|
||||
.setPlaceholder("Contacts")
|
||||
.setValue(this.plugin.settings.listTitle)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.listTitle = value;
|
||||
await this.plugin.saveSettings();
|
||||
this.plugin.refreshContactListView();
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Show last name first in list")
|
||||
.setDesc('When enabled, names in the contact list are shown as "Last, First Middle" instead of the resolved display name.')
|
||||
.addToggle((toggle) =>
|
||||
toggle.setValue(this.plugin.settings.lastNameFirst).onChange(async (value) => {
|
||||
this.plugin.settings.lastNameFirst = value;
|
||||
await this.plugin.saveSettings();
|
||||
this.plugin.refreshContactListView();
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl)
|
||||
.setName("Condensed list view")
|
||||
.setDesc("When enabled, each card in the contact list shows only the photo and name.")
|
||||
.addToggle((toggle) =>
|
||||
toggle.setValue(this.plugin.settings.condensedList).onChange(async (value) => {
|
||||
this.plugin.settings.condensedList = value;
|
||||
await this.plugin.saveSettings();
|
||||
this.plugin.refreshContactListView();
|
||||
})
|
||||
);
|
||||
|
||||
new Setting(containerEl).setName("Default list filters").setHeading();
|
||||
containerEl.createEl("p", {
|
||||
cls: "setting-item-description",
|
||||
text: "Contacts in the list view will be limited to those matching all conditions below.",
|
||||
});
|
||||
|
||||
const filterListEl = containerEl.createDiv();
|
||||
this.renderDefaultFilters(filterListEl);
|
||||
|
||||
new Setting(containerEl)
|
||||
.addButton((btn) =>
|
||||
btn.setButtonText("Add filter condition").onClick(async () => {
|
||||
this.plugin.settings.defaultFilters.push({ property: "", operator: "contains", value: "" });
|
||||
await this.plugin.saveSettings();
|
||||
this.plugin.refreshContactListView();
|
||||
this.renderDefaultFilters(filterListEl);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private renderDefaultFilters(containerEl: HTMLElement): void {
|
||||
containerEl.empty();
|
||||
|
||||
const filters = this.plugin.settings.defaultFilters;
|
||||
const noValueOperators: FrontmatterFilter["operator"][] = ["exists", "is true", "is false"];
|
||||
|
||||
for (let i = 0; i < filters.length; i++) {
|
||||
const filter = filters[i];
|
||||
const setting = new Setting(containerEl)
|
||||
.setName("")
|
||||
.addText((text) =>
|
||||
text
|
||||
.setPlaceholder("frontmatter key")
|
||||
.setValue(filter.property)
|
||||
.onChange(async (value) => {
|
||||
filters[i].property = value;
|
||||
await this.plugin.saveSettings();
|
||||
this.plugin.refreshContactListView();
|
||||
})
|
||||
)
|
||||
.addDropdown((dd) =>
|
||||
dd
|
||||
.addOption("contains", "contains")
|
||||
.addOption("is", "is")
|
||||
.addOption("exists", "exists")
|
||||
.addOption("is true", "is true")
|
||||
.addOption("is false", "is false")
|
||||
.setValue(filter.operator)
|
||||
.onChange(async (value) => {
|
||||
filters[i].operator = value as FrontmatterFilter["operator"];
|
||||
if (noValueOperators.includes(filters[i].operator)) {
|
||||
filters[i].value = "";
|
||||
}
|
||||
await this.plugin.saveSettings();
|
||||
this.plugin.refreshContactListView();
|
||||
this.renderDefaultFilters(containerEl);
|
||||
})
|
||||
);
|
||||
|
||||
if (!noValueOperators.includes(filter.operator)) {
|
||||
setting.addText((text) =>
|
||||
text
|
||||
.setPlaceholder("value")
|
||||
.setValue(filter.value)
|
||||
.onChange(async (value) => {
|
||||
filters[i].value = value;
|
||||
await this.plugin.saveSettings();
|
||||
this.plugin.refreshContactListView();
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
setting.addExtraButton((btn) =>
|
||||
btn
|
||||
.setIcon("x")
|
||||
.setTooltip("Remove filter")
|
||||
.onClick(async () => {
|
||||
filters.splice(i, 1);
|
||||
await this.plugin.saveSettings();
|
||||
this.plugin.refreshContactListView();
|
||||
this.renderDefaultFilters(containerEl);
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
299
src/main.ts
Normal file
299
src/main.ts
Normal file
|
|
@ -0,0 +1,299 @@
|
|||
import {
|
||||
MarkdownView,
|
||||
normalizePath,
|
||||
Notice,
|
||||
Plugin,
|
||||
TFile,
|
||||
MarkdownPostProcessorContext,
|
||||
} from "obsidian";
|
||||
import { ContactListView } from "./ContactListView";
|
||||
import { ContactNoteSettingTab } from "./ContactNoteSettingTab";
|
||||
import { Contact } from "./Contact";
|
||||
import { buildContactCard } from "./ContactCard";
|
||||
|
||||
export const VIEW_TYPE_CONTACT_LIST = "contact-note-list";
|
||||
|
||||
export interface FrontmatterFilter {
|
||||
property: string;
|
||||
operator: "contains" | "is" | "exists" | "is true" | "is false";
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface ContactNoteSettings {
|
||||
useFolder: boolean;
|
||||
folderPath: string;
|
||||
tag: string;
|
||||
listTitle: string;
|
||||
condensedList: boolean;
|
||||
lastNameFirst: boolean;
|
||||
defaultFilters: FrontmatterFilter[];
|
||||
}
|
||||
|
||||
export const DEFAULT_SETTINGS: ContactNoteSettings = {
|
||||
useFolder: true,
|
||||
folderPath: "Contacts",
|
||||
tag: "contact",
|
||||
listTitle: "Contacts",
|
||||
condensedList: true,
|
||||
lastNameFirst: true,
|
||||
defaultFilters: [],
|
||||
};
|
||||
|
||||
export default class ContactNotePlugin extends Plugin {
|
||||
settings!: ContactNoteSettings;
|
||||
private renamingFiles = new Set<string>();
|
||||
|
||||
async onload() {
|
||||
// Settings
|
||||
await this.loadSettings();
|
||||
this.addSettingTab(new ContactNoteSettingTab(this.app, this));
|
||||
|
||||
// Ribbon
|
||||
this.addRibbonIcon("book-user", "Open contact list", () => {
|
||||
this.activateContactListView();
|
||||
});
|
||||
|
||||
// Command
|
||||
this.addCommand({
|
||||
id: "open-contact-list",
|
||||
name: "Open contact list",
|
||||
callback: () => this.activateContactListView(),
|
||||
});
|
||||
|
||||
// Markdown Post Processor
|
||||
this.registerMarkdownPostProcessor((el, ctx) => {
|
||||
// Find the mod-frontmatter element to add the contact note to
|
||||
if (!el.classList.contains("mod-frontmatter")) return;
|
||||
this.processContactNote(el, ctx);
|
||||
});
|
||||
|
||||
// View
|
||||
this.registerView(
|
||||
VIEW_TYPE_CONTACT_LIST,
|
||||
(leaf) => new ContactListView(leaf, this)
|
||||
);
|
||||
|
||||
// Enforce contact file naming
|
||||
this.registerEvent(
|
||||
this.app.metadataCache.on("changed", async (file, _data, cache) => {
|
||||
if (!this.isContactFile(file)) return;
|
||||
await this.enforceContactFileName(file, cache.frontmatter);
|
||||
})
|
||||
);
|
||||
|
||||
this.registerEvent(
|
||||
this.app.vault.on("rename", async (file, _oldPath) => {
|
||||
if (!(file instanceof TFile)) return;
|
||||
if (!this.isContactFile(file)) return;
|
||||
if (this.renamingFiles.has(file.path)) {
|
||||
this.renamingFiles.delete(file.path);
|
||||
return;
|
||||
}
|
||||
const cache = this.app.metadataCache.getFileCache(file);
|
||||
await this.enforceContactFileName(file, cache?.frontmatter);
|
||||
})
|
||||
);
|
||||
|
||||
this.registerEvent(
|
||||
this.app.workspace.on("layout-change", () => {
|
||||
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
|
||||
if (!view || !view.file || !this.isContactFile(view.file)) return;
|
||||
view.contentEl.querySelector(".markdown-reading-view")?.addClass("contact-note");
|
||||
})
|
||||
);
|
||||
|
||||
this.registerEvent(
|
||||
this.app.workspace.on("active-leaf-change", () => {
|
||||
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
|
||||
if (!view || !view.file || !this.isContactFile(view.file)) return;
|
||||
view.contentEl.querySelector(".markdown-reading-view")?.addClass("contact-note");
|
||||
})
|
||||
);
|
||||
|
||||
this.registerEvent(
|
||||
this.app.workspace.on("file-open", () => {
|
||||
const view = this.app.workspace.getActiveViewOfType(MarkdownView);
|
||||
if (!view || !view.file || !this.isContactFile(view.file)) return;
|
||||
view.contentEl.querySelector(".markdown-reading-view")?.addClass("contact-note");
|
||||
})
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
//#region Settings
|
||||
|
||||
async loadSettings() {
|
||||
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
|
||||
}
|
||||
|
||||
async saveSettings() {
|
||||
await this.saveData(this.settings);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Contact File
|
||||
|
||||
async createNewContact(firstName: string, lastName: string): Promise<void> {
|
||||
const folder = this.settings.useFolder
|
||||
? normalizePath(this.settings.folderPath)
|
||||
: "";
|
||||
|
||||
if (folder && !this.app.vault.getAbstractFileByPath(folder)) {
|
||||
await this.app.vault.createFolder(folder);
|
||||
}
|
||||
|
||||
const baseName = [firstName, lastName].filter((s) => s.trim()).join(" ") || "New Contact";
|
||||
let name = baseName;
|
||||
let counter = 1;
|
||||
while (this.app.vault.getAbstractFileByPath(`${folder ? folder + "/" : ""}${name}.md`)) {
|
||||
name = `${baseName} ${counter++}`;
|
||||
}
|
||||
const filePath = `${folder ? folder + "/" : ""}${name}.md`;
|
||||
|
||||
const tagLine = !this.settings.useFolder && this.settings.tag.trim()
|
||||
? `tags:\n - ${this.settings.tag.trim().replace(/^#/, "")}\n`
|
||||
: "";
|
||||
const aliasLines = firstName
|
||||
? ["aliases:", ` - ${firstName}`]
|
||||
: ["aliases:"];
|
||||
|
||||
const lines = [
|
||||
"---",
|
||||
`firstName: ${firstName}`,
|
||||
"middleName: ",
|
||||
`lastName: ${lastName}`,
|
||||
"displayName: ",
|
||||
"company: ",
|
||||
"title: ",
|
||||
"email: ",
|
||||
"phone: ",
|
||||
"photo: ",
|
||||
"socials:",
|
||||
" - twitter: ",
|
||||
" - instagram: ",
|
||||
" - linkedin: ",
|
||||
" - github: ",
|
||||
" - facebook: ",
|
||||
" - youtube: ",
|
||||
" - tiktok: ",
|
||||
" - bluesky: ",
|
||||
" - reddit: ",
|
||||
" - discord: ",
|
||||
" - telegram: ",
|
||||
" - twitch: ",
|
||||
" - snapchat: ",
|
||||
" - pinterest: ",
|
||||
...aliasLines,
|
||||
...(tagLine ? tagLine.replace(/\s+$/, "").split("\n") : []),
|
||||
"---",
|
||||
"",
|
||||
];
|
||||
|
||||
const file = await this.app.vault.create(filePath, lines.join("\n"));
|
||||
await this.app.workspace.getLeaf(false).openFile(file);
|
||||
}
|
||||
|
||||
isContactFile(file: TFile): boolean {
|
||||
if (this.settings.useFolder) {
|
||||
const folder = normalizePath(this.settings.folderPath);
|
||||
if (!folder) return false;
|
||||
return file.path === folder || file.path.startsWith(folder + "/");
|
||||
}
|
||||
|
||||
const tag = this.settings.tag.trim().replace(/^#/, "").toLowerCase();
|
||||
if (!tag) return false;
|
||||
|
||||
const cache = this.app.metadataCache.getFileCache(file);
|
||||
if (!cache) return false;
|
||||
|
||||
const tags: string[] = [];
|
||||
|
||||
const fmTags = cache.frontmatter?.tags;
|
||||
if (Array.isArray(fmTags)) {
|
||||
tags.push(...fmTags.map((t: unknown) => String(t).replace(/^#/, "").toLowerCase()));
|
||||
} else if (typeof fmTags === "string") {
|
||||
tags.push(fmTags.replace(/^#/, "").toLowerCase());
|
||||
}
|
||||
|
||||
if (cache.tags) {
|
||||
tags.push(...cache.tags.map((t) => t.tag.replace(/^#/, "").toLowerCase()));
|
||||
}
|
||||
|
||||
return tags.includes(tag);
|
||||
}
|
||||
|
||||
private async enforceContactFileName(file: TFile, frontmatter: Record<string, unknown> | undefined | null): Promise<void> {
|
||||
if (!frontmatter) return;
|
||||
|
||||
const firstName = String(frontmatter.firstName ?? "").trim();
|
||||
const middleName = String(frontmatter.middleName ?? "").trim();
|
||||
const lastName = String(frontmatter.lastName ?? "").trim();
|
||||
|
||||
if (!firstName || !lastName) return;
|
||||
|
||||
const expectedName = [firstName, middleName, lastName].filter(Boolean).join(" ");
|
||||
if (file.basename === expectedName) return;
|
||||
|
||||
const folder = file.parent?.path;
|
||||
const newPath = (folder ? folder + "/" : "") + expectedName + ".md";
|
||||
|
||||
if (this.app.vault.getAbstractFileByPath(newPath)) {
|
||||
new Notice(`Contact could not be renamed to "${expectedName}": a file with that name already exists. Add a middle name or initial to disambiguate.`);
|
||||
return;
|
||||
}
|
||||
|
||||
this.renamingFiles.add(newPath);
|
||||
await this.app.fileManager.renameFile(file, newPath);
|
||||
}
|
||||
|
||||
private processContactNote(el: HTMLElement, ctx: MarkdownPostProcessorContext): void {
|
||||
const file = this.app.vault.getAbstractFileByPath(ctx.sourcePath);
|
||||
if (!(file instanceof TFile)) return;
|
||||
if (!this.isContactFile(file)) return;
|
||||
if (!ctx.frontmatter) return;
|
||||
|
||||
const contact = Contact.fromCache(file, ctx.frontmatter as Record<string, unknown>);
|
||||
|
||||
if (!contact.isValid) {
|
||||
const missingFields: string[] = [];
|
||||
if (!contact.firstName) missingFields.push("firstName");
|
||||
if (!contact.lastName) missingFields.push("lastName");
|
||||
const errorEl = el.createDiv({ cls: "contact-note-error" });
|
||||
errorEl.createEl("strong", { text: "Contact note is missing required fields: " });
|
||||
errorEl.createEl("span", { text: missingFields.join(", ") });
|
||||
errorEl.createEl("p", { text: "Add these properties to the frontmatter to display this contact." });
|
||||
return;
|
||||
}
|
||||
|
||||
buildContactCard(this.app, el, contact, { showDetails: true });
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region View
|
||||
|
||||
async activateContactListView() {
|
||||
const { workspace } = this.app;
|
||||
const existing = workspace.getLeavesOfType(VIEW_TYPE_CONTACT_LIST);
|
||||
if (existing.length > 0) {
|
||||
workspace.revealLeaf(existing[0]);
|
||||
return;
|
||||
}
|
||||
const leaf = workspace.getRightLeaf(false);
|
||||
if (leaf) {
|
||||
await leaf.setViewState({ type: VIEW_TYPE_CONTACT_LIST, active: true });
|
||||
workspace.revealLeaf(leaf);
|
||||
}
|
||||
}
|
||||
|
||||
refreshContactListView() {
|
||||
for (const leaf of this.app.workspace.getLeavesOfType(VIEW_TYPE_CONTACT_LIST)) {
|
||||
if (leaf.view instanceof ContactListView) {
|
||||
leaf.view.reinit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
276
styles.css
Normal file
276
styles.css
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
/* #region Contact Card */
|
||||
|
||||
.contact-note-card.is-clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.contact-note-card {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: stretch;
|
||||
gap: 16px;
|
||||
padding: 16px 20px;
|
||||
margin-bottom: 24px;
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-radius: var(--radius-m, 8px);
|
||||
background-color: var(--background-secondary);
|
||||
}
|
||||
|
||||
/* Contact Note */
|
||||
.contact-note .contact-note-card {
|
||||
justify-self: center;
|
||||
}
|
||||
|
||||
/* Validation Error */
|
||||
.contact-note-error {
|
||||
padding: 12px 16px;
|
||||
border: 1px solid var(--color-red);
|
||||
border-radius: var(--radius-m, 8px);
|
||||
background-color: var(--background-modifier-error);
|
||||
color: var(--text-normal);
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.contact-note-error p {
|
||||
margin: 6px 0 0;
|
||||
font-size: var(--font-ui-small);
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
/* Photo */
|
||||
.contact-note-photo {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.contact-note-photo-img,
|
||||
.contact-note-photo-default {
|
||||
width: 150px !important;
|
||||
height: 150px !important;
|
||||
border-radius: 50%;
|
||||
object-fit: cover;
|
||||
border: 2px solid var(--background-modifier-border);
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* Name, Company, and Title */
|
||||
.contact-note-info {
|
||||
flex: 1;
|
||||
min-width: 150px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.contact-note-name {
|
||||
font-size: 1.7rem;
|
||||
font-weight: var(--font-semibold);
|
||||
color: var(--text-normal);
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.contact-note-title {
|
||||
font-size: 1.1rem;
|
||||
color: var(--text-muted);
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.contact-note-company {
|
||||
font-size: 1.1rem;
|
||||
font-weight: var(--font-medium);
|
||||
color: var(--text-normal);
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
/* Socials, Emails, and Phones */
|
||||
.contact-note-details {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px 32px;
|
||||
padding-top: 4px;
|
||||
border-top: 1px solid var(--background-modifier-border);
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.contact-note-emails,
|
||||
.contact-note-phones {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.contact-note-detail-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.contact-note-detail-icon {
|
||||
color: var(--text-faint);
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.contact-note-detail-icon svg {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.contact-note-socials .contact-note-detail-icon svg {
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
.contact-note-detail-value {
|
||||
font-size: var(--font-ui-small);
|
||||
color: var(--text-accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.contact-note-detail-value:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* #endregion */
|
||||
|
||||
/* #region Contact List View */
|
||||
|
||||
/* Header */
|
||||
.contact-note-list-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.contact-note-list-title {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.contact-note-header-btns {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.contact-note-header-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-radius: var(--radius-s, 4px);
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.contact-note-header-btn:hover {
|
||||
background: var(--background-modifier-hover);
|
||||
color: var(--text-normal);
|
||||
}
|
||||
|
||||
.contact-note-header-btn.is-active {
|
||||
background: var(--interactive-accent);
|
||||
border-color: var(--interactive-accent);
|
||||
color: var(--text-on-accent);
|
||||
}
|
||||
|
||||
.contact-note-header-btn svg {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
/* Letter filter */
|
||||
.contact-note-alpha-bar .nav-buttons-container {
|
||||
flex-wrap: wrap;
|
||||
gap: 2px;
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
.contact-note-alpha-btn {
|
||||
height: 24px;
|
||||
padding: 0 4px;
|
||||
font-size: var(--font-ui-smaller);
|
||||
border-radius: var(--radius-s, 4px);
|
||||
}
|
||||
|
||||
.contact-note-alpha-btn.is-active {
|
||||
background: var(--interactive-accent) !important;
|
||||
color: var(--text-on-accent) !important;
|
||||
}
|
||||
|
||||
/* Search */
|
||||
.contact-note-search {
|
||||
width: 100%;
|
||||
margin-bottom: 16px;
|
||||
padding: 6px 10px;
|
||||
border: 1px solid var(--background-modifier-border);
|
||||
border-radius: var(--radius-s, 4px);
|
||||
background: var(--background-primary);
|
||||
color: var(--text-normal);
|
||||
font-size: var(--font-ui-small);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.contact-note-search:focus {
|
||||
outline: none;
|
||||
border-color: var(--interactive-accent);
|
||||
}
|
||||
|
||||
/* Contact Card Normal */
|
||||
.contact-note-list-view .contact-note-card:hover {
|
||||
background-color: var(--background-modifier-hover);
|
||||
border-color: var(--interactive-accent);
|
||||
transition: background-color 0.15s ease, border-color 0.15s ease;
|
||||
}
|
||||
|
||||
.contact-note-list-view .contact-note-card {
|
||||
gap: 12px;
|
||||
padding: 12px 14px;
|
||||
margin-bottom: 17px;
|
||||
}
|
||||
|
||||
.contact-note-list-view .contact-note-photo-img,
|
||||
.contact-note-list-view .contact-note-photo-default {
|
||||
width: 108px !important;
|
||||
height: 108px !important;
|
||||
}
|
||||
|
||||
.contact-note-list-view .contact-note-name {
|
||||
font-size: 1.22rem;
|
||||
}
|
||||
|
||||
.contact-note-list-view .contact-note-title,
|
||||
.contact-note-list-view .contact-note-company {
|
||||
font-size: 0.79rem;
|
||||
}
|
||||
|
||||
/* Contact Card Condesned */
|
||||
.contact-note-list-condensed .contact-note-card {
|
||||
padding: 6px 10px;
|
||||
gap: 10px;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.contact-note-list-condensed .contact-note-photo-img,
|
||||
.contact-note-list-condensed .contact-note-photo-default {
|
||||
width: 40px !important;
|
||||
height: 40px !important;
|
||||
}
|
||||
|
||||
.contact-note-list-condensed .contact-note-name {
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
/* #endregion */
|
||||
|
||||
/* Hide the native frontmatter block for contact notes.
|
||||
The class is applied directly to the .mod-frontmatter
|
||||
element by the post-processor. */
|
||||
.contact-note .mod-header {
|
||||
display: none !important;
|
||||
}
|
||||
16
tsconfig.json
Normal file
16
tsconfig.json
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"inlineSourceMap": true,
|
||||
"inlineSources": true,
|
||||
"module": "ESNext",
|
||||
"target": "ES2018",
|
||||
"allowImportingTsExtensions": true,
|
||||
"moduleResolution": "bundler",
|
||||
"importHelpers": true,
|
||||
"isolatedModules": true,
|
||||
"strictNullChecks": true,
|
||||
"noEmit": true,
|
||||
"lib": ["DOM", "ES5", "ES6", "ES7", "ES2017"]
|
||||
},
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
3
versions.json
Normal file
3
versions.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"1.0.0": "1.12.7"
|
||||
}
|
||||
Loading…
Reference in a new issue