See live demo here: https://codepen.io/lorobi/pen/XJdoQPP Other solutions: https://stackoverflow.com/questions/11167628/trees-in-twitter-bootstrap/11170897#11170897
- 1
- 1.1
- 1.2
- 1.2.1
- 1.2.2
- 1.2.2.1
- 1.2.2.2
See live demo here: https://codepen.io/lorobi/pen/XJdoQPP Other solutions: https://stackoverflow.com/questions/11167628/trees-in-twitter-bootstrap/11170897#11170897
| (() => { | |
| let count = 0; | |
| const removeInRoot = root => { | |
| const styles = root.querySelectorAll('style'); | |
| styles.forEach(s => s.remove()); | |
| count += styles.length; | |
| const stylesLinks = root.querySelectorAll('link[rel="stylesheet"]'); | |
| stylesLinks.forEach(s => s.remove()); |
| export const isElementFullyVisible = (element: HTMLElement, topThreshold = 0) => { | |
| if (window && document) { | |
| const windowHeight = window.innerHeight || document.documentElement.clientHeight; | |
| const rect = element.getBoundingClientRect(); | |
| return rect.top > topThreshold && rect.bottom < windowHeight; | |
| } | |
| return false; | |
| }; | |
| export function scrollParentToChild(parent: Element, child: Element, threshold = 100): void { | |
| // Where is the parent on page |
| type CssPath<T extends string> = | |
| T extends `--${infer Rest}` // enlève les "--" du début | |
| ? ReplaceDashWithSlash<Rest> // remplace les tirets restants | |
| : never | |
| type ReplaceDashWithSlash<S extends string> = | |
| S extends `${infer Head}-${infer Tail}` | |
| ? `${Head}/${ReplaceDashWithSlash<Tail>}` | |
| : S |
| // radio-group.component | |
| import { Component, ContentChildren, QueryList, forwardRef } from '@angular/core'; | |
| import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; | |
| import { RadioItemComponent } from './radio-item.component'; | |
| let nextId = 0; | |
| @Component({ | |
| selector: 'radio-group', |
| // src/variants.ts | |
| export type VariantDef = Record<string, readonly string[]>; | |
| export type VariantProps<T extends VariantDef> = { | |
| [K in keyof T]?: T[K][number]; | |
| } & { class?: string }; | |
| // src/factory.ts | |
| import { cva } from "class-variance-authority"; | |
| import type { VariantDef, VariantProps as PublicProps } from "./variants"; |
| // build.js | |
| import ts from "typescript"; | |
| import path from "path"; | |
| async function build() { | |
| const projectDir = path.resolve("./packages/ds-tokens"); | |
| const configPath = path.join(projectDir, "tsconfig.build.json"); | |
| // 1. Charger tsconfig | |
| const configFile = ts.readConfigFile(configPath, ts.sys.readFile); |
| [ -f save.json ] || echo '{}' > save.json && docker run --rm \ | |
| -e COSMIUM_PERSIST=/save.json \ | |
| -e COSMIUM_DISABLETLS=true \ | |
| -e COSMIUM_ACCOUNTKEY=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw== \ | |
| -v ./save.json:/save.json \ | |
| -p 8081:8081 \ | |
| ghcr.io/pikami/cosmium:explorer |
| /** | |
| * @see: https://stackoverflow.com/questions/72757228/mutate-useswr-data-local-state-without-revalidating | |
| */ | |
| import React from "react"; | |
| import useSWR from "swr"; | |
| const fetcher = async (url) => { | |
| await new Promise(resolve => setTimeout(resolve, 1000)); | |
| return fetch(url).then((res) => res.json()) | |
| }; |
| export {}; | |
| /** | |
| * In both methods above, the options parameter provides a way to further manipulate page content | |
| * based on whether consent for a group of cookies has been given. | |
| * This provides a simple mechanism that enables website owners to either incentivize users to opt-in or deliver | |
| * a different user experience to visitors who opt-out. | |
| * @see https://my.onetrust.com/articles/en_US/Knowledge/UUID-518074a1-a6da-81c3-be52-bae7685d9c94 | |
| */ | |
| type OneTrustInsertScriptOptions = { | |
| /** Delete all parent container content before inserting the element */ |