feat: docker compose maybe
This commit is contained in:
		
							
								
								
									
										56
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/TableOfContents.svelte
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/TableOfContents.svelte
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,56 @@
 | 
			
		||||
<script>import { fade } from "svelte/transition";
 | 
			
		||||
import { tocStore, tocActiveId } from "./stores.js";
 | 
			
		||||
export let inactive = "opacity-60 hover:opacity-100";
 | 
			
		||||
export let active = "text-primary-500";
 | 
			
		||||
export let activeId = "";
 | 
			
		||||
export let indentStyles = {
 | 
			
		||||
  h2: "",
 | 
			
		||||
  h3: "ml-4",
 | 
			
		||||
  h4: "ml-8",
 | 
			
		||||
  h5: "ml-12",
 | 
			
		||||
  h6: "ml-16"
 | 
			
		||||
};
 | 
			
		||||
export let regionLead = "font-bold";
 | 
			
		||||
export let regionList = "";
 | 
			
		||||
export let regionListItem = "";
 | 
			
		||||
export let regionAnchor = "";
 | 
			
		||||
const cBase = "space-y-4";
 | 
			
		||||
const cList = "space-y-2";
 | 
			
		||||
const cListItem = "block";
 | 
			
		||||
const cAnchor = "";
 | 
			
		||||
$:
 | 
			
		||||
  reactiveActiveId = $tocActiveId ? $tocActiveId : activeId.replace("#", "");
 | 
			
		||||
$:
 | 
			
		||||
  classesBase = `${cBase} ${$$props.class ?? ""}`;
 | 
			
		||||
$:
 | 
			
		||||
  classesList = `${cList} ${regionList}`;
 | 
			
		||||
$:
 | 
			
		||||
  classesListItem = `${cListItem} ${regionListItem}`;
 | 
			
		||||
$:
 | 
			
		||||
  classesAnchor = `${cAnchor} ${regionAnchor}`;
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
{#if $tocStore.length}
 | 
			
		||||
	<nav class="toc {classesBase}" data-testid="toc" transition:fade|local={{ duration: 100 }}>
 | 
			
		||||
		<!-- Slot: Default (title) -->
 | 
			
		||||
		<div class={regionLead}>
 | 
			
		||||
			<slot>Table of Contents</slot>
 | 
			
		||||
		</div>
 | 
			
		||||
		<!-- List -->
 | 
			
		||||
		<ul class="toc-list {classesList}">
 | 
			
		||||
			{#each $tocStore as tocHeading}
 | 
			
		||||
				<li class="toc-list-item {classesListItem} {indentStyles[tocHeading.element]}">
 | 
			
		||||
					<a
 | 
			
		||||
						href="#{tocHeading.id}"
 | 
			
		||||
						class="toc-anchor {classesAnchor} {tocHeading.id === reactiveActiveId ? active : inactive}"
 | 
			
		||||
						on:click={() => {
 | 
			
		||||
							reactiveActiveId = tocHeading.id;
 | 
			
		||||
						}}
 | 
			
		||||
					>
 | 
			
		||||
						{tocHeading.text}
 | 
			
		||||
					</a>
 | 
			
		||||
				</li>
 | 
			
		||||
			{/each}
 | 
			
		||||
		</ul>
 | 
			
		||||
	</nav>
 | 
			
		||||
{/if}
 | 
			
		||||
							
								
								
									
										34
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/TableOfContents.svelte.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/TableOfContents.svelte.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
import { SvelteComponentTyped } from "svelte";
 | 
			
		||||
declare const __propDef: {
 | 
			
		||||
    props: {
 | 
			
		||||
        [x: string]: any;
 | 
			
		||||
        /** Provide classes to set the inactive anchor styles.*/
 | 
			
		||||
        inactive?: string | undefined;
 | 
			
		||||
        /** Provide classes to set the active anchor styles.*/
 | 
			
		||||
        active?: string | undefined;
 | 
			
		||||
        /** Set the active permalink ID on load.*/
 | 
			
		||||
        activeId?: string | undefined;
 | 
			
		||||
        /** Set indentation per each queried element.*/
 | 
			
		||||
        indentStyles?: Record<string, string> | undefined;
 | 
			
		||||
        /** Provide arbitrary classes to the lead regions, used for titles.*/
 | 
			
		||||
        regionLead?: string | undefined;
 | 
			
		||||
        /** Provide arbitrary classes to style the list element.*/
 | 
			
		||||
        regionList?: string | undefined;
 | 
			
		||||
        /** Provide arbitrary classes to style the list item elements.*/
 | 
			
		||||
        regionListItem?: string | undefined;
 | 
			
		||||
        /** Provide arbitrary classes to style the anchor elements.*/
 | 
			
		||||
        regionAnchor?: string | undefined;
 | 
			
		||||
    };
 | 
			
		||||
    events: {
 | 
			
		||||
        [evt: string]: CustomEvent<any>;
 | 
			
		||||
    };
 | 
			
		||||
    slots: {
 | 
			
		||||
        default: {};
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
export type TableOfContentsProps = typeof __propDef.props;
 | 
			
		||||
export type TableOfContentsEvents = typeof __propDef.events;
 | 
			
		||||
export type TableOfContentsSlots = typeof __propDef.slots;
 | 
			
		||||
export default class TableOfContents extends SvelteComponentTyped<TableOfContentsProps, TableOfContentsEvents, TableOfContentsSlots> {
 | 
			
		||||
}
 | 
			
		||||
export {};
 | 
			
		||||
							
								
								
									
										16
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/crawler.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/crawler.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
			
		||||
interface TOCCrawlerArgs {
 | 
			
		||||
    /** Set generate mode to automatically set heading IDs. */
 | 
			
		||||
    mode?: 'generate' | undefined;
 | 
			
		||||
    /** Provide query list of elements. Defaults h2-h6. */
 | 
			
		||||
    queryElements?: string;
 | 
			
		||||
    scrollTarget?: string;
 | 
			
		||||
    /** Reload the action when this key value changes. */
 | 
			
		||||
    key?: unknown;
 | 
			
		||||
    prefix?: string;
 | 
			
		||||
    suffix?: string;
 | 
			
		||||
}
 | 
			
		||||
export declare function tocCrawler(node: HTMLElement, args?: TOCCrawlerArgs): {
 | 
			
		||||
    update(newArgs: TOCCrawlerArgs): void;
 | 
			
		||||
    destroy(): void;
 | 
			
		||||
};
 | 
			
		||||
export {};
 | 
			
		||||
							
								
								
									
										78
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/crawler.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										78
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/crawler.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,78 @@
 | 
			
		||||
// Action: Table of Contents Crawler
 | 
			
		||||
import { tocStore, tocActiveId } from './stores.js';
 | 
			
		||||
export function tocCrawler(node, args) {
 | 
			
		||||
    let queryElements = 'h2, h3, h4, h5, h6';
 | 
			
		||||
    let scrollTarget = 'body';
 | 
			
		||||
    let headings;
 | 
			
		||||
    let permalinks = [];
 | 
			
		||||
    function init() {
 | 
			
		||||
        // Set accepted list of query elements
 | 
			
		||||
        // (IMPORTANT: must proceed resetting `headings` below)
 | 
			
		||||
        if (args?.queryElements)
 | 
			
		||||
            queryElements = args.queryElements;
 | 
			
		||||
        // Set the desired scroll target to monitor
 | 
			
		||||
        if (args?.scrollTarget)
 | 
			
		||||
            scrollTarget = args.scrollTarget;
 | 
			
		||||
        // Reset local values
 | 
			
		||||
        headings = node.querySelectorAll(queryElements);
 | 
			
		||||
        permalinks = [];
 | 
			
		||||
        // Query and process the headings
 | 
			
		||||
        queryHeadings();
 | 
			
		||||
    }
 | 
			
		||||
    function queryHeadings() {
 | 
			
		||||
        headings?.forEach((elemHeading) => {
 | 
			
		||||
            // If heading has ignore attribute, skip it
 | 
			
		||||
            if (elemHeading.hasAttribute('data-toc-ignore'))
 | 
			
		||||
                return;
 | 
			
		||||
            // If generate mode and heading ID not present, assign one
 | 
			
		||||
            if (args?.mode === 'generate' && !elemHeading.id) {
 | 
			
		||||
                const newHeadingId = elemHeading.firstChild?.textContent
 | 
			
		||||
                    ?.trim()
 | 
			
		||||
                    .replaceAll(/[^a-zA-Z0-9 ]/g, '')
 | 
			
		||||
                    .replaceAll(' ', '-')
 | 
			
		||||
                    .toLowerCase();
 | 
			
		||||
                const prefix = args.prefix ? `${args.prefix}-` : '';
 | 
			
		||||
                const suffix = args.suffix ? `-${args.suffix}` : '';
 | 
			
		||||
                elemHeading.id = prefix + newHeadingId + suffix;
 | 
			
		||||
            }
 | 
			
		||||
            // Push heading data to the permalink array
 | 
			
		||||
            permalinks.push({
 | 
			
		||||
                element: elemHeading.nodeName.toLowerCase(),
 | 
			
		||||
                id: elemHeading.id,
 | 
			
		||||
                text: elemHeading.firstChild?.textContent?.trim() || ''
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
        // Set the store with the permalink array
 | 
			
		||||
        tocStore.set(permalinks);
 | 
			
		||||
    }
 | 
			
		||||
    // Listens to scroll event, determines top-most heading, provides that to the `tocActiveId` store
 | 
			
		||||
    function onWindowScroll(e) {
 | 
			
		||||
        if (!headings?.length)
 | 
			
		||||
            return;
 | 
			
		||||
        const targetElem = e.target;
 | 
			
		||||
        if (!(targetElem instanceof HTMLElement))
 | 
			
		||||
            throw new Error('scrollTarget is not an HTMLElement');
 | 
			
		||||
        const scrollableTop = targetElem.getBoundingClientRect().top || 0;
 | 
			
		||||
        const headingSizeThreshold = 40; // px
 | 
			
		||||
        for (const elemHeading of headings) {
 | 
			
		||||
            const headerBoundTop = elemHeading.getBoundingClientRect().top;
 | 
			
		||||
            const offsetTop = headerBoundTop - scrollableTop + headingSizeThreshold;
 | 
			
		||||
            if (offsetTop >= 0)
 | 
			
		||||
                return tocActiveId.set(elemHeading.id);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    // Lifecycle
 | 
			
		||||
    init();
 | 
			
		||||
    if (scrollTarget)
 | 
			
		||||
        document.querySelector(scrollTarget)?.addEventListener('scroll', onWindowScroll);
 | 
			
		||||
    return {
 | 
			
		||||
        update(newArgs) {
 | 
			
		||||
            args = newArgs;
 | 
			
		||||
            init();
 | 
			
		||||
        },
 | 
			
		||||
        destroy() {
 | 
			
		||||
            if (scrollTarget)
 | 
			
		||||
                document.querySelector(scrollTarget)?.removeEventListener('scroll', onWindowScroll);
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										6
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/stores.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/stores.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,6 @@
 | 
			
		||||
/// <reference types="svelte" />
 | 
			
		||||
import type { TOCHeadingLink } from './types.js';
 | 
			
		||||
/** Contains the set of table of contents link data. */
 | 
			
		||||
export declare const tocStore: import("svelte/store").Writable<TOCHeadingLink[]>;
 | 
			
		||||
/** Contains the ID of the top-most visible heading when scrolling.  */
 | 
			
		||||
export declare const tocActiveId: import("svelte/store").Writable<string>;
 | 
			
		||||
							
								
								
									
										5
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/stores.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/stores.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
import { writable } from 'svelte/store';
 | 
			
		||||
/** Contains the set of table of contents link data. */
 | 
			
		||||
export const tocStore = writable([]);
 | 
			
		||||
/** Contains the ID of the top-most visible heading when scrolling.  */
 | 
			
		||||
export const tocActiveId = writable(undefined);
 | 
			
		||||
							
								
								
									
										5
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/types.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/types.d.ts
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
export interface TOCHeadingLink {
 | 
			
		||||
    element: string;
 | 
			
		||||
    id: string;
 | 
			
		||||
    text: string;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										2
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/types.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								node_modules/@skeletonlabs/skeleton/dist/utilities/TableOfContents/types.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
// Table of Content Types
 | 
			
		||||
export {};
 | 
			
		||||
		Reference in New Issue
	
	Block a user