histoire 0.2.0 → 0.2.3
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/dist/client/app/App.vue +1 -1
- package/dist/client/app/codegen/vue3.js +11 -1
- package/dist/client/app/codegen/vue3.ts +9 -1
- package/dist/client/app/components/app/AppHeader.vue +1 -1
- package/dist/client/app/components/exposed/Story.vue +25 -14
- package/dist/client/app/components/exposed/Variant.vue +7 -0
- package/dist/client/app/components/sandbox/lib.d.ts +2 -0
- package/dist/client/app/components/sandbox/lib.js +6 -0
- package/dist/client/app/components/sandbox/lib.ts +8 -0
- package/dist/client/app/components/story/StoryResponsivePreview.vue +74 -81
- package/dist/client/app/components/story/StorySidePanel.vue +1 -1
- package/dist/client/app/components/story/StorySourceCode.vue +3 -17
- package/dist/client/app/components/story/StoryVariantGrid.vue +112 -0
- package/dist/client/app/components/story/StoryVariantGridItem.vue +36 -6
- package/dist/client/app/components/story/StoryVariantSingleView.vue +20 -161
- package/dist/client/app/components/story/StoryViewer.vue +7 -42
- package/dist/client/app/components/story/toolbar/StoryVariantBackground.vue +67 -0
- package/dist/client/app/components/story/toolbar/StoryVariantNewTab.vue +29 -0
- package/dist/client/app/components/story/toolbar/StoryVariantResponsiveSize.vue +82 -0
- package/dist/client/app/components/story/toolbar/StoryVariantTitle.vue +21 -0
- package/dist/client/app/stores/preview-settings.d.ts +8 -0
- package/dist/client/app/stores/preview-settings.js +14 -0
- package/dist/client/app/stores/preview-settings.ts +17 -0
- package/dist/client/app/stores/story.d.ts +45 -15
- package/dist/client/app/style/main.pcss +4 -0
- package/dist/client/app/types.d.ts +10 -1
- package/dist/client/app/types.ts +11 -1
- package/dist/client/app/util/mapping.js +10 -9
- package/dist/client/app/util/mapping.ts +10 -5
- package/dist/client/app/util/preview-settings.d.ts +1 -8
- package/dist/client/app/util/preview-settings.js +0 -10
- package/dist/client/app/util/preview-settings.ts +1 -19
- package/dist/client/app/util/scroll.d.ts +3 -1
- package/dist/client/app/util/scroll.js +3 -0
- package/dist/client/app/util/scroll.ts +4 -0
- package/dist/node/config.d.ts +2 -2
- package/dist/node/plugin.js +14 -6
- package/dist/node/tree.js +24 -4
- package/dist/style.css +70 -4
- package/package.json +21 -21
- package/src/client/app/App.vue +1 -1
- package/src/client/app/codegen/vue3.ts +9 -1
- package/src/client/app/components/app/AppHeader.vue +1 -1
- package/src/client/app/components/exposed/Story.vue +25 -14
- package/src/client/app/components/exposed/Variant.vue +7 -0
- package/src/client/app/components/sandbox/lib.ts +8 -0
- package/src/client/app/components/story/StoryResponsivePreview.vue +74 -81
- package/src/client/app/components/story/StorySidePanel.vue +1 -1
- package/src/client/app/components/story/StorySourceCode.vue +3 -17
- package/src/client/app/components/story/StoryVariantGrid.vue +112 -0
- package/src/client/app/components/story/StoryVariantGridItem.vue +36 -6
- package/src/client/app/components/story/StoryVariantSingleView.vue +20 -161
- package/src/client/app/components/story/StoryViewer.vue +7 -42
- package/src/client/app/components/story/toolbar/StoryVariantBackground.vue +67 -0
- package/src/client/app/components/story/toolbar/StoryVariantNewTab.vue +29 -0
- package/src/client/app/components/story/toolbar/StoryVariantResponsiveSize.vue +82 -0
- package/src/client/app/components/story/toolbar/StoryVariantTitle.vue +21 -0
- package/src/client/app/stores/preview-settings.ts +17 -0
- package/src/client/app/style/main.pcss +4 -0
- package/src/client/app/types.ts +11 -1
- package/src/client/app/util/mapping.ts +10 -5
- package/src/client/app/util/preview-settings.ts +1 -19
- package/src/client/app/util/scroll.ts +4 -0
- package/src/node/config.ts +2 -2
- package/src/node/plugin.ts +15 -6
- package/src/node/tree.spec.ts +61 -0
- package/src/node/tree.ts +29 -5
|
@@ -12,7 +12,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
12
12
|
slots?: () => Readonly<any>;
|
|
13
13
|
state?: any;
|
|
14
14
|
source?: string;
|
|
15
|
-
|
|
15
|
+
responsiveDisabled?: boolean;
|
|
16
|
+
configReady?: boolean;
|
|
17
|
+
previewReady?: boolean;
|
|
16
18
|
}[];
|
|
17
19
|
layout?: {
|
|
18
20
|
type: "single";
|
|
@@ -38,7 +40,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
38
40
|
slots?: () => Readonly<any>;
|
|
39
41
|
state?: any;
|
|
40
42
|
source?: string;
|
|
41
|
-
|
|
43
|
+
responsiveDisabled?: boolean;
|
|
44
|
+
configReady?: boolean;
|
|
45
|
+
previewReady?: boolean;
|
|
42
46
|
};
|
|
43
47
|
}[]>;
|
|
44
48
|
setStories: (value: Story[]) => void;
|
|
@@ -54,7 +58,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
54
58
|
slots?: () => Readonly<any>;
|
|
55
59
|
state?: any;
|
|
56
60
|
source?: string;
|
|
57
|
-
|
|
61
|
+
responsiveDisabled?: boolean;
|
|
62
|
+
configReady?: boolean;
|
|
63
|
+
previewReady?: boolean;
|
|
58
64
|
}[];
|
|
59
65
|
layout?: {
|
|
60
66
|
type: "single";
|
|
@@ -80,7 +86,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
80
86
|
slots?: () => Readonly<any>;
|
|
81
87
|
state?: any;
|
|
82
88
|
source?: string;
|
|
83
|
-
|
|
89
|
+
responsiveDisabled?: boolean;
|
|
90
|
+
configReady?: boolean;
|
|
91
|
+
previewReady?: boolean;
|
|
84
92
|
};
|
|
85
93
|
}>;
|
|
86
94
|
currentVariant: import("vue").ComputedRef<{
|
|
@@ -92,7 +100,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
92
100
|
slots?: () => Readonly<any>;
|
|
93
101
|
state?: any;
|
|
94
102
|
source?: string;
|
|
95
|
-
|
|
103
|
+
responsiveDisabled?: boolean;
|
|
104
|
+
configReady?: boolean;
|
|
105
|
+
previewReady?: boolean;
|
|
96
106
|
}>;
|
|
97
107
|
isFolderOpened: (path: Array<string>) => boolean;
|
|
98
108
|
toggleFolder: (path: Array<string>, force?: boolean) => void;
|
|
@@ -109,7 +119,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
109
119
|
slots?: () => Readonly<any>;
|
|
110
120
|
state?: any;
|
|
111
121
|
source?: string;
|
|
112
|
-
|
|
122
|
+
responsiveDisabled?: boolean;
|
|
123
|
+
configReady?: boolean;
|
|
124
|
+
previewReady?: boolean;
|
|
113
125
|
}[];
|
|
114
126
|
layout?: {
|
|
115
127
|
type: "single";
|
|
@@ -135,7 +147,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
135
147
|
slots?: () => Readonly<any>;
|
|
136
148
|
state?: any;
|
|
137
149
|
source?: string;
|
|
138
|
-
|
|
150
|
+
responsiveDisabled?: boolean;
|
|
151
|
+
configReady?: boolean;
|
|
152
|
+
previewReady?: boolean;
|
|
139
153
|
};
|
|
140
154
|
}[]>;
|
|
141
155
|
setStories: (value: Story[]) => void;
|
|
@@ -151,7 +165,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
151
165
|
slots?: () => Readonly<any>;
|
|
152
166
|
state?: any;
|
|
153
167
|
source?: string;
|
|
154
|
-
|
|
168
|
+
responsiveDisabled?: boolean;
|
|
169
|
+
configReady?: boolean;
|
|
170
|
+
previewReady?: boolean;
|
|
155
171
|
}[];
|
|
156
172
|
layout?: {
|
|
157
173
|
type: "single";
|
|
@@ -177,7 +193,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
177
193
|
slots?: () => Readonly<any>;
|
|
178
194
|
state?: any;
|
|
179
195
|
source?: string;
|
|
180
|
-
|
|
196
|
+
responsiveDisabled?: boolean;
|
|
197
|
+
configReady?: boolean;
|
|
198
|
+
previewReady?: boolean;
|
|
181
199
|
};
|
|
182
200
|
}>;
|
|
183
201
|
currentVariant: import("vue").ComputedRef<{
|
|
@@ -189,7 +207,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
189
207
|
slots?: () => Readonly<any>;
|
|
190
208
|
state?: any;
|
|
191
209
|
source?: string;
|
|
192
|
-
|
|
210
|
+
responsiveDisabled?: boolean;
|
|
211
|
+
configReady?: boolean;
|
|
212
|
+
previewReady?: boolean;
|
|
193
213
|
}>;
|
|
194
214
|
isFolderOpened: (path: Array<string>) => boolean;
|
|
195
215
|
toggleFolder: (path: Array<string>, force?: boolean) => void;
|
|
@@ -206,7 +226,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
206
226
|
slots?: () => Readonly<any>;
|
|
207
227
|
state?: any;
|
|
208
228
|
source?: string;
|
|
209
|
-
|
|
229
|
+
responsiveDisabled?: boolean;
|
|
230
|
+
configReady?: boolean;
|
|
231
|
+
previewReady?: boolean;
|
|
210
232
|
}[];
|
|
211
233
|
layout?: {
|
|
212
234
|
type: "single";
|
|
@@ -232,7 +254,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
232
254
|
slots?: () => Readonly<any>;
|
|
233
255
|
state?: any;
|
|
234
256
|
source?: string;
|
|
235
|
-
|
|
257
|
+
responsiveDisabled?: boolean;
|
|
258
|
+
configReady?: boolean;
|
|
259
|
+
previewReady?: boolean;
|
|
236
260
|
};
|
|
237
261
|
}[]>;
|
|
238
262
|
setStories: (value: Story[]) => void;
|
|
@@ -248,7 +272,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
248
272
|
slots?: () => Readonly<any>;
|
|
249
273
|
state?: any;
|
|
250
274
|
source?: string;
|
|
251
|
-
|
|
275
|
+
responsiveDisabled?: boolean;
|
|
276
|
+
configReady?: boolean;
|
|
277
|
+
previewReady?: boolean;
|
|
252
278
|
}[];
|
|
253
279
|
layout?: {
|
|
254
280
|
type: "single";
|
|
@@ -274,7 +300,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
274
300
|
slots?: () => Readonly<any>;
|
|
275
301
|
state?: any;
|
|
276
302
|
source?: string;
|
|
277
|
-
|
|
303
|
+
responsiveDisabled?: boolean;
|
|
304
|
+
configReady?: boolean;
|
|
305
|
+
previewReady?: boolean;
|
|
278
306
|
};
|
|
279
307
|
}>;
|
|
280
308
|
currentVariant: import("vue").ComputedRef<{
|
|
@@ -286,7 +314,9 @@ export declare const useStoryStore: import("pinia").StoreDefinition<"story", imp
|
|
|
286
314
|
slots?: () => Readonly<any>;
|
|
287
315
|
state?: any;
|
|
288
316
|
source?: string;
|
|
289
|
-
|
|
317
|
+
responsiveDisabled?: boolean;
|
|
318
|
+
configReady?: boolean;
|
|
319
|
+
previewReady?: boolean;
|
|
290
320
|
}>;
|
|
291
321
|
isFolderOpened: (path: Array<string>) => boolean;
|
|
292
322
|
toggleFolder: (path: Array<string>, force?: boolean) => void;
|
|
@@ -30,7 +30,9 @@ export interface Variant {
|
|
|
30
30
|
slots?: () => Readonly<any>;
|
|
31
31
|
state?: any;
|
|
32
32
|
source?: string;
|
|
33
|
-
|
|
33
|
+
responsiveDisabled?: boolean;
|
|
34
|
+
configReady?: boolean;
|
|
35
|
+
previewReady?: boolean;
|
|
34
36
|
}
|
|
35
37
|
export declare type TreeLeaf = {
|
|
36
38
|
title: string;
|
|
@@ -51,3 +53,10 @@ export interface SearchResult {
|
|
|
51
53
|
icon?: string;
|
|
52
54
|
iconColor?: string;
|
|
53
55
|
}
|
|
56
|
+
export interface PreviewSettings {
|
|
57
|
+
responsiveWidth: number;
|
|
58
|
+
responsiveHeight: number;
|
|
59
|
+
rotate: boolean;
|
|
60
|
+
backgroundColor: string;
|
|
61
|
+
checkerboard: boolean;
|
|
62
|
+
}
|
package/dist/client/app/types.ts
CHANGED
|
@@ -33,7 +33,9 @@ export interface Variant {
|
|
|
33
33
|
slots?: () => Readonly<any>
|
|
34
34
|
state?: any
|
|
35
35
|
source?: string
|
|
36
|
-
|
|
36
|
+
responsiveDisabled?: boolean
|
|
37
|
+
configReady?: boolean
|
|
38
|
+
previewReady?: boolean
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
export type TreeLeaf = {
|
|
@@ -58,3 +60,11 @@ export interface SearchResult {
|
|
|
58
60
|
icon?: string
|
|
59
61
|
iconColor?: string
|
|
60
62
|
}
|
|
63
|
+
|
|
64
|
+
export interface PreviewSettings {
|
|
65
|
+
responsiveWidth: number
|
|
66
|
+
responsiveHeight: number
|
|
67
|
+
rotate: boolean
|
|
68
|
+
backgroundColor: string
|
|
69
|
+
checkerboard: boolean
|
|
70
|
+
}
|
|
@@ -15,14 +15,15 @@ export function mapFile(file, existingFile) {
|
|
|
15
15
|
const variant = result.story.variants[index];
|
|
16
16
|
const existingVariant = existingFile.story.variants[index];
|
|
17
17
|
if (existingVariant) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
for (const key in existingVariant) {
|
|
19
|
+
if (typeof existingVariant[key] !== 'undefined') {
|
|
20
|
+
if (key === 'state') {
|
|
21
|
+
Object.assign(variant.state, existingVariant.state);
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
variant[key] = existingVariant[key];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
if (existingFile.story.lastSelectedVariant) {
|
|
@@ -37,6 +38,6 @@ export function mapVariant(variant) {
|
|
|
37
38
|
state: {},
|
|
38
39
|
initState: null,
|
|
39
40
|
slots: () => ({}),
|
|
40
|
-
|
|
41
|
+
previewReady: false,
|
|
41
42
|
};
|
|
42
43
|
}
|
|
@@ -18,10 +18,15 @@ export function mapFile (file: StoryFile, existingFile?: StoryFile): StoryFile {
|
|
|
18
18
|
const variant = result.story.variants[index]
|
|
19
19
|
const existingVariant = existingFile.story.variants[index]
|
|
20
20
|
if (existingVariant) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
for (const key in existingVariant) {
|
|
22
|
+
if (typeof existingVariant[key] !== 'undefined') {
|
|
23
|
+
if (key === 'state') {
|
|
24
|
+
Object.assign(variant.state, existingVariant.state)
|
|
25
|
+
continue
|
|
26
|
+
}
|
|
27
|
+
variant[key] = existingVariant[key]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
32
|
if (existingFile.story.lastSelectedVariant) {
|
|
@@ -38,6 +43,6 @@ export function mapVariant (variant: Variant): Variant {
|
|
|
38
43
|
state: {},
|
|
39
44
|
initState: null,
|
|
40
45
|
slots: () => ({}),
|
|
41
|
-
|
|
46
|
+
previewReady: false,
|
|
42
47
|
}
|
|
43
48
|
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
responsiveWidth: number;
|
|
3
|
-
responsiveHeight: number;
|
|
4
|
-
rotate: boolean;
|
|
5
|
-
backgroundColor: string;
|
|
6
|
-
checkerboard: boolean;
|
|
7
|
-
}
|
|
8
|
-
export declare function usePreviewSettings(): import("@vueuse/shared").RemovableRef<PreviewSettings>;
|
|
1
|
+
import type { PreviewSettings } from '../types';
|
|
9
2
|
export declare const receivedSettings: {
|
|
10
3
|
responsiveWidth: number;
|
|
11
4
|
responsiveHeight: number;
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import { useStorage } from '@vueuse/core';
|
|
2
1
|
import { reactive } from 'vue';
|
|
3
|
-
export function usePreviewSettings() {
|
|
4
|
-
return useStorage('_histoire-sandbox-settings-v1', {
|
|
5
|
-
responsiveWidth: 720,
|
|
6
|
-
responsiveHeight: null,
|
|
7
|
-
rotate: false,
|
|
8
|
-
backgroundColor: 'transparent',
|
|
9
|
-
checkerboard: false,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
2
|
export const receivedSettings = reactive({});
|
|
13
3
|
export function applyPreviewSettings(settings) {
|
|
14
4
|
Object.assign(receivedSettings, settings);
|
|
@@ -1,23 +1,5 @@
|
|
|
1
|
-
import { useStorage } from '@vueuse/core'
|
|
2
1
|
import { reactive } from 'vue'
|
|
3
|
-
|
|
4
|
-
export interface PreviewSettings {
|
|
5
|
-
responsiveWidth: number
|
|
6
|
-
responsiveHeight: number
|
|
7
|
-
rotate: boolean
|
|
8
|
-
backgroundColor: string
|
|
9
|
-
checkerboard: boolean
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function usePreviewSettings () {
|
|
13
|
-
return useStorage<PreviewSettings>('_histoire-sandbox-settings-v1', {
|
|
14
|
-
responsiveWidth: 720,
|
|
15
|
-
responsiveHeight: null,
|
|
16
|
-
rotate: false,
|
|
17
|
-
backgroundColor: 'transparent',
|
|
18
|
-
checkerboard: false,
|
|
19
|
-
})
|
|
20
|
-
}
|
|
2
|
+
import type { PreviewSettings } from '../types'
|
|
21
3
|
|
|
22
4
|
export const receivedSettings = reactive<PreviewSettings>({} as PreviewSettings)
|
|
23
5
|
|
package/dist/node/config.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export interface HistoireConfig {
|
|
|
66
66
|
dark?: string;
|
|
67
67
|
};
|
|
68
68
|
/**
|
|
69
|
-
* Href to the favicon file (**not** processed by Vite). Put the file in the public directory.
|
|
69
|
+
* Href to the favicon file (**not** processed by Vite). Put the file in the `public` directory.
|
|
70
70
|
*
|
|
71
71
|
* Example: `'/favicon.ico'`
|
|
72
72
|
*/
|
|
@@ -91,7 +91,7 @@ export interface HistoireConfig {
|
|
|
91
91
|
logoHref?: string;
|
|
92
92
|
};
|
|
93
93
|
/**
|
|
94
|
-
* Setup file
|
|
94
|
+
* Setup file exporting a default function executed when setting up each story preview.
|
|
95
95
|
*
|
|
96
96
|
* Import custom CSS files from this file.
|
|
97
97
|
*
|
package/dist/node/plugin.js
CHANGED
|
@@ -137,10 +137,10 @@ if (import.meta.hot) {
|
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
139
|
configureServer(server) {
|
|
140
|
-
server.middlewares.use((req, res, next) => {
|
|
140
|
+
server.middlewares.use(async (req, res, next) => {
|
|
141
141
|
if (req.url.startsWith('/__sandbox')) {
|
|
142
142
|
res.statusCode = 200;
|
|
143
|
-
|
|
143
|
+
let html = `
|
|
144
144
|
<!DOCTYPE html>
|
|
145
145
|
<html>
|
|
146
146
|
<head>
|
|
@@ -162,17 +162,21 @@ if (import.meta.hot) {
|
|
|
162
162
|
</script>
|
|
163
163
|
<script type="module" src="/@fs/${APP_PATH}/sandbox.js"></script>
|
|
164
164
|
</body>
|
|
165
|
-
</html
|
|
165
|
+
</html>`;
|
|
166
|
+
// Apply Vite HTML transforms. This injects the Vite HMR client, and
|
|
167
|
+
// also applies HTML transforms from Vite plugins
|
|
168
|
+
html = await server.transformIndexHtml(req.url, html);
|
|
169
|
+
res.end(html);
|
|
166
170
|
return;
|
|
167
171
|
}
|
|
168
172
|
next();
|
|
169
173
|
});
|
|
170
174
|
// serve our index.html after vite history fallback
|
|
171
175
|
return () => {
|
|
172
|
-
server.middlewares.use((req, res, next) => {
|
|
176
|
+
server.middlewares.use(async (req, res, next) => {
|
|
173
177
|
if (req.url.endsWith('.html')) {
|
|
174
178
|
res.statusCode = 200;
|
|
175
|
-
|
|
179
|
+
let html = `
|
|
176
180
|
<!DOCTYPE html>
|
|
177
181
|
<html>
|
|
178
182
|
<head>
|
|
@@ -187,7 +191,11 @@ if (import.meta.hot) {
|
|
|
187
191
|
<div id="app"></div>
|
|
188
192
|
<script type="module" src="/@fs/${APP_PATH}/index.js"></script>
|
|
189
193
|
</body>
|
|
190
|
-
</html
|
|
194
|
+
</html>`;
|
|
195
|
+
// Apply Vite HTML transforms. This injects the Vite HMR client, and
|
|
196
|
+
// also applies HTML transforms from Vite plugins
|
|
197
|
+
html = await server.transformIndexHtml(req.url, html);
|
|
198
|
+
res.end(html);
|
|
191
199
|
return;
|
|
192
200
|
}
|
|
193
201
|
next();
|
package/dist/node/tree.js
CHANGED
|
@@ -20,17 +20,37 @@ export function makeTree(config, files) {
|
|
|
20
20
|
sortingFunction = config.tree.order;
|
|
21
21
|
}
|
|
22
22
|
return buildTree(treeObject);
|
|
23
|
-
// Undefined behavior for folder and file that share the same name under the same directory
|
|
24
23
|
function setPath(path, value, tree) {
|
|
25
24
|
path.reduce((subtree, key, i) => {
|
|
26
|
-
if (
|
|
25
|
+
if (i === path.length - 1) {
|
|
26
|
+
setKey(subtree, key, value);
|
|
27
|
+
}
|
|
28
|
+
else if (isLeaf(subtree[key])) {
|
|
29
|
+
setKey(subtree, key, subtree[key]);
|
|
27
30
|
subtree[key] = {};
|
|
28
31
|
}
|
|
29
|
-
if (
|
|
30
|
-
subtree[key] =
|
|
32
|
+
else if (!subtree[key]) {
|
|
33
|
+
subtree[key] = {};
|
|
31
34
|
}
|
|
32
35
|
return subtree[key];
|
|
33
36
|
}, tree);
|
|
37
|
+
function isLeaf(element) {
|
|
38
|
+
return !isNaN(element);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
function setKey(tree, key, value) {
|
|
42
|
+
if (isUndefined(tree[key])) {
|
|
43
|
+
tree[key] = value;
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
let copyNumber = 1;
|
|
47
|
+
while (!isUndefined(tree[`${key}-${copyNumber}`])) {
|
|
48
|
+
copyNumber++;
|
|
49
|
+
}
|
|
50
|
+
tree[`${key}-${copyNumber}`] = value;
|
|
51
|
+
function isUndefined(element) {
|
|
52
|
+
return element === undefined;
|
|
53
|
+
}
|
|
34
54
|
}
|
|
35
55
|
function buildTree(treeObject) {
|
|
36
56
|
const tree = [];
|
package/dist/style.css
CHANGED
|
@@ -880,6 +880,11 @@ button {
|
|
|
880
880
|
margin:1rem
|
|
881
881
|
}
|
|
882
882
|
|
|
883
|
+
.htw-my-0{
|
|
884
|
+
margin-top:0px;
|
|
885
|
+
margin-bottom:0px
|
|
886
|
+
}
|
|
887
|
+
|
|
883
888
|
.-htw-my-1{
|
|
884
889
|
margin-top:-0.25rem;
|
|
885
890
|
margin-bottom:-0.25rem
|
|
@@ -977,6 +982,12 @@ button {
|
|
|
977
982
|
height:1rem
|
|
978
983
|
}
|
|
979
984
|
|
|
985
|
+
.htw-h-fit{
|
|
986
|
+
height:-webkit-fit-content;
|
|
987
|
+
height:-moz-fit-content;
|
|
988
|
+
height:fit-content
|
|
989
|
+
}
|
|
990
|
+
|
|
980
991
|
.htw-h-2{
|
|
981
992
|
height:0.5rem
|
|
982
993
|
}
|
|
@@ -989,6 +1000,10 @@ button {
|
|
|
989
1000
|
height:2.5rem
|
|
990
1001
|
}
|
|
991
1002
|
|
|
1003
|
+
.htw-h-\[100px\]{
|
|
1004
|
+
height:100px
|
|
1005
|
+
}
|
|
1006
|
+
|
|
992
1007
|
.htw-max-h-full{
|
|
993
1008
|
max-height:100%
|
|
994
1009
|
}
|
|
@@ -1033,6 +1048,12 @@ button {
|
|
|
1033
1048
|
width:1rem
|
|
1034
1049
|
}
|
|
1035
1050
|
|
|
1051
|
+
.htw-w-fit{
|
|
1052
|
+
width:-webkit-fit-content;
|
|
1053
|
+
width:-moz-fit-content;
|
|
1054
|
+
width:fit-content
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1036
1057
|
.htw-w-px{
|
|
1037
1058
|
width:1px
|
|
1038
1059
|
}
|
|
@@ -1055,6 +1076,10 @@ button {
|
|
|
1055
1076
|
width:7rem
|
|
1056
1077
|
}
|
|
1057
1078
|
|
|
1079
|
+
.htw-w-16{
|
|
1080
|
+
width:4rem
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1058
1083
|
.htw-min-w-0{
|
|
1059
1084
|
min-width:0px
|
|
1060
1085
|
}
|
|
@@ -1135,6 +1160,10 @@ button {
|
|
|
1135
1160
|
resize:vertical
|
|
1136
1161
|
}
|
|
1137
1162
|
|
|
1163
|
+
.htw-grid-cols-\[repeat\(auto-fill\,minmax\(100px\,1fr\)\)\]{
|
|
1164
|
+
grid-template-columns:repeat(auto-fill,minmax(100px,1fr))
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1138
1167
|
.htw-flex-col{
|
|
1139
1168
|
flex-direction:column
|
|
1140
1169
|
}
|
|
@@ -1147,6 +1176,10 @@ button {
|
|
|
1147
1176
|
place-content:space-between
|
|
1148
1177
|
}
|
|
1149
1178
|
|
|
1179
|
+
.htw-items-end{
|
|
1180
|
+
align-items:flex-end
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1150
1183
|
.htw-items-center{
|
|
1151
1184
|
align-items:center
|
|
1152
1185
|
}
|
|
@@ -1159,14 +1192,14 @@ button {
|
|
|
1159
1192
|
justify-content:center
|
|
1160
1193
|
}
|
|
1161
1194
|
|
|
1162
|
-
.htw-gap-2{
|
|
1163
|
-
gap:0.5rem
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
1195
|
.htw-gap-1{
|
|
1167
1196
|
gap:0.25rem
|
|
1168
1197
|
}
|
|
1169
1198
|
|
|
1199
|
+
.htw-gap-2{
|
|
1200
|
+
gap:0.5rem
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1170
1203
|
.htw-gap-4{
|
|
1171
1204
|
gap:1rem
|
|
1172
1205
|
}
|
|
@@ -1269,6 +1302,10 @@ button {
|
|
|
1269
1302
|
border-width:8px
|
|
1270
1303
|
}
|
|
1271
1304
|
|
|
1305
|
+
.htw-border-2{
|
|
1306
|
+
border-width:2px
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1272
1309
|
.htw-border-b-2{
|
|
1273
1310
|
border-bottom-width:2px
|
|
1274
1311
|
}
|
|
@@ -1330,6 +1367,10 @@ button {
|
|
|
1330
1367
|
border-color:rgb(var(--_histoire-color-primary-200) / var(--tw-border-opacity))
|
|
1331
1368
|
}
|
|
1332
1369
|
|
|
1370
|
+
.htw-border-black\/50{
|
|
1371
|
+
border-color:rgb(0 0 0 / 0.5)
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1333
1374
|
.htw-border-black\/20{
|
|
1334
1375
|
border-color:rgb(0 0 0 / 0.2)
|
|
1335
1376
|
}
|
|
@@ -1525,6 +1566,11 @@ button {
|
|
|
1525
1566
|
line-height:1.75rem
|
|
1526
1567
|
}
|
|
1527
1568
|
|
|
1569
|
+
.htw-text-5xl{
|
|
1570
|
+
font-size:3rem;
|
|
1571
|
+
line-height:1
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1528
1574
|
.htw-text-white\/40{
|
|
1529
1575
|
color:rgb(255 255 255 / 0.4)
|
|
1530
1576
|
}
|
|
@@ -1672,6 +1718,10 @@ body,
|
|
|
1672
1718
|
font-family: 'Lato', sans-serif;
|
|
1673
1719
|
}
|
|
1674
1720
|
|
|
1721
|
+
html {
|
|
1722
|
+
font-size: 16px;
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1675
1725
|
body {
|
|
1676
1726
|
font-size: 18px;
|
|
1677
1727
|
}
|
|
@@ -1728,6 +1778,10 @@ body {
|
|
|
1728
1778
|
color:rgb(var(--_histoire-color-primary-500) / var(--tw-text-opacity))
|
|
1729
1779
|
}
|
|
1730
1780
|
|
|
1781
|
+
.hover\:htw-opacity-100:hover{
|
|
1782
|
+
opacity:1
|
|
1783
|
+
}
|
|
1784
|
+
|
|
1731
1785
|
.focus\:htw-border-primary-500:focus{
|
|
1732
1786
|
--tw-border-opacity:1;
|
|
1733
1787
|
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
|
@@ -1742,10 +1796,18 @@ body {
|
|
|
1742
1796
|
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
|
1743
1797
|
}
|
|
1744
1798
|
|
|
1799
|
+
.htw-group:hover .group-hover\:htw-block{
|
|
1800
|
+
display:block
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1745
1803
|
.htw-group:hover .group-hover\:htw-opacity-90{
|
|
1746
1804
|
opacity:0.9
|
|
1747
1805
|
}
|
|
1748
1806
|
|
|
1807
|
+
.htw-group:hover .group-hover\:htw-opacity-100{
|
|
1808
|
+
opacity:1
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1749
1811
|
.htw-group:active .group-active\:htw-bg-gray-500\/20{
|
|
1750
1812
|
background-color:rgb(var(--_histoire-color-gray-500) / 0.2)
|
|
1751
1813
|
}
|
|
@@ -1807,6 +1869,10 @@ body {
|
|
|
1807
1869
|
border-color:rgb(var(--_histoire-color-primary-900) / var(--tw-border-opacity))
|
|
1808
1870
|
}
|
|
1809
1871
|
|
|
1872
|
+
.htw-dark .dark\:htw-border-white\/50{
|
|
1873
|
+
border-color:rgb(255 255 255 / 0.5)
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1810
1876
|
.htw-dark .dark\:htw-border-white\/20{
|
|
1811
1877
|
border-color:rgb(255 255 255 / 0.2)
|
|
1812
1878
|
}
|