@neo4j-ndl/base 4.23.7 → 5.0.0-alpha.0.3d763f7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/public-class-names.js +144 -0
- package/lib/cjs/public-class-names.js.map +1 -0
- package/lib/cjs/tailwind-preset.config.js +53 -20
- package/lib/cjs/tailwind-preset.config.js.map +1 -1
- package/lib/cjs/tokens/js/tokens-esm.js +1 -1
- package/lib/cjs/tokens/js/tokens-esm.js.map +1 -1
- package/lib/cjs/tokens/js/tokens.js +1 -1
- package/lib/cjs/tokens/js/tokens.js.map +1 -1
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/public-class-names.js +118 -0
- package/lib/esm/public-class-names.js.map +1 -0
- package/lib/esm/tailwind-preset.config.js +51 -20
- package/lib/esm/tailwind-preset.config.js.map +1 -1
- package/lib/esm/tokens/js/tokens-esm.js +1 -1
- package/lib/esm/tokens/js/tokens-esm.js.map +1 -1
- package/lib/esm/tokens/js/tokens.js +1 -1
- package/lib/esm/tokens/js/tokens.js.map +1 -1
- package/lib/neo4j-ds-styles.css +23084 -22872
- package/lib/types/index.d.ts +1 -0
- package/lib/types/public-class-names.d.ts +95 -0
- package/lib/types/tailwind-preset.config.d.ts +32 -2
- package/package.json +1 -1
package/lib/types/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
export * from './typings';
|
|
22
|
+
export * from './public-class-names';
|
|
22
23
|
export * from './tokens/js/tokens';
|
|
23
24
|
export * from './tailwindTheme.mjs';
|
|
24
25
|
export * from './tailwind-preset.config';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
*
|
|
3
|
+
* Copyright (c) "Neo4j"
|
|
4
|
+
* Neo4j Sweden AB [http://neo4j.com]
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Neo4j.
|
|
7
|
+
*
|
|
8
|
+
* Neo4j is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU General Public License
|
|
19
|
+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Typography variants that have a matching `ndl-typography-<variant>` class
|
|
23
|
+
* in the shipped stylesheet (`src/base/typography.css`). Mirrors the keys of
|
|
24
|
+
* `tokens.typography`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const NDL_TYPOGRAPHY_VARIANTS: readonly ["code", "display", "title-1", "title-2", "title-3", "title-4", "subheading-large", "subheading-medium", "subheading-small", "body-large", "body-medium", "body-small", "label"];
|
|
27
|
+
export type NdlTypographyVariant = (typeof NDL_TYPOGRAPHY_VARIANTS)[number];
|
|
28
|
+
/** Class name prefix used by the public typography classes. */
|
|
29
|
+
export declare const NDL_TYPOGRAPHY_CLASS_PREFIX = "ndl-typography-";
|
|
30
|
+
/** Theme scope classes, also exposed through `useNeedleTheme().themeClassName`. */
|
|
31
|
+
export declare const NDL_THEME_CLASS_NAMES: readonly ["ndl-theme-light", "ndl-theme-dark"];
|
|
32
|
+
/**
|
|
33
|
+
* The complete list of `ndl-*` class names that are part of the public API:
|
|
34
|
+
* every `ndl-typography-<variant>` class and the theme scope classes.
|
|
35
|
+
*
|
|
36
|
+
* Exact names rather than prefixes, because internal component classes share
|
|
37
|
+
* those prefixes (e.g. `ndl-theme-wrapper` from `NeedleThemeProvider`).
|
|
38
|
+
*
|
|
39
|
+
* Every other `ndl-*` class in the shipped stylesheet is an implementation
|
|
40
|
+
* detail of a component and may change without notice. Consumers who want to
|
|
41
|
+
* prevent accidental reliance on those internals can ban `ndl-*` class names in
|
|
42
|
+
* their own code and allow only these names. For example, with ESLint's
|
|
43
|
+
* `no-restricted-syntax`:
|
|
44
|
+
*
|
|
45
|
+
* ```js
|
|
46
|
+
* const { NDL_INTERNAL_CLASS_PATTERN } = require('@neo4j-ndl/base');
|
|
47
|
+
* const regex = `/${NDL_INTERNAL_CLASS_PATTERN.source}/`;
|
|
48
|
+
*
|
|
49
|
+
* module.exports = {
|
|
50
|
+
* rules: {
|
|
51
|
+
* 'no-restricted-syntax': [
|
|
52
|
+
* 'error',
|
|
53
|
+
* {
|
|
54
|
+
* selector: `Literal[value=${regex}], TemplateElement[value.raw=${regex}]`,
|
|
55
|
+
* message:
|
|
56
|
+
* 'Do not style against internal ndl-* component classes. Use component props or your own class names.',
|
|
57
|
+
* },
|
|
58
|
+
* ],
|
|
59
|
+
* },
|
|
60
|
+
* };
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* And with Stylelint's `selector-disallowed-list`:
|
|
64
|
+
*
|
|
65
|
+
* ```js
|
|
66
|
+
* const { NDL_INTERNAL_CLASS_PATTERN } = require('@neo4j-ndl/base');
|
|
67
|
+
*
|
|
68
|
+
* module.exports = {
|
|
69
|
+
* rules: {
|
|
70
|
+
* 'selector-disallowed-list': [
|
|
71
|
+
* [new RegExp(`\\.${NDL_INTERNAL_CLASS_PATTERN.source}`)],
|
|
72
|
+
* { message: 'Do not style against internal ndl-* component classes.' },
|
|
73
|
+
* ],
|
|
74
|
+
* },
|
|
75
|
+
* };
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export declare const NDL_PUBLIC_CLASS_NAMES: readonly string[];
|
|
79
|
+
/**
|
|
80
|
+
* Matches exactly one of {@link NDL_PUBLIC_CLASS_NAMES}.
|
|
81
|
+
*/
|
|
82
|
+
export declare const NDL_PUBLIC_CLASS_PATTERN: RegExp;
|
|
83
|
+
/**
|
|
84
|
+
* Matches an `ndl-*` class name that is **not** part of the public API, i.e.
|
|
85
|
+
* an internal component class. Intended for lint rules that scan class
|
|
86
|
+
* strings; the pattern is unanchored so it can match anywhere in a string
|
|
87
|
+
* such as `"my-class ndl-button"`.
|
|
88
|
+
*/
|
|
89
|
+
export declare const NDL_INTERNAL_CLASS_PATTERN: RegExp;
|
|
90
|
+
/**
|
|
91
|
+
* Returns `true` when the given class name is part of the public `ndl-*` API.
|
|
92
|
+
*
|
|
93
|
+
* @param className - A single class name (not a space separated list).
|
|
94
|
+
*/
|
|
95
|
+
export declare function isNdlPublicClassName(className: string): boolean;
|
|
@@ -19,10 +19,40 @@
|
|
|
19
19
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Builds the safelist that keeps every semantic color utility
|
|
24
|
+
* (`text-*`, `bg-*`, `border-*` and their `hover:`/`active:` variants)
|
|
25
|
+
* in the generated CSS, regardless of whether a scanned source file uses it.
|
|
26
|
+
*
|
|
27
|
+
* The patterns are matched against the final class name, so they need to
|
|
28
|
+
* include whatever `prefix` the consuming Tailwind config sets. The preset
|
|
29
|
+
* ships without a prefix; pass your own prefix if you override it:
|
|
30
|
+
*
|
|
31
|
+
* ```js
|
|
32
|
+
* const { tailwindConfig, createTailwindSafelist } = require('@neo4j-ndl/base');
|
|
33
|
+
* module.exports = {
|
|
34
|
+
* presets: [tailwindConfig],
|
|
35
|
+
* prefix: 'tw-',
|
|
36
|
+
* safelist: createTailwindSafelist('tw-'),
|
|
37
|
+
* };
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param {string} [prefix=''] - The Tailwind `prefix` option in use.
|
|
41
|
+
* @returns {import('tailwindcss').Config['safelist']}
|
|
42
|
+
*/
|
|
43
|
+
export function createTailwindSafelist(prefix?: string): import("tailwindcss").Config["safelist"];
|
|
22
44
|
/**
|
|
23
45
|
* Tailwind CSS Configuration
|
|
24
46
|
* containing all configurations we need
|
|
25
47
|
* for our components
|
|
48
|
+
*
|
|
49
|
+
* The preset does not set a `prefix`, so utilities are generated with
|
|
50
|
+
* their plain Tailwind names (`flex`, `text-neutral-text-weak`, ...).
|
|
51
|
+
* Consumers who still want a prefix can set `prefix` in their own config
|
|
52
|
+
* and pair it with `createTailwindSafelist(prefix)`.
|
|
53
|
+
*
|
|
54
|
+
* The preset does not set `content` either: which files to scan depends on
|
|
55
|
+
* the consuming app, so set it in your own config.
|
|
26
56
|
*/
|
|
27
|
-
/** @type {import('tailwindcss').Config} */
|
|
28
|
-
export const tailwindConfig: import("tailwindcss").Config
|
|
57
|
+
/** @type {Omit<import('tailwindcss').Config, 'content'>} */
|
|
58
|
+
export const tailwindConfig: Omit<import("tailwindcss").Config, "content">;
|