## ⚙️ Installation
### npm
```sh
$ npm i @scena/guides
```
### scripts
```html
```
## 🚀 How to use
```tsx
import Guides from "@scena/guides";
const guides = new Guides(document.body, {
type: "horizontal",
}).on("changeGuides", e => {
console.log(e.guides);
});
let scrollX = 0;
let scrollY = 0;
window.addEventListener("resize", () => {
guides.resize();
});
window.addEventListener("wheel", e => {
scrollX += e.deltaX;
scrollY += e.deltaY;
guides.scrollGuides(scrollY);
guides.scroll(scrollX);
});
```
### Ruler Units
The default unit is px, and a line is drawn every 50px. If you want to use a different unit instead of the px unit, use it like this:
* 1px (Default)
* zoom: 1
* unit: 50 (every 50px)
* 1cm = 37.7952px
* zoom: 37.7952
* unit: 1 (every 1cm)
* 1in = 96px = 2.54cm
* zoom: 96
* unit: 1 (every 1in)
See:
- https://www.w3schools.com/cssref/css_units.asp
- https://www.scaler.com/topics/css/css-units/
## ⚙️ Developments
The `guides` repo is managed as a [monorepo](https://github.com/lerna/lerna) with `yarn`.
```sh
yarn config set registry https://registry.npmjs.org/
```
## ⭐️ Show Your Support
Please give a ⭐️ if this project helped you!
## 👏 Contributing
If you have any questions or requests or want to contribute to `guides` or other packages, please write the [issue](https://github.com/daybrush/guides/issues) or give me a Pull Request freely.
## 🐞 Bug Report
If you find a bug, please report to us opening a new [Issue](https://github.com/daybrush/guides/issues) on GitHub.
## 📝 License
This project is [MIT](https://github.com/daybrush/guides/blob/master/LICENSE) licensed.
```
MIT License
Copyright (c) 2019 Daybrush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
================================================
FILE: config/update-type-consts.js
================================================
const path = require("path");
const { convertProperties } = require("@daybrush/release/angular");
const { PROPERTIES, EVENTS } = require("../packages/react-guides/dist/guides.cjs.js");
convertProperties(
{
ANGULAR_GUIDES_INPUTS: PROPERTIES,
ANGULAR_GUIDES_OUTPUTS: EVENTS,
},
[
path.resolve(__dirname, "../packages/ngx-guides/projects/ngx-guides/src/public-api.ts"),
],
);
================================================
FILE: demo/index.css
================================================
@import url("https://fonts.googleapis.com/css?family=Open+Sans:300,400,600&display=swap");
@import url("https://fonts.googleapis.com/css?family=Roboto:100&display=swap");
html, body {
font-family: "Open Sans", sans-serif;
position: relative;
margin: 0;
padding: 0;
height: 100%;
color: #333;
letter-spacing: 1px;
background: #f5f5f5;
font-weight: 300;
touch-action: manipulation;
}
#root, .page {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
}
a {
text-decoration: none;
color: #333;
}
.ruler {
position:absolute;
top: 0;
left: 0;
}
.ruler.horizontal {
left: 0px;
width: 100%;
height: 30px;
}
.ruler.vertical {
top: 0px;
width: 30px;
height: 100%;
}
.box {
position: relative;
width: 30px;
height: 30px;
background: #444;
box-sizing: border-box;
z-index: 21;
}
.box:before, .box:after {
position: absolute;
content: "";
background: #777;
}
.box:before {
width: 1px;
height: 100%;
left: 100%;
}
.box:after {
height: 1px;
width: 100%;
top: 100%;
}
.container {
position: relative;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
max-width: calc(100% - 60px);
width: 100%;
}
.badges {
padding: 10px;
}
.badges img {
height: 20px;
margin: 0px 2px;
}
.buttons {
text-align: center;
margin: 0;
padding: 10px;
}
.buttons a {
margin: 0;
position: relative;
text-decoration: none;
color: #333;
border: 1px solid #333;
padding: 12px 30px;
min-width: 140px;
text-align: center;
display: inline-block;
box-sizing: border-box;
margin: 5px;
transition: all ease 0.5s;
}
.buttons a:hover {
background: #333;
color: #fff;
}
p {
padding: 0;
margin: 0;
}
.dragit {
font-weight: bold;
}
================================================
FILE: demo/index.html
================================================
A Guides component that can draw ruler and manage guidelines.
Drag Screen & Rulers!
A Guides component that can draw ruler and manage guidelines.
This component can scroll up and down, left and right in the
negative direction and in the positive direction. It can also be used in combination with
moveable, selecto, guides.
## ⚙️ Installation
### npm
```sh
$ npm i ngx-guides
```
## 🚀 How to use
* app.component.html
```html
```
* app.module.ts
```ts
import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { NgxGuidesModule } from "ngx-guides";
import { AppComponent } from "./app.component";
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, NgxGuidesModule],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
```
## ⚙️ Developments
### `npm run start`
Runs the app in the development mode.
Open [http://localhost:4200](http://localhost:4200) to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
## ⭐️ Show Your Support
Please give a ⭐️ if this project helped you!
## 👏 Contributing
If you have any questions or requests or want to contribute to `ngx-guides` or other packages, please write the [issue](https://github.com/daybrush/guides/issues) or give me a Pull Request freely.
## 🐞 Bug Report
If you find a bug, please report to us opening a new [Issue](https://github.com/daybrush/guides/issues) on GitHub.
## 📝 License
This project is [MIT](https://github.com/daybrush/guides/blob/master/LICENSE) licensed.
```
MIT License
Copyright (c) 2019 Daybrush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
================================================
FILE: packages/ngx-guides/angular.json
================================================
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ngx-guides-project": {
"projectType": "application",
"schematics": {
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/ngx-guides-project",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "ngx-guides-project:build:production"
},
"development": {
"browserTarget": "ngx-guides-project:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "ngx-guides-project:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
}
}
},
"ngx-guides": {
"projectType": "library",
"root": "projects/ngx-guides",
"sourceRoot": "projects/ngx-guides/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:ng-packagr",
"options": {
"project": "projects/ngx-guides/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/ngx-guides/tsconfig.lib.prod.json"
},
"development": {
"tsConfig": "projects/ngx-guides/tsconfig.lib.json"
}
},
"defaultConfiguration": "production"
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ngx-guides/src/test.ts",
"tsConfig": "projects/ngx-guides/tsconfig.spec.json",
"karmaConfig": "projects/ngx-guides/karma.conf.js"
}
}
}
}
},
"defaultProject": "ngx-guides-project"
}
================================================
FILE: packages/ngx-guides/karma.conf.js
================================================
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, './coverage/ngx-guides-project'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
================================================
FILE: packages/ngx-guides/package.json
================================================
{
"name": "ngx-guides-project",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build ngx-guides --configuration production",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"lernaHelperPublishPath": "./dist/ngx-guides",
"dependencies": {
"@angular/animations": "~13.3.0",
"@angular/common": "~13.3.0",
"@angular/compiler": "~13.3.0",
"@angular/core": "~13.3.0",
"@angular/forms": "~13.3.0",
"@angular/platform-browser": "~13.3.0",
"@angular/platform-browser-dynamic": "~13.3.0",
"@angular/router": "~13.3.0",
"@scena/guides": "~0.29.2",
"rxjs": "~7.5.0",
"tslib": "^2.3.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~13.3.9",
"@angular/cli": "~13.3.9",
"@angular/compiler-cli": "~13.3.0",
"@types/jasmine": "~3.10.0",
"@types/node": "^12.11.1",
"jasmine-core": "~4.0.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "~1.7.0",
"ng-packagr": "^13.0.0",
"typescript": "^4.5.0 <4.6.0"
}
}
================================================
FILE: packages/ngx-guides/projects/ngx-guides/.browserslistrc
================================================
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries
# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support
# You can see what browsers were selected by your queries by running:
# npx browserslist
last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 2 Safari major versions
last 2 iOS major versions
Firefox ESR
================================================
FILE: packages/ngx-guides/projects/ngx-guides/CHANGELOG.md
================================================
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.28.2](https://github.com/daybrush/guides/compare/ngx-guides@0.28.1...ngx-guides@0.28.2) (2023-07-29)
### :mega: Other
* publish packages ([9b659fe](https://github.com/daybrush/guides/commit/9b659fe71eb2fcb53b731e88b1561a0b18b9fcdc))
## [0.28.1](https://github.com/daybrush/guides/compare/ngx-guides@0.28.0...ngx-guides@0.28.1) (2023-07-23)
### :mega: Other
* publish packages ([73e2427](https://github.com/daybrush/guides/commit/73e24270c27eec1f30cc051fe84569e79f85822c))
## [0.28.0](https://github.com/daybrush/guides/compare/ngx-guides@0.27.0...ngx-guides@0.28.0) (2023-07-22)
### :mega: Other
* publish packages ([324f848](https://github.com/daybrush/guides/commit/324f848e0bae231c82b33be29ee2534d58a6d6b1))
## [0.27.0](https://github.com/daybrush/guides/compare/ngx-guides@0.26.0...ngx-guides@0.27.0) (2023-06-02)
### :mega: Other
* publish packages ([53d07f3](https://github.com/daybrush/guides/commit/53d07f3e31011ee6bff1a2558380dc6e61e98337))
## [0.26.0](https://github.com/daybrush/guides/compare/ngx-guides@0.25.5...ngx-guides@0.26.0) (2023-06-01)
### :mega: Other
* publish packages ([d038e92](https://github.com/daybrush/guides/commit/d038e92046e55f0f65f4ddde24f12ed117fd64e2))
## [0.25.5](https://github.com/daybrush/guides/compare/ngx-guides@0.25.4...ngx-guides@0.25.5) (2023-05-16)
### :mega: Other
* publish packages ([78ed8c7](https://github.com/daybrush/guides/commit/78ed8c708759927cabeb53b8c607fc6f54324371))
## [0.25.4](https://github.com/daybrush/guides/compare/ngx-guides@0.25.2...ngx-guides@0.25.4) (2023-05-15)
### :mega: Other
* publish packages ([1898b89](https://github.com/daybrush/guides/commit/1898b895d5c812a5fd77d99a5928f7e420152772))
* update packages ([d8db884](https://github.com/daybrush/guides/commit/d8db884cdf43c19f77ad9c5721d3a466808853c3))
## [0.25.2](https://github.com/daybrush/guides/compare/ngx-guides@0.25.0...ngx-guides@0.25.2) (2023-05-07)
### :mega: Other
* publish packages ([e1fb57c](https://github.com/daybrush/guides/commit/e1fb57c59a4a8e6b3e55ffb68cfea64760270288))
* update croact version ([2fd28db](https://github.com/daybrush/guides/commit/2fd28dbbfd648b8ee6fee39f3972057fce580ae0))
## [0.25.0](https://github.com/daybrush/guides/compare/ngx-guides@0.24.0...ngx-guides@0.25.0) (2023-04-12)
### :mega: Other
* publish packages ([548990d](https://github.com/daybrush/guides/commit/548990d8577ffe565b8605f74edd9eb5a6519deb))
## [0.24.0](https://github.com/daybrush/guides/compare/ngx-guides@0.23.0...ngx-guides@0.24.0) (2023-04-06)
### :rocket: New Features
* add croact-guides ([a7be435](https://github.com/daybrush/guides/commit/a7be435704e24b6d80af80e069a6cc4047d645bc))
### :memo: Documentation
* fix Angular README #79 ([4f8b64d](https://github.com/daybrush/guides/commit/4f8b64d1a36e496431e785ea2d2e0cb18b94d9c4))
### :mega: Other
* publish packages ([f30e2ba](https://github.com/daybrush/guides/commit/f30e2bad78e1bc02307c8dde8cb1b69ecccdf116))
## [0.23.0](https://github.com/daybrush/guides/compare/ngx-guides@0.22.3...ngx-guides@0.23.0) (2023-03-04)
### :mega: Other
* publish packages ([1afbe1d](https://github.com/daybrush/guides/commit/1afbe1d193cf2457dc9f3296b73d38b5859c0ee0))
## [0.22.3](https://github.com/daybrush/guides/compare/ngx-guides@0.22.2...ngx-guides@0.22.3) (2023-02-04)
### :mega: Other
* publish packages ([ae0d147](https://github.com/daybrush/guides/commit/ae0d14738d83b4f5352463b69f89efe7cc111baf))
## [0.22.2](https://github.com/daybrush/guides/compare/ngx-guides@0.22.1...ngx-guides@0.22.2) (2023-01-29)
### :mega: Other
* publish packages ([0f7949a](https://github.com/daybrush/guides/commit/0f7949a9954e2093d6a599dc545f988ed624d41f))
## [0.22.1](https://github.com/daybrush/guides/compare/ngx-guides@0.22.0...ngx-guides@0.22.1) (2023-01-29)
### :mega: Other
* publish packages ([ab753c1](https://github.com/daybrush/guides/commit/ab753c1c820463c1c0b7805d428c803c5eacc1e3))
## [0.22.0](https://github.com/daybrush/guides/compare/ngx-guides@0.21.0...ngx-guides@0.22.0) (2023-01-29)
### :mega: Other
* publish packages ([6f83fa0](https://github.com/daybrush/guides/commit/6f83fa0c75f494aa79fff98f4a57f86ab295b67d))
## [0.21.0](https://github.com/daybrush/guides/compare/ngx-guides@0.20.1...ngx-guides@0.21.0) (2023-01-28)
### :mega: Other
* publish packages ([9473e84](https://github.com/daybrush/guides/commit/9473e8464fbd4c374ac6251ff995586afd163719))
## [0.20.1](https://github.com/daybrush/guides/compare/ngx-guides@0.20.0...ngx-guides@0.20.1) (2023-01-27)
### :mega: Other
* publish packages ([628b944](https://github.com/daybrush/guides/commit/628b9444bb9e6f5546c7a5edd55a090126f52dd5))
## [0.20.0](https://github.com/daybrush/guides/compare/ngx-guides@0.19.0...ngx-guides@0.20.0) (2023-01-20)
### :bug: Bug Fix
* fix missing guideStyle prop #69 ([1520b89](https://github.com/daybrush/guides/commit/1520b896c29a2f11d96d55d2dbf51c0c06d9a113))
### :mega: Other
* publish packages ([095e7c6](https://github.com/daybrush/guides/commit/095e7c670d3bd0bdc168e2f3c11b5dbb8074b26b))
* publish packages ([1daa6ea](https://github.com/daybrush/guides/commit/1daa6ea441f6c96b8f354953605cd6ac89117878))
* publish packages ([e143c21](https://github.com/daybrush/guides/commit/e143c2175309bf480ef17731321f6728b8d6bcc2))
* publish packages ([ce2037a](https://github.com/daybrush/guides/commit/ce2037a18f5f6bbcd750e1fd72cbfc60e3f2c217))
* publish packages ([0abcba2](https://github.com/daybrush/guides/commit/0abcba24e8b83ea51cf369124e8c2d85fee1ef7e))
## [0.19.0](https://github.com/daybrush/guides/compare/ngx-guides@0.18.0...ngx-guides@0.19.0) (2022-11-13)
### :rocket: New Features
* add scrollOptions #64 ([e0dc92a](https://github.com/daybrush/guides/commit/e0dc92a9ed417dff071b43a68b065907f8f1b8ad))
### :bug: Bug Fix
* fix scroll event name ([6eba67b](https://github.com/daybrush/guides/commit/6eba67b33c0de50e1c68ff75882889227db663bc))
### :mega: Other
* publish packages ([9cc8e3a](https://github.com/daybrush/guides/commit/9cc8e3ae5f83aa1513c1560166c6babbbe31dfd7))
## [0.18.0](https://github.com/daybrush/guides/compare/ngx-guides@0.17.3...ngx-guides@0.18.0) (2022-09-21)
### :mega: Other
* publish packages ([83de3e4](https://github.com/daybrush/guides/commit/83de3e4ae4bad11905939a44dfa2776fe7d6987d))
================================================
FILE: packages/ngx-guides/projects/ngx-guides/README.md
================================================
Angular Guides
An Angular Guides component that can draw grids and scroll infinitely.
## ⚙️ Installation
### npm
```sh
$ npm i ngx-guides
```
## 🚀 How to use
* app.component.html
```html
```
* app.module.ts
```ts
import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { NgxGuidesModule } from "ngx-guides";
import { AppComponent } from "./app.component";
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, NgxGuidesModule],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {}
```
## ⚙️ Developments
### `npm run start`
Runs the app in the development mode.
Open [http://localhost:4200](http://localhost:4200) to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
## ⭐️ Show Your Support
Please give a ⭐️ if this project helped you!
## 👏 Contributing
If you have any questions or requests or want to contribute to `ngx-guides` or other packages, please write the [issue](https://github.com/daybrush/guides/issues) or give me a Pull Request freely.
## 🐞 Bug Report
If you find a bug, please report to us opening a new [Issue](https://github.com/daybrush/guides/issues) on GitHub.
## 📝 License
This project is [MIT](https://github.com/daybrush/guides/blob/master/LICENSE) licensed.
```
MIT License
Copyright (c) 2019 Daybrush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
================================================
FILE: packages/ngx-guides/projects/ngx-guides/karma.conf.js
================================================
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
jasmine: {
// you can add configuration options for Jasmine here
// the possible options are listed at https://jasmine.github.io/api/edge/Configuration.html
// for example, you can disable the random execution with `random: false`
// or set a specific seed with `seed: 4321`
},
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
jasmineHtmlReporter: {
suppressAll: true // removes the duplicated traces
},
coverageReporter: {
dir: require('path').join(__dirname, '../../coverage/ngx-guides'),
subdir: '.',
reporters: [
{ type: 'html' },
{ type: 'text-summary' }
]
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
================================================
FILE: packages/ngx-guides/projects/ngx-guides/ng-package.json
================================================
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/ngx-guides",
"lib": {
"entryFile": "src/public-api.ts"
},
"allowedNonPeerDependencies": [
"@scena/guides"
]
}
================================================
FILE: packages/ngx-guides/projects/ngx-guides/package.json
================================================
{
"name": "ngx-guides",
"version": "0.28.2",
"description": "An Angular Guides component that can draw ruler and manage guidelines.",
"keywords": [
"scene",
"scenejs",
"scene.js",
"scena",
"ruler",
"guidelines",
"guides",
"scroller",
"angular"
],
"repository": {
"type": "git",
"url": "git+https://github.com/daybrush/guides.git"
},
"author": "Daybrush",
"license": "MIT",
"bugs": {
"url": "https://github.com/daybrush/guides/issues"
},
"homepage": "https://daybrush.com/guides",
"dependencies": {
"@scena/guides": "~0.29.2",
"tslib": "^2.3.0"
}
}
================================================
FILE: packages/ngx-guides/projects/ngx-guides/src/lib/consts.ts
================================================
// auto
// eslint-disable-next-line max-len
export const ANGULAR_GUIDES_INPUTS: ["className","rulerStyle","snapThreshold","snaps","displayDragPos","cspNonce","dragPosFormat","defaultGuides","showGuides","scrollOptions","guideStyle","guidesOffset","digit","defaultGuidesPos","dragGuideStyle","displayGuidePos","guidePosFormat","guidePosStyle","lockGuides","guidesZoom","type","width","height","unit","zoom","direction","textAlign","font","segment","mainLineSize","longLineSize","shortLineSize","lineOffset","textOffset","negativeRuler","range","scrollPos","defaultScrollPos","style","backgroundColor","rangeBackgroundColor","lineColor","textColor","textBackgroundColor","textFormat","warpSelf","selectedBackgroundColor","selectedRanges","defaultPixelScale","useResizeObserver","selectedRangesText","selectedRangesTextColor","selectedRangesTextOffset","marks","markColor"] = ["className","rulerStyle","snapThreshold","snaps","displayDragPos","cspNonce","dragPosFormat","defaultGuides","showGuides","scrollOptions","guideStyle","guidesOffset","digit","defaultGuidesPos","dragGuideStyle","displayGuidePos","guidePosFormat","guidePosStyle","lockGuides","guidesZoom","type","width","height","unit","zoom","direction","textAlign","font","segment","mainLineSize","longLineSize","shortLineSize","lineOffset","textOffset","negativeRuler","range","scrollPos","defaultScrollPos","style","backgroundColor","rangeBackgroundColor","lineColor","textColor","textBackgroundColor","textFormat","warpSelf","selectedBackgroundColor","selectedRanges","defaultPixelScale","useResizeObserver","selectedRangesText","selectedRangesTextColor","selectedRangesTextOffset","marks","markColor"];
export const ANGULAR_GUIDES_OUTPUTS: ["changeGuides","requestScroll","dragStart","drag","dragEnd","clickRuler"] = ["changeGuides","requestScroll","dragStart","drag","dragEnd","clickRuler"];
================================================
FILE: packages/ngx-guides/projects/ngx-guides/src/lib/ngx-guides.component.spec.ts
================================================
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NgxGuidesComponent } from './ngx-guides.component';
describe('NgxGuidesComponent', () => {
let component: NgxGuidesComponent;
let fixture: ComponentFixture;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ NgxGuidesComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(NgxGuidesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
================================================
FILE: packages/ngx-guides/projects/ngx-guides/src/lib/ngx-guides.component.ts
================================================
import {
Component, AfterViewInit, ViewChild,
ElementRef, OnChanges, SimpleChanges,
OnDestroy, EventEmitter
} from '@angular/core';
import Guides, { EVENTS, PROPERTIES, GuideOptions } from '@scena/guides';
import { NgxGuidesInterface } from './ngx-guides.interface';
import { ANGULAR_GUIDES_INPUTS, ANGULAR_GUIDES_OUTPUTS } from './consts';
@Component({
selector: 'ngx-guides',
template: `
`,
styles: [],
inputs: ANGULAR_GUIDES_INPUTS,
outputs: ANGULAR_GUIDES_OUTPUTS,
})
export class NgxGuidesComponent extends NgxGuidesInterface implements AfterViewInit, OnChanges, OnDestroy {
@ViewChild('guidesRef', { static: false }) private guidesRef!: ElementRef;
constructor() {
super();
EVENTS.forEach(name => {
(this as any)[name] = new EventEmitter();
});
}
ngOnChanges(changes: SimpleChanges): void {
const guides = this.guides;
if (!guides) {
return;
}
for (const name in changes) {
const { previousValue, currentValue } = changes[name];
if (previousValue === currentValue) {
continue;
}
if (name === 'style') {
this.setStyle();
} else {
(guides as any)[name] = currentValue;
}
}
}
ngAfterViewInit() {
const el = this.guidesRef.nativeElement;
const options: GuideOptions = {};
PROPERTIES.forEach(name => {
if (name === "style") {
return;
}
if (name in this) {
(options as any)[name] = this[name];
}
});
options.warpSelf = true;
const guides = new Guides(el, options);
this.guides = guides;
this.setStyle();
EVENTS.forEach(name => {
guides.on(name as any, e => {
(this as any)[name].emit(e as any);
});
});
}
ngOnDestroy() {
this.guides.destroy();
}
setStyle() {
const el = this.guidesRef.nativeElement;
const elStyle = el.style;
const style = this.style;
for (const name in style) {
if (elStyle[name] === style[name]) {
continue;
}
elStyle[name] = style[name];
}
}
}
================================================
FILE: packages/ngx-guides/projects/ngx-guides/src/lib/ngx-guides.interface.ts
================================================
import VanillaGuides, { METHODS, GuidesInterface, GuidesOptions } from '@scena/guides';
import { withMethods, MethodInterface } from 'framework-utils';
import { NgxGuidesComponent } from './ngx-guides.component';
import { NgxGuidesEvents } from './types';
export class NgxGuidesInterface {
@withMethods(METHODS as any)
protected guides!: VanillaGuides;
}
export interface NgxGuidesInterface
extends MethodInterface,
Required, NgxGuidesEvents {}
================================================
FILE: packages/ngx-guides/projects/ngx-guides/src/lib/ngx-guides.module.ts
================================================
import { NgModule } from '@angular/core';
import { NgxGuidesComponent } from './ngx-guides.component';
@NgModule({
declarations: [NgxGuidesComponent],
imports: [
],
exports: [NgxGuidesComponent]
})
export class NgxGuidesModule { }
================================================
FILE: packages/ngx-guides/projects/ngx-guides/src/lib/ngx-guides.service.spec.ts
================================================
import { TestBed } from '@angular/core/testing';
import { NgxGuidesService } from './ngx-guides.service';
describe('NgxGuidesService', () => {
beforeEach(() => TestBed.configureTestingModule({}));
it('should be created', () => {
const service: NgxGuidesService = TestBed.get(NgxGuidesService);
expect(service).toBeTruthy();
});
});
================================================
FILE: packages/ngx-guides/projects/ngx-guides/src/lib/ngx-guides.service.ts
================================================
import { Injectable } from '@angular/core';
@Injectable({
providedIn: 'root'
})
export class NgxGuidesService {
constructor() { }
}
================================================
FILE: packages/ngx-guides/projects/ngx-guides/src/lib/types.ts
================================================
import { EventEmitter } from '@angular/core';
import { GuidesEvents } from '@scena/guides';
export type NgxGuidesEvents = {
[key in keyof GuidesEvents]: EventEmitter
};
================================================
FILE: packages/ngx-guides/projects/ngx-guides/src/public-api.ts
================================================
/*
* Public API Surface of ngx-guides
*/
export * from './lib/ngx-guides.service';
export * from './lib/ngx-guides.component';
export * from './lib/ngx-guides.module';
================================================
FILE: packages/ngx-guides/projects/ngx-guides/src/test.ts
================================================
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js';
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
(id: string): T;
keys(): string[];
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
================================================
FILE: packages/ngx-guides/projects/ngx-guides/tsconfig.lib.json
================================================
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"declaration": true,
"declarationMap": true,
"inlineSources": true,
"types": []
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}
================================================
FILE: packages/ngx-guides/projects/ngx-guides/tsconfig.lib.prod.json
================================================
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.lib.json",
"compilerOptions": {
"declarationMap": false
},
"angularCompilerOptions": {
"compilationMode": "partial"
}
}
================================================
FILE: packages/ngx-guides/projects/ngx-guides/tsconfig.spec.json
================================================
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}
================================================
FILE: packages/ngx-guides/src/app/app.component.css
================================================
================================================
FILE: packages/ngx-guides/src/app/app.component.html
================================================
================================================
FILE: packages/ngx-guides/src/app/app.component.spec.ts
================================================
import { TestBed } from '@angular/core/testing';
import { AppComponent } from './app.component';
describe('AppComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
AppComponent
],
}).compileComponents();
});
it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});
it(`should have as title 'ngx-guides-project'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('ngx-guides-project');
});
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('ngx-guides-project app is running!');
});
});
================================================
FILE: packages/ngx-guides/src/app/app.component.ts
================================================
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'ngx-guides-project';
}
================================================
FILE: packages/ngx-guides/src/app/app.module.ts
================================================
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
================================================
FILE: packages/ngx-guides/src/assets/.gitkeep
================================================
================================================
FILE: packages/ngx-guides/src/environments/environment.prod.ts
================================================
export const environment = {
production: true
};
================================================
FILE: packages/ngx-guides/src/environments/environment.ts
================================================
// This file can be replaced during build by using the `fileReplacements` array.
// `ng build` replaces `environment.ts` with `environment.prod.ts`.
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
};
/*
* For easier debugging in development mode, you can import the following file
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
*
* This import should be commented out in production mode because it will have a negative impact
* on performance if an error is thrown.
*/
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
================================================
FILE: packages/ngx-guides/src/index.html
================================================
NgxGuidesProject
================================================
FILE: packages/ngx-guides/src/main.ts
================================================
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.error(err));
================================================
FILE: packages/ngx-guides/src/polyfills.ts
================================================
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes recent versions of Safari, Chrome (including
* Opera), Edge on the desktop, and iOS and Chrome on mobile.
*
* Learn more in https://angular.io/guide/browser-support
*/
/***************************************************************************************************
* BROWSER POLYFILLS
*/
/**
* By default, zone.js will patch all possible macroTask and DomEvents
* user can disable parts of macroTask/DomEvents patch by setting following flags
* because those flags need to be set before `zone.js` being loaded, and webpack
* will put import in the top of bundle, so user need to create a separate file
* in this directory (for example: zone-flags.ts), and put the following flags
* into that file, and then add the following code before importing zone.js.
* import './zone-flags';
*
* The flags allowed in zone-flags.ts are listed here.
*
* The following flags will work for all browsers.
*
* (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
* (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
* (window as any).__zone_symbol__UNPATCHED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
*
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
* with the following flag, it will bypass `zone.js` patch for IE/Edge
*
* (window as any).__Zone_enable_cross_context_check = true;
*
*/
/***************************************************************************************************
* Zone JS is required by default for Angular itself.
*/
import 'zone.js'; // Included with Angular CLI.
/***************************************************************************************************
* APPLICATION IMPORTS
*/
================================================
FILE: packages/ngx-guides/src/styles.css
================================================
/* You can add global styles to this file, and also import other style files */
================================================
FILE: packages/ngx-guides/src/test.ts
================================================
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
(id: string): T;
keys(): string[];
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting(),
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);
================================================
FILE: packages/ngx-guides/tsconfig.app.json
================================================
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": []
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
================================================
FILE: packages/ngx-guides/tsconfig.json
================================================
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"sourceMap": true,
"paths": {
"ngx-guides": [
"dist/ngx-guides/ngx-guides",
"dist/ngx-guides"
]
},
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2017",
"module": "es2020",
"lib": [
"es2020",
"dom"
]
},
"angularCompilerOptions": {
"enableI18nLegacyMessageIdFormat": false,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true,
"strictTemplates": true
}
}
================================================
FILE: packages/ngx-guides/tsconfig.spec.json
================================================
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/spec",
"types": [
"jasmine"
]
},
"files": [
"src/test.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]
}
================================================
FILE: packages/preact-guides/CHANGELOG.md
================================================
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.28.2](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.28.1...preact-guides@0.28.2) (2023-07-29)
### :mega: Other
* publish packages ([9b659fe](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/9b659fe71eb2fcb53b731e88b1561a0b18b9fcdc))
## [0.28.1](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.28.0...preact-guides@0.28.1) (2023-07-23)
### :mega: Other
* publish packages ([73e2427](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/73e24270c27eec1f30cc051fe84569e79f85822c))
## [0.28.0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.27.0...preact-guides@0.28.0) (2023-07-22)
### :mega: Other
* publish packages ([324f848](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/324f848e0bae231c82b33be29ee2534d58a6d6b1))
## [0.27.0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.26.0...preact-guides@0.27.0) (2023-06-02)
### :rocket: New Features
* update ruler and add drawRuler method ([20b1182](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/20b1182c3e8c93980418f34e1360cb4c81a2a0d3))
### :mega: Other
* publish packages ([53d07f3](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/53d07f3e31011ee6bff1a2558380dc6e61e98337))
## [0.26.0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.25.3...preact-guides@0.26.0) (2023-06-01)
### :rocket: New Features
* update ruler and modules ([f528ce4](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/f528ce4c7ef6dd554112a7b86a0f7449d7cd230f))
### :mega: Other
* publish packages ([d038e92](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/d038e92046e55f0f65f4ddde24f12ed117fd64e2))
## [0.25.3](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.25.2...preact-guides@0.25.3) (2023-05-16)
### :bug: Bug Fix
* update css-styled version ([7327395](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/7327395786810c872f53678d47602b80db127197))
### :mega: Other
* publish packages ([78ed8c7](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/78ed8c708759927cabeb53b8c607fc6f54324371))
## [0.25.2](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.25.1...preact-guides@0.25.2) (2023-05-15)
### :rocket: New Features
* update depency modules ([21b67a8](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/21b67a80dfd61183e175d9ac6c64502c092aba74))
### :mega: Other
* publish packages ([1898b89](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/1898b895d5c812a5fd77d99a5928f7e420152772))
## [0.25.1](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.25.0...preact-guides@0.25.1) (2023-05-07)
### :mega: Other
* publish packages ([e1fb57c](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/e1fb57c59a4a8e6b3e55ffb68cfea64760270288))
## [0.25.0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.24.0...preact-guides@0.25.0) (2023-04-12)
### :mega: Other
* publish packages ([548990d](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/548990d8577ffe565b8605f74edd9eb5a6519deb))
## [0.24.0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.23.0...preact-guides@0.24.0) (2023-04-06)
### :rocket: New Features
* add croact-guides ([a7be435](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/a7be435704e24b6d80af80e069a6cc4047d645bc))
### :mega: Other
* publish packages ([f30e2ba](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/f30e2bad78e1bc02307c8dde8cb1b69ecccdf116))
## [0.23.0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.22.3...preact-guides@0.23.0) (2023-03-04)
### :rocket: New Features
* update ruler ([f59fa59](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/f59fa5988f3c4dd96925677ca787e4fb55b150f1))
### :mega: Other
* publish packages ([1afbe1d](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/1afbe1d193cf2457dc9f3296b73d38b5859c0ee0))
## [0.22.3](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.22.2...preact-guides@0.22.3) (2023-02-04)
### :mega: Other
* publish packages ([ae0d147](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/ae0d14738d83b4f5352463b69f89efe7cc111baf))
## [0.22.2](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.22.1...preact-guides@0.22.2) (2023-01-29)
### :mega: Other
* publish packages ([0f7949a](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/0f7949a9954e2093d6a599dc545f988ed624d41f))
## [0.22.1](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.22.0...preact-guides@0.22.1) (2023-01-29)
### :mega: Other
* publish packages ([ab753c1](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/ab753c1c820463c1c0b7805d428c803c5eacc1e3))
## [0.22.0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.21.0...preact-guides@0.22.0) (2023-01-29)
### :mega: Other
* publish packages ([6f83fa0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/6f83fa0c75f494aa79fff98f4a57f86ab295b67d))
## [0.21.0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.20.1...preact-guides@0.21.0) (2023-01-28)
### :mega: Other
* publish packages ([9473e84](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/9473e8464fbd4c374ac6251ff995586afd163719))
## [0.20.1](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.20.0...preact-guides@0.20.1) (2023-01-27)
### :mega: Other
* publish packages ([628b944](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/628b9444bb9e6f5546c7a5edd55a090126f52dd5))
## [0.20.0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.19.0...preact-guides@0.20.0) (2023-01-20)
### :bug: Bug Fix
* fix files field #67 ([28bf5b3](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/28bf5b3bd97cebd94eaf2195f0e99750f14e7ecb))
### :mega: Other
* publish packages ([095e7c6](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/095e7c670d3bd0bdc168e2f3c11b5dbb8074b26b))
* publish packages ([1daa6ea](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/1daa6ea441f6c96b8f354953605cd6ac89117878))
* publish packages ([e143c21](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/e143c2175309bf480ef17731321f6728b8d6bcc2))
* publish packages ([ce2037a](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/ce2037a18f5f6bbcd750e1fd72cbfc60e3f2c217))
* publish packages ([0abcba2](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/0abcba24e8b83ea51cf369124e8c2d85fee1ef7e))
## [0.19.0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.18.0...preact-guides@0.19.0) (2022-11-13)
### :rocket: New Features
* add scrollOptions #64 ([e0dc92a](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/e0dc92a9ed417dff071b43a68b065907f8f1b8ad))
### :bug: Bug Fix
* fix scroll event name ([6eba67b](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/6eba67b33c0de50e1c68ff75882889227db663bc))
* update dependencies ([054e101](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/054e101d1b177bdfefab74bf440a4cb3cf8137be))
### :mega: Other
* publish packages ([9cc8e3a](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/9cc8e3ae5f83aa1513c1560166c6babbbe31dfd7))
## [0.18.0](https://github.com/daybrush/guides/blob/master/packages/preact-guides/compare/preact-guides@0.17.1...preact-guides@0.18.0) (2022-09-21)
### :mega: Other
* publish packages ([83de3e4](https://github.com/daybrush/guides/blob/master/packages/preact-guides/commit/83de3e4ae4bad11905939a44dfa2776fe7d6987d))
================================================
FILE: packages/preact-guides/LICENSE
================================================
MIT License
Copyright (c) 2019 Daybrush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: packages/preact-guides/README.md
================================================
Preact Guides
A Preact Guides component that can draw ruler and manage guidelines.
);
}
================================================
FILE: packages/react-guides/src/demo/serviceWorker.ts
================================================
// This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
window.location.hostname === "localhost" ||
// [::1] is the IPv6 localhost address.
window.location.hostname === "[::1]" ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,
),
);
interface Config {
onSuccess?: (registration: ServiceWorkerRegistration) => void;
onUpdate?: (registration: ServiceWorkerRegistration) => void;
}
export function register(config?: Config) {
if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(
(process as { env: { [key: string]: string } }).env.PUBLIC_URL,
window.location.href,
);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return;
}
window.addEventListener("load", () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config);
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
"This web app is being served cache-first by a service " +
"worker. To learn more, visit https://bit.ly/CRA-PWA",
);
});
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config);
}
});
}
}
function registerValidSW(swUrl: string, config?: Config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => {
if (installingWorker.state === "installed") {
if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
"New content is available and will be used when all " +
"tabs for this page are closed. See https://bit.ly/CRA-PWA.",
);
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log("Content is cached for offline use.");
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
}
}
};
};
})
.catch(error => {
console.error("Error during service worker registration:", error);
});
}
function checkValidServiceWorker(swUrl: string, config?: Config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get("content-type");
if (
response.status === 404 ||
(contentType != null && contentType.indexOf("javascript") === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl, config);
}
})
.catch(() => {
console.log(
"No internet connection found. App is running in offline mode.",
);
});
}
export function unregister() {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
}
================================================
FILE: packages/react-guides/src/index.tsx
================================================
import React from "react";
import ReactDOM from "react-dom";
// import App from "./demo/App";
import App from "./demo/InfiniteViewer";
import * as serviceWorker from "./demo/serviceWorker";
ReactDOM.render(, document.getElementById("root"));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
================================================
FILE: packages/react-guides/src/react-app-env.d.ts
================================================
///
================================================
FILE: packages/react-guides/src/react-guides/Guides.tsx
================================================
import * as React from "react";
import Ruler, { DrawRulerOptions, PROPERTIES as RULER_PROPERTIES, RulerProps } from "@scena/react-ruler";
import { ref, refs } from "framework-utils";
import DragScroll from "@scena/dragscroll";
import Gesto, { OnDrag, OnDragEnd, OnDragStart } from "gesto";
import { styled } from "react-css-styled";
import { GUIDES, GUIDE, DRAGGING, ADDER, DISPLAY_DRAG, GUIDES_CSS } from "./consts";
import { prefix } from "./utils";
import { hasClass, addClass, removeClass } from "@daybrush/utils";
import { GuidesState, GuidesProps, GuidesInterface } from "./types";
import { getDistElementMatrix, calculateMatrixDist } from "css-to-mat";
const GuidesElement = styled("div", GUIDES_CSS);
export default class Guides extends React.PureComponent implements GuidesInterface {
public static defaultProps: GuidesProps = {
className: "",
type: "horizontal",
zoom: 1,
guidesZoom: 0,
style: {},
snapThreshold: 5,
snaps: [],
digit: 0,
onClickRuler: () => { },
onChangeGuides: () => { },
onRequestScroll: () => { },
onDragStart: () => { },
onDrag: () => { },
onDragEnd: () => { },
displayDragPos: false,
dragPosFormat: v => v,
defaultGuides: [],
lockGuides: false,
showGuides: true,
guideStyle: {},
dragGuideStyle: {},
guidePosStyle: {},
defaultGuidesPos: 0,
};
public state: GuidesState = {
guides: [],
};
public adderElement!: HTMLElement;
public scrollPos: number = 0;
public ruler!: Ruler;
private managerRef = React.createRef();
private guidesElement!: HTMLElement;
private displayElement!: HTMLElement;
private originElement!: HTMLElement;
private gesto!: Gesto;
private guideElements: HTMLElement[] = [];
private _isFirstMove = false;
private _zoom = 1;
private _guidesZoom = 1;
private _observer: ResizeObserver | null = null;
constructor(props: GuidesProps) {
super(props);
this.state.guides = props.defaultGuides || [];
this.scrollPos = props.defaultGuidesPos || 0;
}
public render() {
const {
className,
type,
zoom,
guidesZoom,
style,
rulerStyle,
displayDragPos,
cspNonce,
dragGuideStyle,
guidePosStyle = {}
} = this.props as Required;
const props = this.props;
const translateName = this.getTranslateName();
const rulerProps: RulerProps = {};
RULER_PROPERTIES.forEach(name => {
if (name === "style" || name === "warpSelf" || name === "useResizeObserver") {
return;
}
(rulerProps as any)[name] = props[name];
});
this._zoom = zoom;
this._guidesZoom = guidesZoom || zoom;
return
## ⚙️ Installation
### npm
```sh
$ npm i svelte-guides
```
## 🚀 How to use
```html
{
console.log(e.guides);
}}
/>
```
```ts
export interface RulerProps {
type?: "horizontal" | "vertical";
width?: number;
height?: number;
unit?: number;
zoom?: number;
direction?: "start" | "end";
style?: IObject;
backgroundColor?: string;
lineColor?: string;
textColor?: string;
}
export interface GuidesOptions extends RulerProps {
className?: string;
setGuides?: (guides: number[]) => any;
rulerStyle?: IObject;
snapThreshold?: number;
snaps?: number[];
displayDragPos?: boolean;
dragPosFormat?: (value: number) => string | number;
}
export interface GuidesInterface {
getGuides(): number[];
scroll(pos: number): void;
scrollGuides(pos: number): void;
loadGuides(guides: number[]): void;
resize(): void;
}
```
## ⚙️ Developments
### `npm run dev`
Runs the app in the development mode.
Open [http://localhost:5000](http://localhost:5000) to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
## ⭐️ Show Your Support
Please give a ⭐️ if this project helped you!
## 👏 Contributing
If you have any questions or requests or want to contribute to `guides` or other packages, please write the [issue](https://github.com/daybrush/guides/issues) or give me a Pull Request freely.
## 🐞 Bug Report
If you find a bug, please report to us opening a new [Issue](https://github.com/daybrush/guides/issues) on GitHub.
## 📝 License
This project is [MIT](https://github.com/daybrush/guides/blob/master/LICENSE) licensed.
```
MIT License
Copyright (c) 2019 Daybrush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
================================================
FILE: packages/svelte-guides/package.json
================================================
{
"name": "svelte-guides",
"version": "0.28.2",
"description": "A Svelte Guides component that can draw ruler and manage guidelines.",
"svelte": "./src/index.js",
"sideEffects": false,
"types": "src/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/daybrush/guides.git"
},
"author": "Daybrush",
"license": "MIT",
"bugs": {
"url": "https://github.com/daybrush/guides/issues"
},
"homepage": "https://daybrush.com/guides",
"files": [
"./*",
"src/*",
"dist/*",
"declaration/*",
"README.md"
],
"devDependencies": {
"@daybrush/builder": "^0.1.2",
"@pyoner/svelte-ts-preprocess": "^1.2.1",
"keycon": "^0.6.0",
"rollup": "^1.12.0",
"rollup-plugin-commonjs": "^10.0.0",
"rollup-plugin-livereload": "^1.0.4",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-terser": "^5.2.0",
"scenejs": "^1.1.5",
"sirv-cli": "^0.4.4",
"svelte": "^3.16.4",
"svelte-preprocess": "^3.2.2",
"tslib": "^1.10.0",
"typescript": "^4.5.0 <4.6.0"
},
"dependencies": {
"@scena/guides": "~0.29.2"
},
"scripts": {
"build": "rollup -c rollup.build.config.js",
"dev": "rollup -c -w",
"start": "sirv public --single",
"start:dev": "sirv public --single --dev",
"build:dev": "rollup -c"
}
}
================================================
FILE: packages/svelte-guides/public/global.css
================================================
html, body {
position: relative;
width: 100%;
height: 100%;
}
body {
color: #333;
margin: 0;
padding: 8px;
box-sizing: border-box;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}
a {
color: rgb(0,100,200);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:visited {
color: rgb(0,80,160);
}
label {
display: block;
}
input, button, select, textarea {
font-family: inherit;
font-size: inherit;
padding: 0.4em;
margin: 0 0 0.5em 0;
box-sizing: border-box;
border: 1px solid #ccc;
border-radius: 2px;
}
input:disabled {
color: #ccc;
}
input[type="range"] {
height: 0;
}
button {
color: #333;
background-color: #f4f4f4;
outline: none;
}
button:active {
background-color: #ddd;
}
button:focus {
border-color: #666;
}
================================================
FILE: packages/svelte-guides/public/index.html
================================================
Svelte app
================================================
FILE: packages/svelte-guides/rollup.build.config.js
================================================
import buildHelper from "@daybrush/builder";
import svelte from 'rollup-plugin-svelte';
import { preprocess } from "@pyoner/svelte-ts-preprocess";
const defaultOptions = {
tsconfig: "",
input: './src/index.js',
commonjs: true,
external: {
"svelte": "svelte",
},
plugins: [
svelte({
preprocess: preprocess(),
}),
],
}
export default buildHelper([
{
...defaultOptions,
output: "dist/guides.cjs.js",
format: "cjs",
},
{
...defaultOptions,
output: "dist/guides.esm.js",
format: "es",
},
]);
================================================
FILE: packages/svelte-guides/rollup.config.js
================================================
import svelte from 'rollup-plugin-svelte';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import livereload from 'rollup-plugin-livereload';
import { terser } from 'rollup-plugin-terser';
import rollup_start_dev from './rollup_start_dev';
import { preprocess } from "@pyoner/svelte-ts-preprocess";
const production = !process.env.ROLLUP_WATCH;
export default {
input: 'src/main.js',
output: {
sourcemap: true,
format: 'iife',
name: 'app',
file: 'public/bundle.js'
},
plugins: [
svelte({
// enable run-time checks when not in production
dev: !production,
// we'll extract any component CSS out into
// a separate file — better for performance
css: css => {
css.write('public/bundle.css');
},
preprocess: preprocess(),
}),
// If you have external dependencies installed from
// npm, you'll most likely need these plugins. In
// some cases you'll need additional configuration —
// consult the documentation for details:
// https://github.com/rollup/rollup-plugin-commonjs
resolve({
browser: true,
dedupe: importee => importee === 'svelte' || importee.startsWith('svelte/')
}),
commonjs(),
// In dev mode, call `npm run start:dev` once
// the bundle has been generated
!production && rollup_start_dev,
// Watch the `public` directory and refresh the
// browser on changes when not in production
!production && livereload('public'),
// If we're building for production (npm run build
// instead of npm run dev), minify
production && terser()
],
watch: {
clearScreen: false
}
};
================================================
FILE: packages/svelte-guides/rollup_start_dev.js
================================================
import * as child_process from 'child_process';
let running_dev_server = false;
export default {
writeBundle() {
if (!running_dev_server) {
running_dev_server = true;
child_process.spawn('npm', ['run', 'start:dev'], { stdio: ['ignore', 'inherit', 'inherit'], shell: true });
}
}
};
================================================
FILE: packages/svelte-guides/src/App.svelte
================================================
{
console.log(e);
}}
/>
Drag Screen & Rulers!
A Svelte Guides component that can draw ruler and manage guidelines.
================================================
FILE: packages/svelte-guides/src/Guides.svelte
================================================
================================================
FILE: packages/svelte-guides/src/index.d.ts
================================================
///
import { SvelteComponentTyped } from "svelte";
import { GuidesInterface, GuidesOptions, GuidesEvents } from "@scena/guides";
export type SvelteGuidesEvents = {
[key in keyof GuidesEvents]: CustomEvent;
}
export default class GuidesComponent extends SvelteComponentTyped<
GuidesOptions,
SvelteGuidesEvents
> { }
export default interface GuidesComponent extends GuidesInterface {
}
export * from "@scena/guides";
================================================
FILE: packages/svelte-guides/src/index.js
================================================
import Guides from "./Guides.svelte";
import { METHODS } from "@scena/guides";
export default /*#__PURE__*/ (() => {
const prototype = Guides.prototype;
if (!prototype) {
return Guides;
}
METHODS.forEach(name => {
prototype[name] = function (...args) {
const self = this.getInstance();
const result = self[name](...args);
if (result === self) {
return this;
} else {
return result;
}
};
});
return Guides;
})();
================================================
FILE: packages/svelte-guides/src/main.js
================================================
import App from './App.svelte';
const app = new App({
target: document.body,
props: {
name: 'world'
}
});
export default app;
================================================
FILE: packages/svelte-guides/svelte.config.js
================================================
const sveltePreprocess = require('svelte-preprocess');
module.exports = {
preprocess: sveltePreprocess(),
};
================================================
FILE: packages/svelte-guides/tsconfig.json
================================================
{
"include": ["src/**/*"],
"exclude": ["node_modules/*"],
"compilerOptions": {
/* Basic Options */
"target": "ESNEXT", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
"module": "ESNEXT", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "removeComments": false, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
"types": ["svelte"], /* Type declaration files to be included in compilation. */
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
}
}
================================================
FILE: packages/vue-guides/.browserslistrc
================================================
> 1%
last 2 versions
================================================
FILE: packages/vue-guides/.eslintrc.js
================================================
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended',
'@vue/typescript'
],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
},
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
================================================
FILE: packages/vue-guides/.gitignore
================================================
.DS_Store
node_modules
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
================================================
FILE: packages/vue-guides/CHANGELOG.md
================================================
# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [0.28.2](https://github.com/daybrush/guides/compare/vue-guides@0.28.1...vue-guides@0.28.2) (2023-07-29)
### :mega: Other
* publish packages ([9b659fe](https://github.com/daybrush/guides/commit/9b659fe71eb2fcb53b731e88b1561a0b18b9fcdc))
## [0.28.1](https://github.com/daybrush/guides/compare/vue-guides@0.28.0...vue-guides@0.28.1) (2023-07-23)
### :mega: Other
* publish packages ([73e2427](https://github.com/daybrush/guides/commit/73e24270c27eec1f30cc051fe84569e79f85822c))
## [0.28.0](https://github.com/daybrush/guides/compare/vue-guides@0.27.0...vue-guides@0.28.0) (2023-07-22)
### :mega: Other
* publish packages ([324f848](https://github.com/daybrush/guides/commit/324f848e0bae231c82b33be29ee2534d58a6d6b1))
## [0.27.0](https://github.com/daybrush/guides/compare/vue-guides@0.26.0...vue-guides@0.27.0) (2023-06-02)
### :mega: Other
* publish packages ([53d07f3](https://github.com/daybrush/guides/commit/53d07f3e31011ee6bff1a2558380dc6e61e98337))
## [0.26.0](https://github.com/daybrush/guides/compare/vue-guides@0.25.5...vue-guides@0.26.0) (2023-06-01)
### :mega: Other
* publish packages ([d038e92](https://github.com/daybrush/guides/commit/d038e92046e55f0f65f4ddde24f12ed117fd64e2))
## [0.25.5](https://github.com/daybrush/guides/compare/vue-guides@0.25.4...vue-guides@0.25.5) (2023-05-16)
### :mega: Other
* publish packages ([78ed8c7](https://github.com/daybrush/guides/commit/78ed8c708759927cabeb53b8c607fc6f54324371))
## [0.25.4](https://github.com/daybrush/guides/compare/vue-guides@0.25.2...vue-guides@0.25.4) (2023-05-15)
### :mega: Other
* publish packages ([1898b89](https://github.com/daybrush/guides/commit/1898b895d5c812a5fd77d99a5928f7e420152772))
* update packages ([d8db884](https://github.com/daybrush/guides/commit/d8db884cdf43c19f77ad9c5721d3a466808853c3))
## [0.25.2](https://github.com/daybrush/guides/compare/vue-guides@0.25.0...vue-guides@0.25.2) (2023-05-07)
### :mega: Other
* publish packages ([e1fb57c](https://github.com/daybrush/guides/commit/e1fb57c59a4a8e6b3e55ffb68cfea64760270288))
* update croact version ([2fd28db](https://github.com/daybrush/guides/commit/2fd28dbbfd648b8ee6fee39f3972057fce580ae0))
## [0.25.0](https://github.com/daybrush/guides/compare/vue-guides@0.24.0...vue-guides@0.25.0) (2023-04-12)
### :mega: Other
* publish packages ([548990d](https://github.com/daybrush/guides/commit/548990d8577ffe565b8605f74edd9eb5a6519deb))
## [0.24.0](https://github.com/daybrush/guides/compare/vue-guides@0.23.0...vue-guides@0.24.0) (2023-04-06)
### :rocket: New Features
* add croact-guides ([a7be435](https://github.com/daybrush/guides/commit/a7be435704e24b6d80af80e069a6cc4047d645bc))
### :mega: Other
* publish packages ([f30e2ba](https://github.com/daybrush/guides/commit/f30e2bad78e1bc02307c8dde8cb1b69ecccdf116))
## [0.23.0](https://github.com/daybrush/guides/compare/vue-guides@0.22.3...vue-guides@0.23.0) (2023-03-04)
### :mega: Other
* publish packages ([1afbe1d](https://github.com/daybrush/guides/commit/1afbe1d193cf2457dc9f3296b73d38b5859c0ee0))
## [0.22.3](https://github.com/daybrush/guides/compare/vue-guides@0.22.2...vue-guides@0.22.3) (2023-02-04)
### :mega: Other
* publish packages ([ae0d147](https://github.com/daybrush/guides/commit/ae0d14738d83b4f5352463b69f89efe7cc111baf))
## [0.22.2](https://github.com/daybrush/guides/compare/vue-guides@0.22.1...vue-guides@0.22.2) (2023-01-29)
### :mega: Other
* publish packages ([0f7949a](https://github.com/daybrush/guides/commit/0f7949a9954e2093d6a599dc545f988ed624d41f))
## [0.22.1](https://github.com/daybrush/guides/compare/vue-guides@0.22.0...vue-guides@0.22.1) (2023-01-29)
### :mega: Other
* publish packages ([ab753c1](https://github.com/daybrush/guides/commit/ab753c1c820463c1c0b7805d428c803c5eacc1e3))
## [0.22.0](https://github.com/daybrush/guides/compare/vue-guides@0.21.0...vue-guides@0.22.0) (2023-01-29)
### :mega: Other
* publish packages ([6f83fa0](https://github.com/daybrush/guides/commit/6f83fa0c75f494aa79fff98f4a57f86ab295b67d))
## [0.21.0](https://github.com/daybrush/guides/compare/vue-guides@0.20.1...vue-guides@0.21.0) (2023-01-28)
### :mega: Other
* publish packages ([9473e84](https://github.com/daybrush/guides/commit/9473e8464fbd4c374ac6251ff995586afd163719))
## [0.20.1](https://github.com/daybrush/guides/compare/vue-guides@0.20.0...vue-guides@0.20.1) (2023-01-27)
### :mega: Other
* publish packages ([628b944](https://github.com/daybrush/guides/commit/628b9444bb9e6f5546c7a5edd55a090126f52dd5))
## [0.20.0](https://github.com/daybrush/guides/compare/vue-guides@0.19.0...vue-guides@0.20.0) (2023-01-20)
### :bug: Bug Fix
* fix files field #67 ([28bf5b3](https://github.com/daybrush/guides/commit/28bf5b3bd97cebd94eaf2195f0e99750f14e7ecb))
### :mega: Other
* publish packages ([095e7c6](https://github.com/daybrush/guides/commit/095e7c670d3bd0bdc168e2f3c11b5dbb8074b26b))
* publish packages ([1daa6ea](https://github.com/daybrush/guides/commit/1daa6ea441f6c96b8f354953605cd6ac89117878))
* publish packages ([e143c21](https://github.com/daybrush/guides/commit/e143c2175309bf480ef17731321f6728b8d6bcc2))
* publish packages ([ce2037a](https://github.com/daybrush/guides/commit/ce2037a18f5f6bbcd750e1fd72cbfc60e3f2c217))
* publish packages ([0abcba2](https://github.com/daybrush/guides/commit/0abcba24e8b83ea51cf369124e8c2d85fee1ef7e))
## [0.19.0](https://github.com/daybrush/guides/compare/vue-guides@0.18.0...vue-guides@0.19.0) (2022-11-13)
### :rocket: New Features
* add scrollOptions #64 ([e0dc92a](https://github.com/daybrush/guides/commit/e0dc92a9ed417dff071b43a68b065907f8f1b8ad))
### :bug: Bug Fix
* update dependencies ([054e101](https://github.com/daybrush/guides/commit/054e101d1b177bdfefab74bf440a4cb3cf8137be))
### :mega: Other
* publish packages ([9cc8e3a](https://github.com/daybrush/guides/commit/9cc8e3ae5f83aa1513c1560166c6babbbe31dfd7))
## [0.18.0](https://github.com/daybrush/guides/compare/vue-guides@0.17.3...vue-guides@0.18.0) (2022-09-21)
### :mega: Other
* publish packages ([83de3e4](https://github.com/daybrush/guides/commit/83de3e4ae4bad11905939a44dfa2776fe7d6987d))
================================================
FILE: packages/vue-guides/LICENSE
================================================
MIT License
Copyright (c) 2019 Daybrush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: packages/vue-guides/README.md
================================================
Vue Guides
A Vue Guides component that can draw grids and scroll infinitely.
## ⚙️ Installation
### npm
```sh
$ npm i vue-guides
```
## 🚀 How to use
```html
```
```ts
export interface RulerProps {
type?: "horizontal" | "vertical";
width?: number;
height?: number;
unit?: number;
zoom?: number;
direction?: "start" | "end";
style?: IObject;
backgroundColor?: string;
lineColor?: string;
textColor?: string;
}
export interface GuidesOptions extends RulerProps {
className?: string;
setGuides?: (guides: number[]) => any;
rulerStyle?: IObject;
snapThreshold?: number;
snaps?: number[];
displayDragPos?: boolean;
dragPosFormat?: (value: number) => string | number;
}
export interface GuidesInterface {
getGuides(): number[];
scroll(pos: number): void;
scrollGuides(pos: number): void;
loadGuides(guides: number[]): void;
resize(): void;
}
```
## ⚙️ Developments
### `npm run serve`
Runs the app in the development mode.
Open [http://localhost:8080](http://localhost:8080) to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
## ⭐️ Show Your Support
Please give a ⭐️ if this project helped you!
## 👏 Contributing
If you have any questions or requests or want to contribute to `vue-guides` or other packages, please write the [issue](https://github.com/daybrush/guides/issues) or give me a Pull Request freely.
## 🐞 Bug Report
If you find a bug, please report to us opening a new [Issue](https://github.com/daybrush/guides/issues) on GitHub.
## 📝 License
This project is [MIT](https://github.com/daybrush/guides/blob/master/LICENSE) licensed.
```
MIT License
Copyright (c) 2019 Daybrush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
================================================
FILE: packages/vue-guides/package.json
================================================
{
"name": "vue-guides",
"version": "0.28.2",
"description": "A Vue Guides component that can draw grids and scroll infinitely.",
"main": "./dist/guides.cjs.js",
"module": "./dist/guides.esm.js",
"types": "declaration/index.d.ts",
"sideEffects": false,
"keywords": [
"scene",
"scenejs",
"scene.js",
"scena",
"guides",
"ruler",
"guidelines",
"scroller",
"vue"
],
"repository": {
"type": "git",
"url": "git+https://github.com/daybrush/guides.git"
},
"author": "Daybrush",
"license": "MIT",
"bugs": {
"url": "https://github.com/daybrush/guides/issues"
},
"files": [
"./*",
"src/*",
"dist/*",
"declaration/*",
"README.md"
],
"homepage": "https://daybrush.com/guides",
"scripts": {
"serve": "vue-cli-service serve",
"build": "rollup -c && npm run declaration",
"declaration": "rm -rf declaration && tsc -p tsconfig.declaration.json && cp ./src/components/Guides.vue.d.ts ./declaration/",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@scena/guides": "~0.29.2",
"framework-utils": "^1.1.0"
},
"devDependencies": {
"@daybrush/builder": "^0.1.2",
"@vue/cli-plugin-eslint": "^4.0.0",
"@vue/cli-plugin-typescript": "^4.0.0",
"@vue/cli-service": "^4.0.0",
"@vue/compiler-sfc": "^2.7.0",
"@vue/eslint-config-typescript": "^4.0.0",
"eslint": "^5.16.0",
"eslint-plugin-vue": "^5.0.0",
"rollup-plugin-vue": "^5.1.9",
"typescript": "^4.5.0 <4.6.0",
"vue": "^2.6.12",
"vue-class-component": "^7.2.6",
"vue-property-decorator": "^9.1.2",
"vue-template-compiler": "^2.6.12"
}
}
================================================
FILE: packages/vue-guides/postcss.config.js
================================================
module.exports = {
plugins: {
autoprefixer: {}
}
}
================================================
FILE: packages/vue-guides/public/index.html
================================================
vue-guides
================================================
FILE: packages/vue-guides/rollup.config.js
================================================
import builder from "@daybrush/builder";
import vuePlugin from "rollup-plugin-vue";
export default builder([
{
input: "src/components/index.ts",
output: "./dist/guides.esm.js",
exports: "named",
format: "es",
plugins: [
vuePlugin(),
],
},
{
input: "src/components/index.ts",
output: "./dist/guides.cjs.js",
exports: "default",
format: "cjs",
plugins: [
vuePlugin(),
],
},
]);
================================================
FILE: packages/vue-guides/src/App.vue
================================================
Drag Screen & Rulers!
A Svelte Guides component that can draw ruler and manage guidelines.
## ⚙️ Installation
### npm
```sh
$ npm i vue3-guides
```
## 🚀 How to use
```html
```
```ts
export interface RulerProps {
type?: "horizontal" | "vertical";
width?: number;
height?: number;
unit?: number;
zoom?: number;
direction?: "start" | "end";
style?: IObject;
backgroundColor?: string;
lineColor?: string;
textColor?: string;
}
export interface GuidesOptions extends RulerProps {
className?: string;
setGuides?: (guides: number[]) => any;
rulerStyle?: IObject;
snapThreshold?: number;
snaps?: number[];
displayDragPos?: boolean;
dragPosFormat?: (value: number) => string | number;
}
export interface GuidesInterface {
getGuides(): number[];
scroll(pos: number): void;
scrollGuides(pos: number): void;
loadGuides(guides: number[]): void;
resize(): void;
}
```
## ⚙️ Developments
### `npm run serve`
Runs the app in the development mode.
Open [http://localhost:8080](http://localhost:8080) to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
## ⭐️ Show Your Support
Please give a ⭐️ if this project helped you!
## 👏 Contributing
If you have any questions or requests or want to contribute to `vue3-guides` or other packages, please write the [issue](https://github.com/daybrush/guides/issues) or give me a Pull Request freely.
## 🐞 Bug Report
If you find a bug, please report to us opening a new [Issue](https://github.com/daybrush/guides/issues) on GitHub.
## 📝 License
This project is [MIT](https://github.com/daybrush/guides/blob/master/LICENSE) licensed.
```
MIT License
Copyright (c) 2019 Daybrush
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```
================================================
FILE: packages/vue3-guides/demo/App.vue
================================================
Drag Screen & Rulers!
A Svelte Guides component that can draw ruler and manage guidelines.