~hokiegeek/tw5-location-crafts

30bafff33c5ec04e44417c01c66f68860d0c94c0 — HokieGeek 5 months ago 981410f 0.2.0
Can now add to the list easily
3 files changed, 101 insertions(+), 8 deletions(-)

M macros.tid
M plugin.info
M styles.tid
M macros.tid => macros.tid +63 -7
@@ 1,4 1,4 @@
modified: 20220214180052000
modified: 20220214203551000
created: 20220214180052000
creator: hokiegeek
title: $:/plugins/hokiegeek/location-crafts/macros


@@ 13,13 13,69 @@ complete (just for locations?)
none

how to mark uniques?
and how to mark them off?
-->

\define category-list(type)
<h1 style="text-transform: capitalize;">$type$</h1>
<ol>
<$list filter="[is[current]get[crafted-$type$]enlist-input:raw[]]" emptyMessage="no $type$ setup">
<li><<currentTiddler>></li>
</$list>
</ol>
<div class="category-list">
    <$let categoryState={{{ [{!!title}encodeuricomponent[]addprefix[$:/state/location-crafts/]] }}}>
    <div class="header-button">
        <h1 style="text-transform: capitalize;">$type$</h1>
        <$button setTitle=<<categoryState>> setField=$type$ setTo="visible" tooltip="Add $type$" aria-label="Add $type$" class="tc-btn-invisible tc-btn-mini">
            {{$:/core/images/new-button}}
        </$button>
    </div>
    <ol>
        <$let me={{!!title}}>
        <$list filter="[is[current]get[crafted-$type$]enlist-input:raw[]]" counter="counter" emptyMessage="no $type$ setup">
        <li>
            <<currentTiddler>>
            <!--
            <$let prev={{{ [<counter>subtract[1]] }}}
                  last={{{ [<me>get[crafted-$type$]enlist-input:raw[]rest<counter>join[ ]] }}}
                  newlist={{{ [<me>get[crafted-$type$]enlist-input:raw[]first<prev>append<last>join[ ]] }}}>
            <$button setTitle=<<categoryState>> setField=$type$ setTo="hidden" tooltip="use unique" aria-label="use unique" class="tc-btn-invisible tc-btn-mini btn-close">
                <$action-setfield $tiddler=<<me>> $field="crafted-$type$" $value=<<newlist>> />
                {{$:/core/images/erase}}
            </$button>
            </$let>
            -->
        </li>
        </$list>
        </$let>
        <$reveal type="match" stateTitle=<<categoryState>> stateField=$type$ text="visible">
        <li>
        <div style="display: grid; width: fit-content;">
            <div style="grid-row-start: 1; grid-column-start: 1; padding-right: .3rem;">
            <$edit-text tiddler=<<categoryState>> field="custom-$type$" focus="true" />
            </div>
            <div style="grid-row-start: 1; grid-column-start: 2; padding-right: .2rem;">
            <$button setTitle=<<categoryState>> setField=$type$ setTo="hidden" tooltip="cancel" aria-label="cancel" class="tc-btn-invisible tc-btn-mini">
                <$action-setfield $tiddler=<<categoryState>> $field="custom-$type$" $value="" />
                {{$:/core/images/close-button}}
            </$button>
            </div>
            <div style="grid-row-start: 1; grid-column-start: 3;">
            <$button setTitle=<<categoryState>> setField=$type$ setTo="hidden" tooltip="submit" aria-label="submit" class="tc-btn-invisible tc-btn-mini">
                <$let custom-element={{{ [<categoryState>get[custom-$type$]] }}}
                      updated-list={{{ [is[current]get[crafted-$type$]enlist-input:raw[]append<custom-element>join[ ]] }}}>
                <$action-setfield $tiddler=<<currentTiddler>> $field="crafted-$type$" $value=<<updated-list>> />
                </$let>
                <$action-setfield $tiddler=<<categoryState>> $field="custom-$type$" $value="" />
                {{$:/core/images/done-button}}
            </$button>
            </div>
            <!--
            <div style="grid-row-start: 2">
                <$list filter="[[expected random special complete none]enlist-input[]]">
                <<currentTiddler>><br />
                </$list>
            </div>
            -->
        </div>
        </li>
        </$reveal>
    </ol>
    </$let>
</div>
\end

M plugin.info => plugin.info +1 -1
@@ 2,7 2,7 @@
    "title": "$:/plugins/hokiegeek/location-crafts",
    "description": "Some templates and stuff for recording information created with the RPG tool The Location Crafter",
    "author": "hokiegeek",
    "version": "0.1.0",
    "version": "0.2.0",
    "core-version": ">=5.2.1",
    "source": "https://git.sr.ht/~hokiegeek/tw5-location-crafts",
    "plugin-type": "plugin",

M styles.tid => styles.tid +37 -0
@@ 5,4 5,41 @@ title: $:/plugins/hokiegeek/location-crafts/styles
tags: $:/tags/Stylesheet
type: text/vnd.tiddlywiki

\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline

.category-list {
}

.category-list .header-button h1,
.category-list .header-button h2,
.category-list .header-button h3
{
    display: inline-block;
    padding-right: 0.5rem;
    margin-bottom: 0;
}

.category-list .header-button button
{
    position: relative;
    top: -3px;
}

.category-list .header-button svg
{
    opacity: .7;
}

.category-list input {
    width: 8rem;
}

.btn-close svg {
    width: .6rem !important;
    opacity: .3;
}

.btn-close:hover svg {
    opacity: .9;
    fill: red;
}