Merge branch 'develop'

This commit is contained in:
syuilo 2019-04-29 15:26:43 +09:00
commit 42e84b77e1
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
11 changed files with 105 additions and 33 deletions

View file

@ -42,6 +42,16 @@ mongodb:
8. master ブランチに戻す
9. enjoy
11.6.0 (2019/04/29)
-------------------
### Improvements
* AiScriptにいくつかの文字列操作関数を追加
* ページ編集画面にページへのリンクを表示するように
### Fixes
* MisskeyPagesで数値入力が文字列として扱われる問題を修正
* デザインの調整
11.5.1 (2019/04/29)
-------------------
### Fixes

View file

@ -1847,6 +1847,7 @@ pages:
are-you-sure-delete: "このページを削除しますか?"
page-deleted: "ページを削除しました"
edit-this-page: "このページを編集"
view-page: "ページを見る"
variables: "変数"
variables-info: "変数を使うことで動的なページを作成できます。テキスト内で <b>{ 変数名 }</b> と書くとそこに変数の値を埋め込めます。例えば <b>Hello { thing } world!</b> というテキストで、変数(thing)の値が <b>ai</b> だった場合、テキストは <b>Hello ai world!</b> になります。"
variables-info2: "変数の評価(値を算出すること)は上から下に行われるので、ある変数の中で自分より下の変数を参照することはできません。例えば上から <b>A、B、C</b> と3つの変数を定義したとき、<b>C</b>の中で<b>A</b>や<b>B</b>を参照することはできますが、<b>A</b>の中で<b>B</b>や<b>C</b>を参照することはできません。"
@ -1901,10 +1902,28 @@ pages:
random: "ランダム"
value: "値"
fn: "関数"
text: "テキスト操作"
blocks:
text: "テキスト"
multiLineText: "テキスト(複数行)"
textList: "テキストのリスト"
_textList:
info: "ひとつひとつを改行で区切ってください"
strLen: "テキストの長さ"
_strLen:
arg1: "テキスト"
strPick: "文字取り出し"
_strPick:
arg1: "テキスト"
arg2: "文字の位置"
strReplace: "テキスト置き換え"
_strReplace:
arg1: "テキスト"
arg2: "置き換え前"
arg3: "置き換え後"
strReverse: "テキストを反転"
_strReverse:
arg1: "テキスト"
add: "+ 足す"
_add:
arg1: "A"

View file

@ -1,7 +1,7 @@
{
"name": "misskey",
"author": "syuilo <i@syuilo.com>",
"version": "11.5.1",
"version": "11.6.0",
"codename": "daybreak",
"repository": {
"type": "git",

View file

@ -51,26 +51,30 @@ type TypeError = {
};
const funcDefs = {
if: { in: ['boolean', 0, 0], out: 0, category: 'flow', icon: faShareAlt, },
not: { in: ['boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
or: { in: ['boolean', 'boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
and: { in: ['boolean', 'boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
add: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faPlus, },
subtract: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faMinus, },
multiply: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faTimes, },
divide: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faDivide, },
eq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faEquals, },
notEq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faNotEqual, },
gt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThan, },
lt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThan, },
gtEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThanEqual, },
ltEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThanEqual, },
rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
random: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, },
randomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
dailyRannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
dailyRandom: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, },
dailyRandomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
if: { in: ['boolean', 0, 0], out: 0, category: 'flow', icon: faShareAlt, },
not: { in: ['boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
or: { in: ['boolean', 'boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
and: { in: ['boolean', 'boolean'], out: 'boolean', category: 'logical', icon: faFlag, },
add: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faPlus, },
subtract: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faMinus, },
multiply: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faTimes, },
divide: { in: ['number', 'number'], out: 'number', category: 'operation', icon: faDivide, },
eq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faEquals, },
notEq: { in: [0, 0], out: 'boolean', category: 'comparison', icon: faNotEqual, },
gt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThan, },
lt: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThan, },
gtEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faGreaterThanEqual, },
ltEq: { in: ['number', 'number'], out: 'boolean', category: 'comparison', icon: faLessThanEqual, },
strLen: { in: ['string'], out: 'number', category: 'text', icon: faQuoteRight, },
strPick: { in: ['string', 'number'], out: 'string', category: 'text', icon: faQuoteRight, },
strReplace: { in: ['string', 'string', 'string'], out: 'string', category: 'text', icon: faQuoteRight, },
strReverse: { in: ['string'], out: 'string', category: 'text', icon: faQuoteRight, },
rannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
random: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, },
randomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
dailyRannum: { in: ['number', 'number'], out: 'number', category: 'random', icon: faDice, },
dailyRandom: { in: ['number'], out: 'boolean', category: 'random', icon: faDice, },
dailyRandomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
};
const blockDefs = [
@ -413,6 +417,10 @@ export class AiScript {
subtract: (a, b) => a - b,
multiply: (a, b) => a * b,
divide: (a, b) => a / b,
strLen: (a) => a.length,
strPick: (a, b) => a[b - 1],
strReplace: (a, b, c) => a.split(b).join(c),
strReverse: (a) => a.split('').reverse().join(''),
random: (probability) => Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * 100) < probability,
rannum: (min, max) => min + Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * (max - min + 1)),
randomPick: (list) => list[Math.floor(seedrandom(`${this.opts.randomSeed}:${block.id}`)() * list.length)],

View file

@ -1,7 +1,7 @@
<template>
<div class="felqjxyj" :class="{ splash }">
<div class="bg" ref="bg" @click="onBgClick"></div>
<div class="main" ref="main">
<div class="main" ref="main" :class="{ round: $store.state.device.roundedCorners }">
<template v-if="type == 'signin'">
<mk-signin/>
</template>
@ -229,10 +229,12 @@ export default Vue.extend({
width calc(100% - 32px)
text-align center
background var(--face)
border-radius 8px
color var(--faceText)
opacity 0
&.round
border-radius 8px
> .icon
font-size 32px

View file

@ -43,6 +43,13 @@ export default Vue.extend({
created() {
if (this.value.name == null) Vue.set(this.value, 'name', '');
if (this.value.inputType == null) Vue.set(this.value, 'inputType', 'string');
this.$watch('value.inputType', t => {
if (this.value.default != null) {
if (t === 'number') this.value.default = parseInt(this.value.default, 10);
if (t === 'string') this.value.default = this.value.default.toString();
}
});
},
});
</script>

View file

@ -16,8 +16,8 @@
<section v-else-if="value.type === 'multiLineText'" class="tbwccoaw">
<textarea v-model="value.value"></textarea>
</section>
<section v-else-if="value.type === 'textList'" class="frvuzvoi">
<ui-textarea v-model="value.value"></ui-textarea>
<section v-else-if="value.type === 'textList'" class="tbwccoaw">
<textarea v-model="value.value" :placeholder="$t('script.blocks._textList.info')"></textarea>
</section>
<section v-else-if="value.type === 'number'" class="tbwccoaw">
<input v-model="value.value" type="number"/>

View file

@ -11,6 +11,8 @@
</header>
<section>
<a class="view" v-if="pageId" :href="`/@${ $store.state.i.username }/pages/${ currentName }`" target="_blank"><fa :icon="faExternalLinkSquareAlt"/> {{ $t('view-page') }}</a>
<ui-input v-model="title">
<span>{{ $t('title') }}</span>
</ui-input>
@ -84,7 +86,7 @@
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../../i18n';
import { faICursor, faPlus, faSquareRootAlt, faCog } from '@fortawesome/free-solid-svg-icons';
import { faICursor, faPlus, faSquareRootAlt, faCog, faExternalLinkSquareAlt } from '@fortawesome/free-solid-svg-icons';
import { faSave, faStickyNote, faTrashAlt } from '@fortawesome/free-regular-svg-icons';
import XVariable from './page-editor.script-block.vue';
import XBlock from './page-editor.block.vue';
@ -110,6 +112,7 @@ export default Vue.extend({
data() {
return {
pageId: null,
currentName: null,
title: '',
summary: null,
name: Date.now().toString(),
@ -123,7 +126,7 @@ export default Vue.extend({
showOptions: false,
moreDetails: false,
url,
faPlus, faICursor, faSave, faStickyNote, faSquareRootAlt, faCog, faTrashAlt
faPlus, faICursor, faSave, faStickyNote, faSquareRootAlt, faCog, faTrashAlt, faExternalLinkSquareAlt
};
},
@ -157,6 +160,7 @@ export default Vue.extend({
this.pageId = page.id;
this.title = page.title;
this.name = page.name;
this.currentName = page.name;
this.summary = page.summary;
this.font = page.font;
this.alignCenter = page.alignCenter;
@ -194,6 +198,7 @@ export default Vue.extend({
variables: this.variables,
eyeCatchingImageId: this.eyeCatchingImageId,
}).then(page => {
this.currentName = this.name.trim();
this.$root.dialog({
type: 'success',
text: this.$t('page-updated')
@ -211,6 +216,7 @@ export default Vue.extend({
eyeCatchingImageId: this.eyeCatchingImageId,
}).then(page => {
this.pageId = page.id;
this.currentName = this.name.trim();
this.$root.dialog({
type: 'success',
text: this.$t('page-created')
@ -427,6 +433,10 @@ export default Vue.extend({
@media (max-width 500px)
padding 0 16px 16px 16px
> .view
display inline-block
margin 16px 0 0 0
> .content
margin-bottom 16px

View file

@ -1,7 +1,7 @@
<template>
<component class="dmtdnykelhudezerjlfpbhgovrgnqqgr"
:is="link ? 'a' : 'button'"
:class="{ inline, primary, wait }"
:class="{ inline, primary, wait, round: $store.state.device.roundedCorners }"
:type="type"
@click="$emit('click')"
@mousedown="onMousedown"
@ -116,7 +116,6 @@ export default Vue.extend({
font-size 16px
line-height 24px
border none
border-radius 6px
outline none
box-shadow none
text-decoration none
@ -124,6 +123,9 @@ export default Vue.extend({
color var(--text)
background var(--buttonBg)
&.round
border-radius 6px
&:not(:disabled):hover
background var(--buttonHoverBg)
@ -157,7 +159,9 @@ export default Vue.extend({
bottom -5px
left -5px
border 2px solid var(--primaryAlpha03)
border-radius 10px
&.round:focus:after
border-radius 10px
&:not(.inline) + .dmtdnykelhudezerjlfpbhgovrgnqqgr
margin-top 16px
@ -197,7 +201,6 @@ export default Vue.extend({
left 0
width 100%
height 100%
border-radius 6px
overflow hidden
>>> div
@ -210,6 +213,9 @@ export default Vue.extend({
transform scale(1)
transition all 0.5s cubic-bezier(0, .5, .5, 1)
&.round > .ripples
border-radius 6px
&.primary > .ripples >>> div
background rgba(0, 0, 0, 0.15)

View file

@ -184,7 +184,11 @@ export default Vue.extend({
this.v = v;
},
v(v) {
this.$emit('input', v);
if (this.type === 'number') {
this.$emit('input', parseInt(v, 10));
} else {
this.$emit('input', v);
}
if (this.withPasswordMeter) {
if (v == '') {

View file

@ -1,5 +1,5 @@
<template>
<div>
<div class="hkcxmtwj">
<ui-switch v-model="v">{{ value.text }}</ui-switch>
</div>
</template>
@ -31,3 +31,9 @@ export default Vue.extend({
}
});
</script>
<style lang="stylus" scoped>
.hkcxmtwj
display inline-block
margin 16px auto
</style>