@poveste/app 0.12.3 → 0.13.1
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/app/style/font.css +11 -7
- package/dist/app/style/fonts/LICENSE +93 -0
- package/dist/app/style/fonts/noto-sans-display-cyrillic-400-normal.woff2 +0 -0
- package/dist/app/style/fonts/noto-sans-display-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/app/style/fonts/noto-sans-display-greek-400-normal.woff2 +0 -0
- package/dist/app/style/fonts/noto-sans-display-greek-ext-400-normal.woff2 +0 -0
- package/dist/app/style/fonts/noto-sans-display-latin-400-normal.woff2 +0 -0
- package/dist/app/style/fonts/noto-sans-display-latin-ext-400-normal.woff2 +0 -0
- package/dist/app/style/fonts/noto-sans-display-vietnamese-400-normal.woff2 +0 -0
- package/dist/bundled/App.vue_vue_type_script_setup_true_lang.js +30 -38
- package/dist/bundled/app.css +11 -17
- package/dist/bundled/components/base/BaseListItemLink.js +6 -3
- package/dist/bundled/components/base/BaseListItemLink.vue_vue_type_script_lang.js +10 -4
- package/dist/bundled/components/base/BaseOverflowTab.js +6 -3
- package/dist/bundled/components/base/BaseOverflowTab.vue_vue_type_script_lang.js +4 -0
- package/dist/bundled/components/base/BaseSplitPane.js +1 -1
- package/dist/bundled/components/base/BaseSplitPane.vue_vue_type_script_setup_true_lang.js +67 -29
- package/dist/bundled/components/base/BaseTab.js +6 -3
- package/dist/bundled/components/base/BaseTab.vue_vue_type_script_lang.js +4 -0
- package/dist/bundled/components/panel/PaneTabs.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/bundled/components/panel/StorySourceCode.js +1 -1
- package/dist/bundled/components/panel/StorySourceCode.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/bundled/components/story/StoryVariantGridItem.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/bundled/components/story/StoryVariantSingle.js +1 -1
- package/dist/bundled/components/story/StoryVariantSingle.vue_vue_type_script_setup_true_lang.js +28 -43
- package/dist/bundled/components/story/StoryVariantSinglePreviewNative.vue_vue_type_script_setup_true_lang.js +5 -2
- package/dist/bundled/components/story/StoryVariantSinglePreviewRemote.vue_vue_type_script_setup_true_lang.js +4 -0
- package/dist/bundled/components/story/StoryVariantSingleView.vue_vue_type_script_setup_true_lang.js +23 -13
- package/dist/bundled/components/story/StoryView.vue_vue_type_script_setup_true_lang.js +8 -11
- package/dist/bundled/components/toolbar/ToolbarBackground.js +1 -3
- package/dist/bundled/components/toolbar/ToolbarBackground.vue_vue_type_script_setup_true_lang.js +1 -5
- package/dist/bundled/sandbox.js +6 -1
- package/dist/bundled/util/events.js +4 -1
- package/dist/bundled/util/highlighter.js +11 -4
- package/dist/bundled/util/mapping.js +5 -1
- package/dist/bundled/util/occupant.js +16 -0
- package/dist/bundled/util/variant.js +12 -1
- package/dist/style.css +18 -6
- package/package.json +8 -6
- package/src/__tests__/font.spec.ts +48 -2
- package/src/app/App.vue +77 -63
- package/src/app/components/base/BaseListItemLink.vue +12 -1
- package/src/app/components/base/BaseOverflowTab.vue +12 -1
- package/src/app/components/base/BaseSplitPane.vue +95 -29
- package/src/app/components/base/BaseTab.vue +12 -1
- package/src/app/components/command/CommandPrompts.vue +9 -1
- package/src/app/components/panel/PaneTabs.vue +4 -4
- package/src/app/components/panel/StorySourceCode.vue +5 -5
- package/src/app/components/story/StoryVariantSingle.vue +65 -67
- package/src/app/components/story/StoryVariantSinglePreviewNative.vue +13 -2
- package/src/app/components/story/StoryVariantSinglePreviewRemote.vue +8 -0
- package/src/app/components/story/StoryVariantSingleView.vue +59 -13
- package/src/app/components/story/StoryView.vue +17 -17
- package/src/app/components/toolbar/ToolbarBackground.vue +0 -7
- package/src/app/components/tree/StoryGroup.vue +1 -1
- package/src/app/sandbox.ts +9 -1
- package/src/app/style/font.css +11 -7
- package/src/app/style/fonts/LICENSE +93 -0
- package/src/app/style/fonts/noto-sans-display-cyrillic-400-normal.woff2 +0 -0
- package/src/app/style/fonts/noto-sans-display-cyrillic-ext-400-normal.woff2 +0 -0
- package/src/app/style/fonts/noto-sans-display-greek-400-normal.woff2 +0 -0
- package/src/app/style/fonts/noto-sans-display-greek-ext-400-normal.woff2 +0 -0
- package/src/app/style/fonts/noto-sans-display-latin-400-normal.woff2 +0 -0
- package/src/app/style/fonts/noto-sans-display-latin-ext-400-normal.woff2 +0 -0
- package/src/app/style/fonts/noto-sans-display-vietnamese-400-normal.woff2 +0 -0
- package/src/app/util/events.ts +3 -0
- package/src/app/util/highlighter.ts +24 -9
- package/src/app/util/mapping.ts +5 -1
- package/src/app/util/occupant.ts +13 -0
- package/src/app/util/variant.ts +13 -1
- package/LICENSE +0 -22
package/src/app/util/events.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EVENT_SEND } from './const'
|
|
2
|
+
import { occupant } from './occupant'
|
|
2
3
|
|
|
3
4
|
export async function logEvent(name: string, argument) {
|
|
4
5
|
const event = {
|
|
@@ -9,6 +10,8 @@ export async function logEvent(name: string, argument) {
|
|
|
9
10
|
window.parent?.postMessage({
|
|
10
11
|
type: EVENT_SEND,
|
|
11
12
|
event,
|
|
13
|
+
storyId: occupant.storyId,
|
|
14
|
+
variantId: occupant.variantId,
|
|
12
15
|
})
|
|
13
16
|
}
|
|
14
17
|
else {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { HighlighterCore } from 'shiki/core'
|
|
2
|
+
import { createHighlighterCore } from 'shiki/core'
|
|
3
|
+
import { createOnigurumaEngine } from 'shiki/engine/oniguruma'
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Shiki is meant to be used as a singleton: each instance carries its own WASM
|
|
@@ -9,18 +10,32 @@ import { createHighlighter } from 'shiki'
|
|
|
9
10
|
*
|
|
10
11
|
* The langs and themes are fixed, so one shared instance is always correct.
|
|
11
12
|
*/
|
|
12
|
-
let highlighterPromise: Promise<
|
|
13
|
+
let highlighterPromise: Promise<HighlighterCore> | undefined
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* `shiki/core`, not `shiki`: the latter is the full-bundle entry and ships every
|
|
17
|
+
* grammar and theme whatever the options ask for — 10 MB a book (#304). The
|
|
18
|
+
* dynamic imports are the interface, not a lazy-loading choice.
|
|
19
|
+
*/
|
|
20
|
+
export function getHighlighter(): Promise<HighlighterCore> {
|
|
21
|
+
highlighterPromise ??= createHighlighterCore({
|
|
16
22
|
langs: [
|
|
17
|
-
'html',
|
|
18
|
-
'jsx',
|
|
23
|
+
import('shiki/langs/html.mjs'),
|
|
24
|
+
import('shiki/langs/jsx.mjs'),
|
|
19
25
|
],
|
|
26
|
+
/*
|
|
27
|
+
* `github-light-high-contrast`, not `github-light`. The plain one paints
|
|
28
|
+
* keywords at 4.38:1 on the pane background, variables at 3.34 and tag
|
|
29
|
+
* names at 4.43 — three of its twelve token colours miss AA (#533). This is
|
|
30
|
+
* GitHub's own accessible build of the same theme, so code keeps reading the
|
|
31
|
+
* way it did, and the colours are maintained upstream rather than darkened
|
|
32
|
+
* by hand here.
|
|
33
|
+
*/
|
|
20
34
|
themes: [
|
|
21
|
-
'github-light',
|
|
22
|
-
'github-dark',
|
|
35
|
+
import('shiki/themes/github-light-high-contrast.mjs'),
|
|
36
|
+
import('shiki/themes/github-dark.mjs'),
|
|
23
37
|
],
|
|
38
|
+
engine: createOnigurumaEngine(import('shiki/wasm')),
|
|
24
39
|
}).catch((e) => {
|
|
25
40
|
// Don't let a cached rejection disable highlighting for the rest of the
|
|
26
41
|
// session — drop it so the next mount can try again.
|
package/src/app/util/mapping.ts
CHANGED
|
@@ -71,7 +71,11 @@ export function mapVariant(variant: Variant, existingVariant?: Variant): Variant
|
|
|
71
71
|
_hPropDefs: {},
|
|
72
72
|
}),
|
|
73
73
|
setupApp: null,
|
|
74
|
-
|
|
74
|
+
// The three keys `Variant` declares, absent rather than missing: a
|
|
75
|
+
// variant created here defines no slots, and consumers read them
|
|
76
|
+
// with `||`. `Story.slots` is `() => any`, which is why the same
|
|
77
|
+
// literal above needs nothing.
|
|
78
|
+
slots: () => ({ default: undefined, controls: undefined, source: undefined }),
|
|
75
79
|
previewReady: false,
|
|
76
80
|
}
|
|
77
81
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the sandbox realm is currently showing.
|
|
3
|
+
*
|
|
4
|
+
* The realm is reused: a `SANDBOX_RETARGET` hands it another story rather than
|
|
5
|
+
* booting a new document, so a message can outlive the occupant that queued it.
|
|
6
|
+
* Every message `sandbox.ts` posts already carries these ids for that reason;
|
|
7
|
+
* this module exists so `logEvent` — which posts from wherever a story calls it,
|
|
8
|
+
* not from `sandbox.ts` — can carry them too (#328).
|
|
9
|
+
*/
|
|
10
|
+
export const occupant: { storyId: string | null, variantId: string | null } = {
|
|
11
|
+
storyId: null,
|
|
12
|
+
variantId: null,
|
|
13
|
+
}
|
package/src/app/util/variant.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import type { Ref } from 'vue'
|
|
2
|
-
import type { Variant } from '../types'
|
|
2
|
+
import type { Story, Variant } from '../types'
|
|
3
3
|
import { computed } from 'vue'
|
|
4
4
|
import { useRoute } from 'vue-router'
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Whether opening this story will put a variant in the route by itself.
|
|
8
|
+
*
|
|
9
|
+
* `StoryView` resolves the variant one tick after the story, so anything that
|
|
10
|
+
* has to tell "a variant is on its way" from "this story is waiting for the
|
|
11
|
+
* reader to pick one" needs the same answer it will give — hence one predicate
|
|
12
|
+
* rather than two copies of the condition (#328).
|
|
13
|
+
*/
|
|
14
|
+
export function autoSelectsVariant(story: Story | null | undefined): boolean {
|
|
15
|
+
return !!story && (!!story.lastSelectedVariant || story.variants.length === 1)
|
|
16
|
+
}
|
|
17
|
+
|
|
6
18
|
export function useCurrentVariantRoute(variant: Ref<Variant>) {
|
|
7
19
|
const route = useRoute()
|
|
8
20
|
const isActive = computed(() => route.query.variantId === variant.value.id)
|
package/LICENSE
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Guillaume Chau (original "histoire" project)
|
|
4
|
-
Copyright (c) 2026 Sorin Gitlan (poveste fork)
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|