histoire 0.1.5 → 0.2.2
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/codegen/vue3.js +1 -0
- package/dist/client/app/codegen/vue3.js.map +1 -0
- package/dist/client/app/components/app/AppHeader.vue +2 -1
- package/dist/client/app/components/base/BaseCheckbox.vue +76 -0
- package/dist/client/app/components/exposed/Story.vue +20 -14
- 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/search/SearchItem.vue +4 -1
- package/dist/client/app/components/search/SearchModal.vue +4 -4
- package/dist/client/app/components/story/StoryControls.vue +1 -1
- package/dist/client/app/components/story/StoryDocs.vue +1 -0
- package/dist/client/app/components/story/StoryListFolder.vue +1 -1
- package/dist/client/app/components/story/StoryListItem.vue +4 -1
- package/dist/client/app/components/story/StoryResponsivePreview.vue +3 -4
- package/dist/client/app/components/story/StorySidePanel.vue +1 -0
- package/dist/client/app/components/story/StorySourceCode.vue +4 -1
- package/dist/client/app/components/story/StoryVariantGrid.vue +112 -0
- package/dist/client/app/components/story/StoryVariantGridItem.vue +34 -4
- package/dist/client/app/components/story/StoryVariantListItem.vue +4 -1
- package/dist/client/app/components/story/StoryVariantSingleView.vue +20 -160
- package/dist/client/app/components/story/StoryViewer.vue +6 -25
- package/dist/client/app/components/story/variant/StoryVariantBackground.vue +67 -0
- package/dist/client/app/components/story/variant/StoryVariantNewTab.vue +29 -0
- package/dist/client/app/components/story/variant/StoryVariantResponsiveSize.vue +82 -0
- package/dist/client/app/components/story/variant/StoryVariantTitle.vue +21 -0
- package/dist/client/app/global-components.js +1 -0
- package/dist/client/app/global-components.js.map +1 -0
- package/dist/client/app/index.js +1 -0
- package/dist/client/app/index.js.map +1 -0
- package/dist/client/app/sandbox.js +1 -0
- package/dist/client/app/sandbox.js.map +1 -0
- package/dist/client/app/stores/story.d.ts +6 -6
- package/dist/client/app/stores/story.js +1 -0
- package/dist/client/app/stores/story.js.map +1 -0
- package/dist/client/app/style/main.pcss +9 -5
- package/dist/client/app/types.d.ts +1 -1
- package/dist/client/app/types.ts +1 -1
- package/dist/client/app/util/keyboard.js +1 -0
- package/dist/client/app/util/keyboard.js.map +1 -0
- package/dist/client/app/util/mapping.js +1 -0
- package/dist/client/app/util/mapping.js.map +1 -0
- package/dist/client/app/util/preview-settings.js +1 -0
- package/dist/client/app/util/preview-settings.js.map +1 -0
- package/dist/client/app/util/reactivity.js +1 -0
- package/dist/client/app/util/reactivity.js.map +1 -0
- package/dist/client/app/util/scroll.d.ts +3 -1
- package/dist/client/app/util/scroll.js +4 -0
- package/dist/client/app/util/scroll.js.map +1 -0
- package/dist/client/app/util/scroll.ts +4 -0
- package/dist/client/app/util/variant.js +1 -0
- package/dist/client/app/util/variant.js.map +1 -0
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/server/index.js +1 -0
- package/dist/client/server/index.js.map +1 -0
- package/dist/controls.js +1 -0
- package/dist/controls.js.map +1 -0
- package/dist/node/bin.js +7 -0
- package/dist/node/build.js +1 -1
- package/dist/node/{collect.d.ts → collect/index.d.ts} +2 -2
- package/dist/node/{collect.js → collect/index.js} +37 -27
- package/dist/node/collect/worker.d.ts +14 -0
- package/dist/node/collect/worker.js +36 -0
- package/dist/node/commands/preview.d.ts +4 -0
- package/dist/node/commands/preview.js +36 -0
- package/dist/node/config.d.ts +2 -2
- package/dist/node/server.js +1 -1
- package/dist/node/tree.js +24 -4
- package/dist/node/types.d.ts +1 -1
- package/dist/style.css +98 -50
- package/package.json +10 -6
- package/src/client/app/components/app/AppHeader.vue +2 -1
- package/src/client/app/components/base/BaseCheckbox.vue +76 -0
- package/src/client/app/components/exposed/Story.vue +20 -14
- package/src/client/app/components/sandbox/lib.ts +8 -0
- package/src/client/app/components/search/SearchItem.vue +4 -1
- package/src/client/app/components/search/SearchModal.vue +4 -4
- package/src/client/app/components/story/StoryControls.vue +1 -1
- package/src/client/app/components/story/StoryDocs.vue +1 -0
- package/src/client/app/components/story/StoryListFolder.vue +1 -1
- package/src/client/app/components/story/StoryListItem.vue +4 -1
- package/src/client/app/components/story/StoryResponsivePreview.vue +3 -4
- package/src/client/app/components/story/StorySidePanel.vue +1 -0
- package/src/client/app/components/story/StorySourceCode.vue +4 -1
- package/src/client/app/components/story/StoryVariantGrid.vue +112 -0
- package/src/client/app/components/story/StoryVariantGridItem.vue +34 -4
- package/src/client/app/components/story/StoryVariantListItem.vue +4 -1
- package/src/client/app/components/story/StoryVariantSingleView.vue +20 -160
- package/src/client/app/components/story/StoryViewer.vue +6 -25
- package/src/client/app/components/story/variant/StoryVariantBackground.vue +67 -0
- package/src/client/app/components/story/variant/StoryVariantNewTab.vue +29 -0
- package/src/client/app/components/story/variant/StoryVariantResponsiveSize.vue +82 -0
- package/src/client/app/components/story/variant/StoryVariantTitle.vue +21 -0
- package/src/client/app/style/main.pcss +9 -5
- package/src/client/app/types.ts +1 -1
- package/src/client/app/util/scroll.ts +4 -0
- package/src/node/bin.ts +8 -0
- package/src/node/build.ts +1 -1
- package/src/node/{collect.ts → collect/index.ts} +48 -30
- package/src/node/collect/worker.ts +61 -0
- package/src/node/commands/preview.ts +50 -0
- package/src/node/config.ts +2 -2
- package/src/node/server.ts +1 -1
- package/src/node/tree.spec.ts +61 -0
- package/src/node/tree.ts +29 -5
- package/src/node/types.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll.js","sourceRoot":"","sources":["../../../../src/client/app/util/scroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAO,MAAM,KAAK,CAAA;AAC3C,OAAO,cAAc,MAAM,4BAA4B,CAAA;AAEvD,MAAM,UAAU,iBAAiB,CAAE,MAAoB,EAAE,EAAoB;IAC3E,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;QACpB,IAAI,KAAK,EAAE;YACT,UAAU,EAAE,CAAA;SACb;IACH,CAAC,CAAC,CAAA;IAEF,SAAS,UAAU;QACjB,IAAI,EAAE,CAAC,KAAK,EAAE;YACZ,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE;gBACvB,UAAU,EAAE,WAAW;gBACvB,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,SAAS;gBACjB,QAAQ,EAAE,QAAQ;aACnB,CAAC,CAAA;SACH;IACH,CAAC;IAED,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,MAAM,CAAC,KAAK,EAAE;YAChB,UAAU,EAAE,CAAA;SACb;IACH,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,UAAU;KACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant.js","sourceRoot":"","sources":["../../../../src/client/app/util/variant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAO,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrC,MAAM,UAAU,sBAAsB,CAAE,OAAqB;IAC3D,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAA;IACxB,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS,KAAK,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IAC3E,MAAM,WAAW,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;QAClC,GAAG,KAAK;QACR,KAAK,EAAE;YACL,GAAG,KAAK,CAAC,KAAK;YACd,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE;SAC5B;KACF,CAAC,CAAC,CAAA;IAEH,OAAO;QACL,QAAQ;QACR,WAAW;KACZ,CAAA;AACH,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,oBAAoB,CAAE,OAA8B;IAClE,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,OAAO,KAAK,MAAM,oBAAoB,CAAA;AACtC,OAAO,OAAO,MAAM,sBAAsB,CAAA;AAE1C,MAAM,CAAC,KAAK,UAAU,GAAG,CAAE,IAAe,EAAE,SAAS,EAAE,EAAE;IACvD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACrD,MAAM,GAAG,GAAG,SAAS,CAAC;QACpB,OAAO,EAAE;YACP,QAAQ,CAAE,IAAI;gBACZ,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACtB,CAAC;SACF;QACD,MAAM;YACJ,OAAO,CAAC,CAAC,IAAI,EAAE;gBACb,GAAG,EAAE,MAAM;gBACX,IAAI,EAAE,IAAI;aACX,CAAC,CAAA;QACJ,CAAC;KACF,CAAC,CAAA;IAEF,0DAA0D;IAC1D,GAAG,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IAC7B,0DAA0D;IAC1D,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAEjC,qBAAqB,CAAC,GAAG,CAAC,CAAA;IAE1B,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;IACb,GAAG,CAAC,OAAO,EAAE,CAAA;AACf,CAAC"}
|
package/dist/controls.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controls.js","sourceRoot":"","sources":["../src/controls.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA"}
|
package/dist/node/bin.js
CHANGED
|
@@ -19,4 +19,11 @@ program.command('build')
|
|
|
19
19
|
const { buildCommand } = await import('./commands/build.js');
|
|
20
20
|
return buildCommand();
|
|
21
21
|
});
|
|
22
|
+
program.command('preview')
|
|
23
|
+
.describe('preview the built directory')
|
|
24
|
+
.option('-p, --port <port>', 'Listening port of the server')
|
|
25
|
+
.action(async (options) => {
|
|
26
|
+
const { previewCommand } = await import('./commands/preview.js');
|
|
27
|
+
return previewCommand(options);
|
|
28
|
+
});
|
|
22
29
|
program.parse(process.argv);
|
package/dist/node/build.js
CHANGED
|
@@ -7,7 +7,7 @@ import { performance } from 'perf_hooks';
|
|
|
7
7
|
import { APP_PATH } from './alias.js';
|
|
8
8
|
import { createVitePlugins } from './plugin.js';
|
|
9
9
|
import { findAllStories } from './stories.js';
|
|
10
|
-
import { useCollectStories } from './collect.js';
|
|
10
|
+
import { useCollectStories } from './collect/index.js';
|
|
11
11
|
const PRELOAD_MODULES = [
|
|
12
12
|
'vendor',
|
|
13
13
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ViteDevServer } from 'vite';
|
|
2
|
-
import type { StoryFile } from '
|
|
3
|
-
import type { Context } from '
|
|
2
|
+
import type { StoryFile } from '../types.js';
|
|
3
|
+
import type { Context } from '../context.js';
|
|
4
4
|
export interface UseCollectStoriesOptions {
|
|
5
5
|
server: ViteDevServer;
|
|
6
6
|
throws?: boolean;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MessageChannel } from 'worker_threads';
|
|
2
2
|
import { ViteNodeServer } from 'vite-node/server';
|
|
3
|
-
import {
|
|
4
|
-
import { dirname, resolve, relative } from 'pathe';
|
|
3
|
+
import { relative } from 'pathe';
|
|
5
4
|
import pc from 'picocolors';
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
|
|
5
|
+
import Tinypool from 'tinypool';
|
|
6
|
+
import { createBirpc } from 'birpc';
|
|
7
|
+
import { createPath } from '../tree.js';
|
|
9
8
|
export function useCollectStories(options, ctx) {
|
|
10
9
|
const { server } = options;
|
|
11
|
-
const { destroy: destroyDomEnv } = createDomEnv();
|
|
12
10
|
const node = new ViteNodeServer(server, {
|
|
13
11
|
deps: {
|
|
14
12
|
inline: [
|
|
@@ -16,31 +14,43 @@ export function useCollectStories(options, ctx) {
|
|
|
16
14
|
],
|
|
17
15
|
},
|
|
18
16
|
});
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// Alias
|
|
24
|
-
if (id.endsWith('vue.runtime.esm-bundler.js')) {
|
|
25
|
-
id = 'vue';
|
|
26
|
-
}
|
|
27
|
-
return node.fetchModule(id);
|
|
28
|
-
},
|
|
29
|
-
resolveId(id, importer) {
|
|
30
|
-
return node.resolveId(id, importer);
|
|
31
|
-
},
|
|
17
|
+
const threadPool = new Tinypool({
|
|
18
|
+
filename: new URL('./worker.js', import.meta.url).href,
|
|
19
|
+
// WebContainer compatibility (Stackblitz)
|
|
20
|
+
useAtomics: false,
|
|
32
21
|
});
|
|
33
22
|
function clearCache() {
|
|
34
23
|
node.fetchCache.clear();
|
|
35
|
-
|
|
24
|
+
}
|
|
25
|
+
function createChannel() {
|
|
26
|
+
const channel = new MessageChannel();
|
|
27
|
+
const port = channel.port2;
|
|
28
|
+
const workerPort = channel.port1;
|
|
29
|
+
createBirpc({
|
|
30
|
+
fetchModule: (id) => node.fetchModule(id),
|
|
31
|
+
resolveId: (id, importer) => node.resolveId(id, importer),
|
|
32
|
+
}, {
|
|
33
|
+
post: data => port.postMessage(data),
|
|
34
|
+
on: data => port.on('message', data),
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
port,
|
|
38
|
+
workerPort,
|
|
39
|
+
};
|
|
36
40
|
}
|
|
37
41
|
async function executeStoryFile(storyFile) {
|
|
38
42
|
try {
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
const { workerPort } = createChannel();
|
|
44
|
+
const { storyData } = await threadPool.run({
|
|
45
|
+
root: server.config.root,
|
|
46
|
+
base: server.config.base,
|
|
47
|
+
storyFile,
|
|
48
|
+
port: workerPort,
|
|
49
|
+
}, {
|
|
50
|
+
transferList: [
|
|
51
|
+
workerPort,
|
|
52
|
+
],
|
|
53
|
+
});
|
|
44
54
|
if (storyData.length === 0) {
|
|
45
55
|
console.warn(pc.yellow(`⚠️ No story found for ${storyFile.path}`));
|
|
46
56
|
return;
|
|
@@ -64,7 +74,7 @@ export function useCollectStories(options, ctx) {
|
|
|
64
74
|
}
|
|
65
75
|
}
|
|
66
76
|
async function destroy() {
|
|
67
|
-
|
|
77
|
+
await threadPool.destroy();
|
|
68
78
|
}
|
|
69
79
|
return {
|
|
70
80
|
clearCache,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { MessagePort } from 'worker_threads';
|
|
3
|
+
import type { StoryFile, Story } from '../types.js';
|
|
4
|
+
export interface Payload {
|
|
5
|
+
root: string;
|
|
6
|
+
base: string;
|
|
7
|
+
port: MessagePort;
|
|
8
|
+
storyFile: StoryFile;
|
|
9
|
+
}
|
|
10
|
+
export interface ReturnData {
|
|
11
|
+
storyData: Story[];
|
|
12
|
+
}
|
|
13
|
+
declare const _default: (payload: Payload) => Promise<ReturnData>;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { fileURLToPath } from 'url';
|
|
2
|
+
import { ViteNodeRunner } from 'vite-node/client';
|
|
3
|
+
import { createBirpc } from 'birpc';
|
|
4
|
+
import { dirname, resolve } from 'pathe';
|
|
5
|
+
import { createDomEnv } from '../dom/env.js';
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
export default async (payload) => {
|
|
8
|
+
const rpc = createBirpc({}, {
|
|
9
|
+
post: data => payload.port.postMessage(data),
|
|
10
|
+
on: data => payload.port.on('message', data),
|
|
11
|
+
});
|
|
12
|
+
const runner = new ViteNodeRunner({
|
|
13
|
+
root: payload.root,
|
|
14
|
+
base: payload.base,
|
|
15
|
+
fetchModule(id) {
|
|
16
|
+
// Alias
|
|
17
|
+
if (id.endsWith('vue.runtime.esm-bundler.js')) {
|
|
18
|
+
id = 'vue';
|
|
19
|
+
}
|
|
20
|
+
return rpc.fetchModule(id);
|
|
21
|
+
},
|
|
22
|
+
resolveId(id, importer) {
|
|
23
|
+
return rpc.resolveId(id, importer);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const { destroy: destroyDomEnv } = createDomEnv();
|
|
27
|
+
const el = window.document.createElement('div');
|
|
28
|
+
// Mount app to collect stories/variants
|
|
29
|
+
const { run } = await runner.executeFile(resolve(__dirname, '../../client/server/index.js'));
|
|
30
|
+
const storyData = [];
|
|
31
|
+
await run(payload.storyFile, storyData, el);
|
|
32
|
+
destroyDomEnv();
|
|
33
|
+
return {
|
|
34
|
+
storyData,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import http from 'http';
|
|
2
|
+
import { resolveConfig as resolveViteConfig } from 'vite';
|
|
3
|
+
import connect from 'connect';
|
|
4
|
+
import sirv from 'sirv';
|
|
5
|
+
import pc from 'picocolors';
|
|
6
|
+
import { createContext } from '../context.js';
|
|
7
|
+
import { createVitePlugins } from '../plugin.js';
|
|
8
|
+
export async function previewCommand(options) {
|
|
9
|
+
const ctx = await createContext({
|
|
10
|
+
mode: 'build',
|
|
11
|
+
});
|
|
12
|
+
const viteConfig = await resolveViteConfig({
|
|
13
|
+
plugins: await createVitePlugins(ctx),
|
|
14
|
+
}, 'build');
|
|
15
|
+
const app = connect();
|
|
16
|
+
app.use(viteConfig.base, sirv(ctx.config.outDir, {
|
|
17
|
+
dev: true,
|
|
18
|
+
etag: true,
|
|
19
|
+
single: true,
|
|
20
|
+
}));
|
|
21
|
+
let port = options.port ?? 3000;
|
|
22
|
+
const httpServer = http.createServer(app);
|
|
23
|
+
function onError(e) {
|
|
24
|
+
if (e.code === 'EADDRINUSE') {
|
|
25
|
+
httpServer.listen(++port);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
throw e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
httpServer.on('error', onError);
|
|
32
|
+
httpServer.listen(port, () => {
|
|
33
|
+
httpServer.off('error', onError);
|
|
34
|
+
console.log(`Preview server listening on ${pc.cyan(`http://localhost:${port}`)}`);
|
|
35
|
+
});
|
|
36
|
+
}
|
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/server.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createServer as createViteServer } from 'vite';
|
|
2
2
|
import { createVitePlugins, RESOLVED_STORIES_ID } from './plugin.js';
|
|
3
3
|
import { notifyStoryChange, onStoryChange, watchStories } from './stories.js';
|
|
4
|
-
import { useCollectStories } from './collect.js';
|
|
4
|
+
import { useCollectStories } from './collect/index.js';
|
|
5
5
|
export async function createServer(ctx, port) {
|
|
6
6
|
await watchStories(ctx);
|
|
7
7
|
const server = await createViteServer({
|
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/node/types.d.ts
CHANGED
package/dist/style.css
CHANGED
|
@@ -880,6 +880,11 @@ button {
|
|
|
880
880
|
margin:1rem
|
|
881
881
|
}
|
|
882
882
|
|
|
883
|
+
.-htw-my-1{
|
|
884
|
+
margin-top:-0.25rem;
|
|
885
|
+
margin-bottom:-0.25rem
|
|
886
|
+
}
|
|
887
|
+
|
|
883
888
|
.htw-mt-2{
|
|
884
889
|
margin-top:0.5rem
|
|
885
890
|
}
|
|
@@ -960,6 +965,10 @@ button {
|
|
|
960
965
|
height:2rem
|
|
961
966
|
}
|
|
962
967
|
|
|
968
|
+
.htw-h-\[16px\]{
|
|
969
|
+
height:16px
|
|
970
|
+
}
|
|
971
|
+
|
|
963
972
|
.htw-h-\[2px\]{
|
|
964
973
|
height:2px
|
|
965
974
|
}
|
|
@@ -980,10 +989,6 @@ button {
|
|
|
980
989
|
height:2.5rem
|
|
981
990
|
}
|
|
982
991
|
|
|
983
|
-
.htw-h-\[16px\]{
|
|
984
|
-
height:16px
|
|
985
|
-
}
|
|
986
|
-
|
|
987
992
|
.htw-max-h-full{
|
|
988
993
|
max-height:100%
|
|
989
994
|
}
|
|
@@ -992,6 +997,10 @@ button {
|
|
|
992
997
|
max-height:400px
|
|
993
998
|
}
|
|
994
999
|
|
|
1000
|
+
.htw-min-h-\[26px\]{
|
|
1001
|
+
min-height:26px
|
|
1002
|
+
}
|
|
1003
|
+
|
|
995
1004
|
.htw-w-64{
|
|
996
1005
|
width:16rem
|
|
997
1006
|
}
|
|
@@ -1016,6 +1025,10 @@ button {
|
|
|
1016
1025
|
width:2rem
|
|
1017
1026
|
}
|
|
1018
1027
|
|
|
1028
|
+
.htw-w-\[16px\]{
|
|
1029
|
+
width:16px
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1019
1032
|
.htw-w-4{
|
|
1020
1033
|
width:1rem
|
|
1021
1034
|
}
|
|
@@ -1038,8 +1051,8 @@ button {
|
|
|
1038
1051
|
width:5rem
|
|
1039
1052
|
}
|
|
1040
1053
|
|
|
1041
|
-
.htw-w
|
|
1042
|
-
width:
|
|
1054
|
+
.htw-w-28{
|
|
1055
|
+
width:7rem
|
|
1043
1056
|
}
|
|
1044
1057
|
|
|
1045
1058
|
.htw-min-w-0{
|
|
@@ -1118,6 +1131,10 @@ button {
|
|
|
1118
1131
|
resize:none
|
|
1119
1132
|
}
|
|
1120
1133
|
|
|
1134
|
+
.htw-resize-y{
|
|
1135
|
+
resize:vertical
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1121
1138
|
.htw-flex-col{
|
|
1122
1139
|
flex-direction:column
|
|
1123
1140
|
}
|
|
@@ -1210,6 +1227,14 @@ button {
|
|
|
1210
1227
|
white-space:nowrap
|
|
1211
1228
|
}
|
|
1212
1229
|
|
|
1230
|
+
.htw-text-ellipsis{
|
|
1231
|
+
text-overflow:ellipsis
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
.htw-whitespace-nowrap{
|
|
1235
|
+
white-space:nowrap
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1213
1238
|
.htw-rounded-sm{
|
|
1214
1239
|
border-radius:0.25rem
|
|
1215
1240
|
}
|
|
@@ -1264,6 +1289,10 @@ button {
|
|
|
1264
1289
|
border-left-width:2px
|
|
1265
1290
|
}
|
|
1266
1291
|
|
|
1292
|
+
.htw-border-solid{
|
|
1293
|
+
border-style:solid
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1267
1296
|
.htw-border-gray-600{
|
|
1268
1297
|
--tw-border-opacity:1;
|
|
1269
1298
|
border-color:rgb(var(--_histoire-color-gray-600) / var(--tw-border-opacity))
|
|
@@ -1274,6 +1303,15 @@ button {
|
|
|
1274
1303
|
border-color:rgb(var(--_histoire-color-gray-100) / var(--tw-border-opacity))
|
|
1275
1304
|
}
|
|
1276
1305
|
|
|
1306
|
+
.htw-border-primary-500{
|
|
1307
|
+
--tw-border-opacity:1;
|
|
1308
|
+
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
.htw-border-black\/25{
|
|
1312
|
+
border-color:rgb(0 0 0 / 0.25)
|
|
1313
|
+
}
|
|
1314
|
+
|
|
1277
1315
|
.htw-border-gray-200{
|
|
1278
1316
|
--tw-border-opacity:1;
|
|
1279
1317
|
border-color:rgb(var(--_histoire-color-gray-200) / var(--tw-border-opacity))
|
|
@@ -1292,18 +1330,12 @@ button {
|
|
|
1292
1330
|
border-color:rgb(var(--_histoire-color-primary-200) / var(--tw-border-opacity))
|
|
1293
1331
|
}
|
|
1294
1332
|
|
|
1295
|
-
.htw-border-black\/
|
|
1296
|
-
border-color:rgb(0 0 0 / 0.
|
|
1297
|
-
}
|
|
1298
|
-
|
|
1299
|
-
.htw-border-primary-500{
|
|
1300
|
-
--tw-border-opacity:1;
|
|
1301
|
-
border-color:rgb(var(--_histoire-color-primary-500) / var(--tw-border-opacity))
|
|
1333
|
+
.htw-border-black\/50{
|
|
1334
|
+
border-color:rgb(0 0 0 / 0.5)
|
|
1302
1335
|
}
|
|
1303
1336
|
|
|
1304
|
-
.htw-border-
|
|
1305
|
-
|
|
1306
|
-
border-color:rgb(var(--_histoire-color-gray-300) / var(--tw-border-opacity))
|
|
1337
|
+
.htw-border-black\/20{
|
|
1338
|
+
border-color:rgb(0 0 0 / 0.2)
|
|
1307
1339
|
}
|
|
1308
1340
|
|
|
1309
1341
|
.htw-bg-white{
|
|
@@ -1437,6 +1469,11 @@ button {
|
|
|
1437
1469
|
padding-bottom:0px
|
|
1438
1470
|
}
|
|
1439
1471
|
|
|
1472
|
+
.htw-py-1{
|
|
1473
|
+
padding-top:0.25rem;
|
|
1474
|
+
padding-bottom:0.25rem
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1440
1477
|
.htw-pr-2{
|
|
1441
1478
|
padding-right:0.5rem
|
|
1442
1479
|
}
|
|
@@ -1461,6 +1498,10 @@ button {
|
|
|
1461
1498
|
padding-left:1.25rem
|
|
1462
1499
|
}
|
|
1463
1500
|
|
|
1501
|
+
.htw-pl-2{
|
|
1502
|
+
padding-left:0.5rem
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1464
1505
|
.htw-text-left{
|
|
1465
1506
|
text-align:left
|
|
1466
1507
|
}
|
|
@@ -1502,14 +1543,14 @@ button {
|
|
|
1502
1543
|
color:rgb(var(--_histoire-color-gray-500) / var(--tw-text-opacity))
|
|
1503
1544
|
}
|
|
1504
1545
|
|
|
1505
|
-
.htw-text-
|
|
1546
|
+
.htw-text-white{
|
|
1506
1547
|
--tw-text-opacity:1;
|
|
1507
|
-
color:rgb(
|
|
1548
|
+
color:rgb(255 255 255 / var(--tw-text-opacity))
|
|
1508
1549
|
}
|
|
1509
1550
|
|
|
1510
|
-
.htw-text-
|
|
1551
|
+
.htw-text-gray-400{
|
|
1511
1552
|
--tw-text-opacity:1;
|
|
1512
|
-
color:rgb(
|
|
1553
|
+
color:rgb(var(--_histoire-color-gray-400) / var(--tw-text-opacity))
|
|
1513
1554
|
}
|
|
1514
1555
|
|
|
1515
1556
|
.htw-text-black\/\[2\%\]{
|
|
@@ -1573,20 +1614,6 @@ button {
|
|
|
1573
1614
|
outline-offset:2px
|
|
1574
1615
|
}
|
|
1575
1616
|
|
|
1576
|
-
.htw-transition-colors{
|
|
1577
|
-
transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;
|
|
1578
|
-
transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
1579
|
-
transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;
|
|
1580
|
-
transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);
|
|
1581
|
-
transition-duration:150ms
|
|
1582
|
-
}
|
|
1583
|
-
|
|
1584
|
-
.htw-transition-transform{
|
|
1585
|
-
transition-property:transform;
|
|
1586
|
-
transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);
|
|
1587
|
-
transition-duration:150ms
|
|
1588
|
-
}
|
|
1589
|
-
|
|
1590
1617
|
.htw-transition-border{
|
|
1591
1618
|
transition-property:border;
|
|
1592
1619
|
transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);
|
|
@@ -1603,6 +1630,20 @@ button {
|
|
|
1603
1630
|
transition-property:none
|
|
1604
1631
|
}
|
|
1605
1632
|
|
|
1633
|
+
.htw-transition-colors{
|
|
1634
|
+
transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;
|
|
1635
|
+
transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
1636
|
+
transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;
|
|
1637
|
+
transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);
|
|
1638
|
+
transition-duration:150ms
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
.htw-transition-transform{
|
|
1642
|
+
transition-property:transform;
|
|
1643
|
+
transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);
|
|
1644
|
+
transition-duration:150ms
|
|
1645
|
+
}
|
|
1646
|
+
|
|
1606
1647
|
.htw-delay-150{
|
|
1607
1648
|
transition-delay:150ms
|
|
1608
1649
|
}
|
|
@@ -1635,12 +1676,16 @@ body,
|
|
|
1635
1676
|
font-family: 'Lato', sans-serif;
|
|
1636
1677
|
}
|
|
1637
1678
|
|
|
1638
|
-
|
|
1679
|
+
html {
|
|
1680
|
+
font-size: 16px;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
body {
|
|
1639
1684
|
font-size: 18px;
|
|
1640
1685
|
}
|
|
1641
1686
|
|
|
1642
1687
|
@media (min-width: 640px) {
|
|
1643
|
-
|
|
1688
|
+
body {
|
|
1644
1689
|
font-size: 14px;
|
|
1645
1690
|
}
|
|
1646
1691
|
}
|
|
@@ -1657,14 +1702,14 @@ body,
|
|
|
1657
1702
|
visibility: hidden;
|
|
1658
1703
|
}
|
|
1659
1704
|
|
|
1660
|
-
.hover\:htw-bg-primary-
|
|
1705
|
+
.hover\:htw-bg-primary-100:hover{
|
|
1661
1706
|
--tw-bg-opacity:1;
|
|
1662
|
-
background-color:rgb(var(--_histoire-color-primary-
|
|
1707
|
+
background-color:rgb(var(--_histoire-color-primary-100) / var(--tw-bg-opacity))
|
|
1663
1708
|
}
|
|
1664
1709
|
|
|
1665
|
-
.hover\:htw-bg-primary-
|
|
1710
|
+
.hover\:htw-bg-primary-600:hover{
|
|
1666
1711
|
--tw-bg-opacity:1;
|
|
1667
|
-
background-color:rgb(var(--_histoire-color-primary-
|
|
1712
|
+
background-color:rgb(var(--_histoire-color-primary-600) / var(--tw-bg-opacity))
|
|
1668
1713
|
}
|
|
1669
1714
|
|
|
1670
1715
|
.hover\:htw-bg-primary-500\/50:hover{
|
|
@@ -1747,6 +1792,10 @@ body,
|
|
|
1747
1792
|
border-color:rgb(var(--_histoire-color-gray-800) / var(--tw-border-opacity))
|
|
1748
1793
|
}
|
|
1749
1794
|
|
|
1795
|
+
.htw-dark .dark\:htw-border-white\/25{
|
|
1796
|
+
border-color:rgb(255 255 255 / 0.25)
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1750
1799
|
.htw-dark .dark\:htw-border-gray-850{
|
|
1751
1800
|
--tw-border-opacity:1;
|
|
1752
1801
|
border-color:rgb(var(--_histoire-color-gray-850) / var(--tw-border-opacity))
|
|
@@ -1766,13 +1815,12 @@ body,
|
|
|
1766
1815
|
border-color:rgb(var(--_histoire-color-primary-900) / var(--tw-border-opacity))
|
|
1767
1816
|
}
|
|
1768
1817
|
|
|
1769
|
-
.htw-dark .dark\:htw-border-white\/
|
|
1770
|
-
border-color:rgb(255 255 255 / 0.
|
|
1818
|
+
.htw-dark .dark\:htw-border-white\/50{
|
|
1819
|
+
border-color:rgb(255 255 255 / 0.5)
|
|
1771
1820
|
}
|
|
1772
1821
|
|
|
1773
|
-
.htw-dark .dark\:htw-border-
|
|
1774
|
-
|
|
1775
|
-
border-color:rgb(var(--_histoire-color-gray-500) / var(--tw-border-opacity))
|
|
1822
|
+
.htw-dark .dark\:htw-border-white\/20{
|
|
1823
|
+
border-color:rgb(255 255 255 / 0.2)
|
|
1776
1824
|
}
|
|
1777
1825
|
|
|
1778
1826
|
.htw-dark .dark\:htw-bg-gray-700{
|
|
@@ -1833,6 +1881,11 @@ body,
|
|
|
1833
1881
|
color:rgb(var(--_histoire-color-primary-200) / var(--tw-text-opacity))
|
|
1834
1882
|
}
|
|
1835
1883
|
|
|
1884
|
+
.htw-dark .dark\:hover\:htw-bg-primary-700:hover{
|
|
1885
|
+
--tw-bg-opacity:1;
|
|
1886
|
+
background-color:rgb(var(--_histoire-color-primary-700) / var(--tw-bg-opacity))
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1836
1889
|
.htw-dark .dark\:hover\:htw-bg-primary-900:hover{
|
|
1837
1890
|
--tw-bg-opacity:1;
|
|
1838
1891
|
background-color:rgb(var(--_histoire-color-primary-900) / var(--tw-bg-opacity))
|
|
@@ -1848,11 +1901,6 @@ body,
|
|
|
1848
1901
|
background-color:rgb(var(--_histoire-color-gray-800) / var(--tw-bg-opacity))
|
|
1849
1902
|
}
|
|
1850
1903
|
|
|
1851
|
-
.htw-dark .dark\:hover\:htw-bg-primary-700:hover{
|
|
1852
|
-
--tw-bg-opacity:1;
|
|
1853
|
-
background-color:rgb(var(--_histoire-color-primary-700) / var(--tw-bg-opacity))
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
1904
|
.htw-dark .dark\:hover\:htw-text-primary-400:hover{
|
|
1857
1905
|
--tw-text-opacity:1;
|
|
1858
1906
|
color:rgb(var(--_histoire-color-primary-400) / var(--tw-text-opacity))
|