poveste 0.6.0 → 0.7.0
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/controls.d.ts +0 -1
- package/dist/node/alias.d.ts +0 -1
- package/dist/node/bin.d.ts +0 -1
- package/dist/node/build-serialize.d.ts +0 -1
- package/dist/node/build.d.ts +0 -1
- package/dist/node/builtin-plugins/pinceau-tokens.d.ts +0 -1
- package/dist/node/builtin-plugins/vanilla-support/MountStory.d.ts +0 -1
- package/dist/node/builtin-plugins/vanilla-support/RenderStory.d.ts +0 -1
- package/dist/node/builtin-plugins/vanilla-support/client.d.ts +0 -1
- package/dist/node/builtin-plugins/vanilla-support/collect.d.ts +0 -1
- package/dist/node/builtin-plugins/vanilla-support/plugin.d.ts +0 -1
- package/dist/node/builtin-plugins/vanilla-support/types.d.ts +0 -1
- package/dist/node/builtin-plugins/vanilla-support/vanilla.story.d.ts +0 -1
- package/dist/node/collect/index.d.ts +0 -1
- package/dist/node/collect/run.d.ts +0 -1
- package/dist/node/collect/worker.d.ts +0 -1
- package/dist/node/colors.d.ts +0 -1
- package/dist/node/commands/build.d.ts +0 -1
- package/dist/node/commands/dev.d.ts +0 -1
- package/dist/node/commands/port.d.ts +0 -1
- package/dist/node/commands/preview.d.ts +0 -1
- package/dist/node/config.d.ts +0 -1
- package/dist/node/context.d.ts +0 -1
- package/dist/node/dom/dom-keys.d.ts +0 -1
- package/dist/node/dom/env.d.ts +0 -1
- package/dist/node/dom/util.d.ts +0 -1
- package/dist/node/index.d.ts +0 -1
- package/dist/node/load.d.ts +0 -1
- package/dist/node/markdown.d.ts +0 -1
- package/dist/node/plugin.d.ts +0 -1
- package/dist/node/preview.d.ts +0 -1
- package/dist/node/search.d.ts +0 -1
- package/dist/node/server.d.ts +0 -1
- package/dist/node/stories.d.ts +0 -1
- package/dist/node/style-isolation/entry-css-merger.d.ts +0 -1
- package/dist/node/style-isolation/global-styles.d.ts +0 -1
- package/dist/node/style-isolation/index.d.ts +0 -1
- package/dist/node/style-isolation/scope-chrome.d.ts +0 -1
- package/dist/node/style-isolation/selectors.d.ts +0 -1
- package/dist/node/style-isolation/transforms.d.ts +0 -1
- package/dist/node/style-isolation/vite-plugin.d.ts +0 -1
- package/dist/node/tree.d.ts +0 -1
- package/dist/node/util/find-up.d.ts +0 -1
- package/dist/node/util/fs.d.ts +0 -1
- package/dist/node/util/head.d.ts +0 -1
- package/dist/node/util/log.d.ts +0 -1
- package/dist/node/util/slugify.d.ts +0 -1
- package/dist/node/util/vendors.d.ts +0 -1
- package/dist/node/util/watch-ignore.d.ts +0 -1
- package/dist/node/vendors/controls.d.ts +0 -1
- package/dist/node/vendors/vue.d.ts +0 -1
- package/dist/node/virtual/index.d.ts +0 -1
- package/dist/node/virtual/markdown.d.ts +0 -1
- package/dist/node/virtual/noop.d.ts +0 -1
- package/dist/node/virtual/resolved-commands.d.ts +0 -1
- package/dist/node/virtual/resolved-config.d.ts +0 -1
- package/dist/node/virtual/resolved-generated-global-setup.d.ts +0 -1
- package/dist/node/virtual/resolved-generated-setup-code.d.ts +0 -1
- package/dist/node/virtual/resolved-markdown-files.d.ts +0 -1
- package/dist/node/virtual/resolved-stories.d.ts +0 -1
- package/dist/node/virtual/resolved-support-plugins-client.d.ts +0 -1
- package/dist/node/virtual/resolved-support-plugins-collect.d.ts +0 -1
- package/dist/node/virtual/resolved-theme.d.ts +0 -1
- package/dist/node/virtual/story-source.d.ts +0 -1
- package/dist/node/virtual/story.d.ts +0 -1
- package/dist/node/virtual/util.d.ts +0 -1
- package/dist/node/virtual/vite-plugin.d.ts +0 -1
- package/dist/node/vite.d.ts +0 -1
- package/package.json +36 -6
- package/dist/controls.d.ts.map +0 -1
- package/dist/node/alias.d.ts.map +0 -1
- package/dist/node/bin.d.ts.map +0 -1
- package/dist/node/build-serialize.d.ts.map +0 -1
- package/dist/node/build.d.ts.map +0 -1
- package/dist/node/builtin-plugins/pinceau-tokens.d.ts.map +0 -1
- package/dist/node/builtin-plugins/vanilla-support/MountStory.d.ts.map +0 -1
- package/dist/node/builtin-plugins/vanilla-support/RenderStory.d.ts.map +0 -1
- package/dist/node/builtin-plugins/vanilla-support/client.d.ts.map +0 -1
- package/dist/node/builtin-plugins/vanilla-support/collect.d.ts.map +0 -1
- package/dist/node/builtin-plugins/vanilla-support/plugin.d.ts.map +0 -1
- package/dist/node/builtin-plugins/vanilla-support/types.d.ts.map +0 -1
- package/dist/node/builtin-plugins/vanilla-support/vanilla.story.d.ts.map +0 -1
- package/dist/node/collect/index.d.ts.map +0 -1
- package/dist/node/collect/run.d.ts.map +0 -1
- package/dist/node/collect/worker.d.ts.map +0 -1
- package/dist/node/colors.d.ts.map +0 -1
- package/dist/node/commands/build.d.ts.map +0 -1
- package/dist/node/commands/dev.d.ts.map +0 -1
- package/dist/node/commands/port.d.ts.map +0 -1
- package/dist/node/commands/preview.d.ts.map +0 -1
- package/dist/node/config.d.ts.map +0 -1
- package/dist/node/context.d.ts.map +0 -1
- package/dist/node/dom/dom-keys.d.ts.map +0 -1
- package/dist/node/dom/env.d.ts.map +0 -1
- package/dist/node/dom/util.d.ts.map +0 -1
- package/dist/node/index.d.ts.map +0 -1
- package/dist/node/load.d.ts.map +0 -1
- package/dist/node/markdown.d.ts.map +0 -1
- package/dist/node/plugin.d.ts.map +0 -1
- package/dist/node/preview.d.ts.map +0 -1
- package/dist/node/search.d.ts.map +0 -1
- package/dist/node/server.d.ts.map +0 -1
- package/dist/node/stories.d.ts.map +0 -1
- package/dist/node/style-isolation/entry-css-merger.d.ts.map +0 -1
- package/dist/node/style-isolation/global-styles.d.ts.map +0 -1
- package/dist/node/style-isolation/index.d.ts.map +0 -1
- package/dist/node/style-isolation/scope-chrome.d.ts.map +0 -1
- package/dist/node/style-isolation/selectors.d.ts.map +0 -1
- package/dist/node/style-isolation/transforms.d.ts.map +0 -1
- package/dist/node/style-isolation/vite-plugin.d.ts.map +0 -1
- package/dist/node/tree.d.ts.map +0 -1
- package/dist/node/util/find-up.d.ts.map +0 -1
- package/dist/node/util/fs.d.ts.map +0 -1
- package/dist/node/util/head.d.ts.map +0 -1
- package/dist/node/util/log.d.ts.map +0 -1
- package/dist/node/util/slugify.d.ts.map +0 -1
- package/dist/node/util/vendors.d.ts.map +0 -1
- package/dist/node/util/watch-ignore.d.ts.map +0 -1
- package/dist/node/vendors/controls.d.ts.map +0 -1
- package/dist/node/vendors/vue.d.ts.map +0 -1
- package/dist/node/virtual/index.d.ts.map +0 -1
- package/dist/node/virtual/markdown.d.ts.map +0 -1
- package/dist/node/virtual/noop.d.ts.map +0 -1
- package/dist/node/virtual/resolved-commands.d.ts.map +0 -1
- package/dist/node/virtual/resolved-config.d.ts.map +0 -1
- package/dist/node/virtual/resolved-generated-global-setup.d.ts.map +0 -1
- package/dist/node/virtual/resolved-generated-setup-code.d.ts.map +0 -1
- package/dist/node/virtual/resolved-markdown-files.d.ts.map +0 -1
- package/dist/node/virtual/resolved-stories.d.ts.map +0 -1
- package/dist/node/virtual/resolved-support-plugins-client.d.ts.map +0 -1
- package/dist/node/virtual/resolved-support-plugins-collect.d.ts.map +0 -1
- package/dist/node/virtual/resolved-theme.d.ts.map +0 -1
- package/dist/node/virtual/story-source.d.ts.map +0 -1
- package/dist/node/virtual/story.d.ts.map +0 -1
- package/dist/node/virtual/util.d.ts.map +0 -1
- package/dist/node/virtual/vite-plugin.d.ts.map +0 -1
- package/dist/node/vite.d.ts.map +0 -1
- package/src/controls.ts +0 -1
- package/src/node/__tests__/config.spec.ts +0 -25
- package/src/node/__tests__/dom-env.spec.ts +0 -97
- package/src/node/__tests__/head.spec.ts +0 -32
- package/src/node/__tests__/markdown/test1.story.md +0 -7
- package/src/node/__tests__/markdown/test2.story.md +0 -5
- package/src/node/__tests__/markdown.spec.ts +0 -61
- package/src/node/__tests__/port.spec.ts +0 -65
- package/src/node/__tests__/tree.spec.ts +0 -109
- package/src/node/__tests__/virtual-setup.spec.ts +0 -61
- package/src/node/__tests__/watch-ignore.spec.ts +0 -33
- package/src/node/alias.ts +0 -8
- package/src/node/bin.ts +0 -46
- package/src/node/build-serialize.ts +0 -62
- package/src/node/build.ts +0 -339
- package/src/node/builtin-plugins/pinceau-tokens.ts +0 -523
- package/src/node/builtin-plugins/vanilla-support/MountStory.ts +0 -49
- package/src/node/builtin-plugins/vanilla-support/RenderStory.ts +0 -167
- package/src/node/builtin-plugins/vanilla-support/client.ts +0 -6
- package/src/node/builtin-plugins/vanilla-support/collect.ts +0 -43
- package/src/node/builtin-plugins/vanilla-support/plugin.ts +0 -35
- package/src/node/builtin-plugins/vanilla-support/types.ts +0 -42
- package/src/node/builtin-plugins/vanilla-support/vanilla.story.ts +0 -63
- package/src/node/collect/index.ts +0 -164
- package/src/node/collect/run.ts +0 -9
- package/src/node/collect/worker.ts +0 -103
- package/src/node/colors.ts +0 -340
- package/src/node/commands/build.ts +0 -14
- package/src/node/commands/dev.ts +0 -70
- package/src/node/commands/port.ts +0 -41
- package/src/node/commands/preview.ts +0 -30
- package/src/node/config.ts +0 -396
- package/src/node/context.ts +0 -60
- package/src/node/dom/dom-keys.ts +0 -238
- package/src/node/dom/env.ts +0 -123
- package/src/node/dom/util.ts +0 -83
- package/src/node/index.ts +0 -7
- package/src/node/load.ts +0 -59
- package/src/node/markdown.ts +0 -280
- package/src/node/plugin.ts +0 -95
- package/src/node/preview.ts +0 -45
- package/src/node/search.ts +0 -84
- package/src/node/server.ts +0 -258
- package/src/node/stories.ts +0 -145
- package/src/node/style-isolation/__tests__/entry-css-merger.spec.ts +0 -145
- package/src/node/style-isolation/__tests__/transforms.spec.ts +0 -200
- package/src/node/style-isolation/__tests__/vite-plugin.spec.ts +0 -39
- package/src/node/style-isolation/entry-css-merger.ts +0 -134
- package/src/node/style-isolation/global-styles.ts +0 -37
- package/src/node/style-isolation/index.ts +0 -5
- package/src/node/style-isolation/scope-chrome.ts +0 -42
- package/src/node/style-isolation/selectors.ts +0 -19
- package/src/node/style-isolation/transforms.ts +0 -163
- package/src/node/style-isolation/vite-plugin.ts +0 -75
- package/src/node/tree.ts +0 -158
- package/src/node/util/find-up.ts +0 -24
- package/src/node/util/fs.ts +0 -1
- package/src/node/util/head.ts +0 -12
- package/src/node/util/log.ts +0 -10
- package/src/node/util/slugify.ts +0 -26
- package/src/node/util/vendors.ts +0 -27
- package/src/node/util/watch-ignore.ts +0 -13
- package/src/node/vendors/controls.ts +0 -1
- package/src/node/vendors/vue.ts +0 -1
- package/src/node/virtual/index.ts +0 -50
- package/src/node/virtual/markdown.ts +0 -21
- package/src/node/virtual/noop.ts +0 -9
- package/src/node/virtual/resolved-commands.ts +0 -42
- package/src/node/virtual/resolved-config.ts +0 -12
- package/src/node/virtual/resolved-generated-global-setup.ts +0 -33
- package/src/node/virtual/resolved-generated-setup-code.ts +0 -7
- package/src/node/virtual/resolved-markdown-files.ts +0 -19
- package/src/node/virtual/resolved-stories.ts +0 -44
- package/src/node/virtual/resolved-support-plugins-client.ts +0 -14
- package/src/node/virtual/resolved-support-plugins-collect.ts +0 -14
- package/src/node/virtual/resolved-theme.ts +0 -14
- package/src/node/virtual/story-source.ts +0 -18
- package/src/node/virtual/story.ts +0 -9
- package/src/node/virtual/util.ts +0 -41
- package/src/node/virtual/vite-plugin.ts +0 -146
- package/src/node/vite.ts +0 -438
- package/tsconfig.json +0 -44
- package/vitest.config.ts +0 -10
|
@@ -1,523 +0,0 @@
|
|
|
1
|
-
import type { Plugin, PluginApiBase } from '@poveste/shared'
|
|
2
|
-
import { join } from 'pathe'
|
|
3
|
-
import { getInjectedImport } from '../util/vendors.js'
|
|
4
|
-
|
|
5
|
-
export interface PinceauTokensOptions {
|
|
6
|
-
configOrPaths?: string | string[]
|
|
7
|
-
configFileName?: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function pinceauTokens(_options: PinceauTokensOptions = {}): Plugin {
|
|
11
|
-
const themePath = join(process.cwd(), 'node_modules/.vite/pinceau/index.js')
|
|
12
|
-
|
|
13
|
-
async function generate(api: PluginApiBase) {
|
|
14
|
-
try {
|
|
15
|
-
await api.fs.ensureDir(api.pluginTempDir)
|
|
16
|
-
await api.fs.emptyDir(api.pluginTempDir)
|
|
17
|
-
api.moduleLoader.clearCache()
|
|
18
|
-
await api.fs.writeFile(api.path.resolve(api.pluginTempDir, 'style.css'), css)
|
|
19
|
-
const theme = await api.moduleLoader.loadModule(themePath)
|
|
20
|
-
const storyFile = api.path.resolve(api.pluginTempDir, 'Pinceau.story.js')
|
|
21
|
-
await api.fs.writeFile(storyFile, storyTemplate(theme))
|
|
22
|
-
api.addStoryFile(storyFile)
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
api.error(e.stack ?? e.message)
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
name: 'builtin:pinceau-tokens',
|
|
31
|
-
|
|
32
|
-
config(config) {
|
|
33
|
-
// Add 'design-system' group
|
|
34
|
-
if (!config.tree) {
|
|
35
|
-
config.tree = {}
|
|
36
|
-
}
|
|
37
|
-
if (!config.tree.groups) {
|
|
38
|
-
config.tree.groups = []
|
|
39
|
-
}
|
|
40
|
-
if (!config.tree.groups.some(g => g.id === 'design-system')) {
|
|
41
|
-
let index = 0
|
|
42
|
-
// After 'top' group
|
|
43
|
-
const topIndex = config.tree.groups.findIndex(g => g.id === 'top')
|
|
44
|
-
if (topIndex > -1) {
|
|
45
|
-
index = topIndex + 1
|
|
46
|
-
}
|
|
47
|
-
// Insert group
|
|
48
|
-
config.tree.groups.splice(index, 0, {
|
|
49
|
-
id: 'design-system',
|
|
50
|
-
title: 'Design System',
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
async onDev(api, onCleanup) {
|
|
56
|
-
await generate(api)
|
|
57
|
-
|
|
58
|
-
const watcher = api.watcher.watch(themePath)
|
|
59
|
-
.on('change', () => generate(api))
|
|
60
|
-
.on('add', () => generate(api))
|
|
61
|
-
|
|
62
|
-
onCleanup(() => {
|
|
63
|
-
watcher.close()
|
|
64
|
-
})
|
|
65
|
-
},
|
|
66
|
-
|
|
67
|
-
async onBuild(api) {
|
|
68
|
-
await generate(api)
|
|
69
|
-
},
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function storyTemplate(pinceauConfig: any) {
|
|
74
|
-
pinceauConfig = pinceauConfig?.theme || pinceauConfig?.default?.theme || {}
|
|
75
|
-
|
|
76
|
-
// No `import 'poveste-style'` — see the tailwind plugin's template (#219).
|
|
77
|
-
return `import './style.css'
|
|
78
|
-
import { createApp, h, markRaw, ref } from ${getInjectedImport('@poveste/vendors/vue')}
|
|
79
|
-
import {
|
|
80
|
-
HstColorShades,
|
|
81
|
-
HstTokenList,
|
|
82
|
-
HstTokenGrid,
|
|
83
|
-
HstText,
|
|
84
|
-
HstTextarea,
|
|
85
|
-
HstNumber,
|
|
86
|
-
} from ${getInjectedImport('@poveste/controls')}
|
|
87
|
-
|
|
88
|
-
const config = markRaw(${JSON.stringify(pinceauConfig, null, 2)})
|
|
89
|
-
const search = ref('')
|
|
90
|
-
const sampleText = ref('Cat sit like bread eat prawns daintily with a claw then lick paws clean wash down prawns with a lap of carnation milk then retire to the warmest spot on the couch to claw at the fabric before taking a catnap mrow cat cat moo moo lick ears lick paws')
|
|
91
|
-
const fontSize = ref(16)
|
|
92
|
-
const flattenTokens = (data, transformValue = (value) => (value?.value || value)) => {
|
|
93
|
-
const output = {}
|
|
94
|
-
function step(obj, prev) {
|
|
95
|
-
Object.keys(obj).forEach((key) => {
|
|
96
|
-
const value = obj[key]
|
|
97
|
-
const isarray = Array.isArray(value)
|
|
98
|
-
const type = Object.prototype.toString.call(value)
|
|
99
|
-
const isobject
|
|
100
|
-
= type === '[object Object]'
|
|
101
|
-
|| type === '[object Array]'
|
|
102
|
-
|
|
103
|
-
const newKey = prev ? prev + '.' + key : key
|
|
104
|
-
|
|
105
|
-
if (value.value && !output[newKey]) {
|
|
106
|
-
output[newKey] = transformValue(value)
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (!isarray && isobject && Object.keys(value).length) { return step(value, newKey) }
|
|
110
|
-
})
|
|
111
|
-
}
|
|
112
|
-
step(data)
|
|
113
|
-
return output
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function mountApp ({ el, state, onUnmount }, render) {
|
|
117
|
-
Object.assign(state, {
|
|
118
|
-
search,
|
|
119
|
-
sampleText,
|
|
120
|
-
fontSize,
|
|
121
|
-
})
|
|
122
|
-
|
|
123
|
-
const app = createApp({
|
|
124
|
-
render,
|
|
125
|
-
})
|
|
126
|
-
app.mount(el)
|
|
127
|
-
|
|
128
|
-
onUnmount(() => {
|
|
129
|
-
app.unmount()
|
|
130
|
-
})
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/*
|
|
134
|
-
media?: PinceauTokens
|
|
135
|
-
colors?: ScaleTokens
|
|
136
|
-
fonts?: PinceauTokens
|
|
137
|
-
fontWeights?: FontWeightTokens
|
|
138
|
-
fontSizes?: BreakpointsTokens
|
|
139
|
-
size?: BreakpointsTokens
|
|
140
|
-
space?: BreakpointsTokens
|
|
141
|
-
radii?: BreakpointsTokens
|
|
142
|
-
borders?: BreakpointsTokens
|
|
143
|
-
borderWidths?: BreakpointsTokens
|
|
144
|
-
borderStyles?: BreakpointsTokens
|
|
145
|
-
shadows?: BreakpointsTokens
|
|
146
|
-
opacity?: BreakpointsTokens
|
|
147
|
-
leads?: BreakpointsTokens
|
|
148
|
-
letterSpacings?: BreakpointsTokens
|
|
149
|
-
transitions?: PinceauTokens
|
|
150
|
-
zIndices?: PinceauTokens
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
export default {
|
|
154
|
-
id: 'pinceau',
|
|
155
|
-
title: 'Pinceau',
|
|
156
|
-
group: 'design-system',
|
|
157
|
-
icon: 'noto:paintbrush',
|
|
158
|
-
responsiveDisabled: true,
|
|
159
|
-
layout: { type: 'single', iframe: false },
|
|
160
|
-
variants: [
|
|
161
|
-
{
|
|
162
|
-
id: 'media-queries',
|
|
163
|
-
title: 'Media Queries',
|
|
164
|
-
icon: 'carbon:screen',
|
|
165
|
-
onMount: (api) => mountApp(api, () => h(HstTokenGrid, {
|
|
166
|
-
tokens: flattenTokens(config.media),
|
|
167
|
-
getName: key => '@mq.' + key,
|
|
168
|
-
colSize: 180,
|
|
169
|
-
}, ({ token }) => h('div', {
|
|
170
|
-
class: '__pvt-drop-shadow',
|
|
171
|
-
}))),
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
id: 'colors',
|
|
175
|
-
title: 'Colors',
|
|
176
|
-
icon: 'carbon:color-palette',
|
|
177
|
-
onMount: (api) => mountApp(api, () => Object.entries(config.colors).map(([key, shades]) => h(HstColorShades, {
|
|
178
|
-
key,
|
|
179
|
-
shades: shades.value ? { DEFAULT: shades.value } : flattenTokens(shades),
|
|
180
|
-
getName: shade => '{colors.' + key + '.' + shade + '}',
|
|
181
|
-
search: search.value,
|
|
182
|
-
}, ({ color}) => h('div', {
|
|
183
|
-
class: '__pvt-shade',
|
|
184
|
-
style: {
|
|
185
|
-
backgroundColor: color,
|
|
186
|
-
},
|
|
187
|
-
})))),
|
|
188
|
-
onMountControls: (api) => mountApp(api, () => [
|
|
189
|
-
h(HstText, {
|
|
190
|
-
title: 'Filter...',
|
|
191
|
-
modelValue: search.value,
|
|
192
|
-
'onUpdate:modelValue': value => { search.value = value },
|
|
193
|
-
}),
|
|
194
|
-
]),
|
|
195
|
-
},
|
|
196
|
-
// SPACES
|
|
197
|
-
{
|
|
198
|
-
id: 'Spaces',
|
|
199
|
-
title: 'Spaces',
|
|
200
|
-
icon: 'carbon:area',
|
|
201
|
-
onMount: (api) => mountApp(api, () => h(HstTokenList, {
|
|
202
|
-
tokens: flattenTokens(config.space),
|
|
203
|
-
getName: key => '{space.' + key + '}',
|
|
204
|
-
}, ({ token }) => h('div', {
|
|
205
|
-
class: '__pvt-spaces',
|
|
206
|
-
style: {
|
|
207
|
-
padding: token.value,
|
|
208
|
-
},
|
|
209
|
-
}, [
|
|
210
|
-
h('div', {
|
|
211
|
-
class: '__pvt-spaces-box',
|
|
212
|
-
}),
|
|
213
|
-
]))),
|
|
214
|
-
},
|
|
215
|
-
// SIZES
|
|
216
|
-
{
|
|
217
|
-
id: 'sizes',
|
|
218
|
-
title: 'Sizes',
|
|
219
|
-
icon: 'carbon:pan-horizontal',
|
|
220
|
-
onMount: (api) => mountApp(api, () => h(HstTokenList, {
|
|
221
|
-
tokens: flattenTokens(config.size),
|
|
222
|
-
getName: key => '{size.' + key + '}',
|
|
223
|
-
}, ({ token }) => h('div', {
|
|
224
|
-
class: '__pvt-width',
|
|
225
|
-
}, [
|
|
226
|
-
h('div', {
|
|
227
|
-
class: '__pvt-width-box',
|
|
228
|
-
style: {
|
|
229
|
-
width: token.value,
|
|
230
|
-
},
|
|
231
|
-
}),
|
|
232
|
-
]))),
|
|
233
|
-
},
|
|
234
|
-
// FONTSIZES
|
|
235
|
-
{
|
|
236
|
-
id: 'font-size',
|
|
237
|
-
title: 'Font Size',
|
|
238
|
-
icon: 'carbon:text-font',
|
|
239
|
-
onMount: (api) => mountApp(api, () => h(HstTokenList, {
|
|
240
|
-
tokens: flattenTokens(config.fontSizes),
|
|
241
|
-
getName: key => '{fontSizes.' + key + '}',
|
|
242
|
-
}, ({ token }) => h('div', {
|
|
243
|
-
class: '__pvt-truncate',
|
|
244
|
-
style: {
|
|
245
|
-
fontSize: token.value,
|
|
246
|
-
},
|
|
247
|
-
}, sampleText.value))),
|
|
248
|
-
onMountControls: (api) => mountApp(api, () => [
|
|
249
|
-
h(HstTextarea, {
|
|
250
|
-
title: 'Sample text',
|
|
251
|
-
modelValue: sampleText.value,
|
|
252
|
-
'onUpdate:modelValue': value => { sampleText.value = value },
|
|
253
|
-
rows: 5,
|
|
254
|
-
}),
|
|
255
|
-
]),
|
|
256
|
-
},
|
|
257
|
-
// FONTWEIGHTS
|
|
258
|
-
{
|
|
259
|
-
id: 'font-weight',
|
|
260
|
-
title: 'Font Weight',
|
|
261
|
-
icon: 'carbon:text-font',
|
|
262
|
-
onMount: (api) => mountApp(api, () => h(HstTokenList, {
|
|
263
|
-
tokens: flattenTokens(config.fontWeights),
|
|
264
|
-
getName: key => '{fontWeights.' + key + '}',
|
|
265
|
-
}, ({ token }) => h('div', {
|
|
266
|
-
class: '__pvt-truncate',
|
|
267
|
-
style: {
|
|
268
|
-
fontWeight: token.value,
|
|
269
|
-
fontSize: \`\${fontSize.value}px\`,
|
|
270
|
-
},
|
|
271
|
-
}, sampleText.value))),
|
|
272
|
-
onMountControls: (api) => mountApp(api, () => [
|
|
273
|
-
h(HstTextarea, {
|
|
274
|
-
title: 'Sample text',
|
|
275
|
-
modelValue: sampleText.value,
|
|
276
|
-
'onUpdate:modelValue': value => { sampleText.value = value },
|
|
277
|
-
rows: 5,
|
|
278
|
-
}),
|
|
279
|
-
h(HstNumber, {
|
|
280
|
-
title: 'Font size',
|
|
281
|
-
modelValue: fontSize.value,
|
|
282
|
-
'onUpdate:modelValue': value => { fontSize.value = value },
|
|
283
|
-
min: 1,
|
|
284
|
-
}),
|
|
285
|
-
]),
|
|
286
|
-
},
|
|
287
|
-
// FONTS
|
|
288
|
-
{
|
|
289
|
-
id: 'fonts',
|
|
290
|
-
title: 'Fonts',
|
|
291
|
-
icon: 'carbon:text-font',
|
|
292
|
-
onMount: (api) => mountApp(api, () => h(HstTokenList, {
|
|
293
|
-
tokens: flattenTokens(config.fonts),
|
|
294
|
-
getName: key => '{fonts.' + key + '}',
|
|
295
|
-
}, ({ token }) => h('div', {
|
|
296
|
-
class: '__pvt-truncate',
|
|
297
|
-
style: {
|
|
298
|
-
fontFamily: token.value,
|
|
299
|
-
fontSize: \`\${fontSize.value}px\`,
|
|
300
|
-
},
|
|
301
|
-
}, sampleText.value))),
|
|
302
|
-
onMountControls: (api) => mountApp(api, () => [
|
|
303
|
-
h(HstTextarea, {
|
|
304
|
-
title: 'Sample text',
|
|
305
|
-
modelValue: sampleText.value,
|
|
306
|
-
'onUpdate:modelValue': value => { sampleText.value = value },
|
|
307
|
-
rows: 5,
|
|
308
|
-
}),
|
|
309
|
-
h(HstNumber, {
|
|
310
|
-
title: 'Font size',
|
|
311
|
-
modelValue: fontSize.value,
|
|
312
|
-
'onUpdate:modelValue': value => { fontSize.value = value },
|
|
313
|
-
min: 1,
|
|
314
|
-
}),
|
|
315
|
-
]),
|
|
316
|
-
},
|
|
317
|
-
// LETTERSPACINGS
|
|
318
|
-
{
|
|
319
|
-
id: 'letter-spacing',
|
|
320
|
-
title: 'Letter Spacing',
|
|
321
|
-
icon: 'carbon:text-font',
|
|
322
|
-
onMount: (api) => mountApp(api, () => h(HstTokenList, {
|
|
323
|
-
tokens: flattenTokens(config.letterSpacings),
|
|
324
|
-
getName: key => '{letterSpacings.' + key + '}',
|
|
325
|
-
}, ({ token }) => h('div', {
|
|
326
|
-
class: '__pvt-truncate',
|
|
327
|
-
style: {
|
|
328
|
-
letterSpacing: token.value,
|
|
329
|
-
fontSize: \`\${fontSize.value}px\`,
|
|
330
|
-
},
|
|
331
|
-
}, sampleText.value))),
|
|
332
|
-
onMountControls: (api) => mountApp(api, () => [
|
|
333
|
-
h(HstTextarea, {
|
|
334
|
-
title: 'Sample text',
|
|
335
|
-
modelValue: sampleText.value,
|
|
336
|
-
'onUpdate:modelValue': value => { sampleText.value = value },
|
|
337
|
-
rows: 5,
|
|
338
|
-
}),
|
|
339
|
-
h(HstNumber, {
|
|
340
|
-
title: 'Font size',
|
|
341
|
-
modelValue: fontSize.value,
|
|
342
|
-
'onUpdate:modelValue': value => { fontSize.value = value },
|
|
343
|
-
min: 1,
|
|
344
|
-
}),
|
|
345
|
-
]),
|
|
346
|
-
},
|
|
347
|
-
// LEADS
|
|
348
|
-
{
|
|
349
|
-
id: 'leads',
|
|
350
|
-
title: 'Leads',
|
|
351
|
-
icon: 'carbon:text-font',
|
|
352
|
-
onMount: (api) => mountApp(api, () => h(HstTokenList, {
|
|
353
|
-
tokens: flattenTokens(config.leads),
|
|
354
|
-
getName: key => '{leads.' + key + '}',
|
|
355
|
-
}, ({ token }) => h('div', {
|
|
356
|
-
style: {
|
|
357
|
-
lineHeight: token.value,
|
|
358
|
-
},
|
|
359
|
-
}, sampleText.value))),
|
|
360
|
-
onMountControls: (api) => mountApp(api, () => [
|
|
361
|
-
h(HstTextarea, {
|
|
362
|
-
title: 'Sample text',
|
|
363
|
-
modelValue: sampleText.value,
|
|
364
|
-
'onUpdate:modelValue': value => { sampleText.value = value },
|
|
365
|
-
rows: 5,
|
|
366
|
-
}),
|
|
367
|
-
// @TODO select font size
|
|
368
|
-
]),
|
|
369
|
-
},
|
|
370
|
-
// SHADOWS
|
|
371
|
-
{
|
|
372
|
-
id: 'shadows',
|
|
373
|
-
title: 'Shadows',
|
|
374
|
-
icon: 'carbon:shape-except',
|
|
375
|
-
onMount: (api) => mountApp(api, () => h(HstTokenGrid, {
|
|
376
|
-
tokens: flattenTokens(config.shadows),
|
|
377
|
-
getName: key => '{shadows.' + key + '}',
|
|
378
|
-
colSize: 180,
|
|
379
|
-
}, ({ token }) => h('div', {
|
|
380
|
-
class: '__pvt-drop-shadow',
|
|
381
|
-
style: 'box-shadow:' + token.value,
|
|
382
|
-
}))),
|
|
383
|
-
},
|
|
384
|
-
// OPACITIES
|
|
385
|
-
{
|
|
386
|
-
id: 'opacities',
|
|
387
|
-
title: 'Opacities',
|
|
388
|
-
icon: 'carbon:bring-forward',
|
|
389
|
-
onMount: (api) => mountApp(api, () => h(HstTokenGrid, {
|
|
390
|
-
tokens: flattenTokens(config.opacity),
|
|
391
|
-
getName: key => '{opacity.' + key + '}',
|
|
392
|
-
colSize: 180,
|
|
393
|
-
}, ({ token }) => h('div', {
|
|
394
|
-
class: '__pvt-drop-shadow',
|
|
395
|
-
style: 'opacity:' + token.value,
|
|
396
|
-
}))),
|
|
397
|
-
},
|
|
398
|
-
// RADII
|
|
399
|
-
{
|
|
400
|
-
id: 'border-radius',
|
|
401
|
-
title: 'Border Radius',
|
|
402
|
-
icon: 'carbon:condition-wait-point',
|
|
403
|
-
onMount: (api) => mountApp(api, () => h(HstTokenGrid, {
|
|
404
|
-
tokens: flattenTokens(config.radii),
|
|
405
|
-
getName: key => '{radii.' + key + '}',
|
|
406
|
-
colSize: 180,
|
|
407
|
-
}, ({ token }) => h('div', {
|
|
408
|
-
class: '__pvt-border-radius',
|
|
409
|
-
style: {
|
|
410
|
-
borderRadius: token.value,
|
|
411
|
-
},
|
|
412
|
-
}))),
|
|
413
|
-
},
|
|
414
|
-
// BORDERWIDTHS
|
|
415
|
-
{
|
|
416
|
-
id: 'border-width',
|
|
417
|
-
title: 'Border Width',
|
|
418
|
-
icon: 'carbon:checkbox',
|
|
419
|
-
onMount: (api) => mountApp(api, () => h(HstTokenGrid, {
|
|
420
|
-
tokens: flattenTokens(config.borderWidths),
|
|
421
|
-
getName: key => '{borderWidths.' + key + '}',
|
|
422
|
-
colSize: 180,
|
|
423
|
-
}, ({ token }) => h('div', {
|
|
424
|
-
class: '__pvt-border-width',
|
|
425
|
-
style: {
|
|
426
|
-
borderWidth: token.value,
|
|
427
|
-
},
|
|
428
|
-
}))),
|
|
429
|
-
},
|
|
430
|
-
// FULL CONFIG
|
|
431
|
-
{
|
|
432
|
-
id: 'full-config',
|
|
433
|
-
title: 'Full Config',
|
|
434
|
-
icon: 'carbon:code',
|
|
435
|
-
onMount: (api) => mountApp(api, () => h('pre', JSON.stringify(config, null, 2))),
|
|
436
|
-
},
|
|
437
|
-
],
|
|
438
|
-
}`
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
const css = `.__pvt-shade {
|
|
442
|
-
height: 80px;
|
|
443
|
-
border-radius: 4px;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
.__pvt-text {
|
|
447
|
-
font-size: 4rem;
|
|
448
|
-
display: flex;
|
|
449
|
-
align-items: flex-end;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
.__pvt-border {
|
|
453
|
-
border-style: solid;
|
|
454
|
-
border-width: 2px;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
.__pvt-spaces {
|
|
458
|
-
background-color: rgb(113 113 122 / 0.1);
|
|
459
|
-
width: min-content;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
.__pvt-margin {
|
|
463
|
-
border: dashed 1px rgb(113 113 122 / 0.5);
|
|
464
|
-
width: min-content;
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
.__pvt-spaces-box,
|
|
468
|
-
.__pvt-margin-box {
|
|
469
|
-
width: 5rem;
|
|
470
|
-
height: 5rem;
|
|
471
|
-
background-color: rgb(113 113 122 / 0.5);
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
.__pvt-spaces,
|
|
475
|
-
.__pvt-spaces-box,
|
|
476
|
-
.__pvt-margin,
|
|
477
|
-
.__pvt-margin-box,
|
|
478
|
-
.__pvt-drop-shadow {
|
|
479
|
-
border-radius: 4px;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
.__pvt-truncate {
|
|
483
|
-
overflow: hidden;
|
|
484
|
-
text-overflow: ellipsis;
|
|
485
|
-
white-space: nowrap;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
.__pvt-drop-shadow {
|
|
489
|
-
width: 8rem;
|
|
490
|
-
height: 8rem;
|
|
491
|
-
background: white;
|
|
492
|
-
margin-bottom: 0.5rem;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
.__pvt-drop-shadow {
|
|
496
|
-
background: #4e4e57;
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
.__pvt-border-radius {
|
|
500
|
-
width: 8rem;
|
|
501
|
-
height: 8rem;
|
|
502
|
-
background-color: rgb(113 113 122 / 0.5);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
.__pvt-border-width {
|
|
506
|
-
width: 8rem;
|
|
507
|
-
height: 8rem;
|
|
508
|
-
border-color: rgb(113 113 122 / 0.5);
|
|
509
|
-
background-color: rgb(113 113 122 / 0.1);
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
.__pvt-width {
|
|
513
|
-
background-color: rgb(113 113 122 / 0.1);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
.__pvt-width-box,
|
|
517
|
-
.__pvt-height {
|
|
518
|
-
background-color: rgb(113 113 122 / 0.5);
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
.__pvt-width-box {
|
|
522
|
-
height: 5rem;
|
|
523
|
-
}`
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import type { Story } from '@poveste/shared'
|
|
2
|
-
import type { PropType as _PropType } from '@poveste/vendors/vue'
|
|
3
|
-
import type { StoryOptions, VariantOptions } from './types'
|
|
4
|
-
import { defineComponent as _defineComponent } from '@poveste/vendors/vue'
|
|
5
|
-
|
|
6
|
-
export default _defineComponent({
|
|
7
|
-
name: 'MountStory',
|
|
8
|
-
|
|
9
|
-
props: {
|
|
10
|
-
story: {
|
|
11
|
-
type: Object as _PropType<Story>,
|
|
12
|
-
required: true,
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
setup(props) {
|
|
17
|
-
const options = props.story.file.component as StoryOptions
|
|
18
|
-
|
|
19
|
-
let rawVariants: VariantOptions[] = []
|
|
20
|
-
|
|
21
|
-
if (options.onMount) {
|
|
22
|
-
rawVariants = [{
|
|
23
|
-
id: '_default',
|
|
24
|
-
title: 'default',
|
|
25
|
-
onMount: options.onMount,
|
|
26
|
-
onMountControls: options.onMountControls,
|
|
27
|
-
}]
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
rawVariants = options.variants
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
for (const index in props.story.variants) {
|
|
34
|
-
const rawVariant = rawVariants[index]
|
|
35
|
-
Object.assign(props.story.variants[index], {
|
|
36
|
-
slots: () => ({ default: rawVariant.onMount, controls: rawVariant.onMountControls }),
|
|
37
|
-
source: rawVariant.source ?? options.source,
|
|
38
|
-
responsiveDisabled: rawVariant.responsiveDisabled ?? options.responsiveDisabled,
|
|
39
|
-
autoPropsDisabled: rawVariant.autoPropsDisabled ?? options.autoPropsDisabled,
|
|
40
|
-
setupApp: rawVariant.setupApp ?? options.setupApp,
|
|
41
|
-
configReady: true,
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
render() {
|
|
47
|
-
return null
|
|
48
|
-
},
|
|
49
|
-
})
|