diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..13566b81b --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml new file mode 100644 index 000000000..3e22f4b71 --- /dev/null +++ b/.idea/codeStyles/Project.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 000000000..79ee123c2 --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 000000000..03d9549ea --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/metacatui.iml b/.idea/metacatui.iml new file mode 100644 index 000000000..c956989b2 --- /dev/null +++ b/.idea/metacatui.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..5ded37468 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 000000000..f324872a8 --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..35eb1ddfb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/docs/docs/LayerLegendView.html b/docs/docs/LayerLegendView.html index 1beee8f8e..1a1bc901b 100644 --- a/docs/docs/LayerLegendView.html +++ b/docs/docs/LayerLegendView.html @@ -1,961 +1,756 @@ - - MetacatUI Dev Docs: Class: LayerLegendView - - - - - - - - + + MetacatUI Dev Docs: Class: LayerLegendView + + + + + + + + - -
- -

Class: LayerLegendView

- - - + + @@ -963,6 +758,6 @@


- + \ No newline at end of file diff --git a/docs/docs/LayersPanelView.html b/docs/docs/LayersPanelView.html index 6587572f7..7a16e55bf 100644 --- a/docs/docs/LayersPanelView.html +++ b/docs/docs/LayersPanelView.html @@ -1,722 +1,715 @@ - - MetacatUI Dev Docs: Class: LayersPanelView - - - - - - - - + + MetacatUI Dev Docs: Class: LayersPanelView + + + + + + + + - -
- -

Class: LayersPanelView

- - - - + + @@ -724,6 +717,6 @@
Returns:

- + \ No newline at end of file diff --git a/docs/docs/LookupModel.html b/docs/docs/LookupModel.html index c96ec6214..05ea939a7 100644 --- a/docs/docs/LookupModel.html +++ b/docs/docs/LookupModel.html @@ -30,7 +30,25 @@ -

Namespaces

Classes

Global

+

Namespaces

Classes

Global

diff --git a/docs/docs/MapAssets.html b/docs/docs/MapAssets.html index f96b02bc2..0b743f978 100644 --- a/docs/docs/MapAssets.html +++ b/docs/docs/MapAssets.html @@ -1,1367 +1,1153 @@ - - MetacatUI Dev Docs: Class: MapAssets - - - - - - - - + + MetacatUI Dev Docs: Class: MapAssets + + + + + + + +
-

Class: MapAssets

+

Class: MapAssets

- +
+
+

MapAssets()

-
+
A MapAssets collection is a group of MapAsset models - models + that provide the information required to render geo-spatial data on a map, + including imagery (raster), vector, and terrain data. +
-
- -

MapAssets()

- -
A MapAssets collection is a group of MapAsset models - models -that provide the information required to render geo-spatial data on a map, -including imagery (raster), vector, and terrain data.
- - +
- -
+
+
-
- - -

Extends

- - - - -
    +
    • Backbone.Collection
    • -
    +
- +

Methods

- - +

+ + - + + addAsset(asset, mapModelopt) → {MapAsset} +

- - +
+ Add a new MapAsset model to this collection. This is useful if adding + the collection from a Map model, since this method will attach the Map + model to the MapAsset model. +
- - -

Methods

+
Parameters:
- - - - - - -

- - - - - addAsset(asset, mapModelopt) → {MapAsset} -

- - - - - - -
- Add a new MapAsset model to this collection. This is useful if adding -the collection from a Map model, since this method will attach the Map -model to the MapAsset model. -
- - - - - - - - - -
Parameters:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
NameTypeAttributesDescription
asset - - -MapConfig#MapAssetConfig -| - -MapAsset - - - - - - - - - - The configuration -object for the MapAsset model, or the MapAsset model itself.
+ - - - - - - - - - - - - - + - - + + - - -
mapModel - - -MapModel + Name - - <optional>
- +
TypeAttributesThe Map model that contains this -collection. This is optional, but if provided, it will be attached to -the MapAsset model.Description
- - - + + -
- - - - -
Since:
-
  • 2.25.0
- - - - - - - - - - - - - - - + asset - - + - - -
Source:
-
- + MapConfig#MapAssetConfig + | - + MapAsset - - -
+ + + + The configuration + object for the MapAsset model, or the MapAsset model itself. + + + + mapModel + + MapModel -
Returns:
+ - -
- - Returns the MapAsset model that was added to the -collection. -
+ + <optional>
-
-
- Type -
-
- -MapAsset + -
-
- + The Map model that contains this + collection. This is optional, but if provided, it will be attached to + the MapAsset model. + + + + +
- - - +
Since:
+
+
    +
  • 2.25.0
  • +
+
- -

- - - - findAssetWithFeature(feature) → {MapAsset} -

- +
Source:
+
+ +
- +
-
- Find the map asset model that contains a feature selected directly from -the map view widget. -
+
Returns:
+
+ - Returns the MapAsset model that was added to the + collection. +
+
+
+ Type +
+
+ MapAsset +
+
-
Parameters:
- +

+ + - - - - - - + + findAssetWithFeature(feature) → {MapAsset} + - - +
+ Find the map asset model that contains a feature selected directly from + the map view widget. +
- - - - +
Parameters:
- - +
NameTypeDescription
+ - - - - - - - + - - - - + + - - -
feature - - -Cesium.Entity -| -Cesium.Cesium3DTilesetFeature + NameTypeThe -feature selected from the map view widget.Description
- - - - - - -
- - - - -
Since:
-
  • 2.25.0
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - + + + feature -

Returns:
+ - -
- - Returns the MapAsset model that contains the -feature. -
+ Cesium.Entity + | + Cesium.Cesium3DTilesetFeature -
-
- Type -
-
- -MapAsset + -
-
- + The + feature selected from the map view widget. + + + + +
- - - +
Since:
+
+
    +
  • 2.25.0
  • +
+
- -

- - - - getAll(assetType) → {Array.<MapAsset>} -

- +
Source:
+
+ +
- +
-
- Get a list of MapAsset models from this collection that are of a given -type. -
+
Returns:
+
+ - Returns the MapAsset model that contains the + feature. +
+
+
+ Type +
+
+ MapAsset +
+
-
Parameters:
- +

+ + - - - - - - + + getAll(assetType) → {Array.<MapAsset>} + - - +
+ Get a list of MapAsset models from this collection that are of a given + type. +
- - - - +
Parameters:
- - +
NameTypeDescription
+ - - - - - - - + - - - - + + - - -
assetType - - -'Cesium3DTileset' -| - -'CesiumVectorData' -| - -'CesiumImagery' -| -'CesiumTerrain' + NameTypeThe general type of asset to filter the collection by.Description
- - - - - - -
- - - - -
Since:
-
  • 2.22.0
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - + + + assetType + -

Returns:
+ 'Cesium3DTileset' + | - -
- - Returns an array of MapAsset models that are -instances of the given asset type. -
+ 'CesiumVectorData' + | + 'CesiumImagery' + | + 'CesiumTerrain' -
-
- Type -
-
- -Array.<MapAsset> + -
-
- + The general type of asset to filter the collection by. + + + +
- - - +
Since:
+
+
    +
  • 2.22.0
  • +
+
- -

- - - - getFeatureAttributes(features) → {Array.<Object>} -

- +
Source:
+
+ +
- +
-
- Given features selected from the map view widget, get the attributes -required to create new Feature models. -
+
Returns:
+
+ - Returns an array of MapAsset models that are + instances of the given asset type. +
+
+
+ Type +
+
+ Array.<MapAsset> +
+
-
Parameters:
- +

+ + - - - - - - + + getFeatureAttributes(features) → {Array.<Object>} + - - +
+ Given features selected from the map view widget, get the attributes + required to create new Feature models. +
- - - - +
Parameters:
- - +
NameTypeDescription
+ - - - - - - - + - - - - + + - - -
features - - -Cesium.Entity -| -Array.<Cesium.Cesium3DTilesetFeature> + NameTypeThe -feature selected from the map view widget.Description
- - - - - - -
- - - - -
Since:
-
  • 2.25.0
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - -

Returns:
- - -
- - Returns an array of attributes that can be used -to create new Feature models. -
- - - -
-
- Type -
-
- -Array.<Object> - - -
-
- - - - - - - - - - - - - -

- - - - - initialize() -

- - - - - - -
- Executed when a new MapAssets collection is created. -
- - - - - - - - - - - + -
- - - - - - - - - - - - - - - - - - - - + - + features - - -
Source:
-
- + - - + Cesium.Entity + | - -
+ Array.<Cesium.Cesium3DTilesetFeature> + + The + feature selected from the map view widget. + + + + +
+
Since:
+
+
    +
  • 2.25.0
  • +
+
+
Source:
+
+ +
+
+
Returns:
+
+ - Returns an array of attributes that can be used + to create new Feature models. +
- - +
+
+ Type +
+
- + Array.<Object> - -

- - - - model(assetConfig) → {Cesium3DTileset|CesiumImagery|CesiumTerrain|CesiumVectorData} -

- +
+
- +

+ + + + initialize() +

-
- Creates the type of Map Asset based on the given type. This function is -typically not called directly. It is used by Backbone.js when adding a -new model to the collection. -
+
+ Executed when a new MapAssets collection is created. +
+
+
Source:
+
+ +
+
-
Parameters:
- +

+ + - - - - - - + + model(assetConfig) → {Cesium3DTileset|CesiumImagery|CesiumTerrain|CesiumVectorData} + - - +
+ Creates the type of Map Asset based on the given type. This function is + typically not called directly. It is used by Backbone.js when adding a + new model to the collection. +
- - - - +
Parameters:
- - +
NameTypeDescription
+ - - - - - - - - + - - + + - - -
assetConfig - - -MapConfig#MapAssetConfig + NameTypeAn object that -configured the source the asset data, as well as metadata and display -properties of the asset.Description
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - + + + assetConfig + + MapConfig#MapAssetConfig - -

Returns:
- - -
- Returns a MapAsset model -
- - - -
-
- Type -
-
- -Cesium3DTileset -| - -CesiumImagery -| - -CesiumTerrain -| - -CesiumVectorData + -
-
+ An object that + configured the source the asset data, as well as metadata and display + properties of the asset. + + - + + +
- - +
Source:
+
+ +
- - -

- - +

- - setMapModel(mapModel) -

- - +
Returns:
+
+ Returns a MapAsset model +
-
- Set the parent map model on each of the MapAsset models in this -collection. This must be the Map model that contains this asset -collection. -
+
+
+ Type +
+
+ Cesium3DTileset + | + CesiumImagery + | + CesiumTerrain + | + CesiumVectorData +
+
-
Parameters:
- +

+ + - - - - - - + + setMapModel(mapModel) + - - +
+ Set the parent map model on each of the MapAsset models in this + collection. This must be the Map model that contains this asset + collection. +
- - - - +
Parameters:
- - +
NameTypeDescription
+ - - - - - - - - + - - + + - - -
mapModel - - -MapModel + NameTypeThe map model to set on each of the MapAsset -modelsDescription
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - + + + mapModel + + MapModel + + The map model to set on each of the MapAsset + models + + + + +
- - +
Source:
+
+ +
- - - +
- + +

@@ -1369,6 +1155,6 @@
Parameters:

- + \ No newline at end of file diff --git a/docs/docs/MapConfig.html b/docs/docs/MapConfig.html index a1678f9b2..00bd8cf29 100644 --- a/docs/docs/MapConfig.html +++ b/docs/docs/MapConfig.html @@ -1,4146 +1,3750 @@ - - MetacatUI Dev Docs: Namespace: MapConfig - - - - - - - - + + MetacatUI Dev Docs: Namespace: MapConfig + + + + + + + +
-

Namespace: MapConfig

+

Namespace: MapConfig

- +
+
+

MapConfig

-
-
- -

MapConfig

- +
- +
+
- -
-
-
- - -
Configuration options for a MapModel that control the -appearance of the map, the data/imagery displayed, and which UI -components are rendered. A MapConfig object can be used when -initializing a Map model, e.g. `new Map(myMapConfig)`
- +
Configuration options for a MapModel that control the + appearance of the map, the data/imagery displayed, and which UI + components are rendered. A MapConfig object can be used when + initializing a Map model, e.g. `new Map(myMapConfig)` +
- +
Properties:
-
Properties:
- + + + -
- - - - - + - - - - + - - - - - - + - - - - - - + + + + + + + + + + + + + + + + + - - - + - - - - + coordinates that give the (3D) starting point of the Viewer. This + position is also where the "home" button in the Cesium widget will + navigate to when clicked. + + - - - - - + + + + + + + - - - + - - - - + imagery, tiles, vector data, etc. to display on the map. Layers wil be + displayed in the order they appear. The array of the layer + MapAssetConfigs are passed to a MapAssets collection. When layerCategories + exist, this property will be ignored. + + - - - - - + + + + + + + - - - + - - - - + layer categories to display in the tool bar. Categories wil be + displayed in the order they appear. The array of the AssetCategoryConfig + are passed to a AssetCategories collection. When layerCategories + exist, the layers property will be ignored. + + - - - - - + + + + + + + - - - + - - - - + one or more digital elevation models (DEM) for the surface of the + earth. Note: Though multiple terrains are supported, currently only the + first terrain is used in the CesiumWidgetView and there is not yet a UI + for switching terrains in the map. The array of the terrain + MapAssetConfigs are passed to a MapAssets collection. + + - - - - - + + + + - - - + + + + - - - - + side bar with layer list, etc. If true, the MapView will render + a ToolbarView. + + - - - - - + + + + - - - + + + + - - - - + layer list in the toolbar. If true, the ToolbarView will render + a LayerListView. + + - - - - - + + + + - - - + + + + - - - - + home button in the toolbar. + + - - - - - + + + + - - - + + + + - - - - + viewfinder UI and viewfinder button in the toolbar. The ViewfinderView + requires a Google Maps API key present in the AppModel. In order to + work properly the Geocoding API and Places API must be enabled. + + - - - - - + + + + - - - + + + + - - - - + share as URL UI in the toolbar and update the URL as the user interacts + with the map. This feature requires a `layerId` field on any layers + that are expected to be saved to the URL search parameter, as that is + the only unique identifier which can be used to turn the layer + visibility on or off. + + - - - - - + + + + - - - + + + + - - - - + open when the map is initialized. Set to false by default, so that the + toolbar is hidden by default. + + - - - - - + + + + - - - + + + + - - - - + scale bar. If true, the MapView will render a + ScaleBarView. + + - - - - - + + + + - - - + + + + - - - - + users to click on map features to show more information about them. If + true, the MapView will render a FeatureInfoView and + will initialize "picking" in the CesiumWidgetView. + + - - - - - + + + + - - - + + + + - - - - + action to take when a user clicks on a feature on the map. The + available options are "showDetails" (show the feature details in the + sidebar) or "zoom" (zoom to the feature's location). + + - - - - - + + + + - - - + + + + - - - - + navigation instructions in the toolbar. + + - - - - - + + + + - - - + + + + - - - - + feedback section in the toolbar with the text specified in + feedbackText. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameNameTypeAttributesTypeDefaultDescription
Attributes
homePositionDefaultDescription
homePosition - - -MapConfig#CameraPosition - + MapConfig#CameraPosition + + + + + <optional>
+ +
- - <optional>
- - -
+ + - - A set of -coordinates that give the (3D) starting point of the Viewer. This -position is also where the "home" button in the Cesium widget will -navigate to when clicked.
layers
layers - - -Array.<MapConfig#MapAssetConfig> - + Array.<MapConfig#MapAssetConfig> + + + + + <optional>
+ +
- - <optional>
- - -
+ + - - A collection of -imagery, tiles, vector data, etc. to display on the map. Layers wil be -displayed in the order they appear. The array of the layer -MapAssetConfigs are passed to a MapAssets collection. When layerCategories -exist, this property will be ignored.
layerCategories
layerCategories - - -Array.<MapConfig#MapAssetConfig> - + Array.<MapConfig#MapAssetConfig> + + + + + <optional>
+ +
- - <optional>
- - -
+ + - - A collection of -layer categories to display in the tool bar. Categories wil be -displayed in the order they appear. The array of the AssetCategoryConfig -are passed to a AssetCategories collection. When layerCategories -exist, the layers property will be ignored.
terrains
terrains - - -Array.<MapConfig#MapAssetConfig> - + Array.<MapConfig#MapAssetConfig> + + + + + <optional>
+ +
- - <optional>
- - -
+ + - - Configuration for -one or more digital elevation models (DEM) for the surface of the -earth. Note: Though multiple terrains are supported, currently only the -first terrain is used in the CesiumWidgetView and there is not yet a UI -for switching terrains in the map. The array of the terrain -MapAssetConfigs are passed to a MapAssets collection.
showToolbar
showToolbar - - -boolean - + boolean + + - - <optional>
- - -
+ + <optional>
+ + +
+ + true + + - - true - - Whether or not to show the -side bar with layer list, etc. If true, the MapView will render -a ToolbarView.
showLayerList
showLayerList - - -boolean - + boolean + + - - <optional>
- - -
+ + <optional>
+ + +
+ + true + + - - true - - Whether or not to show the -layer list in the toolbar. If true, the ToolbarView will render -a LayerListView.
showHomeButton
showHomeButton - - -boolean - + boolean + + - - <optional>
- - -
+ + <optional>
+ + +
+ + true + + - - true - - Whether or not to show the -home button in the toolbar.
showViewfinder
showViewfinder - - -boolean - + boolean + + - - <optional>
- - -
+ + <optional>
+ + +
+ + false + + - - false - - Whether or not to show the -viewfinder UI and viewfinder button in the toolbar. The ViewfinderView -requires a Google Maps API key present in the AppModel. In order to -work properly the Geocoding API and Places API must be enabled.
showShareUrl
showShareUrl - - -boolean - + boolean + + - - <optional>
- - -
+ + <optional>
+ + +
+ + false + + - - false - - Whether or not to show the -share as URL UI in the toolbar and update the URL as the user interacts -with the map. This feature requires a `layerId` field on any layers -that are expected to be saved to the URL search parameter, as that is -the only unique identifier which can be used to turn the layer -visibility on or off.
toolbarOpen
toolbarOpen - - -boolean - + boolean + + - - <optional>
- - -
+ + <optional>
+ + +
+ + false + + - - false - - Whether or not the toolbar is -open when the map is initialized. Set to false by default, so that the -toolbar is hidden by default.
showScaleBar
showScaleBar - - -boolean - + boolean + + - - <optional>
- - -
+ + <optional>
+ + +
+ + true + + - - true - - Whether or not to show a -scale bar. If true, the MapView will render a -ScaleBarView.
showFeatureInfo
showFeatureInfo - - -boolean - + boolean + + - - <optional>
- - -
+ + <optional>
+ + +
+ + true + + - - true - - Whether or not to allow -users to click on map features to show more information about them. If -true, the MapView will render a FeatureInfoView and -will initialize "picking" in the CesiumWidgetView.
clickFeatureAction
clickFeatureAction - - -string - + string + + - - <optional>
- - -
+ + <optional>
+ + +
+ + "showDetails" + + - - "showDetails" - - The default -action to take when a user clicks on a feature on the map. The -available options are "showDetails" (show the feature details in the -sidebar) or "zoom" (zoom to the feature's location).
showNavHelp
showNavHelp - - -boolean - + boolean + + - - <optional>
- - -
+ + <optional>
+ + +
+ + true + + - - true - - Whether or not to show -navigation instructions in the toolbar.
showFeedback
showFeedback - - -boolean - + boolean + + - - <optional>
- - -
+ + <optional>
+ + +
+ + false + + - - false - - Whether or not to show a -feedback section in the toolbar with the text specified in -feedbackText.
feedbackText + + + string + + + + + <optional>
+ + +
+ + null + + The text to show in the + feedback section. showFeedback must be true for this to be shown. +
globeBaseColor + + + String + + + + + <optional>
+ + +
+ + null + + The base color of the globe when no + layer is shown. +
zoomPresets + + + ZoomPresets + + + + + <optional>
+ + +
+ + null + + A Backbone.Collection of a + predefined list of locations with an enabled list of layer IDs to be + shown the zoom presets UI. Requires `showViewfinder` to be true as this + UI appears within the ViewfinderView. + UI appears within the ViewfinderView. +
+ + +
+ + +
Source:
+
+ +
+ + +
+ + +

Example

+ +
{
+  "homePosition": {
+    "latitude": 74.23,
+    "longitude": -105.7
+  },
+  "layers": [
+    {
+      "label": "My 3D Tile layer",
+      "type": "Cesium3DTileset",
+      "description": "This is an example 3D tileset. This description will be visible in the LayerDetailsView. It will be the default color, since to colorPalette is specified.",
+      "cesiumOptions": {
+        "ionAssetId": "555"
+      },
+    }
+  ],
+  "terrains": [
+    {
+      "label": "Arctic DEM",
+      "type": "CesiumTerrainProvider",
+      "cesiumOptions": {
+        "ionAssetId": "3956",
+        "requestVertexNormals": true
+      }
+    }
+  ],
+  "showToolbar": true,
+  "showScaleBar": false,
+  "showFeatureInfo": false
+}
+ + +
+ + +

Type Definitions

+ + +

+ + + + + AssetCategoryConfig +

+ + +
+ The source of a specific category to show in the ToolBarView, as well as + display properties of the asset. +
+ + +
Type:
+
    +
  • + + object + + +
  • +
+ + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
label + + + string + + + A user friendly name for this category, to be + displayed in a map. +
icon + + + string + + + A PID for an SVG saved as a dataObject, or an SVG + string. The SVG will be used as an icon that will be displayed next to the + category label. It should be an SVG file that has no fills, borders, or styles + set on it (since the icon will be shaded dynamically by the maps CSS using a + fill attribute). It must use a viewbox property rather than a height and width. +
layers + + + MapAssets + + + The data to render in the map.
+ + +
+ + +
Source:
+
+ +
+ + +
+ + +

+ + + + + CameraPosition +

+ + +
+ Coordinates that describe a camera position for Cesium. Requires at + least a longitude and latitude. +
+ + +
Type:
+
    +
  • + + object + + +
  • +
+ + +
Properties:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + - - - - + - + + - - - - - - - + - + number - - - - - + - - - - - + + - - - + + - - - - - + +
NameTypeAttributesDescription
longitude + + + number + + + + + + Longitude of the central home point
latitude + + + number + + + + + + Latitude of the central home point
height + + + number + + + + + <optional>
+ + +
Height above sea level (meters)
heading + + + number + + + + + <optional>
+ + +
The rotation about the negative z axis + (degrees) +
pitch + - + number -
feedbackText - - -string + - - - - <optional>
- + <optional>
- -
- - null - - The text to show in the -feedback section. showFeedback must be true for this to be shown.The rotation about the negative y axis + (degrees) +
globeBaseColor - - -String + roll - - - - <optional>
- - -
- - null - - The base color of the globe when no -layer is shown.
zoomPresets - - - -ZoomPresets + <optional>
- -
- - <optional>
- - -
The rotation about the positive x axis + (degrees) +
- - null - - A Backbone.Collection of a -predefined list of locations with an enabled list of layer IDs to be -shown the zoom presets UI. Requires `showViewfinder` to be true as this -UI appears within the ViewfinderView. -UI appears within the ViewfinderView.
- - - +
+
Source:
+
+ +
-
- +
- - +
Examples
- +
{
+ longitude: -119.8489,
+ latitude: 34.4140
+}
- +
{
+ longitude: -65,
+ latitude: 56,
+ height: 10000000,
+ heading: 1,
+ pitch: -90,
+ roll: 0
+}
- - +

+ + - + + ColorConfig +

- - +
+ A color to use in a map color palette, along with the value that the color + represents. +
- - +
Type:
+ - -
+
Properties:
- -

Example

- -
{
-  "homePosition": {
-    "latitude": 74.23,
-    "longitude": -105.7
-  },
-  "layers": [
-    {
-      "label": "My 3D Tile layer",
-      "type": "Cesium3DTileset",
-      "description": "This is an example 3D tileset. This description will be visible in the LayerDetailsView. It will be the default color, since to colorPalette is specified.",
-      "cesiumOptions": {
-        "ionAssetId": "555"
-      },
-    }
-  ],
-  "terrains": [
-    {
-      "label": "Arctic DEM",
-      "type": "CesiumTerrainProvider",
-      "cesiumOptions": {
-        "ionAssetId": "3956",
-        "requestVertexNormals": true
-      }
-    }
-  ],
-  "showToolbar": true,
-  "showScaleBar": false,
-  "showFeatureInfo": false
-}
- - -
+ + + + + - - + - - + - - + + + - + - - -

Type Definitions

+ - - -

- - +

- - AssetCategoryConfig - + -
Type:
- + + -
Properties:
+ - + -
NameTypeAttributesDescription
value + string + | -
- The source of a specific category to show in the ToolBarView, as well as -display properties of the asset. -
+ number +
- - + The value of the attribute in a MapAsset that + corresponds to this color. If set to null, then this color will be the default + color. +
label
- - - - - - + - - - - + - - - - - - + - - + - - - - - - - + - + Color - - - - - + - - + - - + - - -
NameType - - + string - Description
label - - -string + + <optional>
- -
A user friendly name for this category, to be -displayed in a map.A user-facing name for this attribute value, + to show in map legends, etc. If not set, then the value will be displayed + instead. +
icon - - -string + color - - + string + | - A PID for an SVG saved as a dataObject, or an SVG -string. The SVG will be used as an icon that will be displayed next to the -category label. It should be an SVG file that has no fills, borders, or styles -set on it (since the icon will be shaded dynamically by the maps CSS using a -fill attribute). It must use a viewbox property rather than a height and width.
layers - - -MapAssets + - - The data to render in the map.Either an object with 'red', + 'green', 'blue' properties defining the intensity of each of the three colours + with a value between 0 and 1, OR a string with a hex color code beginning with + #, e.g. '#44A96A'. The AssetColor model will convert the string to an + AssetColor#Color object. +
+ + +
-
- +
Source:
+
+ +
- - +
- - +
Examples
- +
{
+  value: 0,
+  label: 'water',
+  color: {
+    red: 0,
+    green: 0.1,
+    blue: 1
+  }
+}
- +
{
+  value: 'landmark',
+  color: '#7B44A9'
+}
- - +

+ + - + + ColorPaletteConfig +

- - +
+ The ColorPaletteConfig specifies a color scale that is mapped to some + attribute of a MapAsset. For vector assets, like 3D tilesets, + this palette is used to conditionally color features on a map. For any + type of asset, including imagery, it can be used to generate a legend. + The ColorPaletteConfig is passed to a AssetColorPalette model. +
- -
Source:
-
- - +
Type:
+
+ + +
Properties:
+ + + - - -

- - +

- - CameraPosition - + + -
- Coordinates that describe a camera position for Cesium. Requires at -least a longitude and latitude. -
+ -
Type:
- + + + - - + + + -
- +
- - + + - - + +
NameTypeAttributesDefaultDescription
paletteType -
Properties:
- + 'categorical' + | - - - - - - + 'continuous' + | - + 'classified' - - - - + - - - - - + - - - + <optional>
- - - - - - + - - + - - - - - - - + - + string - - - + - - - - - + - - - - - + - - + - - - - - - - + - + string - - - + - - - - - + + - - - + - + + - - - - - - - + - + Array.<MapConfig#ColorConfig> - - - + - - -
NameTypeAttributesDescription
-
longitude - - -number + - + + + 'categorical' - - Longitude of the central home pointNOTE: Currently only categorical and + continuous palettes are supported. + - Categorical: the color conditions will be interpreted such that one + color represents a single value (e.g. a discrete palette). + - Continuous: each color in the colors attribute will represent a point + in a gradient. The point in the gradient will be associated with the + number set with the color, and numbers in between points will be set + to an interpolated color. + - Classified: the numbers set in the colors attribute will be + interpreted as maximums. Continuous properties will be forced into + discrete bins. +
latitude - - -number + property - - - - - Latitude of the central home point
height - - - -number + - - <optional>
- +
- - Height above sea level (meters)The name (ID) of the property in the asset + layer's attribute table to color the vector data by (or for imagery + data that does not have an attribute table, just the name of the + attribute that these colors represent). +
heading - - -number + label - - - - <optional>
- - -
The rotation about the negative z axis -(degrees)
pitch - - - -number + <optional>
- -
- - <optional>
- - -
- + The rotation about the negative y axis -(degrees)A user-friendly name to display instead of + the actual property name. +
roll - - -number + colors - - - - <optional>
- - -
The rotation about the positive x axis -(degrees)
+
+ - + The colors to use in the + color palette, along with the conditions associated with each color + (i.e. the properties of the feature that must be true to use the given + color). The array of ColorConfig objects are passed to a + AssetColors collection, which in turn passes each ColorConfig + to a AssetColor model. +
- - +
- - +
Source:
+
+ +
- - +
- -
Source:
-
- - +
Example
- +
{
+   paletteType: 'categorical',
+   property: 'landUse',
+   label: 'Land Use in 2016',
+   colors: [
+     { value: "agriculture", color: "#FF5733" },
+     { value: "park", color: "#33FF80" }
+   ]
+}
- - +

+ + + + CustomDateProperty +

+
+ An object that defines a formatted date to use as a property in a feature. Used + in the MapConfig#CustomProperties object. +
-
Examples
- -
{
- longitude: -119.8489,
- latitude: 34.4140
-}
-
{
- longitude: -65,
- latitude: 56,
- height: 10000000,
- heading: 1,
- pitch: -90,
- roll: 0
-}
+
Type:
+ - - ColorConfig - +
Properties:
+ + + -
- A color to use in a map color palette, along with the value that the color -represents. -
+ + -
Type:
- + + - - + + + -
Properties:
+ +
Since:
+
+ +
- - - +
Source:
+
+ +
- - - + - - -
NameTypeDescription
type - - - - - - - + 'date' - - - - + - - - - + + - - - - - - -number + - - - + - - + - - - - - - - + - + string - - + + + + - - - - - + +
NameTypeAttributesDescription
Must be set to 'date' to indicate that this is a custom + date property +
value - - -string -| + property - - - + string + - - The value of the attribute in a MapAsset that -corresponds to this color. If set to null, then this color will be the default -color.The name/ID of the existing date property to format
label - - -string + format - - - - <optional>
- - -
A user-facing name for this attribute value, -to show in map legends, etc. If not set, then the value will be displayed -instead.A string that indicates the new format to use. + Follows the syntax used by Day.JS, see + https://day.js.org/docs/en/display/format
color
-
- - -string -| -Color +
- -
- - - Either an object with 'red', -'green', 'blue' properties defining the intensity of each of the three colours -with a value between 0 and 1, OR a string with a hex color code beginning with -#, e.g. '#44A96A'. The AssetColor model will convert the string to an -AssetColor#Color object.
+

+ + + + CustomProperties +

-
+
+ An object where the keys indicate the name/ID of the new custom property to + create, and the values are an object that defines the new property. +
- - +
Type:
+ - - +
- - +
Since:
+
+
    +
  • 2.19.0
  • +
+
- - +
Source:
+
+ +
- - +
- -
Source:
-
- - +
Example
- +
{
+  "year": {
+    "type": "date",
+    "property": "dateTime",
+    "format": "YYYY",
+  },
+  "urlText": {
+    "type": "string",
+    "value": "Click here to learn more about this feature"
+  }
+}
- -
+

+ + + + CustomStringProperty +

+
+ An object that defines a custom string to use as a property in a feature. Used + in the MapConfig#CustomProperties object. +
-
Examples
- -
{
-  value: 0,
-  label: 'water',
-  color: {
-    red: 0,
-    green: 0.1,
-    blue: 1
-  }
-}
-
{
-  value: 'landmark',
-  color: '#7B44A9'
-}
+
Type:
+ - - ColorPaletteConfig - +
Properties:
+ + + -
- The ColorPaletteConfig specifies a color scale that is mapped to some -attribute of a MapAsset. For vector assets, like 3D tilesets, -this palette is used to conditionally color features on a map. For any -type of asset, including imagery, it can be used to generate a legend. -The ColorPaletteConfig is passed to a AssetColorPalette model. -
+ + -
Type:
- + + - - + + + -
Properties:
+ - - - - - - +
Source:
+
+ +
- - - + - - - - - - - - - - - +
Type:
+ - - - +
Properties:
+ +
NameTypeDescription
type - - - - - - - + 'string' - - - - + - - - - - - + + - - - - - - -'continuous' -| -'classified' + + string + + + - - - - - - - - - + + - - - - - + +
NameTypeAttributesDefaultDescription
Must be set to 'string' to indicate that this is a + custom string property +
paletteType - - -'categorical' -| + value - - - - <optional>
- - - -
- - 'categorical' - - NOTE: Currently only categorical and -continuous palettes are supported. -- Categorical: the color conditions will be interpreted such that one - color represents a single value (e.g. a discrete palette). -- Continuous: each color in the colors attribute will represent a point - in a gradient. The point in the gradient will be associated with the - number set with the color, and numbers in between points will be set - to an interpolated color. -- Classified: the numbers set in the colors attribute will be - interpreted as maximums. Continuous properties will be forced into - discrete bins.The new string to use. So far only static strings are + available. In the future, templates that include other properties may be + supported. +
property
-
- - -string +
- -
- +
Since:
+
+
    +
  • 2.19.0
  • +
+
- -
- - The name (ID) of the property in the asset -layer's attribute table to color the vector data by (or for imagery -data that does not have an attribute table, just the name of the -attribute that these colors represent).
label - - -string +

+ + + + FeatureTemplate +

- -
- - <optional>
- +
+ A feature template configures the format and content of information displayed + in the Feature Info panel (FeatureInfoView). The Feature Info panel is + displayed in a map when a user clicks on a vector feature in a map. +
- -
- - A user-friendly name to display instead of -the actual property name.
+ - - - - - - + + + + + - - - - - - - - - + + + + + - - -
colors - - -Array.<MapConfig#ColorConfig> + NameTypeAttributes - - - - - - The colors to use in the -color palette, along with the conditions associated with each color -(i.e. the properties of the feature that must be true to use the given -color). The array of ColorConfig objects are passed to a -AssetColors collection, which in turn passes each ColorConfig -to a AssetColor model.DefaultDescription
+ + + template -
- + - - + 'story' + | - + 'table' - - + - - + - + <optional>
- - + - - -
Source:
-
- + - + 'table' - + - -
+ The name/ID of the template to + use. This must match the name of one of the templates available in + FeatureInfoView#contentTemplates. + + + + label -
Example
- -
{
-   paletteType: 'categorical',
-   property: 'landUse',
-   label: 'Land Use in 2016',
-   colors: [
-     { value: "agriculture", color: "#FF5733" },
-     { value: "park", color: "#33FF80" }
-   ]
-}
+ - - -

- - + string - - CustomDateProperty -

+ + -
- An object that defines a formatted date to use as a property in a feature. Used -in the MapConfig#CustomProperties object. -
+ <optional>
+ -
Type:
- + + Sets which of the feature properties to use as the + title for the FeatureInfoView. The string must exactly match the key for a + property that exists in the feature. + + + -
Properties:
+ options - - - - - - - + - + MapConfig#StoryTemplateOptions - - - - + - - - - - - + + + + + - - + - - - - - + +
Name - TypeDescription
type - - - -'date' + <optional>
- -
- + Must be set to 'date' to indicate that this is a custom -date propertyA list of key-value pairs + that map the template variable to a property/attribute of the the feature. Keys + are the template variable names and values are the names of properties in the + feature. Template variable names are specific to each template. Currently only + the 'story' template allows variables. These are specified in the + FeatureInfoView#contentTemplates. +
property
- - - -string +
- - - +
Since:
+
+ +
+ - +
Source:
+
+ +
+ + +
+ + +
Examples
+ +
// Use the "story" template, which shows a secondary title, image, description,
+// and link.
+{
+  "template": "story",
+  "label": "title",
+  "options": {
+    "subtitle": "formattedDate",
+    "description": "summary",
+    "thumbnail": "imageSrc",
+    "url": "newsLink",
+    "urlText": "newsTitle",
+  }
+}
- The name/ID of the existing date property to format - +
// Use the default template (a table), but use the "forestName" attribute for
+// the FeatureInfo panel label
+{
+  "label": "forestName"
+}
- - - - format - +

+ + - - - -string + + MapAssetConfig +

- - +
+ The source of a specific asset (i.e. layer or terrain data) to show on the map, + as well as metadata and display properties of the asset. Some properties listed + here do not apply to all asset types, but this is specified in the property + description. +
- - +
Type:
+ +
Properties:
-
- + + + - -
Since:
-
- + - - + - - + - - + - - + + + - + - - -
Source:
-
- + - + - - - + - - + + - - -
Since:
-
- + + - - + - + - - + - - - + -
Example
- -
{
-  "year": {
-    "type": "date",
-    "property": "dateTime",
-    "format": "YYYY",
-  },
-  "urlText": {
-    "type": "string",
-    "value": "Click here to learn more about this feature"
-  }
-}
+ - - -

- - +

+ - - CustomStringProperty - + + -
- An object that defines a custom string to use as a property in a feature. Used -in the MapConfig#CustomProperties object. -
+ - - + -
Properties:
+ -
NameTypeAttributesDefaultDescription
type + 'Cesium3DTileset' + | + 'BingMapsImageryProvider' + | + 'IonImageryProvider' + | + 'WebMapTileServiceImageryProvider' + | - - -

- - + 'WebMapServiceImageryProvider' + | - - CustomProperties -

+ 'TileMapServiceImageryProvider' + | + 'NaturalEarthII' + | + 'CesiumTerrainProvider' + | + 'GeoJsonDataSource' + | -
- An object where the keys indicate the name/ID of the new custom property to -create, and the values are an object that defines the new property. -
+ 'USGSImageryTopo' + | + 'OpenStreetMapImageryProvider' -
Type:
-
    -
  • - -Object +
+ -
+
A string indicating the format of the data. Some of these types correspond + directly to Cesium classes. The NaturalEarthII type is a special imagery layer + that automatically sets the cesiumOptions to load the Natural Earth II imagery + that is shipped with Cesium/MetacatUI. If this type is set, then no other + cesiumOptions are required. The same is true for USGSImageryTopo, which pulls + imagery directly from USGS. +
cesiumOptions - - + Cesium3DTileset#cesiumOptions + | - + CesiumImagery#cesiumOptions + | - + CesiumTerrain#cesiumOptions + | - + CesiumVectorData#cesiumOptions - -
Source:
-
- - +
+ <optional>
+
+ For MapAssets that are configured for Cesium, like + Cesium3DTilesets, an object with options to pass to the Cesium constructor + function that creates the Cesium model. Options are specific to each type of + asset. For details, see documentation for each of the types. +
label + string -
Type:
-
    -
  • - -object +
+ - +
- - - - - - + + - - + - - - + - - - - - - + - + - - - + - - - - - - + - - + - - -
NameTypeA user friendly name for this asset, to be displayed + in a map. +
Description
icon
type - - - -'string' + string - - Must be set to 'string' to indicate that this is a -custom string property
- + <optional>
-
value - - -string + - + The new string to use. So far only static strings are -available. In the future, templates that include other properties may be -supported.A PID for an SVG saved as a dataObject, or an SVG + string. The SVG will be used as an icon that will be displayed next to the + label in the layers list. It should be an SVG file that has no fills, borders, + or styles set on it (since the icon will be shaded dynamically by the maps CSS + using a fill attribute). It must use a viewbox property rather than a height + and width. +
- + + opacity -
- + - -
Since:
-
  • 2.19.0
- - + number - - + - - + - + <optional>
- - + - - + - -
Source:
-
- + 1 - + - - -
+ A number between 0 and 1 indicating the + opacity of the layer on the map, with 0 representing fully transparent and 1 + representing fully opaque. This applies to raster (imagery) and vector assets, + not to terrain assets. + + + + saturation + - - -

- - - - FeatureTemplate -

+ number + -
- A feature template configures the format and content of information displayed -in the Feature Info panel (FeatureInfoView). The Feature Info panel is -displayed in a map when a user clicks on a vector feature in a map. -
+ + <optional>
-
Type:
- + + 1 + + A number that indicates the saturation of + the layer on the map. Less than 1.0 reduces the saturation while greater than + 1.0 increases it. This applies to raster (imagery) only. + + -
Properties:
- + - - - - - - + - - - - + - - - - + boolean - - - - - - + - - - - - - - - - - - + - - - - - + - - - - - - - - - - - + - - - - - - - + - - - - - - - - - - -
NamevisibleTypeAttributes - - DefaultDescription
template - - -'story' -| -'table' + + <optional>
- -
- - <optional>
- - - -
- - 'table' - - The name/ID of the template to -use. This must match the name of one of the templates available in -FeatureInfoView#contentTemplates.
label - - - -string + true + - - <optional>
- - - -
- - Sets which of the feature properties to use as the -title for the FeatureInfoView. The string must exactly match the key for a -property that exists in the feature.Set to true if the layer is visible on the + map, false if it is hidden. This applies to raster (imagery) and vector assets, + not to terrain assets. +
options - - -MapConfig#StoryTemplateOptions + description - - - - <optional>
- - - -
- - A list of key-value pairs -that map the template variable to a property/attribute of the the feature. Keys -are the template variable names and values are the names of properties in the -feature. Template variable names are specific to each template. Currently only -the 'story' template allows variables. These are specified in the -FeatureInfoView#contentTemplates.
+ string + -
+ - + <optional>
- -
Since:
-
  • 2.19.0
- - + - - + - + - - + A brief description about the asset, e.g. + which area it covers, the resolution, etc. + + - - + - + attribution - - -
Source:
-
- + - - + string - -
+ + + <optional>
-
Examples
- -
// Use the "story" template, which shows a secondary title, image, description,
-// and link.
-{
-  "template": "story",
-  "label": "title",
-  "options": {
-    "subtitle": "formattedDate",
-    "description": "summary",
-    "thumbnail": "imageSrc",
-    "url": "newsLink",
-    "urlText": "newsTitle",
-  }
-}
-
// Use the default template (a table), but use the "forestName" attribute for
-// the FeatureInfo panel label
-{
-  "label": "forestName"
-}
+ + - - -

- - + - - MapAssetConfig -

+ A credit or attribution to display along with + this asset. + + + -
- The source of a specific asset (i.e. layer or terrain data) to show on the map, -as well as metadata and display properties of the asset. Some properties listed -here do not apply to all asset types, but this is specified in the property -description. -
+ moreInfoLink + -
Type:
- + + + <optional>
-
Properties:
- + - - - - - - - + - + - - - - - - + + - - - - - - - -'WebMapTileServiceImageryProvider' -| -'WebMapServiceImageryProvider' -| + -'USGSImageryTopo' -| -'OpenStreetMapImageryProvider' + - - - - - - - - - - + - - - - - + -CesiumImagery#cesiumOptions -| -CesiumTerrain#cesiumOptions -| + + -CesiumVectorData#cesiumOptions + - - + - - - - - - - - - - - + - - - - + - - - + - + <optional>
- - - + - - - - - - - - - - - - - - - - + - - - - - - - + - - - - - - - - - + MapConfig#ColorPaletteConfig - - - - - - - + - - - - - - - - + <optional>
- - - - - + - - - - - - - - - - - - + - - - - - - - + - + MapConfig#FeatureTemplate - - - - - + - - - - - + + - - - + - + - + + - - - - - - - + - + MapConfig#CustomProperties - - - - - + - - - - - + + + - - - + - - - - + - - - - - - - - - - - - + - - - + MapConfig#VectorFilterConfig - - - - - + - + <optional>
- - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - + - - - - + - - - + - + <optional>
- - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - + boolean - - - - -
NameType - - AttributesDefaultDescription
A complete URL used to create a link to show + in a map where a user can find more information about this resource. +
type - - -'Cesium3DTileset' -| - -'BingMapsImageryProvider' -| -'IonImageryProvider' -| + downloadLink -'TileMapServiceImageryProvider' -| -'NaturalEarthII' -| + string -'CesiumTerrainProvider' -| -'GeoJsonDataSource' -| + + <optional>
- -
- - - - - - A string indicating the format of the data. Some of these types correspond -directly to Cesium classes. The NaturalEarthII type is a special imagery layer -that automatically sets the cesiumOptions to load the Natural Earth II imagery -that is shipped with Cesium/MetacatUI. If this type is set, then no other -cesiumOptions are required. The same is true for USGSImageryTopo, which pulls -imagery directly from USGS.
cesiumOptions - - - -Cesium3DTileset#cesiumOptions -| + A complete URL used to show a link in a map + where a user can go to download the source data. +
id - - <optional>
- - - -
- - For MapAssets that are configured for Cesium, like -Cesium3DTilesets, an object with options to pass to the Cesium constructor -function that creates the Cesium model. Options are specific to each type of -asset. For details, see documentation for each of the types.
-
label - - -string + string - - - - - - - - - A user friendly name for this asset, to be displayed -in a map.
icon - - -string + + - - <optional>
- - - -
- - A PID for an SVG saved as a dataObject, or an SVG -string. The SVG will be used as an icon that will be displayed next to the -label in the layers list. It should be an SVG file that has no fills, borders, -or styles set on it (since the icon will be shaded dynamically by the maps CSS -using a fill attribute). It must use a viewbox property rather than a height -and width.If this asset's data is archived in a DataONE + repository, the ID of the data package. +
opacity - - -number + colorPalette - - - - <optional>
- - - -
- - 1 - - A number between 0 and 1 indicating the -opacity of the layer on the map, with 0 representing fully transparent and 1 -representing fully opaque. This applies to raster (imagery) and vector assets, -not to terrain assets.
saturation - - -number + - - - - <optional>
- - - -
- - 1 - - A number that indicates the saturation of -the layer on the map. Less than 1.0 reduces the saturation while greater than -1.0 increases it. This applies to raster (imagery) only.
visible - - -boolean + + + - - <optional>
- - - -
- - true - - Set to true if the layer is visible on the -map, false if it is hidden. This applies to raster (imagery) and vector assets, -not to terrain assets.The color or colors + mapped to attributes of this asset. This applies to raster/imagery and vector + assets. For imagery, the colorPalette will be used to create a legend. For + vector assets (e.g. 3Dtilesets), it will also be used to style the features. +
description - - -string + featureTemplate - - - - <optional>
- - -
- - A brief description about the asset, e.g. -which area it covers, the resolution, etc.
attribution - - - -string + <optional>
- -
- - <optional>
- - -
- - - - A credit or attribution to display along with -this asset.Configuration for the + content and layout of the Feature Info panel (FeatureInfoView) - the + panel that shows information about a selected feature from a vector asset. If + no feature template is set, then the default table layout is used. +
moreInfoLink - - -string + customProperties - - - - <optional>
- - -
- - A complete URL used to create a link to show -in a map where a user can find more information about this resource.
downloadLink - - - -string + <optional>
- -
- - <optional>
- +
- - - - A complete URL used to show a link in a map -where a user can go to download the source data.Definitions of custom + properties of features, potentially based on existing properties. For example, + a custom property could be a formatted version of another date property. These + custom properties can be used in the filters, colorPalette, or featureTemplate. + So far, custom strings and formatted dates are supported. Eventually, the + custom properties may be expanded to support formatted numbers and booleans. +
id - - -string + filters - - <optional>
- - -
- - - - If this asset's data is archived in a DataONE -repository, the ID of the data package.
colorPalette - - -MapConfig#ColorPaletteConfig + - - - - <optional>
- - - -
- - The color or colors -mapped to attributes of this asset. This applies to raster/imagery and vector -assets. For imagery, the colorPalette will be used to create a legend. For -vector assets (e.g. 3Dtilesets), it will also be used to style the features.
featureTemplate - - -MapConfig#FeatureTemplate + + - - <optional>
- - - -
- - Configuration for the -content and layout of the Feature Info panel (FeatureInfoView) - the -panel that shows information about a selected feature from a vector asset. If -no feature template is set, then the default table layout is used.A set of conditions used + to show or hide specific features of this tileset. +
customProperties - - -MapConfig#CustomProperties + notification - - <optional>
- - - -
- - Definitions of custom -properties of features, potentially based on existing properties. For example, -a custom property could be a formatted version of another date property. These -custom properties can be used in the filters, colorPalette, or featureTemplate. -So far, custom strings and formatted dates are supported. Eventually, the -custom properties may be expanded to support formatted numbers and booleans.
-
filters - - -MapConfig#VectorFilterConfig + MapConfig#Notification - - - - <optional>
- - -
- - - - A set of conditions used -to show or hide specific features of this tileset.
notification - - -MapConfig#Notification + + - - <optional>
- - - -
- - A custom badge and message to -display about the layer in the Layer list. For example, this could highlight -the layer if it is new, give a warning if they layer is under development, etc.A custom badge and message to + display about the layer in the Layer list. For example, this could highlight + the layer if it is new, give a warning if they layer is under development, etc. +
hideInLayerList - - -boolean + hideInLayerList - - <optional>
- +
- - - - Set to true to hide this asset from the -layer list.
+ + + <optional>
-
- + - - + - + - - + Set to true to hide this asset from the + layer list. + + - - + + - - +
- - +
Source:
+
+ +
- -
Source:
-
- - +
- - -
+

+ + + + Notification +

+
+ A notification displays a badge in the LayerListView and a message in + the LayerDetailsView. This is useful for indicating some special status + of the layer: "new", "under development", etc. +
+
Type:
+ +
Properties:
-
- A notification displays a badge in the LayerListView and a message in -the LayerDetailsView. This is useful for indicating some special status -of the layer: "new", "under development", etc. -
+ + + + -
Type:
- - - + + + + + -
Properties:
- + -
NameTypeAttributesDescription
- - - - - + - - - - + - - + 'yellow' + | - - + 'green' + | - - - - + 'blue' + | - -'contrast' + + <optional>
- - - + - - + - - - - - - - - - - - - + - - + string - - - - - - - + - + - - + - - -
NamestyleTypeAttributes - - Description
style - - -'yellow' -| + 'contrast' -'green' -| -'blue' -| + - - - - <optional>
- - -
The badge and message -color. If none is set, then notification elements will be similar to the -background colour (subtle).The badge and message + color. If none is set, then notification elements will be similar to the + background colour (subtle). +
badge - - -string - - - - - + badge - The text to display in the badge element next to the -layer label in the list. This badge should be as few characters as possible.
message - - -string + - - - - - A longer message to display explaining the status.The text to display in the badge element next to the + layer label in the list. This badge should be as few characters as possible. +
+ + message -
+ - - -
Since:
-
  • 2.22.0
- + string - - + - - + - - + - - + A longer message to display explaining the status. + - - + + - -
Source:
-
- - +
- - -
+
Since:
+
+
    +
  • 2.22.0
  • +
+
+
Source:
+
+ +
+
- - -

- - +

+ + - - StoryTemplateOptions -

+ + StoryTemplateOptions +

+
+ An object that maps template variable to feature properties for the "story" + template. +
-
- An object that maps template variable to feature properties for the "story" -template. -
+
Type:
+ +
Properties:
+ + + + -
Properties:
+ - -
NameType
- - - - - + + + - + - - + - - - + - - - - - - + - + - - + - - - - - - - - - - - + - - + string - - - - - - - + + - - + - - + - - - - - + - + - - + - - - - - - - - - + - + string - - -
NameDescription
Type
Description
subtitle
subtitle - - - -string + string - - The name of a feature property to use for a -secondary title in the templateThe name of a feature property to use for a + secondary title in the template +
description - - -string + description - The name of a feature property that contains a -brief summary or description of the feature; displayed as a paragraph.
thumbnail - - -string + The name of a feature property that contains a + brief summary or description of the feature; displayed as a paragraph. +
The name of a feature property that contains a URL -for an image. Displayed as a thumbnail next to the description.
thumbnail
url - - - -string + string - - The name of a feature property with a URL to use to -create a link (e.g. to learn more information about the given feature)The name of a feature property that contains a URL + for an image. Displayed as a thumbnail next to the description. +
urlText - - -string + url - - The name of a feature property that has text to -display for the url. Defaults to 'Read More' if none is set.
+ + The name of a feature property with a URL to use to + create a link (e.g. to learn more information about the given feature) + + -
- + - -
Since:
-
  • 2.19.0
- + urlText - - + - - + string - - + - - + The name of a feature property that has text to + display for the url. Defaults to 'Read More' if none is set. + + - - + + - -
Source:
-
- - +
- - -
+
Since:
+
+
    +
  • 2.19.0
  • +
+
+
Source:
+
+ +
+
- - -

- - +

+ + - - VectorFilterConfig -

+ + VectorFilterConfig +

+
+ A VectorFilterConfig specifies conditions under which specific features of a + vector layer on a map should be visible. The filter defines rules used to show + features conditionally based on properties of the feature. For example, it + could specify hiding all vectors for an asset that have an area greater than + 10km2. This configuration is passed to the VectorFilter model. +
-
- A VectorFilterConfig specifies conditions under which specific features of a -vector layer on a map should be visible. The filter defines rules used to show -features conditionally based on properties of the feature. For example, it -could specify hiding all vectors for an asset that have an area greater than -10km2. This configuration is passed to the VectorFilter model. -
+
Type:
+ +
Properties:
+ + + + -
Properties:
+ - -
NameType
- - - - - + + + - + - - + - - - + - - - - - - + - + - - + - - - - - - + - - + - - + string - - - - - -Array.<number> + + - - - + - + - - - + - - - - - + - - + - - - - - - - - - + - + number - - -
NameDescription
Type
Description
filterType
filterType - - - -'categorical' -| -'numeric' + 'categorical' + | + 'numeric' - - If categorical, then a feature -will be visible when its property value exactly matches one of those listed in -the values attribute. If numeric, then a feature will be visible when its -property value is between the min and max.If categorical, then a feature + will be visible when its property value exactly matches one of those listed in + the values attribute. If numeric, then a feature will be visible when its + property value is between the min and max. +
property - - -string - - - property - The property (attribute) of the MapAsset -feature to filter on.
values - - -Array.<string> -| + The property (attribute) of the MapAsset + feature to filter on. +
valuesOnly used for categorical filters. If -the property matches one of the values listed, the feature will be displayed. -If the filter type is categorical and no values are set, then features will not -be filtered on this property.
-
max - - -number + Array.<string> + | + Array.<number> - - Only used for numeric filters. The property's value must -be less than the value set here for the feature to be visible. If the filter -type is numeric, and max is set, then the max is infinite.Only used for categorical filters. If + the property matches one of the values listed, the feature will be displayed. + If the filter type is categorical and no values are set, then features will not + be filtered on this property. +
min - - -number + max - - Only used for numeric filters. The property's value must -be greater than the value set here for the feature to be visible. If the filter -type is numeric, and min is set, then the min is minus infinity.
+ + Only used for numeric filters. The property's value must + be less than the value set here for the feature to be visible. If the filter + type is numeric, and max is set, then the max is infinite. + + -
- + - + min - - + - - + number - - + - - + Only used for numeric filters. The property's value must + be greater than the value set here for the feature to be visible. If the filter + type is numeric, and min is set, then the min is minus infinity. + + - - + + - -
Source:
-
- - +
- - -
+
Source:
+
+ +
+
+
Examples
-
Examples
- -
// Only show vectors with an 'area' property set to less than 10
+      
// Only show vectors with an 'area' property set to less than 10
 {
   filterType: 'numeric'
   property: 'area'
   max: 10
 }
-
// Show only features that have the 'boreal' or 'tropical' property set on their 'forestType' attribute
+      
// Show only features that have the 'boreal' or 'tropical' property set on their 'forestType' attribute
 {
   filterType: 'categorical'
   property: 'forestType'
@@ -4148,16 +3752,9 @@ 
Examples
}
+ - - - - - - - - - + @@ -4165,6 +3762,6 @@
Examples

- + \ No newline at end of file diff --git a/docs/docs/MapModel.html b/docs/docs/MapModel.html index bd457f943..d3b9c837f 100644 --- a/docs/docs/MapModel.html +++ b/docs/docs/MapModel.html @@ -1,2571 +1,2029 @@ - - MetacatUI Dev Docs: Class: MapModel - - - - - - - - + + MetacatUI Dev Docs: Class: MapModel + + + + + + + +
-

Class: MapModel

- - - - - - -
- -
- -

MapModel()

- -
The Map Model contains all of the settings and options for a -required to render a map view.
- - - - - -
- -
-
- - - - -

Constructor

- - - -

- - - - - new MapModel() -

- - - - - - - - - - - - - - - - - - -
- - - - -
Since:
-
  • 2.18.0
- - - - - - - - - - - +

Class: MapModel

- - +
- +
- +

MapModel()

- +
The Map Model contains all of the settings and options for a + required to render a map view. +
- -
Source:
-
- - +
- +
+
- -
+

Constructor

+

+ + + + new MapModel() +

+
+
Since:
+
+
    +
  • 2.18.0
  • +
+
+
Source:
+
+ +
+
+
+

Extends

- - - -
- - -

Extends

- - - - -
    +
    • Backbone.Model
    • -
    - - - +
- - +

Members

- - +

+ + - + + defaults :Object +

- -

Members

- - -

- - - - - defaults :Object -

+
+ Overrides the default Backbone.Model.defaults() function to specify + default attributes for the Map +
- - -
- Overrides the default Backbone.Model.defaults() function to specify -default attributes for the Map -
- - - -
Type:
-
    +
    Type:
    +
    • - -Object - - -
    • -
    + Object + +
-
Properties:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
Properties:
- - - - - - - - - - - - - - - - - - - +
NameTypeAttributesDefaultDescription
[homePosition={longitude: -65, -latitude: 56, height: 10000000, heading: 1, pitch: -90, roll: 0}] - - -MapConfig#CameraPosition - - - - - - - - - - A set -of coordinates that give the (3D) starting point of the Viewer. This -position is also where the "home" button in the Cesium viewer will -navigate to when clicked.
terrains - - -MapAssets - - - - - - <optional>
- - - -
- - new MapAssets() - - The terrain -options to show in the map.
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + MapConfig#CameraPosition - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - -
layers - - -MapAssets - - - - - - <optional>
- - - -
- - new MapAssets() - - The imagery and -vector data to render in the map. When layerCategories exist, this -property will be ignored.
allLayers - - -MapAssets - - - - - - <optional>
- - - -
- - new MapAssets() - - The assets that -correspond to the layers field or the layerCategories field depending -upon which is used. If layerCategories, this contains a flattened list -of the assets.
Name
layerCategories - - -AssetCategories - - - - - - <optional>
- - - -
- - new AssetCategories() - - A collection of layer categories to display in the tool bar. Categories -wil be displayed in the order they appear. The array of the AssetCategoryConfig -are passed to a AssetCategories collection. When layerCategories -exist, the layers property will be ignored.
Type
showToolbar - - -boolean - - - - - - <optional>
- - - -
- - true - - Whether or not to show the -side bar with layer list and other tools. True by default.
Attributes
showLayerList - - -boolean - - - - - - <optional>
- - - -
- - true - - Whether or not to include -the layer list in the toolbar. True by default.
Default
showHomeButton - - -boolean - - - - - - <optional>
- - - -
- - true - - Whether or not to show the -home button in the toolbar. True by default.Description
showViewfinder - - -boolean - - - - - - <optional>
- - - -
- - false - - Whether or not to show the -viewfinder UI and viewfinder button in the toolbar. Defaults to false.
showShareUrl - - -boolean - - - - - - <optional>
- - - -
- - false - - Whether or not to show the -share as URL UI. Defaults to false.
[homePosition={longitude: -65, + latitude: 56, height: 10000000, heading: 1, pitch: -90, roll: 0}]
toolbarOpen - - -boolean - - - - - - <optional>
- - - -
- - false - - Whether or not the toolbar is -open when the map is initialized. Set to false by default, so that the -toolbar is hidden by default.
-
showScaleBar - - -boolean - - - - - - <optional>
- - - -
- - true - - Whether or not to show a -scale bar.
showFeatureInfo - - -boolean - - - - - - <optional>
- - - -
- - true - - Whether or not to allow -users to click on map features to show more information about them.
clickFeatureAction - - -string - - - - - - <optional>
- - - -
- - "showDetails" - - The default -action to take when a user clicks on a feature on the map. The -available options are "showDetails" (show the feature details in the -sidebar) or "zoom" (zoom to the feature's location).
-
showNavHelp - - -boolean - - - - - - <optional>
- - - -
- - true - - Whether or not to show -navigation instructions in the toolbar.
showFeedback - - -boolean - - - - - - <optional>
- - - -
- - false - - Whether or not to show a -feedback section in the toolbar.
-
feedbackText - - -String - - - - - - <optional>
- - - -
- - null - - The text to show in the -feedback section.
globeBaseColor - - -String - - - - - - <optional>
- - - -
- - null - - The base color of the globe when no -layer is shown.A set + of coordinates that give the (3D) starting point of the Viewer. This + position is also where the "home" button in the Cesium viewer will + navigate to when clicked. +
zoomPresets - - -ZoomPresets - - - - - - <optional>
- - - -
- - null - - A Backbone.Collection of a -predefined list of locations with an enabled list of layer IDs to be -shown the zoom presets UI. Requires `showViewfinder` to be true as this -UI appears within the ViewfinderView. -UI appears within the ViewfinderView.
- - - - -
- - - - - - - - - + terrains - - + - - + MapAssets - - + - - -
Source:
-
- + - + <optional>
- - -
+ + + new MapAssets() + - - -

- - - - - type :String -

- - - - -
- The type of model this is. -
- - - -
Type:
-
    -
  • - -String + The terrain + options to show in the map. + + -
  • -
+ + layers + -
+ MapAssets - - -
Since:
-
  • 2.25.0
- + - - + - + <optional>
- - + - - + - + new MapAssets() - + - -
Default Value:
-
    -
  • "MapModel"
  • -
- - -
Source:
-
- - - + The imagery and + vector data to render in the map. When layerCategories exist, this + property will be ignored. + + - - -
+ + allLayers + + MapAssets - - - -

Methods

+ - - - + - -

- - + <optional>
-
- addAsset(asset) → {MapAsset} -

- - + + -
- Add a layer or other asset to the map. This is the best way to add a -layer to the map because it will ensure that this map model is set on -the layer model. -
+ new MapAssets() + + The assets that + correspond to the layers field or the layerCategories field depending + upon which is used. If layerCategories, this contains a flattened list + of the assets. + + + + layerCategories + -
Parameters:
- - - - - - - + AssetCategories - - + - - - - + - + <optional>
- - - - - -MapAsset + + new AssetCategories() - + - - + - - -
NameTypeDescription
-
asset - - -Object -| + - - A map asset model or object with -attributes to set on a new map asset model.A collection of layer categories to display in the tool bar. Categories + wil be displayed in the order they appear. The array of the AssetCategoryConfig + are passed to a AssetCategories collection. When layerCategories + exist, the layers property will be ignored. +
+ + showToolbar + -
+ boolean - - -
Since:
-
  • 2.25.0
- + - - + - + <optional>
- - + - - + - + true - + - - -
Source:
-
- + Whether or not to show the + side bar with layer list and other tools. True by default. + + - - + - -
To Do:
-
-
    -
  • Enable adding a terrain asset.
  • -
-
- -
+ showLayerList + + boolean + + + <optional>
+ + + true -
Returns:
+ - -
- The new layer model. -
+ Whether or not to include + the layer list in the toolbar. True by default. + + -
-
- Type -
-
- -MapAsset + + showHomeButton -
-
- + + boolean + - - - + - -

- - + <optional>
-
- flyHome() -

- - + + -
- Indicate that the map widget view should navigate to the home position. -
+ true + + Whether or not to show the + home button in the toolbar. True by default. + + + + showViewfinder + + boolean + -
- + - + <optional>
- - + - - + - + false - + - - + Whether or not to show the + viewfinder UI and viewfinder button in the toolbar. Defaults to false. + + - - + - -
Source:
-
- + showShareUrl - - + - -
+ boolean + + + <optional>
+ + + false + + Whether or not to show the + share as URL UI. Defaults to false. + + + + toolbarOpen + - - - + boolean - -

- - - - getLayerGroups() → {Array.<MapAssets>} -

- + - + + <optional>
+ + + false + + Whether or not the toolbar is + open when the map is initialized. Set to false by default, so that the + toolbar is hidden by default. + + + + showScaleBar -
+ - - + boolean - - + - - + - + <optional>
- - + - - + - + true - -
Source:
-
- + - - + Whether or not to show a + scale bar. + + - -
+ + showFeatureInfo + + boolean + + + <optional>
+ -
Returns:
+ - -
- When layerCategories are configured, each MapAssets -represets layers from one category. When layerCategories doesn't exist, flat -layers are used and the array includes exactly one MapAssets with all -the layers. Returns an empty array if no layer are found. -
+ true + -
-
- Type -
-
- -Array.<MapAssets> + Whether or not to allow + users to click on map features to show more information about them. + + -
-
+ - + clickFeatureAction + + string - - - + - -

- - - - getSelectedFeatures() → {Features} -

- + - + <optional>
+ -
- Get the currently selected features on the map. -
+ + "showDetails" + + The default + action to take when a user clicks on a feature on the map. The + available options are "showDetails" (show the feature details in the + sidebar) or "zoom" (zoom to the feature's location). + + + + showNavHelp + + boolean -
- + - -
Since:
-
  • 2.27.0
- - + - + <optional>
- - + - - + - + true - + - - + Whether or not to show + navigation instructions in the toolbar. + + - -
Source:
-
- - + - + showFeedback - -
+ + boolean + + + <optional>
+ + + false + -
Returns:
- -
- The selected Feature collection. -
+ Whether or not to show a + feedback section in the toolbar. + + + -
-
- Type -
-
- -Features + feedbackText -
-
+ - + String + - - + - + <optional>
- -

- - - - initialize(config) -

- + - + + null -
- Run when a new Map is created. -
+ + The text to show in the + feedback section. + + + + globeBaseColor + -
Parameters:
- + String - - - - - - - + - - + - - + <optional>
- - - - - - + - + null - + - - + - - -
NameType - Description
config - - -MapConfig + - - An object specifying configuration options -for the map. If any config option is not specified, the default will be -used instead (see MapModel#defaults).The base color of the globe when no + layer is shown. +
- + + zoomPresets + -
- - - - - - - - - - - - - + ZoomPresets - - + - - + - + <optional>
- -
Source:
-
- - + - - -
+ + null + + A Backbone.Collection of a + predefined list of locations with an enabled list of layer IDs to be + shown the zoom presets UI. Requires `showViewfinder` to be true as this + UI appears within the ViewfinderView. + UI appears within the ViewfinderView. + + + + +
+
Source:
+
+ +
+
+

+ + + + type :String +

+
+ The type of model this is. +
+
Type:
+ - - removeAsset(asset) - - - +
+
Since:
+
+
    +
  • 2.25.0
  • +
+
-
- Remove a layer from the map. -
+
Default Value:
+
+
    +
  • "MapModel"
  • +
+
+
Source:
+
+ +
+
+

Methods

-
Parameters:
- +

+ + - - - - - - + + addAsset(asset) → {MapAsset} + - - +
+ Add a layer or other asset to the map. This is the best way to add a + layer to the map because it will ensure that this map model is set on + the layer model. +
- - - - +
Parameters:
- - +
NameTypeDescription
+ - - - - - - + - - - - + + - - -
asset - - -MapAsset + NameTypeThe layer model to remove from the map.Description
- - - - - - -
- - - - -
Since:
-
  • 2.27.0
- - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - resetLayerVisibility() -

- - - - - - -
- Reset the visibility of all layers to the value that was in the intial -configuration. -
- - - - - - - - - + + + asset -
- + - - + Object + | - + MapAsset - - + - - + A map asset model or object with + attributes to set on a new map asset model. + + - - + + - - +
- -
Source:
-
- - +
Since:
+
+
    +
  • 2.25.0
  • +
+
- - -
+
Source:
+
+ +
+
To Do:
+
+
    +
  • Enable adding a terrain asset.
  • +
+
+
+
Returns:
+
+ The new layer model. +
+
+
+ Type +
+
+ MapAsset +
+
+

+ + + + flyHome() +

+
+ Indicate that the map widget view should navigate to the home position. +
+
- - - +
Source:
+
+ +
- -

- - - - resetLayers() → {MapAssets} -

- +
- +

+ + + + getLayerGroups() → {Array.<MapAssets>} +

-
- Reset the layers to the default layers. This will set a new MapAssets -collection on the layer attribute. -
+
+
Source:
+
+ +
+
+
Returns:
+
+ When layerCategories are configured, each MapAssets + represets layers from one category. When layerCategories doesn't exist, flat + layers are used and the array includes exactly one MapAssets with all + the layers. Returns an empty array if no layer are found. +
+
+
+ Type +
+
+ Array.<MapAssets> -
- +
+
- -
Since:
-
  • 2.25.0
- - +

+ + - + + getSelectedFeatures() → {Features} +

- - +
+ Get the currently selected features on the map. +
- - +
- - +
Since:
+
+
    +
  • 2.27.0
  • +
+
- - +
Source:
+
+ +
- -
Source:
-
- - +
- - -
+
Returns:
+
+ The selected Feature collection. +
+
+
+ Type +
+
+ Features +
+
+

+ + + + initialize(config) +

+
+ Run when a new Map is created. +
+
Parameters:
-
Returns:
- -
- The new layers collection. -
+ + + + -
-
- Type -
-
- -MapAssets +
- - + + + - + + + - - + + + -
- Select features on the map. Updates the selectedFeatures attribute on -the MapInteraction model. -
+ +
NameTypeDescription
config - - -

- - + MapConfig - - selectFeatures(features) -

- - +
An object specifying configuration options + for the map. If any config option is not specified, the default will be + used instead (see MapModel#defaults). +
+
+
Source:
+
+ +
+
-
Parameters:
- +

+ + - - - - - - + + removeAsset(asset) + - - +
+ Remove a layer from the map. +
- - - - +
Parameters:
- - +
NameTypeDescription
+ - - - - - - - - + - - + + - - -
features - - -Array.<Feature> + NameTypeAn array of Feature models to select. -since 2.28.0Description
- - - - - - -
- - - - - - + - - + - + asset - - + - - + MapAsset - - + - -
Source:
-
- - + The layer model to remove from the map. + - - -
+ + +
+
Since:
+
+
    +
  • 2.27.0
  • +
+
+
Source:
+
+ +
+
+

+ + + + resetLayerVisibility() +

+
+ Reset the visibility of all layers to the value that was in the intial + configuration. +
+
+
Source:
+
+ +
+
- - - +

+ + - -

- - + + resetLayers() → {MapAssets} +

- - setUpInteractions() → {MapInteraction} -

- - +
+ Reset the layers to the default layers. This will set a new MapAssets + collection on the layer attribute. +
+
-
- Set or replace the MapInteraction model on the map. -
+
Since:
+
+
    +
  • 2.25.0
  • +
+
+
Source:
+
+ +
+
+
Returns:
+
+ The new layers collection. +
+
+
+ Type +
+
+ MapAssets -
- +
+
- -
Since:
-
  • 2.27.0
- - +

+ + - + + selectFeatures(features) +

- - +
+ Select features on the map. Updates the selectedFeatures attribute on + the MapInteraction model. +
- - +
Parameters:
- - + + + - + - - -
Source:
-
- + - - + + + - - + + + + + + + +
NameTypeDescription
features + Array.<Feature> + An array of Feature models to select. + since 2.28.0 +
-
Returns:
+
- -
- The new interactions model. -
+
Source:
+
+ +
-
-
- Type -
-
- -MapInteraction +
- -
+

+ + - + + setUpInteractions() → {MapInteraction} +

+
+ Set or replace the MapInteraction model on the map. +
+
- - - +
Since:
+
+
    +
  • 2.27.0
  • +
+
- -

- - - - zoomTo(target) -

- +
Source:
+
+ +
- +
-
- Indicate that the map widget view should navigate to a given target. -This is accomplished by setting the zoom target on the MapInteraction -model. The map widget listens to this change and updates the camera -position accordingly. -
+
Returns:
+
+ The new interactions model. +
+
+
+ Type +
+
+ MapInteraction +
+
-
Parameters:
- +

+ + - - - - - - + + zoomTo(target) + - - +
+ Indicate that the map widget view should navigate to a given target. + This is accomplished by setting the zoom target on the MapInteraction + model. The map widget listens to this change and updates the camera + position accordingly. +
- - - - +
Parameters:
- - +
NameTypeDescription
+ - - - - - -GeoBoundingBox -| -Object + - - - - - - - - + + - - -
target - - -Feature -| -MapAsset -| + NameTypeThe target to -zoom to. See CesiumWidgetView#flyTo for more details on types -of targets.Description
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
+ + + target + + Feature + | + MapAsset + | + GeoBoundingBox + | + Object + + The target to + zoom to. See CesiumWidgetView#flyTo for more details on types + of targets. + + + + +
- - +
Source:
+
+ +
- - - +
- + + @@ -2573,6 +2031,6 @@

Parameters:

- + \ No newline at end of file diff --git a/docs/docs/Utilities%0AA%20generic%20utility%20object%20that%20contains%20functions%20used%20throughout%20MetacatUI%20to%20perform%20useful%20functions,%0Abut%20not%20used%20to%20store%20or%20manipulate%20any%20state%20about%20the%20application..html b/docs/docs/Utilities%0AA%20generic%20utility%20object%20that%20contains%20functions%20used%20throughout%20MetacatUI%20to%20perform%20useful%20functions,%0Abut%20not%20used%20to%20store%20or%20manipulate%20any%20state%20about%20the%20application..html deleted file mode 100644 index 2e4fc1804..000000000 --- a/docs/docs/Utilities%0AA%20generic%20utility%20object%20that%20contains%20functions%20used%20throughout%20MetacatUI%20to%20perform%20useful%20functions,%0Abut%20not%20used%20to%20store%20or%20manipulate%20any%20state%20about%20the%20application..html +++ /dev/null @@ -1,146 +0,0 @@ - - - - - MetacatUI Dev Docs: Namespace: Utilities -A generic utility object that contains functions used throughout MetacatUI to perform useful functions, -but not used to store or manipulate any state about the application. - - - - - - - - - - - -
- -

Namespace: Utilities -A generic utility object that contains functions used throughout MetacatUI to perform useful functions, -but not used to store or manipulate any state about the application.

- - - - - - -
- -
- -

Utilities -A generic utility object that contains functions used throughout MetacatUI to perform useful functions, -but not used to store or manipulate any state about the application.

- - - - - -
- -
-
- - -
Utilities -A generic utility object that contains functions used throughout MetacatUI to perform useful functions, -but not used to store or manipulate any state about the application.
- - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Source:
-
- - - - - - - -
- - - - -
- - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- - - -
- -
- Documentation generated by JSDoc 3.6.3 on Mon Dec 07 2020 16:16:21 GMT-0600 (Central Standard Time) -
- - - - - \ No newline at end of file diff --git a/docs/docs/fonts/OpenSans-Bold.svg b/docs/docs/fonts/OpenSans-Bold.svg index 464e98400..81c8a275a 100644 --- a/docs/docs/fonts/OpenSans-Bold.svg +++ b/docs/docs/fonts/OpenSans-Bold.svg @@ -1,958 +1,958 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/fonts/OpenSans-BoldItalic.svg b/docs/docs/fonts/OpenSans-BoldItalic.svg index cc7332505..d06de541a 100644 --- a/docs/docs/fonts/OpenSans-BoldItalic.svg +++ b/docs/docs/fonts/OpenSans-BoldItalic.svg @@ -1,958 +1,958 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/fonts/OpenSans-Italic.svg b/docs/docs/fonts/OpenSans-Italic.svg index f773016b7..7561e874c 100644 --- a/docs/docs/fonts/OpenSans-Italic.svg +++ b/docs/docs/fonts/OpenSans-Italic.svg @@ -1,958 +1,958 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/fonts/OpenSans-Light.svg b/docs/docs/fonts/OpenSans-Light.svg index e481f2c56..c3bd1594c 100644 --- a/docs/docs/fonts/OpenSans-Light.svg +++ b/docs/docs/fonts/OpenSans-Light.svg @@ -1,958 +1,958 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/fonts/OpenSans-LightItalic.svg b/docs/docs/fonts/OpenSans-LightItalic.svg index 162f95c7a..e5694a123 100644 --- a/docs/docs/fonts/OpenSans-LightItalic.svg +++ b/docs/docs/fonts/OpenSans-LightItalic.svg @@ -1,958 +1,958 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/docs/fonts/OpenSans-Regular.svg b/docs/docs/fonts/OpenSans-Regular.svg index 067c09c1d..b34ed428a 100644 --- a/docs/docs/fonts/OpenSans-Regular.svg +++ b/docs/docs/fonts/OpenSans-Regular.svg @@ -1,958 +1,958 @@ - - - - -This is a custom SVG webfont generated by Font Squirrel. -Copyright : Digitized data copyright 20102011 Google Corporation -Foundry : Ascender Corporation -Foundry URL : httpwwwascendercorpcom - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +This is a custom SVG webfont generated by Font Squirrel. +Copyright : Digitized data copyright 20102011 Google Corporation +Foundry : Ascender Corporation +Foundry URL : httpwwwascendercorpcom + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/components/clipboard.js b/src/components/clipboard.js index f82415be8..040c5e005 100644 --- a/src/components/clipboard.js +++ b/src/components/clipboard.js @@ -5,16 +5,16 @@ * Licensed MIT © Zeno Rocha */ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Clipboard = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;oMIT License - */ - -if (typeof KJUR == "undefined" || !KJUR) KJUR = {}; -if (typeof KJUR.jws == "undefined" || !KJUR.jws) KJUR.jws = {}; - -/** - * JSON Web Signature(JWS) class.
- * @name KJUR.jws.JWS - * @class JSON Web Signature(JWS) class - * @property {Dictionary} parsedJWS This property is set after JWS signature verification.
- * Following "parsedJWS_*" properties can be accessed as "parsedJWS.*" because of - * JsDoc restriction. - * @property {String} parsedJWS_headB64U string of Encrypted JWS Header - * @property {String} parsedJWS_payloadB64U string of Encrypted JWS Payload - * @property {String} parsedJWS_sigvalB64U string of Encrypted JWS signature value - * @property {String} parsedJWS_si string of Signature Input - * @property {String} parsedJWS_sigvalH hexadecimal string of JWS signature value - * @property {String} parsedJWS_sigvalBI BigInteger(defined in jsbn.js) object of JWS signature value - * @property {String} parsedJWS_headS string of decoded JWS Header - * @property {String} parsedJWS_headS string of decoded JWS Payload - * @requires base64x.js, json-sans-eval.js and jsrsasign library - * @see 'jwjws'(JWS JavaScript Library) home page http://kjur.github.com/jsjws/ - * @see 'jwrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/ - * @see IETF I-D JSON Web Algorithms (JWA) - * @since jsjws 1.0 - * @description - *

Supported Algorithms

- * Here is supported algorithm names for {@link KJUR.jws.JWS.sign} and {@link KJUR.jws.JWS.verify} - * methods. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
alg valuespec requirementjsjws support
HS256REQUIREDSUPPORTED
HS384OPTIONALSUPPORTED
HS512OPTIONALSUPPORTED
RS256RECOMMENDEDSUPPORTED
RS384OPTIONALSUPPORTED
RS512OPTIONALSUPPORTED
ES256RECOMMENDED+SUPPORTED
ES384OPTIONALSUPPORTED
ES512OPTIONAL-
PS256OPTIONALSUPPORTED
PS384OPTIONALSUPPORTED
PS512OPTIONALSUPPORTED
noneREQUIREDSUPPORTED(signature generation only)
- * NOTE1: HS384 is supported since jsjws 3.0.2 with jsrsasign 4.1.4.
- */ -KJUR.jws.JWS = function() { - var ns1 = KJUR.jws.JWS; - - // === utility ============================================================= - - /** - * parse JWS string and set public property 'parsedJWS' dictionary.
- * @name parseJWS - * @memberOf KJUR.jws.JWS - * @function - * @param {String} sJWS JWS signature string to be parsed. - * @throws if sJWS is not comma separated string such like "Header.Payload.Signature". - * @throws if JWS Header is a malformed JSON string. - * @since jws 1.1 - */ - this.parseJWS = function(sJWS, sigValNotNeeded) { - if ((this.parsedJWS !== undefined) && - (sigValNotNeeded || (this.parsedJWS.sigvalH !== undefined))) { - return; - } - if (sJWS.match(/^([^.]+)\.([^.]+)\.([^.]+)$/) == null) { - throw "JWS signature is not a form of 'Head.Payload.SigValue'."; - } - var b6Head = RegExp.$1; - var b6Payload = RegExp.$2; - var b6SigVal = RegExp.$3; - var sSI = b6Head + "." + b6Payload; - this.parsedJWS = {}; - this.parsedJWS.headB64U = b6Head; - this.parsedJWS.payloadB64U = b6Payload; - this.parsedJWS.sigvalB64U = b6SigVal; - this.parsedJWS.si = sSI; - - if (!sigValNotNeeded) { - var hSigVal = b64utohex(b6SigVal); - var biSigVal = parseBigInt(hSigVal, 16); - this.parsedJWS.sigvalH = hSigVal; - this.parsedJWS.sigvalBI = biSigVal; - } - - var sHead = b64utoutf8(b6Head); - var sPayload = b64utoutf8(b6Payload); - this.parsedJWS.headS = sHead; - this.parsedJWS.payloadS = sPayload; - - if (! ns1.isSafeJSONString(sHead, this.parsedJWS, 'headP')) - throw "malformed JSON string for JWS Head: " + sHead; - }; - - // ==== JWS Validation ========================================================= - function _getSignatureInputByString(sHead, sPayload) { - return utf8tob64u(sHead) + "." + utf8tob64u(sPayload); - }; - - function _getHashBySignatureInput(sSignatureInput, sHashAlg) { - var hashfunc = function(s) { return KJUR.crypto.Util.hashString(s, sHashAlg); }; - if (hashfunc == null) throw "hash function not defined in jsrsasign: " + sHashAlg; - return hashfunc(sSignatureInput); - }; - - function _jws_verifySignature(sHead, sPayload, hSig, hN, hE) { - var sSignatureInput = _getSignatureInputByString(sHead, sPayload); - var biSig = parseBigInt(hSig, 16); - return _rsasign_verifySignatureWithArgs(sSignatureInput, biSig, hN, hE); - }; - - /** - * verify JWS signature with naked RSA public key.
- * This only supports "RS256" and "RS512" algorithm. - * @name verifyJWSByNE - * @memberOf KJUR.jws.JWS - * @function - * @param {String} sJWS JWS signature string to be verified - * @param {String} hN hexadecimal string for modulus of RSA public key - * @param {String} hE hexadecimal string for public exponent of RSA public key - * @return {String} returns 1 when JWS signature is valid, otherwise returns 0 - * @throws if sJWS is not comma separated string such like "Header.Payload.Signature". - * @throws if JWS Header is a malformed JSON string. - * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.verify} - */ - this.verifyJWSByNE = function(sJWS, hN, hE) { - this.parseJWS(sJWS); - return _rsasign_verifySignatureWithArgs(this.parsedJWS.si, this.parsedJWS.sigvalBI, hN, hE); - }; - - /** - * verify JWS signature with RSA public key.
- * This only supports "RS256", "RS512", "PS256" and "PS512" algorithms. - * @name verifyJWSByKey - * @memberOf KJUR.jws.JWS - * @function - * @param {String} sJWS JWS signature string to be verified - * @param {RSAKey} key RSA public key - * @return {Boolean} returns true when JWS signature is valid, otherwise returns false - * @throws if sJWS is not comma separated string such like "Header.Payload.Signature". - * @throws if JWS Header is a malformed JSON string. - * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.verify} - */ - this.verifyJWSByKey = function(sJWS, key) { - this.parseJWS(sJWS); - var hashAlg = _jws_getHashAlgFromParsedHead(this.parsedJWS.headP); - var isPSS = this.parsedJWS.headP['alg'].substr(0, 2) == "PS"; - - if (key.hashAndVerify) { - return key.hashAndVerify(hashAlg, - new Buffer(this.parsedJWS.si, 'utf8').toString('base64'), - b64utob64(this.parsedJWS.sigvalB64U), - 'base64', - isPSS); - } else if (isPSS) { - return key.verifyStringPSS(this.parsedJWS.si, - this.parsedJWS.sigvalH, hashAlg); - } else { - return key.verifyString(this.parsedJWS.si, - this.parsedJWS.sigvalH); - } - }; - - /** - * verify JWS signature by PEM formatted X.509 certificate.
- * This only supports "RS256" and "RS512" algorithm. - * @name verifyJWSByPemX509Cert - * @memberOf KJUR.jws.JWS - * @function - * @param {String} sJWS JWS signature string to be verified - * @param {String} sPemX509Cert string of PEM formatted X.509 certificate - * @return {String} returns 1 when JWS signature is valid, otherwise returns 0 - * @throws if sJWS is not comma separated string such like "Header.Payload.Signature". - * @throws if JWS Header is a malformed JSON string. - * @since 1.1 - * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.verify} - */ - this.verifyJWSByPemX509Cert = function(sJWS, sPemX509Cert) { - this.parseJWS(sJWS); - var x509 = new X509(); - x509.readCertPEM(sPemX509Cert); - return x509.subjectPublicKeyRSA.verifyString(this.parsedJWS.si, this.parsedJWS.sigvalH); - }; - - // ==== JWS Generation ========================================================= - function _jws_getHashAlgFromParsedHead(head) { - var sigAlg = head["alg"]; - var hashAlg = ""; - - if (sigAlg != "RS256" && sigAlg != "RS512" && - sigAlg != "PS256" && sigAlg != "PS512") - throw "JWS signature algorithm not supported: " + sigAlg; - if (sigAlg.substr(2) == "256") hashAlg = "sha256"; - if (sigAlg.substr(2) == "512") hashAlg = "sha512"; - return hashAlg; - }; - - function _jws_getHashAlgFromHead(sHead) { - return _jws_getHashAlgFromParsedHead(jsonParse(sHead)); - }; - - function _jws_generateSignatureValueBySI_NED(sHead, sPayload, sSI, hN, hE, hD) { - var rsa = new RSAKey(); - rsa.setPrivate(hN, hE, hD); - - var hashAlg = _jws_getHashAlgFromHead(sHead); - var sigValue = rsa.signString(sSI, hashAlg); - return sigValue; - }; - - function _jws_generateSignatureValueBySI_Key(sHead, sPayload, sSI, key, head) { - var hashAlg = null; - if (typeof head == "undefined") { - hashAlg = _jws_getHashAlgFromHead(sHead); - } else { - hashAlg = _jws_getHashAlgFromParsedHead(head); - } - - var isPSS = head['alg'].substr(0, 2) == "PS"; - - if (key.hashAndSign) { - return b64tob64u(key.hashAndSign(hashAlg, sSI, 'binary', 'base64', isPSS)); - } else if (isPSS) { - return hextob64u(key.signStringPSS(sSI, hashAlg)); - } else { - return hextob64u(key.signString(sSI, hashAlg)); - } - }; - - function _jws_generateSignatureValueByNED(sHead, sPayload, hN, hE, hD) { - var sSI = _getSignatureInputByString(sHead, sPayload); - return _jws_generateSignatureValueBySI_NED(sHead, sPayload, sSI, hN, hE, hD); - }; - - /** - * generate JWS signature by Header, Payload and a naked RSA private key.
- * This only supports "RS256" and "RS512" algorithm. - * @name generateJWSByNED - * @memberOf KJUR.jws.JWS - * @function - * @param {String} sHead string of JWS Header - * @param {String} sPayload string of JWS Payload - * @param {String} hN hexadecimal string for modulus of RSA public key - * @param {String} hE hexadecimal string for public exponent of RSA public key - * @param {String} hD hexadecimal string for private exponent of RSA private key - * @return {String} JWS signature string - * @throws if sHead is a malformed JSON string. - * @throws if supported signature algorithm was not specified in JSON Header. - * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.sign} - */ - this.generateJWSByNED = function(sHead, sPayload, hN, hE, hD) { - if (! ns1.isSafeJSONString(sHead)) throw "JWS Head is not safe JSON string: " + sHead; - var sSI = _getSignatureInputByString(sHead, sPayload); - var hSigValue = _jws_generateSignatureValueBySI_NED(sHead, sPayload, sSI, hN, hE, hD); - var b64SigValue = hextob64u(hSigValue); - - this.parsedJWS = {}; - this.parsedJWS.headB64U = sSI.split(".")[0]; - this.parsedJWS.payloadB64U = sSI.split(".")[1]; - this.parsedJWS.sigvalB64U = b64SigValue; - - return sSI + "." + b64SigValue; - }; - - /** - * generate JWS signature by Header, Payload and a RSA private key.
- * This only supports "RS256", "RS512", "PS256" and "PS512" algorithms. - * @name generateJWSByKey - * @memberOf KJUR.jws.JWS - * @function - * @param {String} sHead string of JWS Header - * @param {String} sPayload string of JWS Payload - * @param {RSAKey} RSA private key - * @return {String} JWS signature string - * @throws if sHead is a malformed JSON string. - * @throws if supported signature algorithm was not specified in JSON Header. - * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.sign} - */ - this.generateJWSByKey = function(sHead, sPayload, key) { - var obj = {}; - if (! ns1.isSafeJSONString(sHead, obj, 'headP')) - throw "JWS Head is not safe JSON string: " + sHead; - var sSI = _getSignatureInputByString(sHead, sPayload); - var b64SigValue = _jws_generateSignatureValueBySI_Key(sHead, sPayload, sSI, key, obj.headP); - - this.parsedJWS = {}; - this.parsedJWS.headB64U = sSI.split(".")[0]; - this.parsedJWS.payloadB64U = sSI.split(".")[1]; - this.parsedJWS.sigvalB64U = b64SigValue; - - return sSI + "." + b64SigValue; - }; - - // === sign with PKCS#1 RSA private key ===================================================== - function _jws_generateSignatureValueBySI_PemPrvKey(sHead, sPayload, sSI, sPemPrvKey) { - var rsa = new RSAKey(); - rsa.readPrivateKeyFromPEMString(sPemPrvKey); - var hashAlg = _jws_getHashAlgFromHead(sHead); - var sigValue = rsa.signString(sSI, hashAlg); - return sigValue; - }; - - /** - * generate JWS signature by Header, Payload and a PEM formatted PKCS#1 RSA private key.
- * This only supports "RS256" and "RS512" algorithm. - * @name generateJWSByP1PrvKey - * @memberOf KJUR.jws.JWS - * @function - * @param {String} sHead string of JWS Header - * @param {String} sPayload string of JWS Payload - * @param {String} string for sPemPrvKey PEM formatted PKCS#1 RSA private key
- * Heading and trailing space characters in PEM key will be ignored. - * @return {String} JWS signature string - * @throws if sHead is a malformed JSON string. - * @throws if supported signature algorithm was not specified in JSON Header. - * @since 1.1 - * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.sign} - */ - this.generateJWSByP1PrvKey = function(sHead, sPayload, sPemPrvKey) { - if (! ns1.isSafeJSONString(sHead)) throw "JWS Head is not safe JSON string: " + sHead; - var sSI = _getSignatureInputByString(sHead, sPayload); - var hSigValue = _jws_generateSignatureValueBySI_PemPrvKey(sHead, sPayload, sSI, sPemPrvKey); - var b64SigValue = hextob64u(hSigValue); - - this.parsedJWS = {}; - this.parsedJWS.headB64U = sSI.split(".")[0]; - this.parsedJWS.payloadB64U = sSI.split(".")[1]; - this.parsedJWS.sigvalB64U = b64SigValue; - - return sSI + "." + b64SigValue; - }; -}; - -// === major static method ======================================================== - -/** - * generate JWS signature by specified key
- * @name sign - * @memberOf KJUR.jws.JWS - * @function - * @static - * @param {String} alg JWS algorithm name to sign and force set to sHead or null - * @param {String} sHead string of JWS Header - * @param {String} sPayload string of JWS Payload - * @param {String} key string of private key or key object to sign - * @param {String} pass (OPTION)passcode to use encrypted private key - * @return {String} JWS signature string - * @since jws 3.0.0 - * @see jsrsasign KJUR.crypto.Signature method - * @see jsrsasign KJUR.crypto.Mac method - * @description - * This method supports following algorithms. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
alg valuespec requirementjsjws support
HS256REQUIREDSUPPORTED
HS384OPTIONAL-
HS512OPTIONALSUPPORTED
RS256RECOMMENDEDSUPPORTED
RS384OPTIONALSUPPORTED
RS512OPTIONALSUPPORTED
ES256RECOMMENDED+SUPPORTED
ES384OPTIONALSUPPORTED
ES512OPTIONAL-
PS256OPTIONALSUPPORTED
PS384OPTIONALSUPPORTED
PS512OPTIONALSUPPORTED
noneREQUIREDSUPPORTED(signature generation only)
- *
- *
NOTE1: - *
salt length of RSAPSS signature is the same as the hash algorithm length - * because of IETF JOSE ML discussion. - *
NOTE2: - *
The reason of HS384 unsupport is - * CryptoJS HmacSHA384 bug. - *
- */ -KJUR.jws.JWS.sign = function(alg, sHeader, sPayload, key, pass) { - var ns1 = KJUR.jws.JWS; - - if (! ns1.isSafeJSONString(sHeader)) - throw "JWS Head is not safe JSON string: " + sHeader; - - var pHeader = ns1.readSafeJSONString(sHeader); - - // 1. use alg if defined in sHeader - if ((alg == '' || alg == null) && - pHeader['alg'] !== undefined) { - alg = pHeader['alg']; - } - - // 2. set alg in sHeader if undefined - if ((alg != '' && alg != null) && - pHeader['alg'] === undefined) { - pHeader['alg'] = alg; - sHeader = JSON.stringify(pHeader); - } - - // 3. set signature algorithm like SHA1withRSA - var sigAlg = null; - if (ns1.jwsalg2sigalg[alg] === undefined) { - throw "unsupported alg name: " + alg; - } else { - sigAlg = ns1.jwsalg2sigalg[alg]; - } - - var uHeader = utf8tob64u(sHeader); - var uPayload = utf8tob64u(sPayload); - var uSignatureInput = uHeader + "." + uPayload - - // 4. sign - var hSig = ""; - if (sigAlg.substr(0, 4) == "Hmac") { - if (key === undefined) - throw "hexadecimal key shall be specified for HMAC"; - var mac = new KJUR.crypto.Mac({'alg': sigAlg, 'pass': hextorstr(key)}); - mac.updateString(uSignatureInput); - hSig = mac.doFinal(); - } else if (sigAlg.indexOf("withECDSA") != -1) { - var sig = new KJUR.crypto.Signature({'alg': sigAlg}); - sig.init(key, pass); - sig.updateString(uSignatureInput); - hASN1Sig = sig.sign(); - hSig = KJUR.crypto.ECDSA.asn1SigToConcatSig(hASN1Sig); - } else if (sigAlg != "none") { - var sig = new KJUR.crypto.Signature({'alg': sigAlg}); - sig.init(key, pass); - sig.updateString(uSignatureInput); - hSig = sig.sign(); - } - - var uSig = hextob64u(hSig); - return uSignatureInput + "." + uSig; -}; - -/** - * verify JWS signature by specified key or certificate
- * @name verify - * @memberOf KJUR.jws.JWS - * @function - * @static - * @param {String} sJWS string of JWS signature to verify - * @param {Object} key string of public key, certificate or key object to verify - * @param {String} acceptAlgs array of algorithm name strings (OPTION) - * @return {Boolean} true if the signature is valid otherwise false - * @since jws 3.0.0 - * @see jsrsasign KJUR.crypto.Signature method - * @see jsrsasign KJUR.crypto.Mac method - * @description - *

- * This method verifies a JSON Web Signature Compact Serialization string by the validation - * algorithm as described in - * - * the section 5 of Internet Draft draft-jones-json-web-signature-04. - *

- *

- * Since 3.2.0 strict key checking has been provided against a JWS algorithm - * in a JWS header. - *

- *

- *

- * NOTE1: The argument 'acceptAlgs' is supported since 3.2.0. - * Strongly recommended to provide acceptAlgs to mitigate - * signature replacement attacks.
- *

- * @example - * // 1) verify a RS256 JWS signature by a certificate string. - * var isValid = KJUR.jws.JWS.verify('eyJh...', '-----BEGIN...', ['RS256']); - * - * // 2) verify a HS256 JWS signature by a certificate string. - * var isValid = KJUR.jws.JWS.verify('eyJh...', '6f62ad...', ['HS256']); - * - * // 3) verify a ES256 JWS signature by a KJUR.crypto.ECDSA key object. - * var pubkey = KEYUTIL.getKey('-----BEGIN CERT...'); - * var isValid = KJUR.jws.JWS.verify('eyJh...', pubkey); - */ -KJUR.jws.JWS.verify = function(sJWS, key, acceptAlgs) { - var jws = KJUR.jws.JWS; - var a = sJWS.split("."); - var uHeader = a[0]; - var uPayload = a[1]; - var uSignatureInput = uHeader + "." + uPayload; - var hSig = b64utohex(a[2]); - - // 1. parse JWS header - var pHeader = jws.readSafeJSONString(b64utoutf8(a[0])); - var alg = null; - var algType = null; // HS|RS|PS|ES|no - if (pHeader.alg === undefined) { - throw "algorithm not specified in header"; - } else { - alg = pHeader.alg; - algType = alg.substr(0, 2); - } - - // 2. check whether alg is acceptable algorithms - if (acceptAlgs != null && - Object.prototype.toString.call(acceptAlgs) === '[object Array]' && - acceptAlgs.length > 0) { - var acceptAlgStr = ":" + acceptAlgs.join(":") + ":"; - if (acceptAlgStr.indexOf(":" + alg + ":") == -1) { - throw "algorithm '" + alg + "' not accepted in the list"; - } - } - - // 3. check whether key is a proper key for alg. - if (alg != "none" && key === null) { - throw "key shall be specified to verify."; - } - - // 3.1. check whether key is hexstr if alg is HS*. - if (algType == "HS") { - if (typeof key != "string" && - key.length != 0 && - key.length % 2 != 0 && - ! key.match(/^[0-9A-Fa-f]+/)) { - throw "key shall be a hexadecimal str for HS* algs"; - } - } - - // 3.2. convert key object if key is a public key or cert PEM string - if (typeof key == "string" && - key.indexOf("-----BEGIN ") != -1) { - key = KEYUTIL.getKey(key); - } - - // 3.3. check whether key is RSAKey obj if alg is RS* or PS*. - if (algType == "RS" || algType == "PS") { - if (!(key instanceof RSAKey)) { - throw "key shall be a RSAKey obj for RS* and PS* algs"; - } - } - - // 3.4. check whether key is ECDSA obj if alg is ES*. - if (algType == "ES") { - if (!(key instanceof KJUR.crypto.ECDSA)) { - throw "key shall be a ECDSA obj for ES* algs"; - } - } - - // 3.5. check when alg is 'none' - if (alg == "none") { - } - - // 4. check whether alg is supported alg in jsjws. - var sigAlg = null; - if (jws.jwsalg2sigalg[pHeader.alg] === undefined) { - throw "unsupported alg name: " + alg; - } else { - sigAlg = jws.jwsalg2sigalg[alg]; - } - - // 5. verify - if (sigAlg == "none") { - throw "not supported"; - } else if (sigAlg.substr(0, 4) == "Hmac") { - if (key === undefined) - throw "hexadecimal key shall be specified for HMAC"; - var mac = new KJUR.crypto.Mac({'alg': sigAlg, 'pass': hextorstr(key)}); - mac.updateString(uSignatureInput); - hSig2 = mac.doFinal(); - return hSig == hSig2; - } else if (sigAlg.indexOf("withECDSA") != -1) { - var hASN1Sig = null; - try { - hASN1Sig = KJUR.crypto.ECDSA.concatSigToASN1Sig(hSig); - } catch (ex) { - return false; - } - var sig = new KJUR.crypto.Signature({'alg': sigAlg}); - sig.init(key) - sig.updateString(uSignatureInput); - return sig.verify(hASN1Sig); - } else { - var sig = new KJUR.crypto.Signature({'alg': sigAlg}); - sig.init(key) - sig.updateString(uSignatureInput); - return sig.verify(hSig); - } -}; - -/* - * @since jws 3.0.0 - */ -KJUR.jws.JWS.jwsalg2sigalg = { - "HS256": "HmacSHA256", - "HS384": "HmacSHA384", - "HS512": "HmacSHA512", - "RS256": "SHA256withRSA", - "RS384": "SHA384withRSA", - "RS512": "SHA512withRSA", - "ES256": "SHA256withECDSA", - "ES384": "SHA384withECDSA", - //"ES512": "SHA512withECDSA", // unsupported because of jsrsasign's bug - "PS256": "SHA256withRSAandMGF1", - "PS384": "SHA384withRSAandMGF1", - "PS512": "SHA512withRSAandMGF1", - "none": "none", -}; - -// === utility static method ====================================================== - -/** - * check whether a String "s" is a safe JSON string or not.
- * If a String "s" is a malformed JSON string or an other object type - * this returns 0, otherwise this returns 1. - * @name isSafeJSONString - * @memberOf KJUR.jws.JWS - * @function - * @static - * @param {String} s JSON string - * @return {Number} 1 or 0 - */ -KJUR.jws.JWS.isSafeJSONString = function(s, h, p) { - var o = null; - try { - o = jsonParse(s); - if (typeof o != "object") return 0; - if (o.constructor === Array) return 0; - if (h) h[p] = o; - return 1; - } catch (ex) { - return 0; - } -}; - -/** - * read a String "s" as JSON object if it is safe.
- * If a String "s" is a malformed JSON string or not JSON string, - * this returns null, otherwise returns JSON object. - * @name readSafeJSONString - * @memberOf KJUR.jws.JWS - * @function - * @static - * @param {String} s JSON string - * @return {Object} JSON object or null - * @since 1.1.1 - */ -KJUR.jws.JWS.readSafeJSONString = function(s) { - var o = null; - try { - o = jsonParse(s); - if (typeof o != "object") return null; - if (o.constructor === Array) return null; - return o; - } catch (ex) { - return null; - } -}; - -/** - * get Encoed Signature Value from JWS string.
- * @name getEncodedSignatureValueFromJWS - * @memberOf KJUR.jws.JWS - * @function - * @static - * @param {String} sJWS JWS signature string to be verified - * @return {String} string of Encoded Signature Value - * @throws if sJWS is not comma separated string such like "Header.Payload.Signature". - */ -KJUR.jws.JWS.getEncodedSignatureValueFromJWS = function(sJWS) { - if (sJWS.match(/^[^.]+\.[^.]+\.([^.]+)$/) == null) { - throw "JWS signature is not a form of 'Head.Payload.SigValue'."; - } - return RegExp.$1; -}; - -/** - * IntDate class for time representation for JSON Web Token(JWT) - * @class KJUR.jws.IntDate class - * @name KJUR.jws.IntDate - * @since jws 3.0.1 - * @description - * Utility class for IntDate which is integer representation of UNIX origin time - * used in JSON Web Token(JWT). - */ -KJUR.jws.IntDate = function() { -}; - -/** - * @name get - * @memberOf KJUR.jws.IntDate - * @function - * @static - * @param {String} s string of time representation - * @return {Integer} UNIX origin time in seconds for argument 's' - * @since jws 3.0.1 - * @throws "unsupported format: s" when malformed format - * @description - * This method will accept following representation of time. - * - */ -KJUR.jws.IntDate.get = function(s) { - if (s == "now") { - return KJUR.jws.IntDate.getNow(); - } else if (s == "now + 1hour") { - return KJUR.jws.IntDate.getNow() + 60 * 60; - } else if (s == "now + 1day") { - return KJUR.jws.IntDate.getNow() + 60 * 60 * 24; - } else if (s == "now + 1month") { - return KJUR.jws.IntDate.getNow() + 60 * 60 * 24 * 30; - } else if (s == "now + 1year") { - return KJUR.jws.IntDate.getNow() + 60 * 60 * 24 * 365; - } else if (s.match(/Z$/)) { - return KJUR.jws.IntDate.getZulu(s); - } else if (s.match(/^[0-9]+$/)) { - return parseInt(s); - } - throw "unsupported format: " + s; -}; - -KJUR.jws.IntDate.getZulu = function(s) { - if (a = s.match(/(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)Z/)) { - var year = parseInt(RegExp.$1); - var month = parseInt(RegExp.$2) - 1; - var day = parseInt(RegExp.$3); - var hour = parseInt(RegExp.$4); - var min = parseInt(RegExp.$5); - var sec = parseInt(RegExp.$6); - var d = new Date(Date.UTC(year, month, day, hour, min, sec)); - return ~~(d / 1000); - } - throw "unsupported format: " + s; -}; - -/* - * @since jws 3.0.1 - */ -KJUR.jws.IntDate.getNow = function() { - var d = ~~(new Date() / 1000); - return d; -}; - -/* - * @since jws 3.0.1 - */ -KJUR.jws.IntDate.intDate2UTCString = function(intDate) { - var d = new Date(intDate * 1000); - return d.toUTCString(); -}; - -/* - * @since jws 3.0.1 - */ -KJUR.jws.IntDate.intDate2Zulu = function(intDate) { - var d = new Date(intDate * 1000); - var year = ("0000" + d.getUTCFullYear()).slice(-4); - var mon = ("00" + (d.getUTCMonth() + 1)).slice(-2); - var day = ("00" + d.getUTCDate()).slice(-2); - var hour = ("00" + d.getUTCHours()).slice(-2); - var min = ("00" + d.getUTCMinutes()).slice(-2); - var sec = ("00" + d.getUTCSeconds()).slice(-2); - return year + mon + day + hour + min + sec + "Z"; -}; +/*! jws-3.2.2 (c) 2013-2015 Kenji Urushima | kjur.github.com/jsjws/license + */ +/* + * jws.js - JSON Web Signature Class + * + * version: 3.2.2 (2015 Apr 26) + * + * Copyright (c) 2010-2015 Kenji Urushima (kenji.urushima@gmail.com) + * + * This software is licensed under the terms of the MIT License. + * http://kjur.github.com/jsjws/license/ + * + * The above copyright and license notice shall be + * included in all copies or substantial portions of the Software. + */ + +/** + * @fileOverview + * @name jws-3.2.js + * @author Kenji Urushima kenji.urushima@gmail.com + * @version 3.2.2 (2015-Apr-26) + * @since jsjws 1.0 + * @license MIT License + */ + +if (typeof KJUR == "undefined" || !KJUR) KJUR = {}; +if (typeof KJUR.jws == "undefined" || !KJUR.jws) KJUR.jws = {}; + +/** + * JSON Web Signature(JWS) class.
+ * @name KJUR.jws.JWS + * @class JSON Web Signature(JWS) class + * @property {Dictionary} parsedJWS This property is set after JWS signature verification.
+ * Following "parsedJWS_*" properties can be accessed as "parsedJWS.*" because of + * JsDoc restriction. + * @property {String} parsedJWS_headB64U string of Encrypted JWS Header + * @property {String} parsedJWS_payloadB64U string of Encrypted JWS Payload + * @property {String} parsedJWS_sigvalB64U string of Encrypted JWS signature value + * @property {String} parsedJWS_si string of Signature Input + * @property {String} parsedJWS_sigvalH hexadecimal string of JWS signature value + * @property {String} parsedJWS_sigvalBI BigInteger(defined in jsbn.js) object of JWS signature value + * @property {String} parsedJWS_headS string of decoded JWS Header + * @property {String} parsedJWS_headS string of decoded JWS Payload + * @requires base64x.js, json-sans-eval.js and jsrsasign library + * @see 'jwjws'(JWS JavaScript Library) home page http://kjur.github.com/jsjws/ + * @see 'jwrsasign'(RSA Sign JavaScript Library) home page http://kjur.github.com/jsrsasign/ + * @see IETF I-D JSON Web Algorithms (JWA) + * @since jsjws 1.0 + * @description + *

Supported Algorithms

+ * Here is supported algorithm names for {@link KJUR.jws.JWS.sign} and {@link KJUR.jws.JWS.verify} + * methods. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
alg valuespec requirementjsjws support
HS256REQUIREDSUPPORTED
HS384OPTIONALSUPPORTED
HS512OPTIONALSUPPORTED
RS256RECOMMENDEDSUPPORTED
RS384OPTIONALSUPPORTED
RS512OPTIONALSUPPORTED
ES256RECOMMENDED+SUPPORTED
ES384OPTIONALSUPPORTED
ES512OPTIONAL-
PS256OPTIONALSUPPORTED
PS384OPTIONALSUPPORTED
PS512OPTIONALSUPPORTED
noneREQUIREDSUPPORTED(signature generation only)
+ * NOTE1: HS384 is supported since jsjws 3.0.2 with jsrsasign 4.1.4.
+ */ +KJUR.jws.JWS = function() { + var ns1 = KJUR.jws.JWS; + + // === utility ============================================================= + + /** + * parse JWS string and set public property 'parsedJWS' dictionary.
+ * @name parseJWS + * @memberOf KJUR.jws.JWS + * @function + * @param {String} sJWS JWS signature string to be parsed. + * @throws if sJWS is not comma separated string such like "Header.Payload.Signature". + * @throws if JWS Header is a malformed JSON string. + * @since jws 1.1 + */ + this.parseJWS = function(sJWS, sigValNotNeeded) { + if ((this.parsedJWS !== undefined) && + (sigValNotNeeded || (this.parsedJWS.sigvalH !== undefined))) { + return; + } + if (sJWS.match(/^([^.]+)\.([^.]+)\.([^.]+)$/) == null) { + throw "JWS signature is not a form of 'Head.Payload.SigValue'."; + } + var b6Head = RegExp.$1; + var b6Payload = RegExp.$2; + var b6SigVal = RegExp.$3; + var sSI = b6Head + "." + b6Payload; + this.parsedJWS = {}; + this.parsedJWS.headB64U = b6Head; + this.parsedJWS.payloadB64U = b6Payload; + this.parsedJWS.sigvalB64U = b6SigVal; + this.parsedJWS.si = sSI; + + if (!sigValNotNeeded) { + var hSigVal = b64utohex(b6SigVal); + var biSigVal = parseBigInt(hSigVal, 16); + this.parsedJWS.sigvalH = hSigVal; + this.parsedJWS.sigvalBI = biSigVal; + } + + var sHead = b64utoutf8(b6Head); + var sPayload = b64utoutf8(b6Payload); + this.parsedJWS.headS = sHead; + this.parsedJWS.payloadS = sPayload; + + if (! ns1.isSafeJSONString(sHead, this.parsedJWS, 'headP')) + throw "malformed JSON string for JWS Head: " + sHead; + }; + + // ==== JWS Validation ========================================================= + function _getSignatureInputByString(sHead, sPayload) { + return utf8tob64u(sHead) + "." + utf8tob64u(sPayload); + }; + + function _getHashBySignatureInput(sSignatureInput, sHashAlg) { + var hashfunc = function(s) { return KJUR.crypto.Util.hashString(s, sHashAlg); }; + if (hashfunc == null) throw "hash function not defined in jsrsasign: " + sHashAlg; + return hashfunc(sSignatureInput); + }; + + function _jws_verifySignature(sHead, sPayload, hSig, hN, hE) { + var sSignatureInput = _getSignatureInputByString(sHead, sPayload); + var biSig = parseBigInt(hSig, 16); + return _rsasign_verifySignatureWithArgs(sSignatureInput, biSig, hN, hE); + }; + + /** + * verify JWS signature with naked RSA public key.
+ * This only supports "RS256" and "RS512" algorithm. + * @name verifyJWSByNE + * @memberOf KJUR.jws.JWS + * @function + * @param {String} sJWS JWS signature string to be verified + * @param {String} hN hexadecimal string for modulus of RSA public key + * @param {String} hE hexadecimal string for public exponent of RSA public key + * @return {String} returns 1 when JWS signature is valid, otherwise returns 0 + * @throws if sJWS is not comma separated string such like "Header.Payload.Signature". + * @throws if JWS Header is a malformed JSON string. + * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.verify} + */ + this.verifyJWSByNE = function(sJWS, hN, hE) { + this.parseJWS(sJWS); + return _rsasign_verifySignatureWithArgs(this.parsedJWS.si, this.parsedJWS.sigvalBI, hN, hE); + }; + + /** + * verify JWS signature with RSA public key.
+ * This only supports "RS256", "RS512", "PS256" and "PS512" algorithms. + * @name verifyJWSByKey + * @memberOf KJUR.jws.JWS + * @function + * @param {String} sJWS JWS signature string to be verified + * @param {RSAKey} key RSA public key + * @return {Boolean} returns true when JWS signature is valid, otherwise returns false + * @throws if sJWS is not comma separated string such like "Header.Payload.Signature". + * @throws if JWS Header is a malformed JSON string. + * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.verify} + */ + this.verifyJWSByKey = function(sJWS, key) { + this.parseJWS(sJWS); + var hashAlg = _jws_getHashAlgFromParsedHead(this.parsedJWS.headP); + var isPSS = this.parsedJWS.headP['alg'].substr(0, 2) == "PS"; + + if (key.hashAndVerify) { + return key.hashAndVerify(hashAlg, + new Buffer(this.parsedJWS.si, 'utf8').toString('base64'), + b64utob64(this.parsedJWS.sigvalB64U), + 'base64', + isPSS); + } else if (isPSS) { + return key.verifyStringPSS(this.parsedJWS.si, + this.parsedJWS.sigvalH, hashAlg); + } else { + return key.verifyString(this.parsedJWS.si, + this.parsedJWS.sigvalH); + } + }; + + /** + * verify JWS signature by PEM formatted X.509 certificate.
+ * This only supports "RS256" and "RS512" algorithm. + * @name verifyJWSByPemX509Cert + * @memberOf KJUR.jws.JWS + * @function + * @param {String} sJWS JWS signature string to be verified + * @param {String} sPemX509Cert string of PEM formatted X.509 certificate + * @return {String} returns 1 when JWS signature is valid, otherwise returns 0 + * @throws if sJWS is not comma separated string such like "Header.Payload.Signature". + * @throws if JWS Header is a malformed JSON string. + * @since 1.1 + * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.verify} + */ + this.verifyJWSByPemX509Cert = function(sJWS, sPemX509Cert) { + this.parseJWS(sJWS); + var x509 = new X509(); + x509.readCertPEM(sPemX509Cert); + return x509.subjectPublicKeyRSA.verifyString(this.parsedJWS.si, this.parsedJWS.sigvalH); + }; + + // ==== JWS Generation ========================================================= + function _jws_getHashAlgFromParsedHead(head) { + var sigAlg = head["alg"]; + var hashAlg = ""; + + if (sigAlg != "RS256" && sigAlg != "RS512" && + sigAlg != "PS256" && sigAlg != "PS512") + throw "JWS signature algorithm not supported: " + sigAlg; + if (sigAlg.substr(2) == "256") hashAlg = "sha256"; + if (sigAlg.substr(2) == "512") hashAlg = "sha512"; + return hashAlg; + }; + + function _jws_getHashAlgFromHead(sHead) { + return _jws_getHashAlgFromParsedHead(jsonParse(sHead)); + }; + + function _jws_generateSignatureValueBySI_NED(sHead, sPayload, sSI, hN, hE, hD) { + var rsa = new RSAKey(); + rsa.setPrivate(hN, hE, hD); + + var hashAlg = _jws_getHashAlgFromHead(sHead); + var sigValue = rsa.signString(sSI, hashAlg); + return sigValue; + }; + + function _jws_generateSignatureValueBySI_Key(sHead, sPayload, sSI, key, head) { + var hashAlg = null; + if (typeof head == "undefined") { + hashAlg = _jws_getHashAlgFromHead(sHead); + } else { + hashAlg = _jws_getHashAlgFromParsedHead(head); + } + + var isPSS = head['alg'].substr(0, 2) == "PS"; + + if (key.hashAndSign) { + return b64tob64u(key.hashAndSign(hashAlg, sSI, 'binary', 'base64', isPSS)); + } else if (isPSS) { + return hextob64u(key.signStringPSS(sSI, hashAlg)); + } else { + return hextob64u(key.signString(sSI, hashAlg)); + } + }; + + function _jws_generateSignatureValueByNED(sHead, sPayload, hN, hE, hD) { + var sSI = _getSignatureInputByString(sHead, sPayload); + return _jws_generateSignatureValueBySI_NED(sHead, sPayload, sSI, hN, hE, hD); + }; + + /** + * generate JWS signature by Header, Payload and a naked RSA private key.
+ * This only supports "RS256" and "RS512" algorithm. + * @name generateJWSByNED + * @memberOf KJUR.jws.JWS + * @function + * @param {String} sHead string of JWS Header + * @param {String} sPayload string of JWS Payload + * @param {String} hN hexadecimal string for modulus of RSA public key + * @param {String} hE hexadecimal string for public exponent of RSA public key + * @param {String} hD hexadecimal string for private exponent of RSA private key + * @return {String} JWS signature string + * @throws if sHead is a malformed JSON string. + * @throws if supported signature algorithm was not specified in JSON Header. + * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.sign} + */ + this.generateJWSByNED = function(sHead, sPayload, hN, hE, hD) { + if (! ns1.isSafeJSONString(sHead)) throw "JWS Head is not safe JSON string: " + sHead; + var sSI = _getSignatureInputByString(sHead, sPayload); + var hSigValue = _jws_generateSignatureValueBySI_NED(sHead, sPayload, sSI, hN, hE, hD); + var b64SigValue = hextob64u(hSigValue); + + this.parsedJWS = {}; + this.parsedJWS.headB64U = sSI.split(".")[0]; + this.parsedJWS.payloadB64U = sSI.split(".")[1]; + this.parsedJWS.sigvalB64U = b64SigValue; + + return sSI + "." + b64SigValue; + }; + + /** + * generate JWS signature by Header, Payload and a RSA private key.
+ * This only supports "RS256", "RS512", "PS256" and "PS512" algorithms. + * @name generateJWSByKey + * @memberOf KJUR.jws.JWS + * @function + * @param {String} sHead string of JWS Header + * @param {String} sPayload string of JWS Payload + * @param {RSAKey} RSA private key + * @return {String} JWS signature string + * @throws if sHead is a malformed JSON string. + * @throws if supported signature algorithm was not specified in JSON Header. + * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.sign} + */ + this.generateJWSByKey = function(sHead, sPayload, key) { + var obj = {}; + if (! ns1.isSafeJSONString(sHead, obj, 'headP')) + throw "JWS Head is not safe JSON string: " + sHead; + var sSI = _getSignatureInputByString(sHead, sPayload); + var b64SigValue = _jws_generateSignatureValueBySI_Key(sHead, sPayload, sSI, key, obj.headP); + + this.parsedJWS = {}; + this.parsedJWS.headB64U = sSI.split(".")[0]; + this.parsedJWS.payloadB64U = sSI.split(".")[1]; + this.parsedJWS.sigvalB64U = b64SigValue; + + return sSI + "." + b64SigValue; + }; + + // === sign with PKCS#1 RSA private key ===================================================== + function _jws_generateSignatureValueBySI_PemPrvKey(sHead, sPayload, sSI, sPemPrvKey) { + var rsa = new RSAKey(); + rsa.readPrivateKeyFromPEMString(sPemPrvKey); + var hashAlg = _jws_getHashAlgFromHead(sHead); + var sigValue = rsa.signString(sSI, hashAlg); + return sigValue; + }; + + /** + * generate JWS signature by Header, Payload and a PEM formatted PKCS#1 RSA private key.
+ * This only supports "RS256" and "RS512" algorithm. + * @name generateJWSByP1PrvKey + * @memberOf KJUR.jws.JWS + * @function + * @param {String} sHead string of JWS Header + * @param {String} sPayload string of JWS Payload + * @param {String} string for sPemPrvKey PEM formatted PKCS#1 RSA private key
+ * Heading and trailing space characters in PEM key will be ignored. + * @return {String} JWS signature string + * @throws if sHead is a malformed JSON string. + * @throws if supported signature algorithm was not specified in JSON Header. + * @since 1.1 + * @deprecated from 3.0.0 please move to {@link KJUR.jws.JWS.sign} + */ + this.generateJWSByP1PrvKey = function(sHead, sPayload, sPemPrvKey) { + if (! ns1.isSafeJSONString(sHead)) throw "JWS Head is not safe JSON string: " + sHead; + var sSI = _getSignatureInputByString(sHead, sPayload); + var hSigValue = _jws_generateSignatureValueBySI_PemPrvKey(sHead, sPayload, sSI, sPemPrvKey); + var b64SigValue = hextob64u(hSigValue); + + this.parsedJWS = {}; + this.parsedJWS.headB64U = sSI.split(".")[0]; + this.parsedJWS.payloadB64U = sSI.split(".")[1]; + this.parsedJWS.sigvalB64U = b64SigValue; + + return sSI + "." + b64SigValue; + }; +}; + +// === major static method ======================================================== + +/** + * generate JWS signature by specified key
+ * @name sign + * @memberOf KJUR.jws.JWS + * @function + * @static + * @param {String} alg JWS algorithm name to sign and force set to sHead or null + * @param {String} sHead string of JWS Header + * @param {String} sPayload string of JWS Payload + * @param {String} key string of private key or key object to sign + * @param {String} pass (OPTION)passcode to use encrypted private key + * @return {String} JWS signature string + * @since jws 3.0.0 + * @see jsrsasign KJUR.crypto.Signature method + * @see jsrsasign KJUR.crypto.Mac method + * @description + * This method supports following algorithms. + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
alg valuespec requirementjsjws support
HS256REQUIREDSUPPORTED
HS384OPTIONAL-
HS512OPTIONALSUPPORTED
RS256RECOMMENDEDSUPPORTED
RS384OPTIONALSUPPORTED
RS512OPTIONALSUPPORTED
ES256RECOMMENDED+SUPPORTED
ES384OPTIONALSUPPORTED
ES512OPTIONAL-
PS256OPTIONALSUPPORTED
PS384OPTIONALSUPPORTED
PS512OPTIONALSUPPORTED
noneREQUIREDSUPPORTED(signature generation only)
+ *
+ *
NOTE1: + *
salt length of RSAPSS signature is the same as the hash algorithm length + * because of IETF JOSE ML discussion. + *
NOTE2: + *
The reason of HS384 unsupport is + * CryptoJS HmacSHA384 bug. + *
+ */ +KJUR.jws.JWS.sign = function(alg, sHeader, sPayload, key, pass) { + var ns1 = KJUR.jws.JWS; + + if (! ns1.isSafeJSONString(sHeader)) + throw "JWS Head is not safe JSON string: " + sHeader; + + var pHeader = ns1.readSafeJSONString(sHeader); + + // 1. use alg if defined in sHeader + if ((alg == '' || alg == null) && + pHeader['alg'] !== undefined) { + alg = pHeader['alg']; + } + + // 2. set alg in sHeader if undefined + if ((alg != '' && alg != null) && + pHeader['alg'] === undefined) { + pHeader['alg'] = alg; + sHeader = JSON.stringify(pHeader); + } + + // 3. set signature algorithm like SHA1withRSA + var sigAlg = null; + if (ns1.jwsalg2sigalg[alg] === undefined) { + throw "unsupported alg name: " + alg; + } else { + sigAlg = ns1.jwsalg2sigalg[alg]; + } + + var uHeader = utf8tob64u(sHeader); + var uPayload = utf8tob64u(sPayload); + var uSignatureInput = uHeader + "." + uPayload + + // 4. sign + var hSig = ""; + if (sigAlg.substr(0, 4) == "Hmac") { + if (key === undefined) + throw "hexadecimal key shall be specified for HMAC"; + var mac = new KJUR.crypto.Mac({'alg': sigAlg, 'pass': hextorstr(key)}); + mac.updateString(uSignatureInput); + hSig = mac.doFinal(); + } else if (sigAlg.indexOf("withECDSA") != -1) { + var sig = new KJUR.crypto.Signature({'alg': sigAlg}); + sig.init(key, pass); + sig.updateString(uSignatureInput); + hASN1Sig = sig.sign(); + hSig = KJUR.crypto.ECDSA.asn1SigToConcatSig(hASN1Sig); + } else if (sigAlg != "none") { + var sig = new KJUR.crypto.Signature({'alg': sigAlg}); + sig.init(key, pass); + sig.updateString(uSignatureInput); + hSig = sig.sign(); + } + + var uSig = hextob64u(hSig); + return uSignatureInput + "." + uSig; +}; + +/** + * verify JWS signature by specified key or certificate
+ * @name verify + * @memberOf KJUR.jws.JWS + * @function + * @static + * @param {String} sJWS string of JWS signature to verify + * @param {Object} key string of public key, certificate or key object to verify + * @param {String} acceptAlgs array of algorithm name strings (OPTION) + * @return {Boolean} true if the signature is valid otherwise false + * @since jws 3.0.0 + * @see jsrsasign KJUR.crypto.Signature method + * @see jsrsasign KJUR.crypto.Mac method + * @description + *

+ * This method verifies a JSON Web Signature Compact Serialization string by the validation + * algorithm as described in + * + * the section 5 of Internet Draft draft-jones-json-web-signature-04. + *

+ *

+ * Since 3.2.0 strict key checking has been provided against a JWS algorithm + * in a JWS header. + *

+ *

+ *

+ * NOTE1: The argument 'acceptAlgs' is supported since 3.2.0. + * Strongly recommended to provide acceptAlgs to mitigate + * signature replacement attacks.
+ *

+ * @example + * // 1) verify a RS256 JWS signature by a certificate string. + * var isValid = KJUR.jws.JWS.verify('eyJh...', '-----BEGIN...', ['RS256']); + * + * // 2) verify a HS256 JWS signature by a certificate string. + * var isValid = KJUR.jws.JWS.verify('eyJh...', '6f62ad...', ['HS256']); + * + * // 3) verify a ES256 JWS signature by a KJUR.crypto.ECDSA key object. + * var pubkey = KEYUTIL.getKey('-----BEGIN CERT...'); + * var isValid = KJUR.jws.JWS.verify('eyJh...', pubkey); + */ +KJUR.jws.JWS.verify = function(sJWS, key, acceptAlgs) { + var jws = KJUR.jws.JWS; + var a = sJWS.split("."); + var uHeader = a[0]; + var uPayload = a[1]; + var uSignatureInput = uHeader + "." + uPayload; + var hSig = b64utohex(a[2]); + + // 1. parse JWS header + var pHeader = jws.readSafeJSONString(b64utoutf8(a[0])); + var alg = null; + var algType = null; // HS|RS|PS|ES|no + if (pHeader.alg === undefined) { + throw "algorithm not specified in header"; + } else { + alg = pHeader.alg; + algType = alg.substr(0, 2); + } + + // 2. check whether alg is acceptable algorithms + if (acceptAlgs != null && + Object.prototype.toString.call(acceptAlgs) === '[object Array]' && + acceptAlgs.length > 0) { + var acceptAlgStr = ":" + acceptAlgs.join(":") + ":"; + if (acceptAlgStr.indexOf(":" + alg + ":") == -1) { + throw "algorithm '" + alg + "' not accepted in the list"; + } + } + + // 3. check whether key is a proper key for alg. + if (alg != "none" && key === null) { + throw "key shall be specified to verify."; + } + + // 3.1. check whether key is hexstr if alg is HS*. + if (algType == "HS") { + if (typeof key != "string" && + key.length != 0 && + key.length % 2 != 0 && + ! key.match(/^[0-9A-Fa-f]+/)) { + throw "key shall be a hexadecimal str for HS* algs"; + } + } + + // 3.2. convert key object if key is a public key or cert PEM string + if (typeof key == "string" && + key.indexOf("-----BEGIN ") != -1) { + key = KEYUTIL.getKey(key); + } + + // 3.3. check whether key is RSAKey obj if alg is RS* or PS*. + if (algType == "RS" || algType == "PS") { + if (!(key instanceof RSAKey)) { + throw "key shall be a RSAKey obj for RS* and PS* algs"; + } + } + + // 3.4. check whether key is ECDSA obj if alg is ES*. + if (algType == "ES") { + if (!(key instanceof KJUR.crypto.ECDSA)) { + throw "key shall be a ECDSA obj for ES* algs"; + } + } + + // 3.5. check when alg is 'none' + if (alg == "none") { + } + + // 4. check whether alg is supported alg in jsjws. + var sigAlg = null; + if (jws.jwsalg2sigalg[pHeader.alg] === undefined) { + throw "unsupported alg name: " + alg; + } else { + sigAlg = jws.jwsalg2sigalg[alg]; + } + + // 5. verify + if (sigAlg == "none") { + throw "not supported"; + } else if (sigAlg.substr(0, 4) == "Hmac") { + if (key === undefined) + throw "hexadecimal key shall be specified for HMAC"; + var mac = new KJUR.crypto.Mac({'alg': sigAlg, 'pass': hextorstr(key)}); + mac.updateString(uSignatureInput); + hSig2 = mac.doFinal(); + return hSig == hSig2; + } else if (sigAlg.indexOf("withECDSA") != -1) { + var hASN1Sig = null; + try { + hASN1Sig = KJUR.crypto.ECDSA.concatSigToASN1Sig(hSig); + } catch (ex) { + return false; + } + var sig = new KJUR.crypto.Signature({'alg': sigAlg}); + sig.init(key) + sig.updateString(uSignatureInput); + return sig.verify(hASN1Sig); + } else { + var sig = new KJUR.crypto.Signature({'alg': sigAlg}); + sig.init(key) + sig.updateString(uSignatureInput); + return sig.verify(hSig); + } +}; + +/* + * @since jws 3.0.0 + */ +KJUR.jws.JWS.jwsalg2sigalg = { + "HS256": "HmacSHA256", + "HS384": "HmacSHA384", + "HS512": "HmacSHA512", + "RS256": "SHA256withRSA", + "RS384": "SHA384withRSA", + "RS512": "SHA512withRSA", + "ES256": "SHA256withECDSA", + "ES384": "SHA384withECDSA", + //"ES512": "SHA512withECDSA", // unsupported because of jsrsasign's bug + "PS256": "SHA256withRSAandMGF1", + "PS384": "SHA384withRSAandMGF1", + "PS512": "SHA512withRSAandMGF1", + "none": "none", +}; + +// === utility static method ====================================================== + +/** + * check whether a String "s" is a safe JSON string or not.
+ * If a String "s" is a malformed JSON string or an other object type + * this returns 0, otherwise this returns 1. + * @name isSafeJSONString + * @memberOf KJUR.jws.JWS + * @function + * @static + * @param {String} s JSON string + * @return {Number} 1 or 0 + */ +KJUR.jws.JWS.isSafeJSONString = function(s, h, p) { + var o = null; + try { + o = jsonParse(s); + if (typeof o != "object") return 0; + if (o.constructor === Array) return 0; + if (h) h[p] = o; + return 1; + } catch (ex) { + return 0; + } +}; + +/** + * read a String "s" as JSON object if it is safe.
+ * If a String "s" is a malformed JSON string or not JSON string, + * this returns null, otherwise returns JSON object. + * @name readSafeJSONString + * @memberOf KJUR.jws.JWS + * @function + * @static + * @param {String} s JSON string + * @return {Object} JSON object or null + * @since 1.1.1 + */ +KJUR.jws.JWS.readSafeJSONString = function(s) { + var o = null; + try { + o = jsonParse(s); + if (typeof o != "object") return null; + if (o.constructor === Array) return null; + return o; + } catch (ex) { + return null; + } +}; + +/** + * get Encoed Signature Value from JWS string.
+ * @name getEncodedSignatureValueFromJWS + * @memberOf KJUR.jws.JWS + * @function + * @static + * @param {String} sJWS JWS signature string to be verified + * @return {String} string of Encoded Signature Value + * @throws if sJWS is not comma separated string such like "Header.Payload.Signature". + */ +KJUR.jws.JWS.getEncodedSignatureValueFromJWS = function(sJWS) { + if (sJWS.match(/^[^.]+\.[^.]+\.([^.]+)$/) == null) { + throw "JWS signature is not a form of 'Head.Payload.SigValue'."; + } + return RegExp.$1; +}; + +/** + * IntDate class for time representation for JSON Web Token(JWT) + * @class KJUR.jws.IntDate class + * @name KJUR.jws.IntDate + * @since jws 3.0.1 + * @description + * Utility class for IntDate which is integer representation of UNIX origin time + * used in JSON Web Token(JWT). + */ +KJUR.jws.IntDate = function() { +}; + +/** + * @name get + * @memberOf KJUR.jws.IntDate + * @function + * @static + * @param {String} s string of time representation + * @return {Integer} UNIX origin time in seconds for argument 's' + * @since jws 3.0.1 + * @throws "unsupported format: s" when malformed format + * @description + * This method will accept following representation of time. + * + */ +KJUR.jws.IntDate.get = function(s) { + if (s == "now") { + return KJUR.jws.IntDate.getNow(); + } else if (s == "now + 1hour") { + return KJUR.jws.IntDate.getNow() + 60 * 60; + } else if (s == "now + 1day") { + return KJUR.jws.IntDate.getNow() + 60 * 60 * 24; + } else if (s == "now + 1month") { + return KJUR.jws.IntDate.getNow() + 60 * 60 * 24 * 30; + } else if (s == "now + 1year") { + return KJUR.jws.IntDate.getNow() + 60 * 60 * 24 * 365; + } else if (s.match(/Z$/)) { + return KJUR.jws.IntDate.getZulu(s); + } else if (s.match(/^[0-9]+$/)) { + return parseInt(s); + } + throw "unsupported format: " + s; +}; + +KJUR.jws.IntDate.getZulu = function(s) { + if (a = s.match(/(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)Z/)) { + var year = parseInt(RegExp.$1); + var month = parseInt(RegExp.$2) - 1; + var day = parseInt(RegExp.$3); + var hour = parseInt(RegExp.$4); + var min = parseInt(RegExp.$5); + var sec = parseInt(RegExp.$6); + var d = new Date(Date.UTC(year, month, day, hour, min, sec)); + return ~~(d / 1000); + } + throw "unsupported format: " + s; +}; + +/* + * @since jws 3.0.1 + */ +KJUR.jws.IntDate.getNow = function() { + var d = ~~(new Date() / 1000); + return d; +}; + +/* + * @since jws 3.0.1 + */ +KJUR.jws.IntDate.intDate2UTCString = function(intDate) { + var d = new Date(intDate * 1000); + return d.toUTCString(); +}; + +/* + * @since jws 3.0.1 + */ +KJUR.jws.IntDate.intDate2Zulu = function(intDate) { + var d = new Date(intDate * 1000); + var year = ("0000" + d.getUTCFullYear()).slice(-4); + var mon = ("00" + (d.getUTCMonth() + 1)).slice(-2); + var day = ("00" + d.getUTCDate()).slice(-2); + var hour = ("00" + d.getUTCHours()).slice(-2); + var min = ("00" + d.getUTCMinutes()).slice(-2); + var sec = ("00" + d.getUTCSeconds()).slice(-2); + return year + mon + day + hour + min + sec + "Z"; +}; diff --git a/src/components/rdflib.js b/src/components/rdflib.js index 5c7c0f554..6930bb7b2 100644 --- a/src/components/rdflib.js +++ b/src/components/rdflib.js @@ -17513,255 +17513,255 @@ function characterReplacer(character) { module.exports = N3Writer; },{}],40:[function(require,module,exports){ -function DOMParser(options){ - this.options = options ||{locator:{}}; - -} -DOMParser.prototype.parseFromString = function(source,mimeType){ - var options = this.options; - var sax = new XMLReader(); - var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler - var errorHandler = options.errorHandler; - var locator = options.locator; - var defaultNSMap = options.xmlns||{}; - var entityMap = {'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"} - if(locator){ - domBuilder.setDocumentLocator(locator) - } - - sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator); - sax.domBuilder = options.domBuilder || domBuilder; - if(/\/x?html?$/.test(mimeType)){ - entityMap.nbsp = '\xa0'; - entityMap.copy = '\xa9'; - defaultNSMap['']= 'http://www.w3.org/1999/xhtml'; - } - defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace'; - if(source){ - sax.parse(source,defaultNSMap,entityMap); - }else{ - sax.errorHandler.error("invalid document source"); - } - return domBuilder.document; -} -function buildErrorHandler(errorImpl,domBuilder,locator){ - if(!errorImpl){ - if(domBuilder instanceof DOMHandler){ - return domBuilder; - } - errorImpl = domBuilder ; - } - var errorHandler = {} - var isCallback = errorImpl instanceof Function; - locator = locator||{} - function build(key){ - var fn = errorImpl[key]; - if(!fn && isCallback){ - fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl; - } - errorHandler[key] = fn && function(msg){ - fn('[xmldom '+key+']\t'+msg+_locator(locator)); - }||function(){}; - } - build('warning'); - build('error'); - build('fatalError'); - return errorHandler; -} - -//console.log('#\n\n\n\n\n\n\n####') -/** - * +ContentHandler+ErrorHandler - * +LexicalHandler+EntityResolver2 - * -DeclHandler-DTDHandler - * - * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler - * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2 - * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html - */ -function DOMHandler() { - this.cdata = false; -} -function position(locator,node){ - node.lineNumber = locator.lineNumber; - node.columnNumber = locator.columnNumber; -} -/** - * @see org.xml.sax.ContentHandler#startDocument - * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html - */ -DOMHandler.prototype = { - startDocument : function() { - this.document = new DOMImplementation().createDocument(null, null, null); - if (this.locator) { - this.document.documentURI = this.locator.systemId; - } - }, - startElement:function(namespaceURI, localName, qName, attrs) { - var doc = this.document; - var el = doc.createElementNS(namespaceURI, qName||localName); - var len = attrs.length; - appendElement(this, el); - this.currentElement = el; - - this.locator && position(this.locator,el) - for (var i = 0 ; i < len; i++) { - var namespaceURI = attrs.getURI(i); - var value = attrs.getValue(i); - var qName = attrs.getQName(i); - var attr = doc.createAttributeNS(namespaceURI, qName); - if( attr.getOffset){ - position(attr.getOffset(1),attr) - } - attr.value = attr.nodeValue = value; - el.setAttributeNode(attr) - } - }, - endElement:function(namespaceURI, localName, qName) { - var current = this.currentElement - var tagName = current.tagName; - this.currentElement = current.parentNode; - }, - startPrefixMapping:function(prefix, uri) { - }, - endPrefixMapping:function(prefix) { - }, - processingInstruction:function(target, data) { - var ins = this.document.createProcessingInstruction(target, data); - this.locator && position(this.locator,ins) - appendElement(this, ins); - }, - ignorableWhitespace:function(ch, start, length) { - }, - characters:function(chars, start, length) { - chars = _toString.apply(this,arguments) - //console.log(chars) - if(this.currentElement && chars){ - if (this.cdata) { - var charNode = this.document.createCDATASection(chars); - this.currentElement.appendChild(charNode); - } else { - var charNode = this.document.createTextNode(chars); - this.currentElement.appendChild(charNode); - } - this.locator && position(this.locator,charNode) - } - }, - skippedEntity:function(name) { - }, - endDocument:function() { - this.document.normalize(); - }, - setDocumentLocator:function (locator) { - if(this.locator = locator){// && !('lineNumber' in locator)){ - locator.lineNumber = 0; - } - }, - //LexicalHandler - comment:function(chars, start, length) { - chars = _toString.apply(this,arguments) - var comm = this.document.createComment(chars); - this.locator && position(this.locator,comm) - appendElement(this, comm); - }, - - startCDATA:function() { - //used in characters() methods - this.cdata = true; - }, - endCDATA:function() { - this.cdata = false; - }, - - startDTD:function(name, publicId, systemId) { - var impl = this.document.implementation; - if (impl && impl.createDocumentType) { - var dt = impl.createDocumentType(name, publicId, systemId); - this.locator && position(this.locator,dt) - appendElement(this, dt); - } - }, - /** - * @see org.xml.sax.ErrorHandler - * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html - */ - warning:function(error) { - console.warn('[xmldom warning]\t'+error,_locator(this.locator)); - }, - error:function(error) { - console.error('[xmldom error]\t'+error,_locator(this.locator)); - }, - fatalError:function(error) { - console.error('[xmldom fatalError]\t'+error,_locator(this.locator)); - throw error; - } -} -function _locator(l){ - if(l){ - return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']' - } -} -function _toString(chars,start,length){ - if(typeof chars == 'string'){ - return chars.substr(start,length) - }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)") - if(chars.length >= start+length || start){ - return new java.lang.String(chars,start,length)+''; - } - return chars; - } -} - -/* - * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html - * used method of org.xml.sax.ext.LexicalHandler: - * #comment(chars, start, length) - * #startCDATA() - * #endCDATA() - * #startDTD(name, publicId, systemId) - * - * - * IGNORED method of org.xml.sax.ext.LexicalHandler: - * #endDTD() - * #startEntity(name) - * #endEntity(name) - * - * - * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html - * IGNORED method of org.xml.sax.ext.DeclHandler - * #attributeDecl(eName, aName, type, mode, value) - * #elementDecl(name, model) - * #externalEntityDecl(name, publicId, systemId) - * #internalEntityDecl(name, value) - * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html - * IGNORED method of org.xml.sax.EntityResolver2 - * #resolveEntity(String name,String publicId,String baseURI,String systemId) - * #resolveEntity(publicId, systemId) - * #getExternalSubset(name, baseURI) - * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html - * IGNORED method of org.xml.sax.DTDHandler - * #notationDecl(name, publicId, systemId) {}; - * #unparsedEntityDecl(name, publicId, systemId, notationName) {}; - */ -"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){ - DOMHandler.prototype[key] = function(){return null} -}) - -/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */ -function appendElement (hander,node) { - if (!hander.currentElement) { - hander.document.appendChild(node); - } else { - hander.currentElement.appendChild(node); - } -}//appendChild and setAttributeNS are preformance key - -if(typeof require == 'function'){ - var XMLReader = require('./sax').XMLReader; - var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation; - exports.XMLSerializer = require('./dom').XMLSerializer ; - exports.DOMParser = DOMParser; -} +function DOMParser(options){ + this.options = options ||{locator:{}}; + +} +DOMParser.prototype.parseFromString = function(source,mimeType){ + var options = this.options; + var sax = new XMLReader(); + var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler + var errorHandler = options.errorHandler; + var locator = options.locator; + var defaultNSMap = options.xmlns||{}; + var entityMap = {'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"} + if(locator){ + domBuilder.setDocumentLocator(locator) + } + + sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator); + sax.domBuilder = options.domBuilder || domBuilder; + if(/\/x?html?$/.test(mimeType)){ + entityMap.nbsp = '\xa0'; + entityMap.copy = '\xa9'; + defaultNSMap['']= 'http://www.w3.org/1999/xhtml'; + } + defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace'; + if(source){ + sax.parse(source,defaultNSMap,entityMap); + }else{ + sax.errorHandler.error("invalid document source"); + } + return domBuilder.document; +} +function buildErrorHandler(errorImpl,domBuilder,locator){ + if(!errorImpl){ + if(domBuilder instanceof DOMHandler){ + return domBuilder; + } + errorImpl = domBuilder ; + } + var errorHandler = {} + var isCallback = errorImpl instanceof Function; + locator = locator||{} + function build(key){ + var fn = errorImpl[key]; + if(!fn && isCallback){ + fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl; + } + errorHandler[key] = fn && function(msg){ + fn('[xmldom '+key+']\t'+msg+_locator(locator)); + }||function(){}; + } + build('warning'); + build('error'); + build('fatalError'); + return errorHandler; +} + +//console.log('#\n\n\n\n\n\n\n####') +/** + * +ContentHandler+ErrorHandler + * +LexicalHandler+EntityResolver2 + * -DeclHandler-DTDHandler + * + * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler + * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2 + * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html + */ +function DOMHandler() { + this.cdata = false; +} +function position(locator,node){ + node.lineNumber = locator.lineNumber; + node.columnNumber = locator.columnNumber; +} +/** + * @see org.xml.sax.ContentHandler#startDocument + * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html + */ +DOMHandler.prototype = { + startDocument : function() { + this.document = new DOMImplementation().createDocument(null, null, null); + if (this.locator) { + this.document.documentURI = this.locator.systemId; + } + }, + startElement:function(namespaceURI, localName, qName, attrs) { + var doc = this.document; + var el = doc.createElementNS(namespaceURI, qName||localName); + var len = attrs.length; + appendElement(this, el); + this.currentElement = el; + + this.locator && position(this.locator,el) + for (var i = 0 ; i < len; i++) { + var namespaceURI = attrs.getURI(i); + var value = attrs.getValue(i); + var qName = attrs.getQName(i); + var attr = doc.createAttributeNS(namespaceURI, qName); + if( attr.getOffset){ + position(attr.getOffset(1),attr) + } + attr.value = attr.nodeValue = value; + el.setAttributeNode(attr) + } + }, + endElement:function(namespaceURI, localName, qName) { + var current = this.currentElement + var tagName = current.tagName; + this.currentElement = current.parentNode; + }, + startPrefixMapping:function(prefix, uri) { + }, + endPrefixMapping:function(prefix) { + }, + processingInstruction:function(target, data) { + var ins = this.document.createProcessingInstruction(target, data); + this.locator && position(this.locator,ins) + appendElement(this, ins); + }, + ignorableWhitespace:function(ch, start, length) { + }, + characters:function(chars, start, length) { + chars = _toString.apply(this,arguments) + //console.log(chars) + if(this.currentElement && chars){ + if (this.cdata) { + var charNode = this.document.createCDATASection(chars); + this.currentElement.appendChild(charNode); + } else { + var charNode = this.document.createTextNode(chars); + this.currentElement.appendChild(charNode); + } + this.locator && position(this.locator,charNode) + } + }, + skippedEntity:function(name) { + }, + endDocument:function() { + this.document.normalize(); + }, + setDocumentLocator:function (locator) { + if(this.locator = locator){// && !('lineNumber' in locator)){ + locator.lineNumber = 0; + } + }, + //LexicalHandler + comment:function(chars, start, length) { + chars = _toString.apply(this,arguments) + var comm = this.document.createComment(chars); + this.locator && position(this.locator,comm) + appendElement(this, comm); + }, + + startCDATA:function() { + //used in characters() methods + this.cdata = true; + }, + endCDATA:function() { + this.cdata = false; + }, + + startDTD:function(name, publicId, systemId) { + var impl = this.document.implementation; + if (impl && impl.createDocumentType) { + var dt = impl.createDocumentType(name, publicId, systemId); + this.locator && position(this.locator,dt) + appendElement(this, dt); + } + }, + /** + * @see org.xml.sax.ErrorHandler + * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html + */ + warning:function(error) { + console.warn('[xmldom warning]\t'+error,_locator(this.locator)); + }, + error:function(error) { + console.error('[xmldom error]\t'+error,_locator(this.locator)); + }, + fatalError:function(error) { + console.error('[xmldom fatalError]\t'+error,_locator(this.locator)); + throw error; + } +} +function _locator(l){ + if(l){ + return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']' + } +} +function _toString(chars,start,length){ + if(typeof chars == 'string'){ + return chars.substr(start,length) + }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)") + if(chars.length >= start+length || start){ + return new java.lang.String(chars,start,length)+''; + } + return chars; + } +} + +/* + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html + * used method of org.xml.sax.ext.LexicalHandler: + * #comment(chars, start, length) + * #startCDATA() + * #endCDATA() + * #startDTD(name, publicId, systemId) + * + * + * IGNORED method of org.xml.sax.ext.LexicalHandler: + * #endDTD() + * #startEntity(name) + * #endEntity(name) + * + * + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html + * IGNORED method of org.xml.sax.ext.DeclHandler + * #attributeDecl(eName, aName, type, mode, value) + * #elementDecl(name, model) + * #externalEntityDecl(name, publicId, systemId) + * #internalEntityDecl(name, value) + * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html + * IGNORED method of org.xml.sax.EntityResolver2 + * #resolveEntity(String name,String publicId,String baseURI,String systemId) + * #resolveEntity(publicId, systemId) + * #getExternalSubset(name, baseURI) + * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html + * IGNORED method of org.xml.sax.DTDHandler + * #notationDecl(name, publicId, systemId) {}; + * #unparsedEntityDecl(name, publicId, systemId, notationName) {}; + */ +"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){ + DOMHandler.prototype[key] = function(){return null} +}) + +/* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */ +function appendElement (hander,node) { + if (!hander.currentElement) { + hander.document.appendChild(node); + } else { + hander.currentElement.appendChild(node); + } +}//appendChild and setAttributeNS are preformance key + +if(typeof require == 'function'){ + var XMLReader = require('./sax').XMLReader; + var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation; + exports.XMLSerializer = require('./dom').XMLSerializer ; + exports.DOMParser = DOMParser; +} },{"./dom":41,"./sax":42}],41:[function(require,module,exports){ /* @@ -18913,592 +18913,592 @@ if(typeof require == 'function'){ } },{}],42:[function(require,module,exports){ -//[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] -//[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] -//[5] Name ::= NameStartChar (NameChar)* -var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]///\u10000-\uEFFFF -var nameChar = new RegExp("[\\-\\.0-9"+nameStartChar.source.slice(1,-1)+"\u00B7\u0300-\u036F\\u203F-\u2040]"); -var tagNamePattern = new RegExp('^'+nameStartChar.source+nameChar.source+'*(?:\:'+nameStartChar.source+nameChar.source+'*)?$'); -//var tagNamePattern = /^[a-zA-Z_][\w\-\.]*(?:\:[a-zA-Z_][\w\-\.]*)?$/ -//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',') - -//S_TAG, S_ATTR, S_EQ, S_V -//S_ATTR_S, S_E, S_S, S_C -var S_TAG = 0;//tag name offerring -var S_ATTR = 1;//attr name offerring -var S_ATTR_S=2;//attr name end and space offer -var S_EQ = 3;//=space? -var S_V = 4;//attr value(no quot value only) -var S_E = 5;//attr value end and no space(quot end) -var S_S = 6;//(attr value end || tag end ) && (space offer) -var S_C = 7;//closed el - -function XMLReader(){ - -} - -XMLReader.prototype = { - parse:function(source,defaultNSMap,entityMap){ - var domBuilder = this.domBuilder; - domBuilder.startDocument(); - _copy(defaultNSMap ,defaultNSMap = {}) - parse(source,defaultNSMap,entityMap, - domBuilder,this.errorHandler); - domBuilder.endDocument(); - } -} -function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ - function fixedFromCharCode(code) { - // String.prototype.fromCharCode does not supports - // > 2 bytes unicode chars directly - if (code > 0xffff) { - code -= 0x10000; - var surrogate1 = 0xd800 + (code >> 10) - , surrogate2 = 0xdc00 + (code & 0x3ff); - - return String.fromCharCode(surrogate1, surrogate2); - } else { - return String.fromCharCode(code); - } - } - function entityReplacer(a){ - var k = a.slice(1,-1); - if(k in entityMap){ - return entityMap[k]; - }else if(k.charAt(0) === '#'){ - return fixedFromCharCode(parseInt(k.substr(1).replace('x','0x'))) - }else{ - errorHandler.error('entity not found:'+a); - return a; - } - } - function appendText(end){//has some bugs - if(end>start){ - var xt = source.substring(start,end).replace(/&#?\w+;/g,entityReplacer); - locator&&position(start); - domBuilder.characters(xt,0,end-start); - start = end - } - } - function position(p,m){ - while(p>=lineEnd && (m = linePattern.exec(source))){ - lineStart = m.index; - lineEnd = lineStart + m[0].length; - locator.lineNumber++; - //console.log('line++:',locator,startPos,endPos) - } - locator.columnNumber = p-lineStart+1; - } - var lineStart = 0; - var lineEnd = 0; - var linePattern = /.+(?:\r\n?|\n)|.*$/g - var locator = domBuilder.locator; - - var parseStack = [{currentNSMap:defaultNSMapCopy}] - var closeMap = {}; - var start = 0; - while(true){ - try{ - var tagStart = source.indexOf('<',start); - if(tagStart<0){ - if(!source.substr(start).match(/^\s*$/)){ - var doc = domBuilder.document; - var text = doc.createTextNode(source.substr(start)); - doc.appendChild(text); - domBuilder.currentElement = text; - } - return; - } - if(tagStart>start){ - appendText(tagStart); - } - switch(source.charAt(tagStart+1)){ - case '/': - var end = source.indexOf('>',tagStart+3); - var tagName = source.substring(tagStart+2,end); - var config = parseStack.pop(); - var localNSMap = config.localNSMap; - if(config.tagName != tagName){ - errorHandler.fatalError("end tag name: "+tagName+' is not match the current start tagName:'+config.tagName ); - } - domBuilder.endElement(config.uri,config.localName,tagName); - if(localNSMap){ - for(var prefix in localNSMap){ - domBuilder.endPrefixMapping(prefix) ; - } - } - end++; - break; - // end elment - case '?':// - locator&&position(tagStart); - end = parseInstruction(source,tagStart,domBuilder); - break; - case '!':// start){ - start = end; - }else{ - //TODO: 这里有可能sax回退,有位置错误风险 - appendText(Math.max(tagStart,start)+1); - } - } -} -function copyLocator(f,t){ - t.lineNumber = f.lineNumber; - t.columnNumber = f.columnNumber; - return t; -} - -/** - * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack); - * @return end of the elementStartPart(end of elementEndPart for selfClosed el) - */ -function parseElementStartPart(source,start,el,entityReplacer,errorHandler){ - var attrName; - var value; - var p = ++start; - var s = S_TAG;//status - while(true){ - var c = source.charAt(p); - switch(c){ - case '=': - if(s === S_ATTR){//attrName - attrName = source.slice(start,p); - s = S_EQ; - }else if(s === S_ATTR_S){ - s = S_EQ; - }else{ - //fatalError: equal must after attrName or space after attrName - throw new Error('attribute equal must after attrName'); - } - break; - case '\'': - case '"': - if(s === S_EQ){//equal - start = p+1; - p = source.indexOf(c,start) - if(p>0){ - value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); - el.add(attrName,value,start-1); - s = S_E; - }else{ - //fatalError: no end quot match - throw new Error('attribute value no end \''+c+'\' match'); - } - }else if(s == S_V){ - value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); - //console.log(attrName,value,start,p) - el.add(attrName,value,start); - //console.dir(el) - errorHandler.warning('attribute "'+attrName+'" missed start quot('+c+')!!'); - start = p+1; - s = S_E - }else{ - //fatalError: no equal before - throw new Error('attribute value must after "="'); - } - break; - case '/': - switch(s){ - case S_TAG: - el.setTagName(source.slice(start,p)); - case S_E: - case S_S: - case S_C: - s = S_C; - el.closed = true; - case S_V: - case S_ATTR: - case S_ATTR_S: - break; - //case S_EQ: - default: - throw new Error("attribute invalid close char('/')") - } - break; - case ''://end document - //throw new Error('unexpected end of input') - errorHandler.error('unexpected end of input'); - case '>': - switch(s){ - case S_TAG: - el.setTagName(source.slice(start,p)); - case S_E: - case S_S: - case S_C: - break;//normal - case S_V://Compatible state - case S_ATTR: - value = source.slice(start,p); - if(value.slice(-1) === '/'){ - el.closed = true; - value = value.slice(0,-1) - } - case S_ATTR_S: - if(s === S_ATTR_S){ - value = attrName; - } - if(s == S_V){ - errorHandler.warning('attribute "'+value+'" missed quot(")!!'); - el.add(attrName,value.replace(/&#?\w+;/g,entityReplacer),start) - }else{ - errorHandler.warning('attribute "'+value+'" missed value!! "'+value+'" instead!!') - el.add(value,value,start) - } - break; - case S_EQ: - throw new Error('attribute value missed!!'); - } -// console.log(tagName,tagNamePattern,tagNamePattern.test(tagName)) - return p; - /*xml space '\x20' | #x9 | #xD | #xA; */ - case '\u0080': - c = ' '; - default: - if(c<= ' '){//space - switch(s){ - case S_TAG: - el.setTagName(source.slice(start,p));//tagName - s = S_S; - break; - case S_ATTR: - attrName = source.slice(start,p) - s = S_ATTR_S; - break; - case S_V: - var value = source.slice(start,p).replace(/&#?\w+;/g,entityReplacer); - errorHandler.warning('attribute "'+value+'" missed quot(")!!'); - el.add(attrName,value,start) - case S_E: - s = S_S; - break; - //case S_S: - //case S_EQ: - //case S_ATTR_S: - // void();break; - //case S_C: - //ignore warning - } - }else{//not space -//S_TAG, S_ATTR, S_EQ, S_V -//S_ATTR_S, S_E, S_S, S_C - switch(s){ - //case S_TAG:void();break; - //case S_ATTR:void();break; - //case S_V:void();break; - case S_ATTR_S: - errorHandler.warning('attribute "'+attrName+'" missed value!! "'+attrName+'" instead!!') - el.add(attrName,attrName,start); - start = p; - s = S_ATTR; - break; - case S_E: - errorHandler.warning('attribute space is required"'+attrName+'"!!') - case S_S: - s = S_ATTR; - start = p; - break; - case S_EQ: - s = S_V; - start = p; - break; - case S_C: - throw new Error("elements closed character '/' and '>' must be connected to"); - } - } - } - p++; - } -} -/** - * @return end of the elementStartPart(end of elementEndPart for selfClosed el) - */ -function appendElement(el,domBuilder,parseStack){ - var tagName = el.tagName; - var localNSMap = null; - var currentNSMap = parseStack[parseStack.length-1].currentNSMap; - var i = el.length; - while(i--){ - var a = el[i]; - var qName = a.qName; - var value = a.value; - var nsp = qName.indexOf(':'); - if(nsp>0){ - var prefix = a.prefix = qName.slice(0,nsp); - var localName = qName.slice(nsp+1); - var nsPrefix = prefix === 'xmlns' && localName - }else{ - localName = qName; - prefix = null - nsPrefix = qName === 'xmlns' && '' - } - //can not set prefix,because prefix !== '' - a.localName = localName ; - //prefix == null for no ns prefix attribute - if(nsPrefix !== false){//hack!! - if(localNSMap == null){ - localNSMap = {} - //console.log(currentNSMap,0) - _copy(currentNSMap,currentNSMap={}) - //console.log(currentNSMap,1) - } - currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value; - a.uri = 'http://www.w3.org/2000/xmlns/' - domBuilder.startPrefixMapping(nsPrefix, value) - } - } - var i = el.length; - while(i--){ - a = el[i]; - var prefix = a.prefix; - if(prefix){//no prefix attribute has no namespace - if(prefix === 'xml'){ - a.uri = 'http://www.w3.org/XML/1998/namespace'; - }if(prefix !== 'xmlns'){ - a.uri = currentNSMap[prefix] - - //{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)} - } - } - } - var nsp = tagName.indexOf(':'); - if(nsp>0){ - prefix = el.prefix = tagName.slice(0,nsp); - localName = el.localName = tagName.slice(nsp+1); - }else{ - prefix = null;//important!! - localName = el.localName = tagName; - } - //no prefix element has default namespace - var ns = el.uri = currentNSMap[prefix || '']; - domBuilder.startElement(ns,localName,tagName,el); - //endPrefixMapping and startPrefixMapping have not any help for dom builder - //localNSMap = null - if(el.closed){ - domBuilder.endElement(ns,localName,tagName); - if(localNSMap){ - for(prefix in localNSMap){ - domBuilder.endPrefixMapping(prefix) - } - } - }else{ - el.currentNSMap = currentNSMap; - el.localNSMap = localNSMap; - parseStack.push(el); - } -} -function parseHtmlSpecialContent(source,elStartEnd,tagName,entityReplacer,domBuilder){ - if(/^(?:script|textarea)$/i.test(tagName)){ - var elEndStart = source.indexOf('',elStartEnd); - var text = source.substring(elStartEnd+1,elEndStart); - if(/[&<]/.test(text)){ - if(/^script$/i.test(tagName)){ - //if(!/\]\]>/.test(text)){ - //lexHandler.startCDATA(); - domBuilder.characters(text,0,text.length); - //lexHandler.endCDATA(); - return elEndStart; - //} - }//}else{//text area - text = text.replace(/&#?\w+;/g,entityReplacer); - domBuilder.characters(text,0,text.length); - return elEndStart; - //} - - } - } - return elStartEnd+1; -} -function fixSelfClosed(source,elStartEnd,tagName,closeMap){ - //if(tagName in closeMap){ - var pos = closeMap[tagName]; - if(pos == null){ - //console.log(tagName) - pos = closeMap[tagName] = source.lastIndexOf('') - } - return pos',start+4); - //append comment source.substring(4,end)//',start+4); + //append comment source.substring(4,end)//