on main help sign in
cleanup and bug fix
commit994efea6a10a9fde6841c70a7da5f8fbaaf40935 authorJohn Hyde <johnhydefour@gmail.com> dateFri 30 Sep 2022, 03:37 (4 years ago) parentb16f593
14 files changed+21−123
bin/commit.sh+1−2 bin/get_glob.sh+1−4 desk/doc/usr/sigil.udon+1−1 ui/.env+1−1 ui/src/actions/sigma.ts−73 ui/src/actions/symbolPartClick.ts+1−11 ui/src/components/search/SearchResults.svelte+2−10 ui/src/components/search/sigil/ClanSelect.svelte−5 ui/src/components/search/sigil/SigilInput.svelte+1−5 ui/src/components/search/sigil/SymbolInput.svelte−5 ui/src/lib/sigil.ts+9−4 ui/src/stores/docs.ts−1 ui/src/stores/store.ts+1−1 ui/src/styles/tailwind-output.css+3
bin/commit.sh+1−2
@@ -21,5 +21,4 @@ lensa() {
2121 "http://localhost:$port" | xargs printf %s | sed 's/\\n/\n/g'
2222}
2323
24−
25−lensa 'hood' "+hood/commit %$DESK"
24+lensa 'hood' "+hood/commit %$DESK"
bin/get_glob.sh+1−4
@@ -1,8 +1,5 @@
11#!/bin/bash
2−#
3−# Taken from: https://github.com/timlucmiptev/btc-agents/blob/master/install.sh
4−# by ~timluc-miptev
5−#
2+
63usage() { printf "Usage: $0 URBIT_GLOBBER_DESK_DIRECTORY" 1>&2; exit 1; }
74
85cdir=$(dirname $0)
desk/doc/usr/sigil.udon+1−1
@@ -1,4 +1,4 @@
11;>
22# What is a Sigil?
33
4−TODO: write this doc
4+TODO: write this doc
ui/.env+1−1
@@ -1,3 +1,3 @@
11VITE_SHIP_URL=http://localhost:8081
22ASTROLABE_DESK=~/urbit/zod/astrolabe
3−GLOBBER_DESK=~/urbit/zod/globber
3+GLOBBER_DESK=~/urbit/zod/globber
ui/src/actions/sigma.tsdeleted−73
@@ -1,73 +0,0 @@
1−import tippy from 'tippy.js';
2−// import DocLink from '@/docs/DocLink.svelte'; // TODO try to add a link in the tooltip somehow or something, like:
3−// const app = new DocLink({
4−// target: document.getElementBySelector('.tippy')
5−// })
6−
7−const defaultParams = {
8− theme: 'astrolabe',
9− delay: [500, 0],
10−};
11−
12−function getParams(paramsOrContent:any = {}, overrides = {}) {
13− let params = paramsOrContent;
14− if (typeof paramsOrContent === 'string') {
15− params = { content: paramsOrContent };
16− }
17− return {
18− ...defaultParams,
19− ...params,
20− ...overrides,
21− };
22−}
23−
24−export default function tooltip(node, paramsOrContent: any = {}) {
25− const onTrigger = () => {
26− console.log('triggered');
27− node.dispatchEvent(new CustomEvent("tooltipTriggered"));
28− };
29− const onUntrigger = () => {
30− console.log('untriggered');
31− node.dispatchEvent(new CustomEvent("tooltipUntriggered"));
32− };
33− const onClickOutside = (_, e) => {
34− e.stopPropagation();
35− };
36− const listeners = {
37− onTrigger,
38− onUntrigger,
39− onClickOutside,
40− }
41−
42− const params = getParams(paramsOrContent, listeners);
43− const { content } = params;
44−
45− // Let's make sure the "aria-label" attribute
46− // is set so our element is accessible:
47− // https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-label_attribute
48− if (!node.getAttribute("aria-label")) node.setAttribute("aria-label", content);
49−
50−
51− // Support any of the Tippy props by forwarding all "params":
52− // https://atomiks.github.io/tippyjs/v6/all-props/
53− const tip: any = tippy(node, params);
54− const hideTip = (e) => {
55− if (tip.state.isShown) {
56− tip.hide();
57− // e.stopPropagation();
58− }
59− }
60− node.addEventListener('click', hideTip);
61−
62−
63− return {
64− // If the props change, let's update the Tippy instance:
65− update: (newParams) => tip.setProps(getParams(newParams)),
66−
67− // Clean up the Tippy instance on unmount:
68− destroy: () => {
69− node.removeEventListener('click', hideTip);
70− tip.destroy();
71− }
72− };
73−};
ui/src/actions/symbolPartClick.ts+1−11
@@ -1,6 +1,3 @@
1−const docLinkRegex = /\/~\/scry\/docs\/usr\/astrolabe\/([-~._\w\d]+).html/;
2−
3−
41function listenOnSvgElements(node, onPathChange) {
52 const parts = node.querySelectorAll('path, circle, line');
63 for (let part of parts) {
@@ -15,13 +12,6 @@ function listenOnSvgElements(node, onPathChange) {
1512 }
1613}
1714
18−// function docLinks(node, onPathChange: Function) {
19−// convertDocLinks(node, onPathChange)
20−// return {
21−// update: (onPathChange) => convertDocLinks(node, onPathChange),
22−// };
23−// };
24−
2515export default function svgClick(node: HTMLElement, { onPartClick, enabled = true, svgString }) {
2616 if (enabled) listenOnSvgElements(node, onPartClick);
2717
@@ -34,4 +24,4 @@ export default function svgClick(node: HTMLElement, { onPartClick, enabled = tru
3424 }
3525 },
3626 };
37−}
27+}
ui/src/components/search/SearchResults.svelte+2−10
@@ -12,7 +12,7 @@
1212 export let sigilQuery: SigilQuery;
1313 export let patpSearch: string;
1414 export let searchMode: ('patp' | 'sigil') = 'patp';
15− // export let patp: string;
15+
1616 let combinedSearchResults = [];
1717 let searchedPointsP: Promise<any>;
1818 let searchedPoints: Patp[] = [];
@@ -35,15 +35,7 @@
3535 }
3636 }, 1000);
3737 }
38− // let otherTimer;
39− // $: {
40− // clearTimeout(otherTimer);
41− // if (searchMode === 'sigil') {
42− // otherTimer = setTimeout(() => {
43− // searchedContacts.patpSearch(regexQuery, searchMode);
44− // }, 1000);
45− // }
46− // }
38+
4739 function doSearch() {
4840 const searchSnap = search;
4941 searchStatus = 'prog';
ui/src/components/search/sigil/ClanSelect.svelte−5
@@ -4,11 +4,6 @@
44 import { capitalize } from 'lib/utils';
55 import { CLANS, Clan } from 'types/sigil';
66
7− // const CLANS = ['galaxy', 'star', 'planet'] as const;
8− // const ClanTuple = typeof CLANS;
9− // type Clan = typeof ClanTuple[number];
10−
11− export let sigilSearch = {};
127 export let clan: Clan = 'planet';
138
149 let dropdownOpen = false;
ui/src/components/search/sigil/SigilInput.svelte+1−5
@@ -8,15 +8,11 @@
88 import type { SigilQuery } from 'lib/sigil';
99 import { searchSettings } from 'stores/searchStores';
1010 import { toggleStoreKey } from 'lib/utils';
11−import { sigil } from '@tlon/sigil-js';
1211
1312 export let sigilQuery: SigilQuery;
14− // export let clan: ('galaxy' | 'star' | 'planet') = 'planet';
1513 let focusedSymbolIndex: number = undefined;
1614 let inputComponents: string[] = [];
1715
18− // let symbols: SymbolQuery = [];
19−
2016 $: gridClasses = (sigilQuery.clan === 'galaxy' ? 'max-w-[10rem] grid items-center' : 'max-w-[18rem] grid grid-cols-2 items-center');
2117
2218 function unfocusSymbol() {
@@ -43,7 +39,7 @@ import { sigil } from '@tlon/sigil-js';
4339 }
4440</script>
4541
46−<div class="">
42+<div>
4743 <ClanSelect bind:clan={sigilQuery.clan} />
4844 <div class="flex flex-col xs:flex-row">
4945 <div class="grow-[2] w-full xs:m-0 xs:max-w-[18rem]" on:click={unfocusSymbol}>
ui/src/components/search/sigil/SymbolInput.svelte−5
@@ -3,13 +3,10 @@
33 import without from 'lodash/without';
44
55 import { searchSettings } from 'stores/searchStores';
6− import type { PartType } from 'types/sigil';
76 import type { SymbolQuery } from 'lib/sigil';
87 import { filterPartsByGeon } from 'lib/sigil';
9− import * as colors from 'lib/colors';
108
119 export let symbolQuery: SymbolQuery;
12− // export let inputMode: PartType;
1310 export let focusedSymbolIndex: number;
1411 export let index: number = 0;
1512 export let clan: string = 'galaxy';
@@ -44,7 +41,6 @@
4441 focused ? `${scaleClass} z-10`
4542 : (focusedSymbolIndex !== undefined ? 'scale-50' : '' )
4643 );
47− // $: focusedClasses = focused ? `border border-gold-s1 border-2` : '';
4844
4945 function onPartDelete({ detail: partId }) {
5046 symbolQuery = symbolQuery.removePart(partId);
@@ -76,7 +72,6 @@
7672 style:max-width="{size}px"
7773 on:click|stopPropagation
7874>
79−<!-- fgColor={!plausible ? 'red' : (symbolQuery.isPerfectMatch ? colors.GOLDS1 : 'black')} -->
8075 {#if symbolQuery.components.length > 0}
8176 <Symbol components={symbolQuery.components} {size}
8277 inverted={!symbolQuery.geon}
ui/src/lib/sigil.ts+9−4
@@ -110,13 +110,18 @@ export class SigilQuery {
110110 default:
111111 return;
112112 }
113+ let symbols;
113114 try {
114− this.symbols = queryParts.map((parts) => {
115− return new SymbolQuery(this, parts);
115+ symbols = queryParts.map((parts) => {
116+ let symbol = new SymbolQuery(this, parts);
117+ if (symbol.components.length !== parts.length) {
118+ throw new Error(`Invalid component ids: ${without(parts, symbol.components)}`);
119+ }
116120 });
117121 } catch (e) {
118122 console.error("Couldn't load in sigil query text", e);
119− this.symbols = [];
123+ this.clan = 'planet';
124+ symbols = [];
120125 }
121126 this.padSymbols();
122127 }
@@ -248,7 +253,7 @@ export function filterPartsByGeon(parts: string[], geon: Geon): string[] {
248253
249254export function filterFakeParts(parts: string[], symbolType: SymbolType): string[] {
250255 let plausibleSyllables = getSyllablesBySymbolType(symbolType);
251− return parts.filter(part => !plausibleSyllables.includes(part));
256+ return parts.filter(part => plausibleSyllables.includes(part));
252257}
253258
254259export class SymbolQuery {
ui/src/stores/docs.ts−1
@@ -2,7 +2,6 @@ import { writable } from 'svelte/store';
22
33import { getDoc } from 'lib/api';
44const docs = {};
5−// import type { AppState, Contacts } from 'types/store';
65
76const initStore: any = {
87 show: false,
ui/src/stores/store.ts+1−1
@@ -48,4 +48,4 @@ getPeers().then(({ points }) => {
4848 setStoreKey(store, 'peers', points.map(normalizeId));
4949});
5050
51−export default { subscribe, set, searchPatp, searchSigil, reset };
51+export default { subscribe, set, searchPatp, searchSigil, reset };
ui/src/styles/tailwind-output.css+3
@@ -1721,6 +1721,9 @@ Ensure the default browser behavior of the `hidden` attribute.
17211721.hover\:opacity-80:hover {
17221722 opacity: 0.8;
17231723}
1724+.hover\:opacity-40:hover {
1725+ opacity: 0.4;
1726+}
17241727@media (min-width: 360px) {
17251728
17261729 .\32xs\:-bottom-3\.5 {