feat:Add Base64Resource
This commit is contained in:
parent
5501dd38d9
commit
6402522946
@ -43,6 +43,7 @@ import pub.doric.plugin.StoragePlugin;
|
|||||||
import pub.doric.refresh.RefreshableNode;
|
import pub.doric.refresh.RefreshableNode;
|
||||||
import pub.doric.resource.DoricAssetsLoader;
|
import pub.doric.resource.DoricAssetsLoader;
|
||||||
import pub.doric.resource.DoricAndroidLoader;
|
import pub.doric.resource.DoricAndroidLoader;
|
||||||
|
import pub.doric.resource.DoricBase64Loader;
|
||||||
import pub.doric.resource.DoricLocalLoader;
|
import pub.doric.resource.DoricLocalLoader;
|
||||||
import pub.doric.resource.DoricRemoteLoader;
|
import pub.doric.resource.DoricRemoteLoader;
|
||||||
import pub.doric.resource.DoricResourceManager;
|
import pub.doric.resource.DoricResourceManager;
|
||||||
@ -134,6 +135,7 @@ public class DoricRegistry {
|
|||||||
this.getResourceManager().registerLoader(new DoricAssetsLoader());
|
this.getResourceManager().registerLoader(new DoricAssetsLoader());
|
||||||
this.getResourceManager().registerLoader(new DoricLocalLoader());
|
this.getResourceManager().registerLoader(new DoricLocalLoader());
|
||||||
this.getResourceManager().registerLoader(new DoricRemoteLoader());
|
this.getResourceManager().registerLoader(new DoricRemoteLoader());
|
||||||
|
this.getResourceManager().registerLoader(new DoricBase64Loader());
|
||||||
initRegistry(this);
|
initRegistry(this);
|
||||||
doricJSEngine.setEnvironmentValue(DoricSingleton.getInstance().envMap);
|
doricJSEngine.setEnvironmentValue(DoricSingleton.getInstance().envMap);
|
||||||
DoricSingleton.getInstance().registries.add(new WeakReference<>(this));
|
DoricSingleton.getInstance().registries.add(new WeakReference<>(this));
|
||||||
|
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2021] [Doric.Pub]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package pub.doric.resource;
|
||||||
|
|
||||||
|
import pub.doric.DoricContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: This loads base64 resource
|
||||||
|
* @Author: pengfei.zhou
|
||||||
|
* @CreateDate: 2021/10/22
|
||||||
|
*/
|
||||||
|
public class DoricBase64Loader implements DoricResourceLoader {
|
||||||
|
@Override
|
||||||
|
public String resourceType() {
|
||||||
|
return "base64";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DoricResource load(DoricContext doricContext, String identifier) {
|
||||||
|
return new DoricBase64Resource(doricContext, identifier);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright [2021] [Doric.Pub]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package pub.doric.resource;
|
||||||
|
|
||||||
|
import android.text.TextUtils;
|
||||||
|
import android.util.Base64;
|
||||||
|
import android.util.Pair;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import pub.doric.DoricContext;
|
||||||
|
import pub.doric.async.AsyncResult;
|
||||||
|
import pub.doric.utils.DoricUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: This represents a base64 resource
|
||||||
|
* @Author: pengfei.zhou
|
||||||
|
* @CreateDate: 2021/10/22
|
||||||
|
*/
|
||||||
|
class DoricBase64Resource extends DoricResource {
|
||||||
|
private final String identifier;
|
||||||
|
|
||||||
|
public DoricBase64Resource(DoricContext doricContext, String identifier) {
|
||||||
|
super(doricContext);
|
||||||
|
this.identifier = identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AsyncResult<InputStream> asInputStream() {
|
||||||
|
AsyncResult<InputStream> ret = new AsyncResult<>();
|
||||||
|
Pair<String, String> result = DoricUtils.translateBase64(identifier);
|
||||||
|
if (result != null) {
|
||||||
|
String imageType = result.first;
|
||||||
|
String base64 = result.second;
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(imageType) && !TextUtils.isEmpty(base64)) {
|
||||||
|
try {
|
||||||
|
byte[] data = Base64.decode(base64, Base64.DEFAULT);
|
||||||
|
ret.setResult(new ByteArrayInputStream(data));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ret.setError(new Error("Base64 format error"));
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
@ -374,7 +374,19 @@ public class ImageNode extends ViewNode<ImageView> {
|
|||||||
doricResource.asInputStream().setCallback(new AsyncResult.Callback<InputStream>() {
|
doricResource.asInputStream().setCallback(new AsyncResult.Callback<InputStream>() {
|
||||||
@Override
|
@Override
|
||||||
public void onResult(InputStream result) {
|
public void onResult(InputStream result) {
|
||||||
loadIntoTarget(Glide.with(getContext()).load(result));
|
try {
|
||||||
|
byte[] imageData = new byte[result.available()];
|
||||||
|
result.read(imageData, 0, result.available());
|
||||||
|
loadIntoTarget(Glide.with(getContext()).load(imageData));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
result.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2147,47 +2147,61 @@ var Resource = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
return Resource;
|
return Resource;
|
||||||
}());
|
}());
|
||||||
/** @class */ ((function (_super) {
|
var FileResource = /** @class */ (function (_super) {
|
||||||
__extends$e(FileResource, _super);
|
__extends$e(FileResource, _super);
|
||||||
function FileResource(path) {
|
function FileResource(path) {
|
||||||
return _super.call(this, "file", path) || this;
|
return _super.call(this, "file", path) || this;
|
||||||
}
|
}
|
||||||
return FileResource;
|
return FileResource;
|
||||||
})(Resource));
|
}(Resource));
|
||||||
/** @class */ ((function (_super) {
|
var RemoteResource = /** @class */ (function (_super) {
|
||||||
__extends$e(RemoteResource, _super);
|
__extends$e(RemoteResource, _super);
|
||||||
function RemoteResource(url) {
|
function RemoteResource(url) {
|
||||||
return _super.call(this, "remote", url) || this;
|
return _super.call(this, "remote", url) || this;
|
||||||
}
|
}
|
||||||
return RemoteResource;
|
return RemoteResource;
|
||||||
})(Resource));
|
}(Resource));
|
||||||
|
var Base64Resource = /** @class */ (function (_super) {
|
||||||
|
__extends$e(Base64Resource, _super);
|
||||||
|
function Base64Resource(url) {
|
||||||
|
return _super.call(this, "base64", url) || this;
|
||||||
|
}
|
||||||
|
return Base64Resource;
|
||||||
|
}(Resource));
|
||||||
/**
|
/**
|
||||||
* This is for android platform
|
* This is for android platform
|
||||||
*/
|
*/
|
||||||
/** @class */ ((function (_super) {
|
var DrawableResource = /** @class */ (function (_super) {
|
||||||
__extends$e(DrawableResource, _super);
|
__extends$e(DrawableResource, _super);
|
||||||
function DrawableResource(url) {
|
function DrawableResource(url) {
|
||||||
return _super.call(this, "drawable", url) || this;
|
return _super.call(this, "drawable", url) || this;
|
||||||
}
|
}
|
||||||
return DrawableResource;
|
return DrawableResource;
|
||||||
})(Resource));
|
}(Resource));
|
||||||
/** @class */ ((function (_super) {
|
var RawResource = /** @class */ (function (_super) {
|
||||||
|
__extends$e(RawResource, _super);
|
||||||
|
function RawResource(url) {
|
||||||
|
return _super.call(this, "raw", url) || this;
|
||||||
|
}
|
||||||
|
return RawResource;
|
||||||
|
}(Resource));
|
||||||
|
var AssetResource = /** @class */ (function (_super) {
|
||||||
__extends$e(AssetResource, _super);
|
__extends$e(AssetResource, _super);
|
||||||
function AssetResource(path) {
|
function AssetResource(path) {
|
||||||
return _super.call(this, "assets", path) || this;
|
return _super.call(this, "assets", path) || this;
|
||||||
}
|
}
|
||||||
return AssetResource;
|
return AssetResource;
|
||||||
})(Resource));
|
}(Resource));
|
||||||
/**
|
/**
|
||||||
* This is for iOS platform
|
* This is for iOS platform
|
||||||
*/
|
*/
|
||||||
/** @class */ ((function (_super) {
|
var MainBundleResource = /** @class */ (function (_super) {
|
||||||
__extends$e(MainBundleResource, _super);
|
__extends$e(MainBundleResource, _super);
|
||||||
function MainBundleResource(path) {
|
function MainBundleResource(path) {
|
||||||
return _super.call(this, "mainBundle", path) || this;
|
return _super.call(this, "mainBundle", path) || this;
|
||||||
}
|
}
|
||||||
return MainBundleResource;
|
return MainBundleResource;
|
||||||
})(Resource));
|
}(Resource));
|
||||||
|
|
||||||
var __extends$d = (undefined && undefined.__extends) || (function () {
|
var __extends$d = (undefined && undefined.__extends) || (function () {
|
||||||
var extendStatics = function (d, b) {
|
var extendStatics = function (d, b) {
|
||||||
@ -4371,13 +4385,17 @@ var ModularPanel = /** @class */ (function (_super) {
|
|||||||
|
|
||||||
exports.AlphaAnimation = AlphaAnimation;
|
exports.AlphaAnimation = AlphaAnimation;
|
||||||
exports.AnimationSet = AnimationSet;
|
exports.AnimationSet = AnimationSet;
|
||||||
|
exports.AssetResource = AssetResource;
|
||||||
exports.BOTTOM = BOTTOM;
|
exports.BOTTOM = BOTTOM;
|
||||||
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
||||||
|
exports.Base64Resource = Base64Resource;
|
||||||
exports.CENTER = CENTER;
|
exports.CENTER = CENTER;
|
||||||
exports.CENTER_X = CENTER_X;
|
exports.CENTER_X = CENTER_X;
|
||||||
exports.CENTER_Y = CENTER_Y;
|
exports.CENTER_Y = CENTER_Y;
|
||||||
exports.Color = Color;
|
exports.Color = Color;
|
||||||
exports.Draggable = Draggable;
|
exports.Draggable = Draggable;
|
||||||
|
exports.DrawableResource = DrawableResource;
|
||||||
|
exports.FileResource = FileResource;
|
||||||
exports.FlexLayout = FlexLayout;
|
exports.FlexLayout = FlexLayout;
|
||||||
exports.FlexTypedValue = FlexTypedValue;
|
exports.FlexTypedValue = FlexTypedValue;
|
||||||
exports.FlowLayout = FlowLayout;
|
exports.FlowLayout = FlowLayout;
|
||||||
@ -4393,6 +4411,7 @@ exports.LEFT = LEFT;
|
|||||||
exports.LayoutConfigImpl = LayoutConfigImpl;
|
exports.LayoutConfigImpl = LayoutConfigImpl;
|
||||||
exports.List = List;
|
exports.List = List;
|
||||||
exports.ListItem = ListItem;
|
exports.ListItem = ListItem;
|
||||||
|
exports.MainBundleResource = MainBundleResource;
|
||||||
exports.ModularPanel = ModularPanel;
|
exports.ModularPanel = ModularPanel;
|
||||||
exports.Module = Module;
|
exports.Module = Module;
|
||||||
exports.Mutable = Mutable;
|
exports.Mutable = Mutable;
|
||||||
@ -4403,8 +4422,11 @@ exports.Panel = Panel;
|
|||||||
exports.Property = Property;
|
exports.Property = Property;
|
||||||
exports.Provider = Provider;
|
exports.Provider = Provider;
|
||||||
exports.RIGHT = RIGHT;
|
exports.RIGHT = RIGHT;
|
||||||
|
exports.RawResource = RawResource;
|
||||||
exports.Ref = Ref;
|
exports.Ref = Ref;
|
||||||
exports.Refreshable = Refreshable;
|
exports.Refreshable = Refreshable;
|
||||||
|
exports.RemoteResource = RemoteResource;
|
||||||
|
exports.Resource = Resource;
|
||||||
exports.Root = Root;
|
exports.Root = Root;
|
||||||
exports.RotationAnimation = RotationAnimation;
|
exports.RotationAnimation = RotationAnimation;
|
||||||
exports.RotationXAnimation = RotationXAnimation;
|
exports.RotationXAnimation = RotationXAnimation;
|
||||||
|
@ -1615,6 +1615,47 @@ class Resource {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class FileResource extends Resource {
|
||||||
|
constructor(path) {
|
||||||
|
super("file", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class RemoteResource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("remote", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class Base64Resource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("base64", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is for android platform
|
||||||
|
*/
|
||||||
|
class DrawableResource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("drawable", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class RawResource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("raw", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class AssetResource extends Resource {
|
||||||
|
constructor(path) {
|
||||||
|
super("assets", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is for iOS platform
|
||||||
|
*/
|
||||||
|
class MainBundleResource extends Resource {
|
||||||
|
constructor(path) {
|
||||||
|
super("mainBundle", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
@ -3327,13 +3368,17 @@ class ModularPanel extends Module {
|
|||||||
|
|
||||||
exports.AlphaAnimation = AlphaAnimation;
|
exports.AlphaAnimation = AlphaAnimation;
|
||||||
exports.AnimationSet = AnimationSet;
|
exports.AnimationSet = AnimationSet;
|
||||||
|
exports.AssetResource = AssetResource;
|
||||||
exports.BOTTOM = BOTTOM;
|
exports.BOTTOM = BOTTOM;
|
||||||
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
||||||
|
exports.Base64Resource = Base64Resource;
|
||||||
exports.CENTER = CENTER;
|
exports.CENTER = CENTER;
|
||||||
exports.CENTER_X = CENTER_X;
|
exports.CENTER_X = CENTER_X;
|
||||||
exports.CENTER_Y = CENTER_Y;
|
exports.CENTER_Y = CENTER_Y;
|
||||||
exports.Color = Color;
|
exports.Color = Color;
|
||||||
exports.Draggable = Draggable;
|
exports.Draggable = Draggable;
|
||||||
|
exports.DrawableResource = DrawableResource;
|
||||||
|
exports.FileResource = FileResource;
|
||||||
exports.FlexLayout = FlexLayout;
|
exports.FlexLayout = FlexLayout;
|
||||||
exports.FlexTypedValue = FlexTypedValue;
|
exports.FlexTypedValue = FlexTypedValue;
|
||||||
exports.FlowLayout = FlowLayout;
|
exports.FlowLayout = FlowLayout;
|
||||||
@ -3349,6 +3394,7 @@ exports.LEFT = LEFT;
|
|||||||
exports.LayoutConfigImpl = LayoutConfigImpl;
|
exports.LayoutConfigImpl = LayoutConfigImpl;
|
||||||
exports.List = List;
|
exports.List = List;
|
||||||
exports.ListItem = ListItem;
|
exports.ListItem = ListItem;
|
||||||
|
exports.MainBundleResource = MainBundleResource;
|
||||||
exports.ModularPanel = ModularPanel;
|
exports.ModularPanel = ModularPanel;
|
||||||
exports.Module = Module;
|
exports.Module = Module;
|
||||||
exports.Mutable = Mutable;
|
exports.Mutable = Mutable;
|
||||||
@ -3359,8 +3405,11 @@ exports.Panel = Panel;
|
|||||||
exports.Property = Property;
|
exports.Property = Property;
|
||||||
exports.Provider = Provider;
|
exports.Provider = Provider;
|
||||||
exports.RIGHT = RIGHT;
|
exports.RIGHT = RIGHT;
|
||||||
|
exports.RawResource = RawResource;
|
||||||
exports.Ref = Ref;
|
exports.Ref = Ref;
|
||||||
exports.Refreshable = Refreshable;
|
exports.Refreshable = Refreshable;
|
||||||
|
exports.RemoteResource = RemoteResource;
|
||||||
|
exports.Resource = Resource;
|
||||||
exports.Root = Root;
|
exports.Root = Root;
|
||||||
exports.RotationAnimation = RotationAnimation;
|
exports.RotationAnimation = RotationAnimation;
|
||||||
exports.RotationXAnimation = RotationXAnimation;
|
exports.RotationXAnimation = RotationXAnimation;
|
||||||
|
@ -3136,6 +3136,47 @@ class Resource {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class FileResource extends Resource {
|
||||||
|
constructor(path) {
|
||||||
|
super("file", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class RemoteResource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("remote", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class Base64Resource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("base64", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is for android platform
|
||||||
|
*/
|
||||||
|
class DrawableResource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("drawable", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class RawResource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("raw", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class AssetResource extends Resource {
|
||||||
|
constructor(path) {
|
||||||
|
super("assets", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is for iOS platform
|
||||||
|
*/
|
||||||
|
class MainBundleResource extends Resource {
|
||||||
|
constructor(path) {
|
||||||
|
super("mainBundle", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
@ -5089,13 +5130,17 @@ global$1.nativeEmpty = () => {
|
|||||||
|
|
||||||
exports.AlphaAnimation = AlphaAnimation;
|
exports.AlphaAnimation = AlphaAnimation;
|
||||||
exports.AnimationSet = AnimationSet;
|
exports.AnimationSet = AnimationSet;
|
||||||
|
exports.AssetResource = AssetResource;
|
||||||
exports.BOTTOM = BOTTOM;
|
exports.BOTTOM = BOTTOM;
|
||||||
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
||||||
|
exports.Base64Resource = Base64Resource;
|
||||||
exports.CENTER = CENTER;
|
exports.CENTER = CENTER;
|
||||||
exports.CENTER_X = CENTER_X;
|
exports.CENTER_X = CENTER_X;
|
||||||
exports.CENTER_Y = CENTER_Y;
|
exports.CENTER_Y = CENTER_Y;
|
||||||
exports.Color = Color;
|
exports.Color = Color;
|
||||||
exports.Draggable = Draggable;
|
exports.Draggable = Draggable;
|
||||||
|
exports.DrawableResource = DrawableResource;
|
||||||
|
exports.FileResource = FileResource;
|
||||||
exports.FlexLayout = FlexLayout;
|
exports.FlexLayout = FlexLayout;
|
||||||
exports.FlexTypedValue = FlexTypedValue;
|
exports.FlexTypedValue = FlexTypedValue;
|
||||||
exports.FlowLayout = FlowLayout;
|
exports.FlowLayout = FlowLayout;
|
||||||
@ -5111,6 +5156,7 @@ exports.LEFT = LEFT;
|
|||||||
exports.LayoutConfigImpl = LayoutConfigImpl;
|
exports.LayoutConfigImpl = LayoutConfigImpl;
|
||||||
exports.List = List;
|
exports.List = List;
|
||||||
exports.ListItem = ListItem;
|
exports.ListItem = ListItem;
|
||||||
|
exports.MainBundleResource = MainBundleResource;
|
||||||
exports.ModularPanel = ModularPanel;
|
exports.ModularPanel = ModularPanel;
|
||||||
exports.Module = Module;
|
exports.Module = Module;
|
||||||
exports.Mutable = Mutable;
|
exports.Mutable = Mutable;
|
||||||
@ -5121,8 +5167,11 @@ exports.Panel = Panel;
|
|||||||
exports.Property = Property;
|
exports.Property = Property;
|
||||||
exports.Provider = Provider;
|
exports.Provider = Provider;
|
||||||
exports.RIGHT = RIGHT;
|
exports.RIGHT = RIGHT;
|
||||||
|
exports.RawResource = RawResource;
|
||||||
exports.Ref = Ref;
|
exports.Ref = Ref;
|
||||||
exports.Refreshable = Refreshable;
|
exports.Refreshable = Refreshable;
|
||||||
|
exports.RemoteResource = RemoteResource;
|
||||||
|
exports.Resource = Resource;
|
||||||
exports.Root = Root;
|
exports.Root = Root;
|
||||||
exports.RotationAnimation = RotationAnimation;
|
exports.RotationAnimation = RotationAnimation;
|
||||||
exports.RotationXAnimation = RotationXAnimation;
|
exports.RotationXAnimation = RotationXAnimation;
|
||||||
|
75
doric-js/index.d.ts
vendored
75
doric-js/index.d.ts
vendored
@ -122,6 +122,7 @@ declare module 'doric/lib/src/util/index.util' {
|
|||||||
export * from 'doric/lib/src/util/uniqueId';
|
export * from 'doric/lib/src/util/uniqueId';
|
||||||
export * from 'doric/lib/src/util/flexbox';
|
export * from 'doric/lib/src/util/flexbox';
|
||||||
export * from 'doric/lib/src/util/jsx';
|
export * from 'doric/lib/src/util/jsx';
|
||||||
|
export * from 'doric/lib/src/util/resource';
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'doric/lib/src/pattern/index.pattern' {
|
declare module 'doric/lib/src/pattern/index.pattern' {
|
||||||
@ -1623,6 +1624,46 @@ declare module 'doric/lib/src/util/jsx' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module 'doric/lib/src/util/resource' {
|
||||||
|
import { Modeling } from "doric/lib/src/util/types";
|
||||||
|
export abstract class Resource implements Modeling {
|
||||||
|
type: string;
|
||||||
|
identifier: string;
|
||||||
|
constructor(type: string, identifier: string);
|
||||||
|
toModel(): {
|
||||||
|
type: string;
|
||||||
|
identifier: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
export class FileResource extends Resource {
|
||||||
|
constructor(path: string);
|
||||||
|
}
|
||||||
|
export class RemoteResource extends Resource {
|
||||||
|
constructor(url: string);
|
||||||
|
}
|
||||||
|
export class Base64Resource extends Resource {
|
||||||
|
constructor(url: string);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is for android platform
|
||||||
|
*/
|
||||||
|
export class DrawableResource extends Resource {
|
||||||
|
constructor(url: string);
|
||||||
|
}
|
||||||
|
export class RawResource extends Resource {
|
||||||
|
constructor(url: string);
|
||||||
|
}
|
||||||
|
export class AssetResource extends Resource {
|
||||||
|
constructor(path: string);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is for iOS platform
|
||||||
|
*/
|
||||||
|
export class MainBundleResource extends Resource {
|
||||||
|
constructor(path: string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
declare module 'doric/lib/src/pattern/candies' {
|
declare module 'doric/lib/src/pattern/candies' {
|
||||||
export function take<T>(target: T): (block: (p: T) => void) => void;
|
export function take<T>(target: T): (block: (p: T) => void) => void;
|
||||||
export function takeNonNull<T, R>(target?: T): (block: (p: T) => R) => R | undefined;
|
export function takeNonNull<T, R>(target?: T): (block: (p: T) => R) => R | undefined;
|
||||||
@ -1766,40 +1807,6 @@ declare module 'doric/lib/src/pattern/modular' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'doric/lib/src/util/resource' {
|
|
||||||
import { Modeling } from "doric/lib/src/util/types";
|
|
||||||
export abstract class Resource implements Modeling {
|
|
||||||
type: string;
|
|
||||||
identifier: string;
|
|
||||||
constructor(type: string, identifier: string);
|
|
||||||
toModel(): {
|
|
||||||
type: string;
|
|
||||||
identifier: string;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
export class FileResource extends Resource {
|
|
||||||
constructor(path: string);
|
|
||||||
}
|
|
||||||
export class RemoteResource extends Resource {
|
|
||||||
constructor(url: string);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This is for android platform
|
|
||||||
*/
|
|
||||||
export class DrawableResource extends Resource {
|
|
||||||
constructor(url: string);
|
|
||||||
}
|
|
||||||
export class AssetResource extends Resource {
|
|
||||||
constructor(path: string);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* This is for iOS platform
|
|
||||||
*/
|
|
||||||
export class MainBundleResource extends Resource {
|
|
||||||
constructor(path: string);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module '*.png' {
|
declare module '*.png' {
|
||||||
const value: any;
|
const value: any;
|
||||||
export default value;
|
export default value;
|
||||||
|
1
doric-js/lib/src/util/index.util.d.ts
vendored
1
doric-js/lib/src/util/index.util.d.ts
vendored
@ -6,3 +6,4 @@ export * from './types';
|
|||||||
export * from './uniqueId';
|
export * from './uniqueId';
|
||||||
export * from './flexbox';
|
export * from './flexbox';
|
||||||
export * from './jsx';
|
export * from './jsx';
|
||||||
|
export * from './resource';
|
||||||
|
@ -21,3 +21,4 @@ export * from './types';
|
|||||||
export * from './uniqueId';
|
export * from './uniqueId';
|
||||||
export * from './flexbox';
|
export * from './flexbox';
|
||||||
export * from './jsx';
|
export * from './jsx';
|
||||||
|
export * from './resource';
|
||||||
|
6
doric-js/lib/src/util/resource.d.ts
vendored
6
doric-js/lib/src/util/resource.d.ts
vendored
@ -14,12 +14,18 @@ export declare class FileResource extends Resource {
|
|||||||
export declare class RemoteResource extends Resource {
|
export declare class RemoteResource extends Resource {
|
||||||
constructor(url: string);
|
constructor(url: string);
|
||||||
}
|
}
|
||||||
|
export declare class Base64Resource extends Resource {
|
||||||
|
constructor(url: string);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* This is for android platform
|
* This is for android platform
|
||||||
*/
|
*/
|
||||||
export declare class DrawableResource extends Resource {
|
export declare class DrawableResource extends Resource {
|
||||||
constructor(url: string);
|
constructor(url: string);
|
||||||
}
|
}
|
||||||
|
export declare class RawResource extends Resource {
|
||||||
|
constructor(url: string);
|
||||||
|
}
|
||||||
export declare class AssetResource extends Resource {
|
export declare class AssetResource extends Resource {
|
||||||
constructor(path: string);
|
constructor(path: string);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,11 @@ export class RemoteResource extends Resource {
|
|||||||
super("remote", url);
|
super("remote", url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export class Base64Resource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("base64", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* This is for android platform
|
* This is for android platform
|
||||||
*/
|
*/
|
||||||
@ -28,6 +33,11 @@ export class DrawableResource extends Resource {
|
|||||||
super("drawable", url);
|
super("drawable", url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
export class RawResource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("raw", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
export class AssetResource extends Resource {
|
export class AssetResource extends Resource {
|
||||||
constructor(path) {
|
constructor(path) {
|
||||||
super("assets", path);
|
super("assets", path);
|
||||||
|
@ -21,3 +21,4 @@ export * from './types'
|
|||||||
export * from './uniqueId'
|
export * from './uniqueId'
|
||||||
export * from './flexbox'
|
export * from './flexbox'
|
||||||
export * from './jsx'
|
export * from './jsx'
|
||||||
|
export * from './resource'
|
@ -27,17 +27,23 @@ export class RemoteResource extends Resource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class Base64Resource extends Resource {
|
||||||
|
constructor(content: string) {
|
||||||
|
super("base64", content)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is for android platform
|
* This is for android platform
|
||||||
*/
|
*/
|
||||||
export class DrawableResource extends Resource {
|
export class DrawableResource extends Resource {
|
||||||
constructor(url: string) {
|
constructor(name: string) {
|
||||||
super("drawable", url)
|
super("drawable", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class RawResource extends Resource {
|
export class RawResource extends Resource {
|
||||||
constructor(url: string) {
|
constructor(name: string) {
|
||||||
super("raw", url)
|
super("raw", name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
49
doric-web/dist/index.js
vendored
49
doric-web/dist/index.js
vendored
@ -3190,6 +3190,47 @@ class Resource {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class FileResource extends Resource {
|
||||||
|
constructor(path) {
|
||||||
|
super("file", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class RemoteResource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("remote", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class Base64Resource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("base64", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is for android platform
|
||||||
|
*/
|
||||||
|
class DrawableResource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("drawable", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class RawResource extends Resource {
|
||||||
|
constructor(url) {
|
||||||
|
super("raw", url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class AssetResource extends Resource {
|
||||||
|
constructor(path) {
|
||||||
|
super("assets", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This is for iOS platform
|
||||||
|
*/
|
||||||
|
class MainBundleResource extends Resource {
|
||||||
|
constructor(path) {
|
||||||
|
super("mainBundle", path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||||
@ -4902,13 +4943,17 @@ class ModularPanel extends Module {
|
|||||||
|
|
||||||
exports.AlphaAnimation = AlphaAnimation;
|
exports.AlphaAnimation = AlphaAnimation;
|
||||||
exports.AnimationSet = AnimationSet;
|
exports.AnimationSet = AnimationSet;
|
||||||
|
exports.AssetResource = AssetResource;
|
||||||
exports.BOTTOM = BOTTOM;
|
exports.BOTTOM = BOTTOM;
|
||||||
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
exports.BackgroundColorAnimation = BackgroundColorAnimation;
|
||||||
|
exports.Base64Resource = Base64Resource;
|
||||||
exports.CENTER = CENTER;
|
exports.CENTER = CENTER;
|
||||||
exports.CENTER_X = CENTER_X;
|
exports.CENTER_X = CENTER_X;
|
||||||
exports.CENTER_Y = CENTER_Y;
|
exports.CENTER_Y = CENTER_Y;
|
||||||
exports.Color = Color;
|
exports.Color = Color;
|
||||||
exports.Draggable = Draggable;
|
exports.Draggable = Draggable;
|
||||||
|
exports.DrawableResource = DrawableResource;
|
||||||
|
exports.FileResource = FileResource;
|
||||||
exports.FlexLayout = FlexLayout;
|
exports.FlexLayout = FlexLayout;
|
||||||
exports.FlexTypedValue = FlexTypedValue;
|
exports.FlexTypedValue = FlexTypedValue;
|
||||||
exports.FlowLayout = FlowLayout;
|
exports.FlowLayout = FlowLayout;
|
||||||
@ -4924,6 +4969,7 @@ exports.LEFT = LEFT;
|
|||||||
exports.LayoutConfigImpl = LayoutConfigImpl;
|
exports.LayoutConfigImpl = LayoutConfigImpl;
|
||||||
exports.List = List;
|
exports.List = List;
|
||||||
exports.ListItem = ListItem;
|
exports.ListItem = ListItem;
|
||||||
|
exports.MainBundleResource = MainBundleResource;
|
||||||
exports.ModularPanel = ModularPanel;
|
exports.ModularPanel = ModularPanel;
|
||||||
exports.Module = Module;
|
exports.Module = Module;
|
||||||
exports.Mutable = Mutable;
|
exports.Mutable = Mutable;
|
||||||
@ -4934,8 +4980,11 @@ exports.Panel = Panel;
|
|||||||
exports.Property = Property;
|
exports.Property = Property;
|
||||||
exports.Provider = Provider;
|
exports.Provider = Provider;
|
||||||
exports.RIGHT = RIGHT;
|
exports.RIGHT = RIGHT;
|
||||||
|
exports.RawResource = RawResource;
|
||||||
exports.Ref = Ref;
|
exports.Ref = Ref;
|
||||||
exports.Refreshable = Refreshable;
|
exports.Refreshable = Refreshable;
|
||||||
|
exports.RemoteResource = RemoteResource;
|
||||||
|
exports.Resource = Resource;
|
||||||
exports.Root = Root;
|
exports.Root = Root;
|
||||||
exports.RotationAnimation = RotationAnimation;
|
exports.RotationAnimation = RotationAnimation;
|
||||||
exports.RotationXAnimation = RotationXAnimation;
|
exports.RotationXAnimation = RotationXAnimation;
|
||||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user