update js

This commit is contained in:
pengfei.zhou 2020-01-03 16:35:04 +08:00 committed by osborn
parent 4b3a370f5f
commit 680b95f05d
18 changed files with 124 additions and 141 deletions

71
doric-js/index.d.ts vendored
View File

@ -140,6 +140,13 @@ declare module 'doric/lib/src/ui/view' {
*/ */
rotation?: number; rotation?: number;
} }
export type NativeViewModel = {
id: string;
type: string;
props: {
[index: string]: Model;
};
};
export abstract class View implements Modeling, IView { export abstract class View implements Modeling, IView {
width: number; width: number;
height: number; height: number;
@ -193,24 +200,12 @@ declare module 'doric/lib/src/ui/view' {
get dirtyProps(): { get dirtyProps(): {
[index: string]: Model; [index: string]: Model;
}; };
nativeViewModel: { nativeViewModel: NativeViewModel;
id: string;
type: string;
props: {
[index: string]: Model;
};
};
onPropertyChanged(propKey: string, oldV: Model, newV: Model): void; onPropertyChanged(propKey: string, oldV: Model, newV: Model): void;
clean(): void; clean(): void;
isDirty(): boolean; isDirty(): boolean;
responseCallback(id: string, ...args: any): any; responseCallback(id: string, ...args: any): any;
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: Model;
};
};
let(block: (it: this) => void): void; let(block: (it: this) => void): void;
also(block: (it: this) => void): this; also(block: (it: this) => void): this;
apply(config: IView): this; apply(config: IView): this;
@ -238,13 +233,7 @@ declare module 'doric/lib/src/ui/view' {
abstract allSubviews(): Iterable<View>; abstract allSubviews(): Iterable<View>;
isDirty(): boolean; isDirty(): boolean;
clean(): void; clean(): void;
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: Model;
};
};
} }
export abstract class Group extends Superview { export abstract class Group extends Superview {
readonly children: View[]; readonly children: View[];
@ -481,7 +470,7 @@ declare module 'doric/lib/src/widget/image' {
} }
declare module 'doric/lib/src/widget/list' { declare module 'doric/lib/src/widget/list' {
import { View, Superview, IView } from "doric/lib/src/ui/view"; import { View, Superview, IView, NativeViewModel } from "doric/lib/src/ui/view";
import { Stack } from "doric/lib/src/widget/layouts"; import { Stack } from "doric/lib/src/widget/layouts";
export class ListItem extends Stack { export class ListItem extends Stack {
/** /**
@ -504,13 +493,7 @@ declare module 'doric/lib/src/widget/list' {
loadMoreView?: ListItem; loadMoreView?: ListItem;
reset(): void; reset(): void;
isDirty(): boolean; isDirty(): boolean;
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: import("../..").Model;
};
};
} }
export function list(config: IList): List; export function list(config: IList): List;
export function listItem(item: View): ListItem; export function listItem(item: View): ListItem;
@ -547,7 +530,7 @@ declare module 'doric/lib/src/widget/slider' {
} }
declare module 'doric/lib/src/widget/scroller' { declare module 'doric/lib/src/widget/scroller' {
import { Superview, View, IView } from 'doric/lib/src/ui/view'; import { Superview, View, IView, NativeViewModel } from 'doric/lib/src/ui/view';
export function scroller(content: View): Scroller; export function scroller(content: View): Scroller;
export interface IScroller extends IView { export interface IScroller extends IView {
content: View; content: View;
@ -555,18 +538,12 @@ declare module 'doric/lib/src/widget/scroller' {
export class Scroller extends Superview implements IScroller { export class Scroller extends Superview implements IScroller {
content: View; content: View;
allSubviews(): View[]; allSubviews(): View[];
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: import("../..").Model;
};
};
} }
} }
declare module 'doric/lib/src/widget/refreshable' { declare module 'doric/lib/src/widget/refreshable' {
import { View, Superview, IView } from "doric/lib/src/ui/view"; import { View, Superview, IView, NativeViewModel } from "doric/lib/src/ui/view";
import { List } from "doric/lib/src/widget/list"; import { List } from "doric/lib/src/widget/list";
import { Scroller } from "doric/lib/src/widget/scroller"; import { Scroller } from "doric/lib/src/widget/scroller";
import { BridgeContext } from "doric/lib/src/runtime/global"; import { BridgeContext } from "doric/lib/src/runtime/global";
@ -584,13 +561,7 @@ declare module 'doric/lib/src/widget/refreshable' {
setRefreshing(context: BridgeContext, refreshing: boolean): Promise<any>; setRefreshing(context: BridgeContext, refreshing: boolean): Promise<any>;
isRefreshable(context: BridgeContext): Promise<boolean>; isRefreshable(context: BridgeContext): Promise<boolean>;
isRefreshing(context: BridgeContext): Promise<boolean>; isRefreshing(context: BridgeContext): Promise<boolean>;
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: import("../..").Model;
};
};
} }
export function refreshable(config: IRefreshable): Refreshable; export function refreshable(config: IRefreshable): Refreshable;
export interface IPullable { export interface IPullable {
@ -603,7 +574,7 @@ declare module 'doric/lib/src/widget/refreshable' {
declare module 'doric/lib/src/widget/flowlayout' { declare module 'doric/lib/src/widget/flowlayout' {
import { Stack } from 'doric/lib/src/widget/layouts'; import { Stack } from 'doric/lib/src/widget/layouts';
import { IView, Superview, View } from 'doric/lib/src/ui/view'; import { IView, Superview, View, NativeViewModel } from 'doric/lib/src/ui/view';
export class FlowLayoutItem extends Stack { export class FlowLayoutItem extends Stack {
/** /**
* Set to reuse native view * Set to reuse native view
@ -631,13 +602,7 @@ declare module 'doric/lib/src/widget/flowlayout' {
loadMoreView?: FlowLayoutItem; loadMoreView?: FlowLayoutItem;
reset(): void; reset(): void;
isDirty(): boolean; isDirty(): boolean;
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: import("../util/types").Model;
};
};
} }
export function flowlayout(config: IFlowLayout): FlowLayout; export function flowlayout(config: IFlowLayout): FlowLayout;
export function flowItem(item: View): FlowLayoutItem; export function flowItem(item: View): FlowLayoutItem;

View File

@ -57,6 +57,13 @@ export interface IView {
*/ */
rotation?: number; rotation?: number;
} }
export declare type NativeViewModel = {
id: string;
type: string;
props: {
[index: string]: Model;
};
};
export declare abstract class View implements Modeling, IView { export declare abstract class View implements Modeling, IView {
width: number; width: number;
height: number; height: number;
@ -114,24 +121,12 @@ export declare abstract class View implements Modeling, IView {
get dirtyProps(): { get dirtyProps(): {
[index: string]: Model; [index: string]: Model;
}; };
nativeViewModel: { nativeViewModel: NativeViewModel;
id: string;
type: string;
props: {
[index: string]: Model;
};
};
onPropertyChanged(propKey: string, oldV: Model, newV: Model): void; onPropertyChanged(propKey: string, oldV: Model, newV: Model): void;
clean(): void; clean(): void;
isDirty(): boolean; isDirty(): boolean;
responseCallback(id: string, ...args: any): any; responseCallback(id: string, ...args: any): any;
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: Model;
};
};
let(block: (it: this) => void): void; let(block: (it: this) => void): void;
also(block: (it: this) => void): this; also(block: (it: this) => void): this;
apply(config: IView): this; apply(config: IView): this;
@ -159,13 +154,7 @@ export declare abstract class Superview extends View {
abstract allSubviews(): Iterable<View>; abstract allSubviews(): Iterable<View>;
isDirty(): boolean; isDirty(): boolean;
clean(): void; clean(): void;
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: Model;
};
};
} }
export declare abstract class Group extends Superview { export declare abstract class Group extends Superview {
readonly children: View[]; readonly children: View[];

View File

@ -1,5 +1,5 @@
import { Stack } from './layouts'; import { Stack } from './layouts';
import { IView, Superview, View } from '../ui/view'; import { IView, Superview, View, NativeViewModel } from '../ui/view';
export declare class FlowLayoutItem extends Stack { export declare class FlowLayoutItem extends Stack {
/** /**
* Set to reuse native view * Set to reuse native view
@ -31,13 +31,7 @@ export declare class FlowLayout extends Superview implements IFlowLayout {
private getItem; private getItem;
isDirty(): boolean; isDirty(): boolean;
private renderBunchedItems; private renderBunchedItems;
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: import("../util/types").Model;
};
};
} }
export declare function flowlayout(config: IFlowLayout): FlowLayout; export declare function flowlayout(config: IFlowLayout): FlowLayout;
export declare function flowItem(item: View): FlowLayoutItem; export declare function flowItem(item: View): FlowLayoutItem;

View File

@ -1,4 +1,4 @@
import { View, Superview, IView } from "../ui/view"; import { View, Superview, IView, NativeViewModel } from "../ui/view";
import { Stack } from "./layouts"; import { Stack } from "./layouts";
export declare class ListItem extends Stack { export declare class ListItem extends Stack {
/** /**
@ -25,13 +25,7 @@ export declare class List extends Superview implements IList {
private getItem; private getItem;
isDirty(): boolean; isDirty(): boolean;
private renderBunchedItems; private renderBunchedItems;
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: import("../..").Model;
};
};
} }
export declare function list(config: IList): List; export declare function list(config: IList): List;
export declare function listItem(item: View): ListItem; export declare function listItem(item: View): ListItem;

View File

@ -1,4 +1,4 @@
import { View, Superview, IView } from "../ui/view"; import { View, Superview, IView, NativeViewModel } from "../ui/view";
import { List } from "./list"; import { List } from "./list";
import { Scroller } from "./scroller"; import { Scroller } from "./scroller";
import { BridgeContext } from "../runtime/global"; import { BridgeContext } from "../runtime/global";
@ -16,13 +16,7 @@ export declare class Refreshable extends Superview implements IRefreshable {
setRefreshing(context: BridgeContext, refreshing: boolean): Promise<any>; setRefreshing(context: BridgeContext, refreshing: boolean): Promise<any>;
isRefreshable(context: BridgeContext): Promise<boolean>; isRefreshable(context: BridgeContext): Promise<boolean>;
isRefreshing(context: BridgeContext): Promise<boolean>; isRefreshing(context: BridgeContext): Promise<boolean>;
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: import("../..").Model;
};
};
} }
export declare function refreshable(config: IRefreshable): Refreshable; export declare function refreshable(config: IRefreshable): Refreshable;
export interface IPullable { export interface IPullable {

View File

@ -1,4 +1,4 @@
import { Superview, View, IView } from '../ui/view'; import { Superview, View, IView, NativeViewModel } from '../ui/view';
export declare function scroller(content: View): Scroller; export declare function scroller(content: View): Scroller;
export interface IScroller extends IView { export interface IScroller extends IView {
content: View; content: View;
@ -6,11 +6,5 @@ export interface IScroller extends IView {
export declare class Scroller extends Superview implements IScroller { export declare class Scroller extends Superview implements IScroller {
content: View; content: View;
allSubviews(): View[]; allSubviews(): View[];
toModel(): { toModel(): NativeViewModel;
id: string;
type: string;
props: {
[index: string]: import("../..").Model;
};
};
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "doric", "name": "doric",
"version": "0.2.2-alpha.2", "version": "0.2.2-alpha.3",
"description": "The JS Framework of Doric", "description": "The JS Framework of Doric",
"main": "bundle/doric-vm.js", "main": "bundle/doric-vm.js",
"types": "index.d.ts", "types": "index.d.ts",

View File

@ -70,6 +70,13 @@ export interface IView {
/**----------transform----------*/ /**----------transform----------*/
} }
export type NativeViewModel = {
id: string;
type: string;
props: {
[index: string]: Model;
};
}
export abstract class View implements Modeling, IView { export abstract class View implements Modeling, IView {
@Property @Property
@ -206,7 +213,7 @@ export abstract class View implements Modeling, IView {
return this.__dirty_props__ return this.__dirty_props__
} }
nativeViewModel = { nativeViewModel: NativeViewModel = {
id: this.viewId, id: this.viewId,
type: this.constructor.name, type: this.constructor.name,
props: this.__dirty_props__, props: this.__dirty_props__,

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { Stack } from './layouts' import { Stack } from './layouts'
import { Property, IView, Superview, View } from '../ui/view' import { Property, IView, Superview, View, NativeViewModel } from '../ui/view'
import { layoutConfig } from '../util/index.util' import { layoutConfig } from '../util/index.util'
export class FlowLayoutItem extends Stack { export class FlowLayoutItem extends Stack {
@ -105,7 +105,7 @@ export class FlowLayout extends Superview implements IFlowLayout {
}) })
} }
toModel() { toModel(): NativeViewModel {
if (this.loadMoreView) { if (this.loadMoreView) {
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId
} }

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import { View, Property, Superview, IView } from "../ui/view"; import { View, Property, Superview, IView, NativeViewModel } from "../ui/view";
import { Stack } from "./layouts"; import { Stack } from "./layouts";
import { layoutConfig, LayoutSpec } from "../util/layoutconfig"; import { layoutConfig, LayoutSpec } from "../util/layoutconfig";
@ -93,7 +93,7 @@ export class List extends Superview implements IList {
}) })
} }
toModel() { toModel(): NativeViewModel {
if (this.loadMoreView) { if (this.loadMoreView) {
this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId this.dirtyProps['loadMoreView'] = this.loadMoreView.viewId
} }

View File

@ -1,4 +1,4 @@
import { View, Property, Superview, IView } from "../ui/view"; import { View, Property, Superview, IView, NativeViewModel } from "../ui/view";
import { List } from "./list"; import { List } from "./list";
import { Scroller } from "./scroller"; import { Scroller } from "./scroller";
import { BridgeContext } from "../runtime/global"; import { BridgeContext } from "../runtime/global";
@ -43,7 +43,7 @@ export class Refreshable extends Superview implements IRefreshable {
return this.nativeChannel(context, 'isRefreshing')() as Promise<boolean> return this.nativeChannel(context, 'isRefreshing')() as Promise<boolean>
} }
toModel() { toModel(): NativeViewModel {
this.dirtyProps.content = this.content.viewId this.dirtyProps.content = this.content.viewId
this.dirtyProps.header = ((this.header || {}) as any).viewId this.dirtyProps.header = ((this.header || {}) as any).viewId
return super.toModel() return super.toModel()

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import { Superview, View, IView } from '../ui/view' import { Superview, View, IView, NativeViewModel } from '../ui/view'
import { layoutConfig } from '../util/layoutconfig' import { layoutConfig } from '../util/layoutconfig'
export function scroller(content: View) { export function scroller(content: View) {
@ -34,7 +34,7 @@ export class Scroller extends Superview implements IScroller {
return [this.content] return [this.content]
} }
toModel() { toModel(): NativeViewModel {
this.dirtyProps.content = this.content.viewId this.dirtyProps.content = this.content.viewId
return super.toModel() return super.toModel()
} }

View File

@ -3664,7 +3664,7 @@ return __module.exports;
},this,[{exports:{}}])]); },this,[{exports:{}}])]);
/**--------Lib--------*/ /**--------Lib--------*/
(function (axios, sandbox) { var doric_web = (function (exports, axios, sandbox) {
'use strict'; 'use strict';
axios = axios && axios.hasOwnProperty('default') ? axios['default'] : axios; axios = axios && axios.hasOwnProperty('default') ? axios['default'] : axios;
@ -3698,12 +3698,11 @@ return __module.exports;
} }
} }
var LayoutSpec;
(function (LayoutSpec) { (function (LayoutSpec) {
LayoutSpec[LayoutSpec["EXACTLY"] = 0] = "EXACTLY"; LayoutSpec[LayoutSpec["EXACTLY"] = 0] = "EXACTLY";
LayoutSpec[LayoutSpec["WRAP_CONTENT"] = 1] = "WRAP_CONTENT"; LayoutSpec[LayoutSpec["WRAP_CONTENT"] = 1] = "WRAP_CONTENT";
LayoutSpec[LayoutSpec["AT_MOST"] = 2] = "AT_MOST"; LayoutSpec[LayoutSpec["AT_MOST"] = 2] = "AT_MOST";
})(LayoutSpec || (LayoutSpec = {})); })(exports.LayoutSpec || (exports.LayoutSpec = {}));
const SPECIFIED = 1; const SPECIFIED = 1;
const START = 1 << 1; const START = 1 << 1;
const END = 1 << 2; const END = 1 << 2;
@ -3715,6 +3714,7 @@ return __module.exports;
const BOTTOM = (END | SPECIFIED) << SHIFT_Y; const BOTTOM = (END | SPECIFIED) << SHIFT_Y;
const CENTER_X = SPECIFIED << SHIFT_X; const CENTER_X = SPECIFIED << SHIFT_X;
const CENTER_Y = SPECIFIED << SHIFT_Y; const CENTER_Y = SPECIFIED << SHIFT_Y;
const CENTER = CENTER_X | CENTER_Y;
function toPixelString(v) { function toPixelString(v) {
return `${v}px`; return `${v}px`;
} }
@ -3737,8 +3737,8 @@ return __module.exports;
this.viewId = ""; this.viewId = "";
this.viewType = "View"; this.viewType = "View";
this.layoutConfig = { this.layoutConfig = {
widthSpec: LayoutSpec.EXACTLY, widthSpec: exports.LayoutSpec.EXACTLY,
heightSpec: LayoutSpec.EXACTLY, heightSpec: exports.LayoutSpec.EXACTLY,
alignment: 0, alignment: 0,
weight: 0, weight: 0,
margin: { margin: {
@ -3804,13 +3804,13 @@ return __module.exports;
} }
configWidth() { configWidth() {
switch (this.layoutConfig.widthSpec) { switch (this.layoutConfig.widthSpec) {
case LayoutSpec.WRAP_CONTENT: case exports.LayoutSpec.WRAP_CONTENT:
this.view.style.width = "max-content"; this.view.style.width = "max-content";
break; break;
case LayoutSpec.AT_MOST: case exports.LayoutSpec.AT_MOST:
this.view.style.width = "100%"; this.view.style.width = "100%";
break; break;
case LayoutSpec.EXACTLY: case exports.LayoutSpec.EXACTLY:
default: default:
this.view.style.width = toPixelString(this.frameWidth this.view.style.width = toPixelString(this.frameWidth
- this.paddingLeft - this.paddingRight - this.paddingLeft - this.paddingRight
@ -3820,13 +3820,13 @@ return __module.exports;
} }
configHeight() { configHeight() {
switch (this.layoutConfig.heightSpec) { switch (this.layoutConfig.heightSpec) {
case LayoutSpec.WRAP_CONTENT: case exports.LayoutSpec.WRAP_CONTENT:
this.view.style.height = "max-content"; this.view.style.height = "max-content";
break; break;
case LayoutSpec.AT_MOST: case exports.LayoutSpec.AT_MOST:
this.view.style.height = "100%"; this.view.style.height = "100%";
break; break;
case LayoutSpec.EXACTLY: case exports.LayoutSpec.EXACTLY:
default: default:
this.view.style.height = toPixelString(this.frameHeight this.view.style.height = toPixelString(this.frameHeight
- this.paddingTop - this.paddingBottom - this.paddingTop - this.paddingBottom
@ -4135,13 +4135,13 @@ return __module.exports;
}); });
} }
configSize() { configSize() {
if (this.layoutConfig.widthSpec === LayoutSpec.WRAP_CONTENT) { if (this.layoutConfig.widthSpec === exports.LayoutSpec.WRAP_CONTENT) {
const width = this.childNodes.reduce((prev, current) => { const width = this.childNodes.reduce((prev, current) => {
return Math.max(prev, current.view.offsetWidth); return Math.max(prev, current.view.offsetWidth);
}, 0); }, 0);
this.view.style.width = toPixelString(width); this.view.style.width = toPixelString(width);
} }
if (this.layoutConfig.heightSpec === LayoutSpec.WRAP_CONTENT) { if (this.layoutConfig.heightSpec === exports.LayoutSpec.WRAP_CONTENT) {
const height = this.childNodes.reduce((prev, current) => { const height = this.childNodes.reduce((prev, current) => {
return Math.max(prev, current.view.offsetHeight); return Math.max(prev, current.view.offsetHeight);
}, 0); }, 0);
@ -4762,6 +4762,9 @@ return __module.exports;
function acquireJSBundle(name) { function acquireJSBundle(name) {
return bundles.get(name); return bundles.get(name);
} }
function registerJSBundle(name, bundle) {
bundles.set(name, bundle);
}
function registerPlugin(name, plugin) { function registerPlugin(name, plugin) {
plugins.set(name, plugin); plugins.set(name, plugin);
} }
@ -4978,10 +4981,15 @@ ${content}
} }
connectedCallback() { connectedCallback() {
if (this.src && this.context === undefined) { if (this.src && this.context === undefined) {
if (this.src.startsWith("http")) {
axios.get(this.src).then(result => { axios.get(this.src).then(result => {
this.load(result.data); this.load(result.data);
}); });
} }
else {
this.load(this.src);
}
}
} }
disconnectedCallback() { disconnectedCallback() {
} }
@ -5046,5 +5054,33 @@ ${content}
window.customElements.define('doric-div', DoricElement); window.customElements.define('doric-div', DoricElement);
window.customElements.define('doric-navigation', NavigationElement); window.customElements.define('doric-navigation', NavigationElement);
}(axios, doric)); exports.BOTTOM = BOTTOM;
exports.CENTER = CENTER;
exports.CENTER_X = CENTER_X;
exports.CENTER_Y = CENTER_Y;
exports.DoricElement = DoricElement;
exports.DoricGroupViewNode = DoricGroupViewNode;
exports.DoricPlugin = DoricPlugin;
exports.DoricSuperNode = DoricSuperNode;
exports.DoricViewNode = DoricViewNode;
exports.LEFT = LEFT;
exports.NavigationElement = NavigationElement;
exports.RIGHT = RIGHT;
exports.TOP = TOP;
exports.acquireJSBundle = acquireJSBundle;
exports.acquirePlugin = acquirePlugin;
exports.acquireViewNode = acquireViewNode;
exports.createContext = createContext;
exports.destroyContext = destroyContext;
exports.injectGlobalObject = injectGlobalObject;
exports.loadJS = loadJS;
exports.registerJSBundle = registerJSBundle;
exports.registerPlugin = registerPlugin;
exports.registerViewNode = registerViewNode;
exports.toPixelString = toPixelString;
exports.toRGBAString = toRGBAString;
return exports;
}({}, axios, doric));
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map

File diff suppressed because one or more lines are too long

View File

@ -2,3 +2,9 @@ import { DoricElement } from './src/DoricElement'
import { NavigationElement } from './src/navigate/NavigationElement' import { NavigationElement } from './src/navigate/NavigationElement'
window.customElements.define('doric-div', DoricElement); window.customElements.define('doric-div', DoricElement);
window.customElements.define('doric-navigation', NavigationElement); window.customElements.define('doric-navigation', NavigationElement);
export * from './src/DoricElement'
export * from './src/navigate/NavigationElement'
export * from './src/DoricPlugin'
export * from './src/DoricRegistry'
export * from './src/DoricDriver'
export * from './src/shader/DoricViewNode'

View File

@ -1,6 +1,6 @@
{ {
"name": "doric-web", "name": "doric-web",
"version": "0.1.0", "version": "0.1.1",
"description": "Doric library for Web", "description": "Doric library for Web",
"main": "build/index.js", "main": "build/index.js",
"scripts": { "scripts": {

View File

@ -26,7 +26,7 @@ export default {
input: `build/index.js`, input: `build/index.js`,
output: { output: {
format: "iife", format: "iife",
name: "index", name: "doric_web",
file: `dist/index.js`, file: `dist/index.js`,
sourcemap: true, sourcemap: true,
banner: builtinScript, banner: builtinScript,

View File

@ -23,9 +23,13 @@ export class DoricElement extends HTMLElement {
connectedCallback() { connectedCallback() {
if (this.src && this.context === undefined) { if (this.src && this.context === undefined) {
if (this.src.startsWith("http")) {
axios.get<string>(this.src).then(result => { axios.get<string>(this.src).then(result => {
this.load(result.data) this.load(result.data)
}) })
} else {
this.load(this.src)
}
} }
} }