Skip to content

Commit 86d50d2

Browse files
committed
fix: vue - bring back simple demo (without storybook)
1 parent 478b634 commit 86d50d2

File tree

5 files changed

+54
-17
lines changed

5 files changed

+54
-17
lines changed

Diff for: packages/ui-predicate-vue/examples/simple.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ import Vue from 'vue';
22

33
import App from './simple.vue';
44

5-
import uiPredicate from './..';
5+
import UIPredicateCore from '..';
6+
Vue.use(UIPredicateCore);
67

7-
Vue.use(uiPredicate);
8-
9-
new Vue({
8+
// expose for debug purposes
9+
window.Vue = Vue;
10+
window.UIPredicateCore = UIPredicateCore;
11+
window.app = new Vue({
1012
el: '#app',
1113
render: h => h(App),
1214
});

Diff for: packages/ui-predicate-vue/examples/simple.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<template>
22
<div id="app">
33
<h1>Simple ui-predicate usage</h1>
4-
<UIPredicate v-bind:config="config"></UIPredicate>
4+
<ui-predicate :config="config" @onChange="onChange"></ui-predicate>
55
<p>Tips: Use "alt + click" to create a sub-group.</p>
6+
<pre>{{ ast }}</pre>
67
</div>
78
</template>
89

@@ -11,6 +12,7 @@ export default {
1112
name: 'app',
1213
data() {
1314
return {
15+
ast: {},
1416
msg: 'Welcome to Your Vue.js App!',
1517
config: {
1618
operators: [
@@ -99,6 +101,11 @@ export default {
99101
},
100102
};
101103
},
104+
methods: {
105+
onChange(diff) {
106+
this.ast = diff;
107+
},
108+
},
102109
};
103110
</script>
104111

Diff for: packages/ui-predicate-vue/package-lock.json

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: packages/ui-predicate-vue/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"test:watch": "jest --watch --coverage=false",
1212
"test:watch:coverage": "npm run --silent test:watch -- --coverage",
1313
"test:coverage": "true",
14+
"dev":"parcel --no-cache examples/index.html",
1415
"storybook:build": "build-storybook --output-dir ../../docs/packages/$npm_package_name/$npm_package_version/examples",
1516
"storybook:watch": "start-storybook -p 9001",
1617
"image-snapshots": "npm run storybook:build && npm run image-snapshots:run",
@@ -53,7 +54,7 @@
5354
"react": "^16.3.2",
5455
"react-dom": "^16.3.2",
5556
"svg-url-loader": "^2.3.2",
56-
"ui-predicate-core": "0.*",
57+
"ui-predicate-core": "^0.1.0",
5758
"vue-jest": "^2.5.0",
5859
"vue-loader": "^14.2.2",
5960
"vue-template-compiler": "^2.5.16",

Diff for: packages/ui-predicate-vue/src/index.js

+15-11
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,25 @@
1-
const UIPredicateOptions = require('../src/UIPredicateOptions.vue');
2-
const UIPredicateComparison = require('../src/UIPredicateComparison.vue');
3-
const UIPredicateCompound = require('../src/UIPredicateCompound.vue');
4-
const UIPredicate = require('../src/UIPredicate.vue');
1+
const UIPredicateOptions = require('./ui-predicate-options.vue');
2+
const UIPredicateComparison = require('./ui-predicate-comparison.vue');
3+
const UIPredicateCompound = require('./ui-predicate-compound.vue');
4+
const UIPredicate = require('./ui-predicate.vue');
55

66
// not single-source-of-truth, but need it for static refs
77
const components = {
8-
UIPredicateOptions,
9-
UIPredicateComparison,
10-
UIPredicateCompound,
11-
UIPredicate,
8+
// https://w3c.github.io/webcomponents/spec/custom/#concepts
9+
// The custom element type identifies a custom element interface and is a sequence of characters that must match the NCName production,
10+
// must contain a U+002D HYPHEN-MINUS character, and must not contain any uppercase ASCII letters.
11+
'ui-predicate-options': UIPredicateOptions,
12+
'ui-predicate-comparison': UIPredicateComparison,
13+
'ui-predicate-compound': UIPredicateCompound,
14+
'ui-predicate': UIPredicate,
1215
};
1316

1417
// f(Vue, opts = {}) used by Vue.use()
1518
const install = function(Vue) {
16-
Object.keys(components).forEach(name =>
17-
Vue.component(name, components[name].default)
18-
);
19+
Object.keys(components).forEach(name => {
20+
// console.log('Installing %s', name, components[name]);
21+
Vue.component(name, components[name]);
22+
});
1923
};
2024

2125
/* istanbul ignore if */

0 commit comments

Comments
 (0)