UNPKG

flowbite-angular

Version:

<div align="center"> <h1>:construction: flowbite-angular (unreleased) :construction:</h1> <p> <a href="https://flowbite.com"> <img alt="Flowbite - Tailwind CSS components" width="350" src="https://flowbite.s3.amazonaws.com/github/logo-github

1 lines 9.87 kB
{"version":3,"file":"flowbite-angular-utils.mjs","sources":["../../../../libs/flowbite-angular/utils/theme/is-object.ts","../../../../libs/flowbite-angular/utils/theme/clone-deep.ts","../../../../libs/flowbite-angular/utils/theme/create-class.ts","../../../../libs/flowbite-angular/utils/theme/create-theme.ts","../../../../libs/flowbite-angular/utils/theme/merge-theme.ts","../../../../libs/flowbite-angular/utils/theme/to-string.ts","../../../../libs/flowbite-angular/utils/icon.list.ts","../../../../libs/flowbite-angular/utils/id.generator.ts","../../../../libs/flowbite-angular/utils/flowbite-angular-utils.ts"],"sourcesContent":["/**\n * Check if the provided parameter is an object or not.\n *\n * @param item The unknown type parameter.\n * @returns true if it's an ibject ; false otherwise.\n */\nexport function isObject(item: unknown): item is Record<string, unknown> {\n return item !== null && typeof item === 'object' && item.constructor === Object;\n}\n","import { isObject } from './is-object';\n\n/**\n * Function that return the cloned type of the provided generic type.\n *\n * @param source Generic object to be cloned.\n * @returns The clone type of th eprovided type.\n */\nexport function cloneDeep<T>(source: T): T {\n if (!isObject(source)) {\n return source;\n }\n\n const output: Record<string, unknown> = {};\n\n for (const key in source) {\n output[key] = cloneDeep(source[key]);\n }\n\n return output as T;\n}\n","/**\n * This function is used to create classes for component's while keeping the intellisens up for TailwindCSS and other extensions.\n *\n * @param input Generic type to be created.\n * @returns The generic type's definition.\n */\nexport function createClass<T>(input: T) {\n return input;\n}\n","/**\n * This function is used to create themes for component's while keeping the intellisens up for TailwindCSS and other extensions.\n *\n * @param input Generic type to be created.\n * @returns The generic type's definition.\n */\nexport function createTheme<T>(input: T) {\n return input;\n}\n","import { cloneDeep } from './clone-deep';\nimport { isObject } from './is-object';\n\n/**\n * Merge two objects into one.\n *\n * @param target Object to be merged.\n * @param source Object to be merged.\n * @returns The merged object.\n */\nexport function mergeTheme<T extends object, S extends object>(target: T, source: S): T & S {\n if (isObject(source) && Object.keys(source).length === 0) {\n return cloneDeep({ ...target, ...source });\n }\n\n const output = { ...target, ...source };\n\n if (isObject(source) && isObject(target)) {\n for (const key in source) {\n if (isObject(source[key]) && key in target && isObject(target[key])) {\n (output as Record<string, unknown>)[key] = mergeTheme(\n target[key] as object,\n source[key] as object\n );\n } else {\n (output as Record<string, unknown>)[key] = isObject(source[key])\n ? cloneDeep(source[key])\n : source[key];\n }\n }\n }\n\n return output;\n}\n","/**\n * Return theme value to an indented string.\n *\n * @param value The theme to be stringify.\n * @returns The theme as string.\n */\nexport function themeToString(value: unknown): string {\n return JSON.stringify(value, undefined, 2);\n}\n","export const CLOSE_SVG_ICON = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"\n d=\"M6 18 17.94 6M18 18 6.06 6\" />\n</svg>\n`;\n\nexport const CHEVRON_UP_SVG_ICON = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m16 14-4-4-4 4\" />\n</svg>\n`;\n\nexport const CHEVRON_DOWN_SVG_ICON = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m8 10 4 4 4-4\" />\n</svg>\n`;\n\nexport const CHEVRON_RIGHT_SVG_ICON = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\" d=\"m10 16 4-4-4-4\" />\n</svg>\n`;\n\nexport const SUN_SVG_ICON = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"\n d=\"M12 5V3m0 18v-2M7.05 7.05 5.636 5.636m12.728 12.728L16.95 16.95M5 12H3m18 0h-2M7.05 16.95l-1.414 1.414M18.364 5.636 16.95 7.05M16 12a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z\" />\n</svg>\n`;\n\nexport const MOON_SVG_ICON = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2\"\n d=\"M12 21a9 9 0 0 1-.5-17.986V3c-.354.966-.5 1.911-.5 3a9 9 0 0 0 9 9c.239 0 .254.018.488 0A9.004 9.004 0 0 1 12 21Z\" />\n</svg>\n`;\n\nexport const BARS_SVG_ICON = `\n<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\">\n <path stroke=\"currentColor\" stroke-linecap=\"round\" stroke-width=\"2\" d=\"M5 7h14M5 12h14M5 17h14\" />\n</svg>\n`;\n","/**\n * This class provide an implementation of Guid used as id for flowbite-angular components.\n *\n * @see https://gist.github.com/emptyother/1fd97db034ef848f38eca3354fa9ee90\n */\nexport class Guid {\n private value: string = this.empty;\n\n /**\n * If value is given and if the value is a valid Guid, then return a Guid from the string ; Otherwise or if no value is given, create a Guid class without value.\n *\n * @param value Guid as string if you want to get a Guid type from string\n */\n constructor(value?: string) {\n if (value) {\n if (Guid.isValid(value)) {\n this.value = value;\n }\n }\n }\n\n /**\n * Function that generate new Guid.\n *\n * @returns New Guid.\n */\n public static newGuid(): Guid {\n return new Guid(crypto.randomUUID());\n }\n\n /**\n * Function that generate an empty Guid.\n *\n * @return \"00000000-0000-0000-0000-000000000000\".\n */\n public static get empty(): string {\n return '00000000-0000-0000-0000-000000000000';\n }\n\n /**\n * Function that generate an empty Guid.\n *\n * @return \"00000000-0000-0000-0000-000000000000\".\n */\n public get empty(): string {\n return Guid.empty;\n }\n\n /**\n * Check if the provided Guid is valid.\n *\n * @param str The Guid to check.\n * @returns true if the Guid is valid ; false otherwise.\n */\n public static isValid(str: string): boolean {\n const validRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n return validRegex.test(str);\n }\n\n /**\n * ToString base method.\n *\n * @returns Value as string.\n */\n public toString() {\n return this.value;\n }\n\n /**\n * ToJson base method.\n *\n * @returns Value as Json compatible string.\n */\n public toJSON(): string {\n return this.value;\n }\n}\n\n/**\n * Function that return a new Guid.\n *\n * @returns New {@link Guid}.\n *\n * @see `Guid`\n */\nexport function generateId(): Guid {\n return Guid.newGuid();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAA;;;;;AAKG;AACG,SAAU,QAAQ,CAAC,IAAa,EAAA;AACpC,IAAA,OAAO,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,WAAW,KAAK,MAAM;AACjF;;ACNA;;;;;AAKG;AACG,SAAU,SAAS,CAAI,MAAS,EAAA;AACpC,IAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;AACrB,QAAA,OAAO,MAAM;;IAGf,MAAM,MAAM,GAA4B,EAAE;AAE1C,IAAA,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;QACxB,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;;AAGtC,IAAA,OAAO,MAAW;AACpB;;ACpBA;;;;;AAKG;AACG,SAAU,WAAW,CAAI,KAAQ,EAAA;AACrC,IAAA,OAAO,KAAK;AACd;;ACRA;;;;;AAKG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