@fastkit/vui 0.8.11 → 0.8.15

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.
@@ -20,7 +20,7 @@ function resolveWysiwygLinterFixMessage(message: WysiwygLinterFixMessage) {
20
20
  return typeof message === 'function' ? message() : message;
21
21
  }
22
22
 
23
- function renderIcon(view: EditorView<any>, issue: Issue) {
23
+ function renderIcon(view: EditorView, issue: Issue) {
24
24
  const { level = 'warning' } = issue;
25
25
  const icon = document.createElement('div');
26
26
  const message = resolveWysiwygLinterFixMessage(issue.message);
@@ -81,7 +81,7 @@ export interface WysiwygLinterStorage {
81
81
  }
82
82
 
83
83
  export const WysiwygLinter = createWysiwygExtension((ctx) => {
84
- function showMenu(view: EditorView<any>, issue: Issue, event: Event) {
84
+ function showMenu(view: EditorView, issue: Issue, event: Event) {
85
85
  const message = resolveWysiwygLinterFixMessage(issue.message);
86
86
  const variant = ctx.vui.setting('containedVariant');
87
87
  const scope = ctx.vui.setting(`${issue.level}Scope`);
@@ -166,49 +166,45 @@ export const WysiwygLinter = createWysiwygExtension((ctx) => {
166
166
  };
167
167
  };
168
168
 
169
- return [
170
- new Plugin({
171
- key: new PluginKey('linter'),
172
- state: {
173
- init(_, { doc }) {
174
- return runAll(doc);
175
- },
176
- apply(transaction, oldState) {
177
- return transaction.docChanged
178
- ? runAll(transaction.doc)
179
- : oldState;
180
- },
169
+ const linterPlugin: Plugin<any> = new Plugin({
170
+ key: new PluginKey('linter'),
171
+ state: {
172
+ init(_, { doc }) {
173
+ return runAll(doc);
181
174
  },
182
- props: {
183
- decorations(state) {
184
- return this.getState(state);
185
- },
186
- handleClick(view, _, event) {
187
- const info = getIssueElementByEvent(event.target);
188
- if (!info) {
189
- return false;
190
- }
191
-
192
- const { issue } = info;
193
- const { from, to } = issue;
194
-
195
- const focus = () =>
196
- view.dispatch(
197
- view.state.tr
198
- .setSelection(
199
- TextSelection.create(view.state.doc, from, to),
200
- )
201
- .scrollIntoView(),
202
- );
203
-
204
- focus();
205
-
206
- showMenu(view, issue, event);
207
- return true;
208
- },
175
+ apply(transaction, oldState) {
176
+ return transaction.docChanged ? runAll(transaction.doc) : oldState;
209
177
  },
210
- }),
211
- ];
178
+ },
179
+ props: {
180
+ decorations(state) {
181
+ return linterPlugin.getState(state);
182
+ },
183
+ handleClick(view, _, event) {
184
+ const info = getIssueElementByEvent(event.target);
185
+ if (!info) {
186
+ return false;
187
+ }
188
+
189
+ const { issue } = info;
190
+ const { from, to } = issue;
191
+
192
+ const focus = () =>
193
+ view.dispatch(
194
+ view.state.tr
195
+ .setSelection(TextSelection.create(view.state.doc, from, to))
196
+ .scrollIntoView(),
197
+ );
198
+
199
+ focus();
200
+
201
+ showMenu(view, issue, event);
202
+ return true;
203
+ },
204
+ },
205
+ });
206
+
207
+ return [linterPlugin];
212
208
  },
213
209
  });
214
210
  });
@@ -1,3 +1,7 @@
1
+ @function get-typo-family($level) {
2
+ @return var(--typo-#{$level}-family);
3
+ }
4
+
1
5
  @function get-typo-size($level) {
2
6
  @return var(--typo-#{$level}-size);
3
7
  }
@@ -22,6 +26,10 @@
22
26
  @return var(--typo-#{$level}-color);
23
27
  }
24
28
 
29
+ @mixin typo-family($level) {
30
+ font-family: get-typo-family($level);
31
+ }
32
+
25
33
  @mixin typo-size($level) {
26
34
  font-size: get-typo-size($level);
27
35
  }
@@ -47,6 +55,7 @@
47
55
  }
48
56
 
49
57
  @mixin typo($level) {
58
+ @include typo-family($level);
50
59
  @include typo-size($level);
51
60
  @include typo-weight($level);
52
61
  @include typo-height($level);
@@ -34,6 +34,7 @@
34
34
  --typo-medium-weight: 500;
35
35
 
36
36
  // h1
37
+ --typo-h1-family: inherit;
37
38
  --typo-h1-size: 2.5rem;
38
39
  --typo-h1-weight: 500;
39
40
  --typo-h1-height: 1.2222222222222223;
@@ -42,6 +43,7 @@
42
43
  --typo-h1-color: var(--palette-heading);
43
44
 
44
45
  // h2
46
+ --typo-h2-family: inherit;
45
47
  --typo-h2-size: 1.875rem;
46
48
  --typo-h2-weight: 500;
47
49
  --typo-h2-height: 1.5;
@@ -50,6 +52,7 @@
50
52
  --typo-h2-color: var(--palette-heading);
51
53
 
52
54
  // h3
55
+ --typo-h3-family: inherit;
53
56
  --typo-h3-size: 1.25rem;
54
57
  --typo-h3-weight: 500;
55
58
  --typo-h3-height: 1.5;
@@ -58,6 +61,7 @@
58
61
  --typo-h3-color: var(--palette-heading);
59
62
 
60
63
  // h4
64
+ --typo-h4-family: inherit;
61
65
  --typo-h4-size: 1.25rem;
62
66
  --typo-h4-weight: 400;
63
67
  --typo-h4-height: 1.5;
@@ -66,6 +70,7 @@
66
70
  --typo-h4-color: var(--palette-heading);
67
71
 
68
72
  // h5
73
+ --typo-h5-family: inherit;
69
74
  --typo-h5-size: 0.875rem;
70
75
  --typo-h5-weight: 400;
71
76
  --typo-h5-height: 1.57;
@@ -74,6 +79,7 @@
74
79
  --typo-h5-color: var(--palette-heading);
75
80
 
76
81
  // h6
82
+ --typo-h6-family: inherit;
77
83
  --typo-h6-size: 0.67rem;
78
84
  --typo-h6-weight: 400;
79
85
  --typo-h6-height: 1.5;
@@ -82,12 +88,14 @@
82
88
  --typo-h6-color: var(--palette-heading);
83
89
 
84
90
  // subtitle1
91
+ --typo-subtitle1-family: inherit;
85
92
  --typo-subtitle1-size: 1rem;
86
93
  --typo-subtitle1-weight: 400;
87
94
  --typo-subtitle1-height: 1.75;
88
95
  --typo-subtitle1-spacing: 0.00938em;
89
96
 
90
97
  // subtitle2
98
+ --typo-subtitle2-family: inherit;
91
99
  --typo-subtitle2-size: 0.875rem;
92
100
  --typo-subtitle2-weight: 500;
93
101
  --typo-subtitle2-height: 1.57;
@@ -75,28 +75,15 @@ async function renderTemplate({
75
75
  }
76
76
 
77
77
  function defaultDynamicDest() {
78
- // const pkgDir = findPackageDirSync();
79
- // if (!pkgDir) {
80
- // throw new Error(`missing package directory`);
81
- // }
82
- // return path.join(pkgDir, '.vui');
83
78
  return path.resolve('.vui');
84
79
  }
85
80
 
86
81
  function getBuiltinsDir() {
87
- // const cwd = process.cwd();
88
82
  const pkgDir = findPackageDirSync(undefined, true);
89
83
  if (!pkgDir) {
90
84
  throw new Error(`missing package directory`);
91
85
  }
92
86
 
93
- // For development...
94
- // console.log('■■■', cwd);
95
- // if (cwd.endsWith('/docs')) {
96
- // const result = path.resolve(cwd, '../packages/vui/src/assets/builtins');
97
- // return result;
98
- // }
99
-
100
87
  return path.join(pkgDir, 'node_modules/@fastkit/vui/dist/assets/builtins');
101
88
  }
102
89
 
@@ -112,7 +99,6 @@ export interface ViteVuiPluginOptions
112
99
  __dev?: boolean;
113
100
  }
114
101
 
115
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
116
102
  export interface ViteVuiPluginResultSettings
117
103
  extends Pick<VuiServiceOptions, 'uiSettings' | 'icons'> {
118
104
  colorScheme: string;
@@ -191,11 +177,6 @@ export function viteVuiPlugin(
191
177
  const { dynamicDest: _dynamicDest } = options;
192
178
 
193
179
  if (!_dynamicDest) {
194
- // if (options.__dev) {
195
- // dynamicDest = path.resolve(__dirname, '../../../../docs/.vui');
196
- // } else {
197
- // dynamicDest = defaultDynamicDest();
198
- // }
199
180
  dynamicDest = defaultDynamicDest();
200
181
  } else {
201
182
  dynamicDest = _dynamicDest;
@@ -261,7 +242,6 @@ export {};
261
242
  const ssr = (config as any).ssr || {};
262
243
  ssr.noExternal = ssr.noExternal || [];
263
244
  ssr.noExternal.push(/\/vui\/dist\/assets\//);
264
- // ssr.noExternal.push(/\/fastkit\//);
265
245
 
266
246
  (config as any).ssr = ssr;
267
247
  return config;