@operato/image-marker 8.0.0-alpha.50 → 8.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts DELETED
@@ -1,34 +0,0 @@
1
- export type ShapeType = 'text' | 'rectangle' | 'circle' | 'triangle' | 'line' | 'arrow' | 'link'
2
- export type ImageMarkerMode = 'edit' | 'view' | 'shape'
3
- export interface Shape {
4
- id: string
5
- type: ShapeType
6
- x?: number
7
- y?: number
8
- width?: number
9
- height?: number
10
- cx?: number
11
- cy?: number
12
- r?: number
13
- points?: string
14
- x1?: number
15
- y1?: number
16
- x2?: number
17
- y2?: number
18
- selected?: boolean
19
- text?: string
20
- link?: string
21
- opacity?: number
22
- }
23
-
24
- export interface ImageOptions {
25
- id: string
26
- scale: number
27
- offsetX: number
28
- offsetY: number
29
- currentImage?: string // 기존 이미지 객체
30
- }
31
-
32
- export interface ImageProvider {
33
- getImage(options: ImageOptions): Promise<string>
34
- }
@@ -1,41 +0,0 @@
1
- import '../src/ox-image-marker-mode.js'
2
- import { html, TemplateResult } from 'lit'
3
-
4
- export default {
5
- title: 'ox-image-marker-mode',
6
- component: 'ox-image-marker-mode',
7
- argTypes: {}
8
- }
9
-
10
- interface Story<T> {
11
- (args: T): TemplateResult
12
- args?: Partial<T>
13
- argTypes?: Record<string, unknown>
14
- }
15
-
16
- interface ArgTypes {}
17
-
18
- const Template: Story<ArgTypes> = ({}: ArgTypes) => html`
19
- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
20
- <link href="/themes/light.css" rel="stylesheet" />
21
- <link href="/themes/dark.css" rel="stylesheet" />
22
- <link href="/themes/spacing.css" rel="stylesheet" />
23
- <link href="/themes/md-typescale-styles.css" rel="stylesheet" />
24
- <link
25
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
26
- rel="stylesheet"
27
- />
28
- <link
29
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
30
- rel="stylesheet"
31
- />
32
- <link
33
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
34
- rel="stylesheet"
35
- />
36
-
37
- <ox-image-marker-mode @mode-changed=${(e: CustomEvent) => console.log(e.detail)}></ox-image-marker-mode>
38
- `
39
-
40
- export const Default = Template.bind({})
41
- Default.args = {}
@@ -1,134 +0,0 @@
1
- import '../src/ox-image-marker-view.js'
2
-
3
- import { html, TemplateResult } from 'lit'
4
- import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
5
-
6
- import { Shape, ShapeType } from '../src/types.js'
7
-
8
- export default {
9
- title: 'ox-image-marker-view',
10
- component: 'ox-image-marker-view',
11
- argTypes: {
12
- imageUrl: { control: 'text' },
13
- shapes: { control: 'object' }
14
- }
15
- }
16
-
17
- interface Story<T> {
18
- (args: T): TemplateResult
19
- args?: Partial<T>
20
- argTypes?: Record<string, unknown>
21
- }
22
-
23
- interface ArgTypes {
24
- imageUrl: string
25
- shapes: Array<{
26
- id: string
27
- type: ShapeType
28
- x?: number
29
- y?: number
30
- width?: number
31
- height?: number
32
- cx?: number
33
- cy?: number
34
- r?: number
35
- x1?: number
36
- y1?: number
37
- x2?: number
38
- y2?: number
39
- text?: string
40
- }>
41
- }
42
-
43
- const Template: Story<ArgTypes> = ({ imageUrl, shapes }: ArgTypes) => html`
44
- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
45
- <link href="/themes/light.css" rel="stylesheet" />
46
- <link href="/themes/dark.css" rel="stylesheet" />
47
- <link href="/themes/spacing.css" rel="stylesheet" />
48
- <link href="/themes/md-typescale-styles.css" rel="stylesheet" />
49
- <link
50
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
51
- rel="stylesheet"
52
- />
53
- <link
54
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
55
- rel="stylesheet"
56
- />
57
- <link
58
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
59
- rel="stylesheet"
60
- />
61
-
62
- <style>
63
- ${MDTypeScaleStyles.cssText}
64
- </style>
65
-
66
- <style>
67
- body {
68
- width: 100%;
69
- height: 800px;
70
- text-align: center;
71
-
72
- background-color: var(--md-sys-color-background);
73
- color: var(--md-sys-color-on-background);
74
- }
75
-
76
- ox-image-marker-view {
77
- height: 650px;
78
- box-sizing: border-box;
79
- background-color: var(--md-sys-color-primary-container);
80
- color: var(--md-sys-color-on-primary-container);
81
- }
82
- </style>
83
-
84
- <ox-image-marker-view .imageUrl=${imageUrl} .shapes=${shapes}></ox-image-marker-view>
85
- `
86
-
87
- export const ViewOnly = Template.bind({})
88
- ViewOnly.args = {
89
- imageUrl: 'https://via.placeholder.com/800x600',
90
- shapes: [
91
- {
92
- id: '1',
93
- type: 'rectangle',
94
- x: 100,
95
- y: 100,
96
- width: 200,
97
- height: 150,
98
- text: 'Rectangle 1'
99
- },
100
- {
101
- id: '2',
102
- type: 'circle',
103
- cx: 300,
104
- cy: 300,
105
- r: 50,
106
- text: 'Circle 1'
107
- },
108
- {
109
- id: '3',
110
- type: 'line',
111
- x1: 400,
112
- y1: 400,
113
- x2: 500,
114
- y2: 500,
115
- text: 'Line 1'
116
- },
117
- {
118
- id: '4',
119
- type: 'arrow',
120
- x1: 600,
121
- y1: 100,
122
- x2: 700,
123
- y2: 200,
124
- text: 'Arrow 1'
125
- },
126
- {
127
- id: '5',
128
- type: 'text',
129
- x: 600,
130
- y: 300,
131
- text: 'Text 1'
132
- }
133
- ]
134
- }
@@ -1,118 +0,0 @@
1
- import '../src/ox-image-marker.js'
2
-
3
- import { html, TemplateResult } from 'lit'
4
- import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
5
-
6
- import { Shape } from '../src/types.js'
7
-
8
- export default {
9
- title: 'ox-image-marker',
10
- component: 'ox-image-marker',
11
- argTypes: {
12
- imageUrl: { control: 'text', description: 'Image URL to display in the marker.' },
13
- shapes: { control: 'object', description: 'List of shapes to display on the image.' },
14
- currentShapeType: {
15
- control: 'select',
16
- options: ['text', 'rectangle', 'circle', 'triangle', 'line', 'arrow'],
17
- description: 'The type of shape to draw on the image.'
18
- }
19
- }
20
- }
21
-
22
- interface Story<T> {
23
- (args: T): TemplateResult
24
- args?: Partial<T>
25
- argTypes?: Record<string, unknown>
26
- }
27
-
28
- interface ArgTypes {
29
- imageUrl: string
30
- shapes: Shape[]
31
- }
32
-
33
- const Template: Story<ArgTypes> = ({ imageUrl, shapes = [] }: ArgTypes) => html`
34
- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
35
- <link href="/themes/light.css" rel="stylesheet" />
36
- <link href="/themes/dark.css" rel="stylesheet" />
37
- <link href="/themes/spacing.css" rel="stylesheet" />
38
- <link href="/themes/md-typescale-styles.css" rel="stylesheet" />
39
-
40
- <link
41
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
42
- rel="stylesheet"
43
- />
44
- <link
45
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
46
- rel="stylesheet"
47
- />
48
- <link
49
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
50
- rel="stylesheet"
51
- />
52
-
53
- <style>
54
- ${MDTypeScaleStyles.cssText}
55
- </style>
56
-
57
- <style>
58
- html,
59
- body {
60
- margin: 0;
61
- padding: 0;
62
- overflow: hidden;
63
-
64
- overscroll-behavior-y: none;
65
-
66
- /* This is a font-stack that tries to use the system-default sans-serifs first */
67
- font-family: Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
68
- line-height: 1.5;
69
- -webkit-font-smoothing: antialiased;
70
-
71
- accent-color: var(--md-sys-color-primary);
72
- }
73
-
74
- body {
75
- width: 100%;
76
- height: 800px;
77
- text-align: center;
78
-
79
- background-color: var(--md-sys-color-background);
80
- color: var(--md-sys-color-on-background);
81
- }
82
-
83
- ox-image-marker {
84
- height: 650px;
85
- box-sizing: border-box;
86
- background-color: var(--md-sys-color-primary-container);
87
- color: var(--md-sys-color-on-primary-container);
88
- }
89
- </style>
90
-
91
- <ox-image-marker .imageUrl=${imageUrl} .shapes=${shapes}></ox-image-marker>
92
- `
93
-
94
- export const Regular = Template.bind({})
95
- Regular.args = {
96
- imageUrl: 'https://via.placeholder.com/800x600',
97
- shapes: [
98
- {
99
- id: '1',
100
- type: 'rectangle',
101
- x: 100,
102
- y: 100,
103
- width: 200,
104
- height: 150,
105
- selected: true,
106
- text: 'Rectangle 1'
107
- },
108
- {
109
- id: '2',
110
- type: 'circle',
111
- cx: 300,
112
- cy: 300,
113
- r: 50,
114
- selected: false,
115
- text: 'Circle 1'
116
- }
117
- ]
118
- }
@@ -1,135 +0,0 @@
1
- import '../src/ox-image-marker.js'
2
-
3
- import { html, TemplateResult } from 'lit'
4
- import { styles as MDTypeScaleStyles } from '@material/web/typography/md-typescale-styles'
5
-
6
- import { Shape } from '../src/types.js'
7
-
8
- export default {
9
- title: 'test-image-provider',
10
- component: 'test-image-provider',
11
- argTypes: {
12
- imageUrl: { control: 'text', description: 'Image URL to display in the marker.' },
13
- shapes: { control: 'object', description: 'List of shapes to display on the image.' },
14
- currentShapeType: {
15
- control: 'select',
16
- options: ['text', 'rectangle', 'circle', 'triangle', 'line', 'arrow'],
17
- description: 'The type of shape to draw on the image.'
18
- }
19
- }
20
- }
21
-
22
- interface Story<T> {
23
- (args: T): TemplateResult
24
- args?: Partial<T>
25
- argTypes?: Record<string, unknown>
26
- }
27
-
28
- interface ArgTypes {
29
- imageUrl: string
30
- shapes: Shape[]
31
- }
32
-
33
- const Template: Story<ArgTypes> = ({ imageUrl, shapes = [] }: ArgTypes) => html`
34
- <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet" />
35
- <link href="/themes/light.css" rel="stylesheet" />
36
- <link href="/themes/dark.css" rel="stylesheet" />
37
- <link href="/themes/spacing.css" rel="stylesheet" />
38
- <link href="/themes/md-typescale-styles.css" rel="stylesheet" />
39
-
40
- <link
41
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL@20..48,100..700,0..1"
42
- rel="stylesheet"
43
- />
44
- <link
45
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL@20..48,100..700,0..1"
46
- rel="stylesheet"
47
- />
48
- <link
49
- href="https://fonts.googleapis.com/css2?family=Material+Symbols+Sharp:opsz,wght,FILL@20..48,100..700,0..1"
50
- rel="stylesheet"
51
- />
52
-
53
- <style>
54
- ${MDTypeScaleStyles.cssText}
55
- </style>
56
-
57
- <style>
58
- html,
59
- body {
60
- margin: 0;
61
- padding: 0;
62
- overflow: hidden;
63
-
64
- overscroll-behavior-y: none;
65
-
66
- /* This is a font-stack that tries to use the system-default sans-serifs first */
67
- font-family: Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
68
- line-height: 1.5;
69
- -webkit-font-smoothing: antialiased;
70
-
71
- accent-color: var(--md-sys-color-primary);
72
- }
73
-
74
- body {
75
- width: 100%;
76
- height: 800px;
77
- text-align: center;
78
-
79
- background-color: var(--md-sys-color-background);
80
- color: var(--md-sys-color-on-background);
81
- }
82
-
83
- ox-image-marker {
84
- height: 650px;
85
- box-sizing: border-box;
86
- background-color: var(--md-sys-color-primary-container);
87
- color: var(--md-sys-color-on-primary-container);
88
- }
89
- </style>
90
-
91
- <script type="module">
92
- import { TestImageProvider } from '../dist/stories/test-image-provider.js'
93
- const imageMarker = document.body.querySelector('ox-image-marker')
94
-
95
- imageMarker.setImageProvider(new TestImageProvider(1080, 720))
96
- document.body.querySelector('[button1]').addEventListener('click', e => {
97
- imageMarker.setImageProvider(new TestImageProvider(1600, 400))
98
- })
99
- document.body.querySelector('[button2]').addEventListener('click', e => {
100
- imageMarker.setImageProvider(new TestImageProvider(800, 600))
101
- })
102
- </script>
103
-
104
- <ox-image-marker .imageUrl=${imageUrl} .shapes=${shapes}></ox-image-marker>
105
- <div buttons>
106
- <button button1>1600 x 400</button>
107
- <button button2>800 x 600</button>
108
- </div>
109
- `
110
-
111
- export const Regular = Template.bind({})
112
- Regular.args = {
113
- imageUrl: 'https://via.placeholder.com/800x600',
114
- shapes: [
115
- {
116
- id: '1',
117
- type: 'rectangle',
118
- x: 100,
119
- y: 100,
120
- width: 200,
121
- height: 150,
122
- selected: true,
123
- text: 'Rectangle 1'
124
- },
125
- {
126
- id: '2',
127
- type: 'circle',
128
- cx: 300,
129
- cy: 300,
130
- r: 50,
131
- selected: false,
132
- text: 'Circle 1'
133
- }
134
- ]
135
- }
@@ -1,51 +0,0 @@
1
- import { ImageOptions, ImageProvider } from '../src/types'
2
-
3
- export class TestImageProvider implements ImageProvider {
4
- private width: number = 0
5
- private height: number = 0
6
-
7
- constructor(width: number, height: number) {
8
- this.width = width
9
- this.height = height
10
- }
11
-
12
- async getImage(options: ImageOptions): Promise<string> {
13
- // 무작위 색상 생성 함수
14
- const getRandomColor = () => {
15
- const letters = '0123456789ABCDEF'
16
- let color = '#'
17
- for (let i = 0; i < 6; i++) {
18
- color += letters[Math.floor(Math.random() * 16)]
19
- }
20
- return color
21
- }
22
-
23
- // 무작위 색상 그라데이션 이미지 생성
24
- const canvas = document.createElement('canvas')
25
- const ctx = canvas.getContext('2d')
26
- if (!ctx) {
27
- throw new Error('Failed to get canvas context')
28
- }
29
-
30
- const { scale } = options
31
-
32
- const width = this.width * scale
33
- const height = this.height * scale
34
- canvas.width = width
35
- canvas.height = height
36
-
37
- const gradient = ctx.createLinearGradient(0, 0, width, height)
38
- gradient.addColorStop(0, getRandomColor())
39
- gradient.addColorStop(0.15, getRandomColor())
40
- gradient.addColorStop(0.3, getRandomColor())
41
- gradient.addColorStop(0.5, getRandomColor())
42
- gradient.addColorStop(0.65, getRandomColor())
43
- gradient.addColorStop(0.8, getRandomColor())
44
- gradient.addColorStop(1, getRandomColor())
45
-
46
- ctx.fillStyle = gradient
47
- ctx.fillRect(0, 0, width, height)
48
-
49
- return canvas.toDataURL()
50
- }
51
- }
package/tsconfig.json DELETED
@@ -1,25 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "esnext",
4
- "module": "esnext",
5
- "moduleResolution": "node",
6
- "resolveJsonModule": true,
7
- "noEmitOnError": true,
8
- "lib": ["es2017", "dom"],
9
- "strict": true,
10
- "esModuleInterop": false,
11
- "allowSyntheticDefaultImports": true,
12
- "experimentalDecorators": true,
13
- "useDefineForClassFields": false,
14
- "importHelpers": true,
15
- "outDir": "dist",
16
- "sourceMap": true,
17
- "inlineSources": true,
18
- "rootDir": "./",
19
- "declaration": true,
20
- "incremental": true,
21
- "skipLibCheck": true,
22
- "types": ["node", "mocha"]
23
- },
24
- "include": ["**/*.ts"]
25
- }
@@ -1,27 +0,0 @@
1
- // import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
2
-
3
- /** Use Hot Module replacement by adding --hmr to the start command */
4
- const hmr = process.argv.includes('--hmr');
5
-
6
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
7
- open: '/demo/',
8
- /** Use regular watch mode if HMR is not enabled. */
9
- watch: !hmr,
10
- /** Resolve bare module imports */
11
- nodeResolve: {
12
- exportConditions: ['browser', 'development'],
13
- },
14
-
15
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
16
- // esbuildTarget: 'auto'
17
-
18
- /** Set appIndex to enable SPA routing */
19
- // appIndex: 'demo/index.html',
20
-
21
- plugins: [
22
- /** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
23
- // hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
24
- ],
25
-
26
- // See documentation for all available options
27
- });
@@ -1,41 +0,0 @@
1
- // import { playwrightLauncher } from '@web/test-runner-playwright';
2
-
3
- const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
4
-
5
- export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
6
- /** Test files to run */
7
- files: 'dist/test/**/*.test.js',
8
-
9
- /** Resolve bare module imports */
10
- nodeResolve: {
11
- exportConditions: ['browser', 'development'],
12
- },
13
-
14
- /** Filter out lit dev mode logs */
15
- filterBrowserLogs(log) {
16
- for (const arg of log.args) {
17
- if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
18
- return false;
19
- }
20
- }
21
- return true;
22
- },
23
-
24
- /** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
25
- // esbuildTarget: 'auto',
26
-
27
- /** Amount of browsers to run concurrently */
28
- // concurrentBrowsers: 2,
29
-
30
- /** Amount of test files per browser to test concurrently */
31
- // concurrency: 1,
32
-
33
- /** Browsers to run tests on */
34
- // browsers: [
35
- // playwrightLauncher({ product: 'chromium' }),
36
- // playwrightLauncher({ product: 'firefox' }),
37
- // playwrightLauncher({ product: 'webkit' }),
38
- // ],
39
-
40
- // See documentation for all available options
41
- });