winduum 0.8.0-next.2 → 0.8.0-next.4

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/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "winduum",
3
- "version": "0.8.0-next.2",
3
+ "version": "0.8.0-next.4",
4
4
  "type": "module",
5
- "main": "plugin/tailwind.cjs",
6
- "module": "plugin/tailwind.js",
5
+ "types": "types/index.d.ts",
6
+ "main": "plugin/index.cjs",
7
+ "module": "plugin/index.js",
7
8
  "scripts": {
8
9
  "dev": "vite --host",
9
10
  "build": "vite build",
@@ -12,7 +13,8 @@
12
13
  "eslint-fix": "eslint 'src/**/*.js' --fix",
13
14
  "stylelint": "npx stylelint 'src/**/*.css'",
14
15
  "stylelint-fix": "npx stylelint 'src/**/*.css' --fix",
15
- "tailwind": "rollup plugin/tailwind.js --file plugin/tailwind.cjs -f cjs --exports named",
16
+ "tailwind": "rollup plugin/index.js --file plugin/index.cjs -f cjs --exports named",
17
+ "dts": "node dts.js",
16
18
  "publish-next": "npm publish --tag next"
17
19
  },
18
20
  "devDependencies": {
@@ -34,39 +36,53 @@
34
36
  "tailwindcss-animate": "^1.0.7",
35
37
  "vite": "^5.0.12",
36
38
  "vue": "^3.4.15",
37
- "slide-element": "^2.3.1"
39
+ "slide-element": "^2.3.1",
40
+ "dts-buddy": "^0.4.4"
38
41
  },
39
42
  "files": [
40
43
  "index.js",
41
44
  "tailwind.config.js",
42
45
  "dist",
43
46
  "src",
44
- "plugin"
47
+ "plugin",
48
+ "types"
45
49
  ],
46
50
  "exports": {
47
51
  ".": {
48
- "default": "./plugin/tailwind.js",
49
- "require": "./plugin/tailwind.cjs",
50
- "import": "./plugin/tailwind.js"
52
+ "default": "./plugin/index.js",
53
+ "require": "./plugin/index.cjs",
54
+ "import": "./plugin/index.js"
51
55
  },
52
56
  "./src/*": "./src/*",
53
57
  "./dist/*": "./dist/*",
54
58
  "./plugin/*": "./plugin/*",
55
- "./base/*": "./src/base/*",
56
- "./components/*": "./src/components/*",
57
- "./libraries/*": "./src/libraries/*",
58
- "./ui/*": "./src/ui/*",
59
+ "./src/components/compare": {
60
+ "default": "./src/components/compare/index.js",
61
+ "types": "./src/components/compare/index.d.ts"
62
+ },
63
+ "./src/components/details": {
64
+ "default": "./src/components/details/index.js",
65
+ "types": "./src/components/details/index.d.ts"
66
+ },
59
67
  "./src/components/dialog": {
60
68
  "default": "./src/components/dialog/index.js",
61
- "types": "./src/components/dialog/types/index.d.ts"
69
+ "types": "./src/components/dialog/index.d.ts"
62
70
  },
63
71
  "./src/components/form": {
64
72
  "default": "./src/components/form/index.js",
65
- "types": "./src/components/form/types/index.d.ts"
73
+ "types": "./src/components/form/index.d.ts"
74
+ },
75
+ "./src/components/toaster": {
76
+ "default": "./src/components/toaster/index.js",
77
+ "types": "./src/components/toaster/index.d.ts"
78
+ },
79
+ "./src/ui/range": {
80
+ "default": "./src/ui/range/index.js",
81
+ "types": "./src/ui/range/index.d.ts"
66
82
  }
67
83
  },
68
84
  "engines": {
69
- "node": ">=18.0.0",
85
+ "node": ">=20.0.0",
70
86
  "npm": ">=9.0.0"
71
87
  },
72
88
  "repository": {
@@ -7,7 +7,7 @@ import { accentColor, textColor } from './utilities/color.js'
7
7
  import { tailwindAnimations, tailwindColors, tailwindPropertyUtilities, tailwindVariables, tailwindVariablesFont } from './utilities/common.js'
8
8
 
9
9
  /**
10
- * @type {import('./tailwind').PluginOptions} options.
10
+ * @type {import('./').PluginOptions} options.
11
11
  */
12
12
  export const defaultConfig = {
13
13
  colors: [
@@ -48,7 +48,7 @@ export const defaultConfig = {
48
48
  }
49
49
 
50
50
  /**
51
- * @param {import('./tailwind').PluginOptions} userConfig
51
+ * @param {import('./').PluginOptions} userConfig
52
52
  */
53
53
  export const createPlugin = (userConfig = {}) => {
54
54
  const settings = {
@@ -1,6 +1,6 @@
1
1
  /**
2
- * @param {import("./types/index").Position} event
3
- * @param {import("./types/index").PositionOptions} options
2
+ * @param {import("./").Position} event
3
+ * @param {import("./").PositionOptions} options
4
4
  * @returns void
5
5
  */
6
6
  export const setPosition = ({ currentTarget }, options = {}) => {
@@ -14,7 +14,7 @@ export const setPosition = ({ currentTarget }, options = {}) => {
14
14
  }
15
15
 
16
16
  /**
17
- * @param {import("./types/index").KeyboardStep} event
17
+ * @param {import("./").KeyboardStep} event
18
18
  * @param {Number} step
19
19
  * @returns void
20
20
  */
@@ -25,7 +25,7 @@ export const setKeyboardStep = ({ key, currentTarget }, step = 10) => {
25
25
  }
26
26
 
27
27
  /**
28
- * @param {import("./types/index").MouseStep} event
28
+ * @param {import("./").MouseStep} event
29
29
  * @param {Number} step
30
30
  * @returns void
31
31
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @type {import("./types/index").DefaultDetailsOptions}
2
+ * @type {import("./").DefaultDetailsOptions}
3
3
  */
4
4
  export const defaultOptions = {
5
5
  selector: 'details',
@@ -8,7 +8,7 @@ export const defaultOptions = {
8
8
 
9
9
  /**
10
10
  * @param {HTMLInputElement | HTMLElement} element
11
- * @param {import("./types/index").DefaultDetailsOptions} options
11
+ * @param {import("./").DefaultDetailsOptions} options
12
12
  * @returns Promise<void>
13
13
  */
14
14
  export const showDetails = async (element, options = {}) => {
@@ -31,7 +31,7 @@ export const showDetails = async (element, options = {}) => {
31
31
 
32
32
  /**
33
33
  * @param {HTMLInputElement | HTMLElement} element
34
- * @param {import("./types/index").DefaultDetailsOptions} options
34
+ * @param {import("./").DefaultDetailsOptions} options
35
35
  * @returns Promise<void>
36
36
  */
37
37
  export const closeDetails = async (element, options = {}) => {
@@ -56,7 +56,7 @@ export const closeDetails = async (element, options = {}) => {
56
56
 
57
57
  /**
58
58
  * @param {HTMLInputElement | HTMLElement} element
59
- * @param {import("./types/index").DefaultDetailsOptions} options
59
+ * @param {import("./").DefaultDetailsOptions} options
60
60
  * @returns Promise<void>
61
61
  */
62
62
  export const toggleDetails = async (element, options = {}) => {
@@ -0,0 +1,30 @@
1
+ export interface DialogElement extends HTMLDialogElement {
2
+ _dialogHasEvents: boolean
3
+ }
4
+
5
+ export interface DefaultOptions {
6
+ remove?: boolean | null
7
+ closable?: boolean | null
8
+ openClass?: string
9
+ scrollbarWidthProperty?: string
10
+ }
11
+
12
+ export interface InsertOptions {
13
+ selector?: string | null
14
+ class?: string | null
15
+ append?: boolean | null
16
+ show?: DefaultOptions
17
+ }
18
+
19
+ export interface FetchOptions {
20
+ url: string
21
+ insert?: InsertOptions
22
+ }
23
+
24
+ export const defaultOptions: DefaultOptions;
25
+ export function dialogSelector(selector: any): any;
26
+ export function dismissDialog(selector: HTMLDialogElement, options?: DefaultOptions): Promise<void>;
27
+ export function showDialog(selector: DialogElement, options?: DefaultOptions): Promise<void>;
28
+ export function closeDialog(selector: HTMLDialogElement, options?: DefaultOptions): Promise<void>;
29
+ export function insertDialog(content: string, options?: InsertOptions): Promise<void>;
30
+ export function fetchDialog({ url, insert }: FetchOptions): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  import { animationsFinished } from '../../common.js'
2
2
 
3
3
  /**
4
- * @type {import("./types/index").DefaultOptions}
4
+ * @type {import("./").DefaultOptions}
5
5
  */
6
6
  export const defaultOptions = {
7
7
  openClass: 'visible',
@@ -17,7 +17,7 @@ export const dialogSelector = selector => document.querySelectorAll(selector)[do
17
17
  /**
18
18
  * Dismisses a dialog.
19
19
  * @param {HTMLDialogElement} selector - The dialog element to dismiss.
20
- * @param {import("./types/index").DefaultOptions} options - The options for closing the dialog.
20
+ * @param {import("./").DefaultOptions} options - The options for closing the dialog.
21
21
  * @returns Promise<void>
22
22
  */
23
23
  export const dismissDialog = async (selector, options = defaultOptions) => {
@@ -35,8 +35,8 @@ export const dismissDialog = async (selector, options = defaultOptions) => {
35
35
 
36
36
  /**
37
37
  * Shows a dialog.
38
- * @param {import("./types/index").DialogElement} selector - The dialog element to show.
39
- * @param {import("./types/index").DefaultOptions} options - The options for showing the dialog.
38
+ * @param {HTMLDialogElement | import("./").DialogElement} selector - The dialog element to show.
39
+ * @param {import("./").DefaultOptions} options - The options for showing the dialog.
40
40
  * @returns Promise<void>
41
41
  */
42
42
  export const showDialog = async (selector, options = {}) => {
@@ -76,7 +76,7 @@ export const showDialog = async (selector, options = {}) => {
76
76
  /**
77
77
  * Closes and dismisses a dialog.
78
78
  * @param {HTMLDialogElement} selector - The dialog element to dismiss.
79
- * @param {import("./types/index").DefaultOptions} options - The options for closing the dialog.
79
+ * @param {import("./").DefaultOptions} options - The options for closing the dialog.
80
80
  * @returns Promise<void>
81
81
  */
82
82
  export const closeDialog = async (selector, options = {}) => {
@@ -95,7 +95,7 @@ export const closeDialog = async (selector, options = {}) => {
95
95
  /**
96
96
  * Inserts a dialog into the DOM.
97
97
  * @param {string} content - The HTML content to insert into the dialog.
98
- * @param {import("./types/index").InsertOptions} options - The options for inserting the dialog.
98
+ * @param {import("./").InsertOptions} options - The options for inserting the dialog.
99
99
  * @returns Promise<void>
100
100
  */
101
101
  export const insertDialog = async (content, options = {}) => {
@@ -123,7 +123,7 @@ export const insertDialog = async (content, options = {}) => {
123
123
 
124
124
  /**
125
125
  * Fetches a dialog from a URL and inserts it into the DOM.
126
- * @param {import("./types/index").FetchOptions} options - The options for fetching and inserting the dialog.
126
+ * @param {import("./").FetchOptions} options - The options for fetching and inserting the dialog.
127
127
  */
128
128
  export const fetchDialog = async ({ url, insert = {} }) => {
129
129
  await fetch(url, { headers: { 'X-Requested-With': 'XMLHttpRequest' } })
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @param {Event | SubmitEvent} event
3
- * @param {import("./types/index").ValidateFormOptions} options
3
+ * @param {import("./").ValidateFormOptions} options
4
4
  * @returns void
5
5
  */
6
6
  export const validateForm = (event, options = {}) => {
@@ -28,7 +28,7 @@ export const validateForm = (event, options = {}) => {
28
28
 
29
29
  /**
30
30
  * @param {HTMLElement} element
31
- * @param {import("./types/index").ValidateFieldOptions} options
31
+ * @param {import("./").ValidateFieldOptions} options
32
32
  * @returns void
33
33
  */
34
34
  export const validateField = (element, options = {}) => {
@@ -98,3 +98,8 @@ export const validateField = (element, options = {}) => {
98
98
  }
99
99
  }
100
100
  }
101
+
102
+ export default {
103
+ validateForm,
104
+ validateField
105
+ }
@@ -2,7 +2,7 @@ import { animationsFinished, nextRepaint } from '../../common.js'
2
2
 
3
3
  /**
4
4
  * @param {HTMLElement} element
5
- * @param {import('./types/index').CloseToastOptions} options
5
+ * @param {import('./index').CloseToastOptions} options
6
6
  * @returns Promise<void>
7
7
  */
8
8
  export const closeToast = async (element, options = {}) => {
@@ -29,7 +29,7 @@ export const closeToast = async (element, options = {}) => {
29
29
 
30
30
  /**
31
31
  * @param {HTMLElement} element
32
- * @param {import('./types/index').ShowToastOptions} options
32
+ * @param {import('./').ShowToastOptions} options
33
33
  * @returns Promise<void>
34
34
  */
35
35
  export const showToast = async (element, options = {}) => {
@@ -56,7 +56,7 @@ export const showToast = async (element, options = {}) => {
56
56
 
57
57
  /**
58
58
  * @param {HTMLElement} element
59
- * @param {import('./types/index').InsertToasterOptions} options
59
+ * @param {import('./').InsertToasterOptions} options
60
60
  * @returns Promise<void>
61
61
  */
62
62
  export const insertToaster = async (element, options = {}) => {
@@ -72,7 +72,7 @@ export const insertToaster = async (element, options = {}) => {
72
72
 
73
73
  /**
74
74
  * @param {HTMLElement} element
75
- * @param {import('./types/index').InsertToastOptions} options
75
+ * @param {import('./').InsertToastOptions} options
76
76
  * @returns Promise<void>
77
77
  */
78
78
  export const insertToast = async (element, options = {}) => {
@@ -104,7 +104,7 @@ export const insertToast = async (element, options = {}) => {
104
104
 
105
105
  /**
106
106
  * @param {HTMLElement} element
107
- * @param {import('./types/index').CloseToastOptions} options
107
+ * @param {import('./').CloseToastOptions} options
108
108
  * @returns Promise<void>
109
109
  */
110
110
  export const closeToaster = (element, options = {}) => {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @type {import("./types/index").DefaultOptions}
2
+ * @type {import("./").DefaultOptions}
3
3
  */
4
4
  export const defaultOptions = {
5
5
  selector: '.ui-range',
@@ -7,7 +7,7 @@ export const defaultOptions = {
7
7
  }
8
8
 
9
9
  /**
10
- * @param {import("./types/index").TrackOptions} options
10
+ * @param {import("./").TrackOptions} options
11
11
  * @param {'start' | 'end'} track
12
12
  * @returns void
13
13
  */
@@ -17,7 +17,7 @@ export const setTrackProperty = ({ element, value, max }, track = defaultOptions
17
17
 
18
18
  /**
19
19
  * @param {HTMLInputElement} target
20
- * @param {import("./types/index").DefaultOptions} options
20
+ * @param {import("./").DefaultOptions} options
21
21
  * @returns void
22
22
  */
23
23
  export const setValue = (target, options = {}) => {
@@ -55,7 +55,7 @@ export const setValue = (target, options = {}) => {
55
55
 
56
56
  /**
57
57
  * @param {HTMLInputElement} target
58
- * @param {import("./types/index").OutputOptions} options
58
+ * @param {import("./").OutputOptions} options
59
59
  * @returns void
60
60
  */
61
61
  export const setOutputValue = (target, options = {}) => {
File without changes
File without changes
@@ -0,0 +1,155 @@
1
+ declare module 'winduum' {
2
+ export interface PluginOptions {
3
+ colors?: string[]
4
+ fontFamily?: string[],
5
+ fontWeight?: string[],
6
+ ease?: string[],
7
+ zIndex?: string[],
8
+ fontSize?: string[],
9
+ spacing?: string[],
10
+ borderRadius?: string[],
11
+ animations?: string[],
12
+ mask?: string[],
13
+ screens?: {
14
+ [key: string]: string
15
+ },
16
+ settings?: {
17
+ rgb?: boolean,
18
+ colorMix?: boolean
19
+ }
20
+ }
21
+ }
22
+
23
+ declare module 'winduum/src/components/compare' {
24
+ export interface Position {
25
+ currentTarget: HTMLInputElement | EventTarget
26
+ }
27
+
28
+ export interface KeyboardStep {
29
+ currentTarget: HTMLInputElement | EventTarget
30
+ key: string
31
+ }
32
+
33
+ export interface MouseStep {
34
+ currentTarget: HTMLInputElement | EventTarget
35
+ }
36
+
37
+ export interface PositionOptions {
38
+ selector?: string
39
+ positionProperty?: string
40
+ }
41
+ }
42
+
43
+ declare module 'winduum/src/components/details' {
44
+ export interface DefaultDetailsOptions {
45
+ selector?: string
46
+ summarySelector?: string
47
+ }
48
+ }
49
+
50
+ declare module 'winduum/src/components/dialog' {
51
+ export interface DialogElement extends HTMLDialogElement {
52
+ _dialogHasEvents: boolean
53
+ }
54
+
55
+ export interface DefaultOptions {
56
+ remove?: boolean | null
57
+ closable?: boolean | null
58
+ openClass?: string
59
+ scrollbarWidthProperty?: string
60
+ }
61
+
62
+ export interface InsertOptions {
63
+ selector?: string | null
64
+ class?: string | null
65
+ append?: boolean | null
66
+ show?: DefaultOptions
67
+ }
68
+
69
+ export interface FetchOptions {
70
+ url: string
71
+ insert?: InsertOptions
72
+ }
73
+
74
+ export const defaultOptions: DefaultOptions;
75
+ export function dialogSelector(selector: any): any;
76
+ export function dismissDialog(selector: HTMLDialogElement, options?: DefaultOptions): Promise<void>;
77
+ export function showDialog(selector: DialogElement, options?: DefaultOptions): Promise<void>;
78
+ export function closeDialog(selector: HTMLDialogElement, options?: DefaultOptions): Promise<void>;
79
+ export function insertDialog(content: string, options?: InsertOptions): Promise<void>;
80
+ export function fetchDialog({ url, insert }: FetchOptions): Promise<void>;
81
+ }
82
+
83
+ declare module 'winduum/src/components/form' {
84
+ export interface ValidateFormOptions {
85
+ validateSelectors?: string
86
+ validateOptions?: ValidateFieldOptions
87
+ submitterLoadingClass?: string
88
+ }
89
+
90
+ export interface ValidateFieldOptions {
91
+ validate?: boolean
92
+ selector?: string
93
+ ignoreMatch?: string
94
+ validitySelector?: string
95
+ infoParentSelector?: string
96
+ infoSelector?: string
97
+ infoContent?: string
98
+ endParentSelector?: string
99
+ endSelector?: string
100
+ endContent?: string
101
+ validClass?: string
102
+ validIcon?: string
103
+ invalidClass?: string
104
+ invalidIcon?: string
105
+ activeClass?: string
106
+ }
107
+ }
108
+
109
+ declare module 'winduum/src/components/toaster' {
110
+ export interface ShowToastOptions {
111
+ visibleClass?: string
112
+ autoHide?: number | null
113
+ heightProperty?: string
114
+ close?: CloseToastOptions
115
+ }
116
+
117
+ export interface CloseToastOptions {
118
+ hiddenClass?: string
119
+ heightProperty?: string
120
+ }
121
+
122
+ export interface InsertToasterOptions {
123
+ classes?: string
124
+ }
125
+
126
+ export interface InsertToastOptions {
127
+ classes?: string
128
+ title?: string
129
+ text?: string
130
+ start?: string
131
+ end?: string
132
+ show?: ShowToastOptions
133
+ }
134
+ }
135
+
136
+ declare module 'winduum/src/ui/range' {
137
+ export interface DefaultOptions {
138
+ selector?: string
139
+ track?: 'start' | 'end'
140
+ }
141
+
142
+ export interface OutputOptions {
143
+ element?: HTMLOutputElement
144
+ lang?: string
145
+ formatOptions?: Intl.NumberFormatOptions
146
+ }
147
+
148
+ export interface TrackOptions {
149
+ element: HTMLElement | Element
150
+ value: string
151
+ max?: number
152
+ }
153
+ }
154
+
155
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,50 @@
1
+ {
2
+ "version": 3,
3
+ "file": "index.d.ts",
4
+ "names": [
5
+ "PluginOptions",
6
+ "Position",
7
+ "KeyboardStep",
8
+ "MouseStep",
9
+ "PositionOptions",
10
+ "DefaultDetailsOptions",
11
+ "DialogElement",
12
+ "DefaultOptions",
13
+ "InsertOptions",
14
+ "FetchOptions",
15
+ "defaultOptions",
16
+ "dialogSelector",
17
+ "dismissDialog",
18
+ "showDialog",
19
+ "closeDialog",
20
+ "insertDialog",
21
+ "fetchDialog",
22
+ "ValidateFormOptions",
23
+ "ValidateFieldOptions",
24
+ "ShowToastOptions",
25
+ "CloseToastOptions",
26
+ "InsertToasterOptions",
27
+ "InsertToastOptions",
28
+ "OutputOptions",
29
+ "TrackOptions"
30
+ ],
31
+ "sources": [
32
+ "../plugin/index.d.ts",
33
+ "../src/components/compare/index.d.ts",
34
+ "../src/components/details/index.d.ts",
35
+ "../src/components/dialog/index.d.ts",
36
+ "../src/components/form/index.d.ts",
37
+ "../src/components/toaster/index.d.ts",
38
+ "../src/ui/range/index.d.ts"
39
+ ],
40
+ "sourcesContent": [
41
+ null,
42
+ null,
43
+ null,
44
+ null,
45
+ null,
46
+ null,
47
+ null
48
+ ],
49
+ "mappings": ";kBAAiBA,aAAaA;;;;;;;;;;;;;;;;;;;;;;kBCAbC,QAAQA;;;;kBAIRC,YAAYA;;;;;kBAKZC,SAASA;;;;kBAITC,eAAeA;;;;;;;kBCbfC,qBAAqBA;;;;;;;kBCArBC,aAAaA;;;;kBAIbC,cAAcA;;;;;;;kBAOdC,aAAaA;;;;;;;kBAObC,YAAYA;;;;;cAKhBC,cAAcA;iBACXC,cAAcA;iBACdC,aAAaA;iBACbC,UAAUA;iBACVC,WAAWA;iBACXC,YAAYA;iBACZC,WAAWA;;;;kBC7BVC,mBAAmBA;;;;;;kBAMnBC,oBAAoBA;;;;;;;;;;;;;;;;;;;;kBCNpBC,gBAAgBA;;;;;;;kBAOhBC,iBAAiBA;;;;;kBAKjBC,oBAAoBA;;;;kBAIpBC,kBAAkBA;;;;;;;;;;;kBChBlBf,cAAcA;;;;;kBAKdgB,aAAaA;;;;;;kBAMbC,YAAYA"
50
+ }
@@ -1,320 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var plugin = require('tailwindcss/plugin');
6
- var flattenColorPalette = require('tailwindcss/src/util/flattenColorPalette');
7
- var withAlphaVariable = require('tailwindcss/src/util/withAlphaVariable');
8
- var toColorValue = require('tailwindcss/src/util/toColorValue');
9
-
10
- var FlexUtility = {
11
- '.flex-center': {
12
- display: 'flex',
13
- alignItems: 'center',
14
- gap: 'var(--spacing-sm)'
15
- },
16
- '.flex-between': {
17
- display: 'flex',
18
- justifyContent: 'space-between',
19
- gap: 'var(--spacing-sm)'
20
- }
21
- };
22
-
23
- var DotUtility = {
24
- '.dot': {
25
- '--tw-bg-opacity': '1',
26
- display: 'inline-flex',
27
- width: '0.625rem',
28
- height: '0.625rem',
29
- borderRadius: 'var(--rounded-full)',
30
- backgroundColor: 'color-mix(in srgb, var(--color-accent) calc(var(--tw-bg-opacity) * 100%), transparent)',
31
- flexShrink: '0'
32
- }
33
- };
34
-
35
- function divideGap ({ theme, e }) {
36
- return [
37
- ...Object.entries(theme('spacing')).map(([key, value]) => {
38
- return {
39
- [`.${e(`divide-gap-x-${key}`)}`]: {
40
- '& > :where(*:not(:first-child))': {
41
- paddingLeft: value,
42
- marginLeft: value
43
- }
44
- },
45
- [`.${e(`divide-gap-y-${key}`)}`]: {
46
- '& > :where(*:not(:first-child))': {
47
- paddingTop: value,
48
- marginTop: value
49
- }
50
- }
51
- }
52
- })
53
- ]
54
- }
55
-
56
- const accentColor = ({ value }, settings) => {
57
- const matchValue = toColorValue(value).match(/var\((--color-.*?)\)/);
58
- const colorProperties = {};
59
-
60
- if (matchValue) {
61
- if (settings.rgb) {
62
- colorProperties['--color-accent-rgb'] =
63
- `var(${matchValue[1].includes('-rgb') ? matchValue[1] : matchValue[1] + '-rgb'})`;
64
- colorProperties['--color-accent-foreground-rgb'] =
65
- `var(${matchValue[1].includes('-rgb') ? matchValue[1].replace('-rgb', '-foreground-rgb') : matchValue[1] + '-foreground-rgb, var(--color-light-rgb)'})`;
66
- }
67
-
68
- if (toColorValue(value).includes('calc(1 * 100%)') || toColorValue(value).includes(' / 1')) {
69
- colorProperties['--color-accent'] = matchValue[0].replace('-rgb', '');
70
- colorProperties['--color-accent-foreground'] = `var(${matchValue[1].replace('-rgb', '')}-foreground, var(--color-light))`;
71
-
72
- return {
73
- ...colorProperties,
74
- 'accent-color': settings.colorMix ? 'var(--color-accent)' : 'rgb(var(--color-accent))'
75
- }
76
- } else {
77
- if (matchValue[1].includes('-rgb')) {
78
- colorProperties['--color-accent'] = toColorValue(value);
79
- } else {
80
- colorProperties['--color-accent'] = settings.rgb ? `rgb(var(--color-accent-rgb) / ${toColorValue(value).match(/calc\((.*?)\)/)[0]})` : toColorValue(value);
81
- }
82
-
83
- colorProperties['--color-accent-foreground'] = settings.rgb ? 'rgb(var(--color-accent-foreground-rgb))' : `var(${matchValue[1]}-foreground, var(--color-light))`;
84
-
85
- return {
86
- ...colorProperties,
87
- 'accent-color': settings.colorMix ? 'var(--color-accent)' : 'rgb(var(--color-accent))'
88
- }
89
- }
90
- }
91
-
92
- return {
93
- '--color-accent': toColorValue(value),
94
- 'accent-color': 'var(--color-accent)'
95
- }
96
- };
97
-
98
- const textColor = ({ value, corePlugins }, settings) => {
99
- const matchValue = toColorValue(value).match(/var\((--color-.*?)\)/);
100
- const withCurrentRgb = {};
101
-
102
- if (matchValue && settings.rgb) {
103
- withCurrentRgb['--tw-text-current-rgb'] = matchValue[1].includes('rgb') ? matchValue[0] : `var(${matchValue[1]}-rgb)`;
104
- }
105
-
106
- if (!corePlugins('textOpacity')) {
107
- return {
108
- ...withCurrentRgb,
109
- color: toColorValue(value)
110
- }
111
- }
112
-
113
- return {
114
- ...withCurrentRgb,
115
- ...withAlphaVariable({
116
- color: value,
117
- property: 'color',
118
- variable: '--tw-text-opacity'
119
- })
120
- }
121
- };
122
-
123
- /**
124
- * @param {[]} colors
125
- * @param {boolean} colorMix
126
- * @param {boolean} rgb
127
- * @returns {[]}
128
- */
129
- const tailwindColors = (colors = [], colorMix = true, rgb = false) => {
130
- colors.forEach(name => {
131
- if (rgb) {
132
- colors[name + '-rgb'] = `rgb(var(--color-${name}-rgb) / <alpha-value>)`;
133
- }
134
-
135
- colors[name] = colorMix
136
- ? `color-mix(in var(--space), var(--color-${name}) calc(<alpha-value> * 100%), transparent)`
137
- : `rgb(var(--color-${name}) / <alpha-value>)`;
138
- });
139
-
140
- return colors
141
- };
142
-
143
- /**
144
- * @param {string} type
145
- * @param {string[]} variables
146
- * @param {Object} values
147
- * @returns {Object}
148
- */
149
- const tailwindVariables = (type, variables = [], values = {}) => {
150
- variables.forEach(name => {
151
- values[name] = `var(--${type}-${name})`;
152
- });
153
-
154
- return values
155
- };
156
-
157
- /**
158
- * @param {string} type
159
- * @param {string[]} variables
160
- * @param {Object} values
161
- * @returns {Object}
162
- */
163
- const tailwindVariablesFont = (type, variables = [], values = {}) => {
164
- variables.forEach(name => {
165
- values[name] = [`var(--${type}-${name})`, `calc(var(--${type}-${name}) + 0.5rem)`];
166
- });
167
-
168
- return values
169
- };
170
-
171
- /**
172
- * @param {string} type
173
- * @param {string[]} variables
174
- * @returns {Object}
175
- */
176
- const tailwindPropertyUtilities = (type, variables = []) => {
177
- const result = {};
178
-
179
- variables.forEach(name => {
180
- result[`.${type}-${name}`] = {
181
- [type]: `var(--${type}-${name})`
182
- };
183
- });
184
-
185
- return result
186
- };
187
-
188
- /**
189
- * @param {string[]} values
190
- * @returns {Object}
191
- */
192
- const tailwindAnimations = (values) => {
193
- const result = {};
194
-
195
- values.forEach(value => {
196
- result[`.animation-${value}`] = {
197
- 'animation-name': value
198
- };
199
- });
200
-
201
- return result
202
- };
203
-
204
- /**
205
- * @type {import('./tailwind').PluginOptions} options.
206
- */
207
- const defaultConfig = {
208
- colors: [
209
- 'primary', 'accent',
210
- 'warning', 'error', 'info', 'success', 'light', 'dark',
211
- 'main', 'main-primary', 'main-secondary', 'main-tertiary',
212
- 'body', 'body-primary', 'body-secondary', 'body-tertiary',
213
- 'primary-foreground', 'accent-foreground', 'current-foreground',
214
- 'warning-foreground', 'error-foreground', 'info-foreground', 'success-foreground', 'light-foreground', 'dark-foreground',
215
- 'main-foreground', 'main-primary-foreground', 'main-secondary-foreground', 'main-tertiary-foreground',
216
- 'body-foreground', 'body-primary-foreground', 'body-secondary-foreground', 'body-tertiary-foreground'
217
- ],
218
- fontFamily: ['primary', 'secondary'],
219
- fontWeight: ['light', 'normal', 'medium', 'semibold', 'bold', 'extrabold'],
220
- ease: ['linear', 'in', 'out', 'in-out'],
221
- zIndex: ['10', '20', '30', '40', '50', '60'],
222
- fontSize: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', '3xl', '4xl', '5xl', '6xl', '7xl', '7xl', '8xl', '9xl'],
223
- spacing: ['xs', 'sm', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl'],
224
- borderRadius: ['xs', 'sm', 'base', 'md', 'lg', 'xl', '2xl', '3xl', '4xl', '5xl', '6xl', 'full'],
225
- animations: ['fade-in', 'fade-out', 'fade-in-down', 'fade-out-up', 'ripple', 'spin', 'move-indeterminate'],
226
- mask: ['check', 'radio', 'angle-up', 'angle-down'],
227
- screens: {
228
- xs: '22.5em',
229
- sm: '26em',
230
- md: '48em',
231
- lg: '60em',
232
- xl: '76em',
233
- '2xl': '82em',
234
- '3xl': '88em',
235
- '4xl': '100em',
236
- xxl: '126em',
237
- '2xxl': '158em'
238
- },
239
- settings: {
240
- rgb: false,
241
- colorMix: true
242
- }
243
- };
244
-
245
- /**
246
- * @param {import('./tailwind').PluginOptions} userConfig
247
- */
248
- const createPlugin = (userConfig = {}) => {
249
- const settings = {
250
- ...defaultConfig.settings,
251
- ...userConfig.settings
252
- };
253
-
254
- userConfig = {
255
- ...defaultConfig,
256
- ...userConfig,
257
- settings
258
- };
259
-
260
- return plugin(({ addComponents, matchUtilities, theme, e, corePlugins }) => {
261
- matchUtilities(
262
- {
263
- accent: value => accentColor({ value }, userConfig.settings)
264
- },
265
- { values: flattenColorPalette(theme('accentColor')), type: ['color', 'any'] }
266
- );
267
- matchUtilities(
268
- {
269
- text: value => textColor({ value, corePlugins }, userConfig.settings)
270
- },
271
- { values: flattenColorPalette(theme('textColor')), type: ['color', 'any'] }
272
- );
273
- addComponents(tailwindAnimations(userConfig.animations));
274
- addComponents(tailwindPropertyUtilities('mask', userConfig.mask));
275
- addComponents(divideGap({ theme, e }));
276
- addComponents({
277
- ...FlexUtility,
278
- ...DotUtility
279
- });
280
- }, {
281
- corePlugins: {
282
- preflight: false,
283
- textColor: false,
284
- accentColor: false
285
- },
286
- theme: {
287
- extend: {
288
- transitionProperty: {
289
- DEFAULT: 'var(--transition)'
290
- },
291
- transitionDuration: {
292
- DEFAULT: 'var(--duration)'
293
- },
294
- transitionTimingFunction: tailwindVariables('ease', userConfig.ease),
295
- colors: tailwindColors(userConfig.colors, settings.colorMix, settings.rgb),
296
- fontSize: tailwindVariablesFont('text', userConfig.fontSize),
297
- fontFamily: tailwindVariables('font', userConfig.fontFamily),
298
- fontWeight: tailwindVariables('font', userConfig.fontWeight),
299
- zIndex: tailwindVariables('z', userConfig.zIndex, {
300
- 0: 0,
301
- auto: 'auto'
302
- }),
303
- spacing: tailwindVariables('spacing', userConfig.spacing),
304
- borderRadius: tailwindVariables('rounded', userConfig.borderRadius, {
305
- DEFAULT: 'var(--rounded)'
306
- }),
307
- screens: userConfig.screens
308
- }
309
- }
310
- })
311
- };
312
-
313
- exports.createPlugin = createPlugin;
314
- exports.default = createPlugin;
315
- exports.defaultConfig = defaultConfig;
316
- exports.tailwindAnimations = tailwindAnimations;
317
- exports.tailwindColors = tailwindColors;
318
- exports.tailwindPropertyUtilities = tailwindPropertyUtilities;
319
- exports.tailwindVariables = tailwindVariables;
320
- exports.tailwindVariablesFont = tailwindVariablesFont;
@@ -1,22 +0,0 @@
1
- export interface DialogElement extends HTMLDialogElement {
2
- _dialogHasEvents: boolean
3
- }
4
-
5
- export interface DefaultOptions {
6
- remove?: boolean | null
7
- closable?: boolean | null
8
- openClass?: string
9
- scrollbarWidthProperty?: string
10
- }
11
-
12
- export interface InsertOptions {
13
- selector?: string | null
14
- class?: string | null
15
- append?: boolean | null
16
- show?: DefaultOptions
17
- }
18
-
19
- export interface FetchOptions {
20
- url: string
21
- insert?: InsertOptions
22
- }
File without changes
File without changes